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

Move crypto/key_passphrase.ts to crypto-api/key-passphrase.ts #4401

Merged

Conversation

florianduros
Copy link
Contributor

@florianduros florianduros commented Sep 13, 2024

Checklist

  • Tests written for new code (and old code if feasible).
  • New or updated public/exported symbols have accurate TSDoc documentation.
  • Linter and other CI checks pass.
  • Sign-off given on the changes (see CONTRIBUTING.md).

Task element-hq/element-web#26922

Changes:

  • Moving keyFromAuthData to common-crypto and deprecates it. It should be deleted but it's still used.
  • Move deriveKey into crypto-api and renamed into deriveRecoveryKeyFromPassphrase
  • Deprecate MatrixClient.keyBackupKeyFromPassword

@florianduros
Copy link
Contributor Author

Sorry, back to draft I pushed the wrong button.

@florianduros florianduros added the T-Task Tasks for the team like planning label Sep 13, 2024
@florianduros florianduros force-pushed the florianduros/rip-out-legacy-crypto/move-key-passphrase branch from 9640cfd to d7f433e Compare September 13, 2024 09:04
@florianduros
Copy link
Contributor Author

I tried to add documentation but my knowledge around crypto is not enough. Maybe @andybalaam or @richvdh can give me a hand on it? Thanks!

@florianduros florianduros changed the title Move crypto/key_passphrase.ts to crypto-api/key-passphrase.ts Move crypto/key_passphrase.ts to crypto-api/key-passphrase.ts Sep 13, 2024
@richvdh richvdh self-requested a review September 13, 2024 09:38
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

These methods are all about deriving a recovery or backup key from a passphrase; the relevant spec is https://spec.matrix.org/v1.11/client-server-api/#deriving-keys-from-passphrases.

src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
src/crypto-api/key-passphrase.ts Outdated Show resolved Hide resolved
…ey-passphrase

# Conflicts:
#	src/client.ts
#	src/crypto-api/index.ts
#	src/crypto/backup.ts
#	src/crypto/index.ts
#	src/rust-crypto/rust-crypto.ts
- Call `deriveRecoveryKeyFromPassphrase` into `RustCrypto.createRecoveryKeyFromPassphrase` instead of using `keyFromPassphrase`
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

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

LGTM other than a few nits

src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
src/rust-crypto/rust-crypto.ts Outdated Show resolved Hide resolved
* Derive a backup key from a passphrase using the salt and iterations from the auth data.
* @param authData - The auth data containing the salt and iterations
* @param passphrase - The passphrase to derive the key from
* @deprecated
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* @deprecated
*
* @deprecated Deriving a backup key from a passphrase is not part of the matrix spec.
* Instead, a random key is generated and stored/shared via 4S.

src/client.ts Outdated Show resolved Hide resolved
@florianduros florianduros added this pull request to the merge queue Sep 17, 2024
Merged via the queue into develop with commit fab9cab Sep 17, 2024
26 checks passed
@florianduros florianduros deleted the florianduros/rip-out-legacy-crypto/move-key-passphrase branch September 17, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T-Task Tasks for the team like planning
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants