diff --git a/composer.json b/composer.json index 9f748608..3bbc1211 100755 --- a/composer.json +++ b/composer.json @@ -33,7 +33,6 @@ "symfony/mime": "~6.4", "symfony/process": "~6.4", "symfony/routing": "~6.4", - "symfony/security-core": "~6.4", "symfony/translation": "~6.4", "voku/portable-ascii": "2.0.3" }, diff --git a/src/Illuminate/Contracts/Encryption/StringEncrypter.php b/src/Illuminate/Contracts/Encryption/StringEncrypter.php new file mode 100644 index 00000000..399d653f --- /dev/null +++ b/src/Illuminate/Contracts/Encryption/StringEncrypter.php @@ -0,0 +1,26 @@ +key; } + /** + * Get the current encryption key and all previous encryption keys. + * + * @return array + */ + // ponytail: single-key fork; key rotation (previous_keys) arrives with the + // illuminate/encryption v13 swap. Contract still satisfied for consumers now. + public function getAllKeys(): array + { + return [$this->key]; + } + + /** + * Get the previous encryption keys. + * + * @return array + */ + public function getPreviousKeys(): array + { + return []; + } + /** * Calculate the hash of the given payload. * @@ -233,15 +257,4 @@ protected function calculateMac($payload, $bytes): string ); } - /** - * Set the encryption key. - * - * @param string $key - * @return void - */ - public function setKey($key) - { - $this->key = (string) $key; - } - } diff --git a/src/Illuminate/Filesystem/FileNotFoundException.php b/src/Illuminate/Filesystem/FileNotFoundException.php index f6ee5dc7..8144e77d 100644 --- a/src/Illuminate/Filesystem/FileNotFoundException.php +++ b/src/Illuminate/Filesystem/FileNotFoundException.php @@ -1,3 +1,7 @@ alias('log', 'Illuminate\Log\Writer'); + + // Encrypter now implements the L13 contracts (task 2.9); resolve them to 'encrypter'. + $this->alias('encrypter', 'Illuminate\Contracts\Encryption\Encrypter'); + $this->alias('encrypter', 'Illuminate\Contracts\Encryption\StringEncrypter'); } } diff --git a/tests/Encryption/EncrypterTest.php b/tests/Encryption/EncrypterTest.php index 8edffc06..03c72948 100755 --- a/tests/Encryption/EncrypterTest.php +++ b/tests/Encryption/EncrypterTest.php @@ -25,7 +25,7 @@ public function testEncryptionWithCustomCipher() public function testExceptionThrownWhenPayloadIsInvalid() { - $this->expectException(Illuminate\Encryption\DecryptException::class); + $this->expectException(Illuminate\Contracts\Encryption\DecryptException::class); $this->expectExceptionMessage("The payload is invalid."); $e = $this->getEncrypter(); $payload = $e->encrypt('foo');