Skip to content

Accept CryptoKey in ResultsReader; unwrap CEK via crypto.subtle#21

Open
jpslav wants to merge 1 commit into
mainfrom
add-cryptokey
Open

Accept CryptoKey in ResultsReader; unwrap CEK via crypto.subtle#21
jpslav wants to merge 1 commit into
mainfrom
add-cryptokey

Conversation

@jpslav

@jpslav jpslav commented May 5, 2026

Copy link
Copy Markdown

ResultsReader previously required the recipient's private key as a raw PKCS#8 ArrayBuffer, forcing any consumer that wanted to hold an unlocked key longer than a single decrypt to keep raw key bytes resident in JS memory. Internally the per-file AES content-encryption key was also recovered via crypto.subtle.decrypt + importKey('raw', ...), so the CEK briefly materialized as raw bytes on every file unwrap regardless of how the private key was held.

…pKey

ResultsReader previously required the recipient's private key as a raw PKCS#8 ArrayBuffer, forcing any consumer that wanted to hold an unlocked key longer than a single decrypt to keep raw key bytes resident in JS memory. Internally the per-file AES content-encryption key was also recovered via crypto.subtle.decrypt + importKey('raw', ...), so the CEK briefly materialized as raw bytes on every file unwrap regardless of how the private key was held.

@nathanstitt nathanstitt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this seems good to me.

I think we'd discussed using this as part of using passkeys, but decided against it for v0. Perhaps it's time to expand support for those as well?

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.

2 participants