diff --git a/www/lib/CoreLibs/Security/AsymmetricAnonymousEncryption.php b/www/lib/CoreLibs/Security/AsymmetricAnonymousEncryption.php index 47c357d7..82d16213 100644 --- a/www/lib/CoreLibs/Security/AsymmetricAnonymousEncryption.php +++ b/www/lib/CoreLibs/Security/AsymmetricAnonymousEncryption.php @@ -262,7 +262,7 @@ class AsymmetricAnonymousEncryption public function setKeyPair( #[\SensitiveParameter] string $key_pair - ) { + ): AsymmetricAnonymousEncryption { if (empty($key_pair)) { throw new \UnexpectedValueException('Key pair cannot be empty'); } @@ -277,6 +277,7 @@ class AsymmetricAnonymousEncryption // check if valid $this->createPublicKey($this->public_key); } + return $this; } /** @@ -311,7 +312,7 @@ class AsymmetricAnonymousEncryption * @return void * @throws \UnexpectedValueException public key empty */ - public function setPublicKey(string $public_key) + public function setPublicKey(string $public_key): AsymmetricAnonymousEncryption { if (empty($public_key)) { throw new \UnexpectedValueException('Public key cannot be empty'); @@ -320,6 +321,7 @@ class AsymmetricAnonymousEncryption $this->createPublicKey($public_key); $this->public_key = $public_key; sodium_memzero($public_key); + return $this; } /** diff --git a/www/lib/CoreLibs/Security/SymmetricEncryption.php b/www/lib/CoreLibs/Security/SymmetricEncryption.php index 91d8c2cb..ed0ca398 100644 --- a/www/lib/CoreLibs/Security/SymmetricEncryption.php +++ b/www/lib/CoreLibs/Security/SymmetricEncryption.php @@ -215,7 +215,7 @@ class SymmetricEncryption public function setKey( #[\SensitiveParameter] string $key - ) { + ): SymmetricEncryption { if (empty($key)) { throw new \UnexpectedValueException('Key cannot be empty'); } @@ -224,6 +224,7 @@ class SymmetricEncryption // set key $this->key = $key; sodium_memzero($key); + return $this; } /**