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 committed 2024-12-23 11:36:06 +09:00
1 parent 9f8a86b4b0
commit b7d5a79c3a
3 files changed
+19 -13

No files matched your search

+3 -2
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;
}
/**