We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
EncryptedCaster
1 parent 0363cb6 commit 62bced9Copy full SHA for 62bced9
packages/database/src/Casters/EncryptedCaster.php
@@ -4,8 +4,11 @@
4
5
namespace Tempest\Database\Casters;
6
7
+use Tempest\Cryptography\Encryption\EncryptedData;
8
use Tempest\Cryptography\Encryption\Encrypter;
9
+use Tempest\Cryptography\Encryption\Exceptions\EncryptionException;
10
use Tempest\Mapper\Caster;
11
+use Tempest\Support\Json\Exception\JsonException;
12
13
final readonly class EncryptedCaster implements Caster
14
{
@@ -19,6 +22,10 @@ public function cast(mixed $input): ?string
19
22
return null;
20
23
}
21
24
- return $this->encrypter->decrypt($input);
25
+ try {
26
+ return $this->encrypter->decrypt($input);
27
+ } catch (EncryptionException|JsonException) {
28
+ return $input;
29
+ }
30
31
0 commit comments