feat: add historySerialization with default behaviour - #214
Open
TiagoCerqueira wants to merge 1 commit into
Open
Conversation
TiagoCerqueira
force-pushed
the
feat/BOTIV-9965-serialization-backend-message
branch
from
September 3, 2026 14:11
75bf6c2 to
2bd3061
Compare
Fabilin
reviewed
Sep 4, 2026
| * encryption). | ||
| * @param encryptionKey - optional function returning the raw encryption key | ||
| */ | ||
| export function createDefaultHistoryEncryption( |
Member
There was a problem hiding this comment.
I'd rather have createDefaultHistorySerialization, returning the basic {JSON.stringify, JSON.parse}, and a dedicated createEncryptedHistorySerialization(encryptionKey: () => string) returning {encrypt, decrypt}
| | `historyMaxAge` | `number?` | If set to a positive value, represents the number of seconds before the message history is cleared (the timeout is reset after each message received). | | ||
| | `maxMessageCount` | `number?` | When message history is enabled, sets the max number of messages to store. Defaults to 10. | | ||
| | `prefix` | `string?` | Prefix for local storage keys allowing communication with different bots from the same domain (used for both `userId` and message history). | | ||
| | `encryptionKey` | `(() => string)?` | A function returning the raw key used to AES-GCM-encrypt the persisted message history, using the library's default encryption. If omitted, the history is stored as plain (unencrypted) JSON. Ignored if `historyEncryption` is provided. | |
Member
There was a problem hiding this comment.
Instead of a separate parameter, I am very much in favor of publicizing a dedicated createEncryptedHistorySerialization method (see other comment)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #213 by adding encryption support while allowing consumers to provide a custom encryption/decryption implementation, with the existing behaviour preserved by default.