diff options
Diffstat (limited to 'lib/private/Security/CSRF/CsrfToken.php')
-rw-r--r-- | lib/private/Security/CSRF/CsrfToken.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/private/Security/CSRF/CsrfToken.php b/lib/private/Security/CSRF/CsrfToken.php index d9e27ff80e3..643e58e1d53 100644 --- a/lib/private/Security/CSRF/CsrfToken.php +++ b/lib/private/Security/CSRF/CsrfToken.php @@ -1,4 +1,5 @@ <?php +declare(strict_types=1); /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @@ -40,7 +41,7 @@ class CsrfToken { /** * @param string $value Value of the token. Can be encrypted or not encrypted. */ - public function __construct($value) { + public function __construct(string $value) { $this->value = $value; } @@ -50,9 +51,9 @@ class CsrfToken { * * @return string */ - public function getEncryptedValue() { + public function getEncryptedValue(): string { if($this->encryptedValue === '') { - $sharedSecret = random_bytes(strlen($this->value)); + $sharedSecret = random_bytes(\strlen($this->value)); $this->encryptedValue = base64_encode($this->value ^ $sharedSecret) . ':' . base64_encode($sharedSecret); } @@ -65,9 +66,9 @@ class CsrfToken { * * @return string */ - public function getDecryptedValue() { + public function getDecryptedValue(): string { $token = explode(':', $this->value); - if (count($token) !== 2) { + if (\count($token) !== 2) { return ''; } $obfuscatedToken = $token[0]; |