-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
ElementR: Fix missing key check values in 4S key storage #3950
ElementR: Fix missing key check values in 4S key storage #3950
Conversation
@@ -100,10 +100,12 @@ export interface PassphraseInfo { | |||
* Options for {@link ServerSideSecretStorageImpl#addKey}. | |||
*/ | |||
export interface AddSecretStorageKeyOpts { | |||
pubkey?: string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is some legacy field that was used for the deprecated m.secret_storage.v1.curve25519-aes-sha2
algorithm.
src/crypto-api.ts
Outdated
@@ -713,7 +713,8 @@ export interface CrossSigningKeyInfo { | |||
* Recovery key created by {@link CryptoApi#createRecoveryKeyFromPassphrase} | |||
*/ | |||
export interface GeneratedSecretStorageKey { | |||
keyInfo?: AddSecretStorageKeyOpts; | |||
/** Information to generate the key from a passphrase if any. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: could be a bit clearer here
/** Information to generate the key from a passphrase if any. */ | |
/** If the key was derived from a passphrase, information (algorithm, salt, etc) on that derivation. */ |
src/secret-storage.ts
Outdated
name?: string; | ||
key?: Uint8Array; | ||
/** The private key. Will be used to generate the key check values in the key info, it will not be stored on the server */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit:
/** The private key. Will be used to generate the key check values in the key info, it will not be stored on the server */ | |
/** The private key. Will be used to generate the key check values in the key info; it will not be stored on the server */ |
src/crypto-api.ts
Outdated
@@ -713,7 +713,8 @@ export interface CrossSigningKeyInfo { | |||
* Recovery key created by {@link CryptoApi#createRecoveryKeyFromPassphrase} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a new issue, but this documentation is incomplete. This interface is also the return type of CreateSecretStorageOpts.createSecretStorageKey
.
src/crypto-api.ts
Outdated
@@ -713,7 +713,8 @@ export interface CrossSigningKeyInfo { | |||
* Recovery key created by {@link CryptoApi#createRecoveryKeyFromPassphrase} | |||
*/ | |||
export interface GeneratedSecretStorageKey { | |||
keyInfo?: AddSecretStorageKeyOpts; | |||
/** Information to generate the key from a passphrase if any. */ | |||
passphrase?: PassphraseInfo; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with this change (replacing the optional keyInfo
property with an optional passphrase
property) is that it means any existing implementation of CreateSecretStorageOpts.createSecretStorageKey
(such as the one in matrix-react-sdk) will be incorrect. Worse, it will fail silently because new new property is optional. I think this is very dangerous.
I see two possible ways forward:
- Retain the
keyInfo
property, but with a reduced structure. This is what I suggested before:export interface GeneratedSecretStorageKey { keyInfo?: { passphrase?: PassphraseInfo; name?: string; // maybe we don't need this? }, privateKey: Uint8Array; encodedPrivateKey?: string; }
- Define a new interface to replace
GeneratedSecretStorageKey
(and deprecate the old one). Define a new property inCreateSecretStorageOpts
to replacecreateSecretStorageKey
which returns the new interface (and deprecate the old one); allow clients to provide either interface.
The second option ends up being more elegant (once we get rid of the deprecated classes/properties), but seems a lot more work.
There was a problem hiding this 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 wording nits
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
Co-authored-by: Richard van der Hoff <[email protected]>
Fixes element-hq/element-web#26721
Checklist
Here's what your changelog entry will look like:
🚨 BREAKING CHANGES