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

indexeddb: expose new method IndexeddbCryptoStore::open_with_key #3423

Merged
merged 6 commits into from
May 22, 2024

Conversation

richvdh
Copy link
Member

@richvdh richvdh commented May 16, 2024

Part of a resolution to element-hq/element-web#26821: allow applications to skip the PBKDF2 operation if they already have a cryptographically secure key.

In order to maintain compatibility for existing element-web sessions, if we discover that we have an existing store that was encrypted with a key derived from PBKDF2, then we reconstruct what element-web used to do: specifically, we base64-encode the key to obtain the "passphrase" that was previously passed in. If that matches, we know we've got the right key, and can update the meta store accordingly.

@richvdh richvdh marked this pull request as ready for review May 16, 2024 16:38
@richvdh richvdh requested a review from a team as a code owner May 16, 2024 16:38
@richvdh richvdh requested review from Hywan and removed request for a team May 16, 2024 16:38
Copy link

codecov bot commented May 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.96%. Comparing base (64c5a83) to head (09eca96).
Report is 24 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3423      +/-   ##
==========================================
- Coverage   82.97%   82.96%   -0.01%     
==========================================
  Files         246      246              
  Lines       25022    25029       +7     
==========================================
+ Hits        20761    20765       +4     
- Misses       4261     4264       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Allow applications which already have a cryptographically-secure key to avoid
PBKDF, by passing that key in directly.
@richvdh richvdh requested a review from poljar May 20, 2024 14:57
Copy link
Contributor

@poljar poljar left a comment

Choose a reason for hiding this comment

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

Left a couple of nits, looks good otherwise.

crates/matrix-sdk-indexeddb/Cargo.toml Outdated Show resolved Hide resolved
crates/matrix-sdk-indexeddb/src/crypto_store/mod.rs Outdated Show resolved Hide resolved
Co-authored-by: Damir Jelić <poljar@termina.org.uk>
Signed-off-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
@richvdh richvdh merged commit d7a8877 into main May 22, 2024
36 checks passed
@richvdh richvdh deleted the rav/less_pbkdf_2 branch May 22, 2024 08:07
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.

None yet

2 participants