Skip to content

feat: cache email RSA CryptoKeys by public key#2083

Merged
lanedirt merged 1 commit into
aliasvault:mainfrom
AmarBego:feat/cache-cryptokey-for-decryption
May 29, 2026
Merged

feat: cache email RSA CryptoKeys by public key#2083
lanedirt merged 1 commit into
aliasvault:mainfrom
AmarBego:feat/cache-cryptokey-for-decryption

Conversation

@AmarBego
Copy link
Copy Markdown
Contributor

@AmarBego AmarBego commented May 26, 2026

Description

  • Bug fix
  • Feature enhancement
  • Documentation update

The email decrypt path currently imports the matching per-vault RSA private key from its JWK string every time an email/data is decrypted, this happens in decryptEmail, decryptEmailList and decryptAttachment

What changed now is not the vault schema rather we introduced a cache that caches keys as non-exctractable CryptoKey objects for the unlocked client session. The cache is keyed by the existing public-key match EncyptionKey.PublicKey === email.encryptionKey so it supports multiple RSA keys for future key rotation instead of assuming a single vault key. The cache is cleared when in-memory vault/session is cleared or locked. In the extension i also manually verified that opening the Emails tab imports once and subsequent email opens reuse the cached key whilst logout clears the cache

Related Issues

Checklist

  • Code adheres to project standards and guidelines.
  • Documentation has been updated where applicable.

@AmarBego AmarBego force-pushed the feat/cache-cryptokey-for-decryption branch from 301dd60 to ab1ee14 Compare May 26, 2026 13:12
Copy link
Copy Markdown
Member

@lanedirt lanedirt left a comment

Choose a reason for hiding this comment

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

Hi @AmarBego, just tested it locally and seems to work fine. Thanks for the work on this. LGTM!

@lanedirt lanedirt merged commit 4a42b53 into aliasvault:main May 29, 2026
13 checks passed
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