Skip to content

Commit e45ca74

Browse files
committed
docs: update message decryption documentation to include failed decryption option
1 parent c9a6881 commit e45ca74

File tree

2 files changed

+17
-16
lines changed

2 files changed

+17
-16
lines changed

docs/src/content/docs/messages.md

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -134,18 +134,4 @@ If you need to reverse this process and decrypt the messages, you can use the `l
134134
php artisan le-chat:decrypt-messages
135135
```
136136

137-
This command will go through all messages in the database and decrypt them.
138-
139-
### Allowing failed decryption
140-
When your application is switching from unencrypted to encrypted messages but already has messages in the database, and for some reason you are not yet able to run the Artisan commands, you can allow failed decryption by setting the `return_failed_decrypt` option to `true` in the feature configuration:
141-
```php
142-
// config/chat.php
143-
'features' => [
144-
Features::encryptMessagesAtRest([
145-
'return_failed_decrypt' => true,
146-
]),
147-
],
148-
```
149-
This will allow your application to return the original message content if decryption fails, instead of throwing an exception. This is useful for transitioning existing messages to encrypted storage without losing data.
150-
151-
You should NOT rely on this feature as it may be unsafe. Instead, when switching to encrypted messages, you should migrate your existing messages to the encrypted format with the provided commands.
137+
This command will go through all messages in the database and decrypt them.

docs/src/content/docs/package-configuration.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,19 @@ You can enable the encryption of messages at rest by adding the following featur
5555
'features' => [
5656
Features::encryptMessagesAtRest(),
5757
],
58-
```
58+
```
59+
60+
61+
#### Allowing failed decryption
62+
When your application is switching from unencrypted to encrypted messages but already has messages in the database, and for some reason you are not yet able to run the Artisan commands to migrate, you can allow failed decryption by setting the `return_failed_decrypt` option to `true` in the feature configuration:
63+
```php
64+
// config/chat.php
65+
'features' => [
66+
Features::encryptMessagesAtRest([
67+
'return_failed_decrypt' => true,
68+
]),
69+
],
70+
```
71+
This will allow your application to return the original message content if decryption fails, instead of throwing an exception. This is useful for transitioning existing messages to encrypted storage without losing data.
72+
73+
You should NOT rely on this feature as it may be unsafe. Instead, when switching to encrypted messages, you should migrate your existing messages to the encrypted format with the provided commands.

0 commit comments

Comments
 (0)