Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly encrypt history state, fixes #2028 #2029

Closed
wants to merge 1 commit into from

Conversation

buhrmi
Copy link
Contributor

@buhrmi buhrmi commented Oct 14, 2024

No description provided.

@buhrmi buhrmi changed the title Correctly encrypt history stage, fixes #2028 Correctly encrypt history state, fixes #2028 Oct 14, 2024
@@ -47,9 +47,7 @@ const encryptData = async (iv: Uint8Array, key: CryptoKey, data: any) => {

const textEncoder = new TextEncoder()
const str = JSON.stringify(data)
const encoded = new Uint8Array(str.length)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we still want to use more performant encodeInto and not deal with UTF-8 issues, we can use str.length * 3: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto#buffer_sizing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather have smaller history state. Already dumping lots of stuff in there, don't want it 3x the size

@joetannenbaum
Copy link
Contributor

Thanks for your pull request! I didn't see this until after I had one already open, sorry about that.

I'm going to close this in favor of #2030 since that one still uses encodeInto and just trims off anything we don't write.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants