Allow method chaining in Session and encryption class

For session set/unset/auto write close flag

In the encryption classes for setting keys
This commit is contained in:
Clemens Schwaighofer
2024-12-23 11:35:44 +09:00
parent 9f8a86b4b0
commit b7d5a79c3a
3 changed files with 19 additions and 13 deletions

View File

@@ -209,13 +209,13 @@ class SymmetricEncryption
* set a new key for encryption
*
* @param string $key
* @return void
* @return SymmetricEncryption
* @throws \UnexpectedValueException key cannot be empty
*/
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;
}
/**