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

Rust crypto mini warts #3985

Open
kegsay opened this issue Jan 3, 2024 · 3 comments
Open

Rust crypto mini warts #3985

kegsay opened this issue Jan 3, 2024 · 3 comments
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust T-Defect

Comments

@kegsay
Copy link
Member

kegsay commented Jan 3, 2024

Amalgamated issue so I don't forget about it.

  • Buffer is used liberally assuming it exists when it practice it may not (in browsers without polyfills). ../matrix-js-sdk/src/rust-crypto/rust-crypto.ts:1073: return Buffer.from(backupKeys.decryptionKey.toBase64(), "base64"); - Solution: use the util class which handles this for us encodeBase64.
  • Type definitions on export interface CreateSecretStorageOpts imply all args are optional but createSecretStorageKey is not, it is required.
  • Rust crypto calls keyFromPassphrase https://github.com/matrix-org/matrix-js-sdk/blob/develop/src/crypto/key_passphrase.ts#L55 which does a global.Olm check and fails if it isn't found, meaning rust crypto relies on old crypto..
@kegsay kegsay added the T-Defect label Jan 3, 2024
@kegsay
Copy link
Member Author

kegsay commented Jan 4, 2024

@kegsay
Copy link
Member Author

kegsay commented Jan 4, 2024

  • cacheSecretStorageKey should probably live on SecretStorageCallbacks as it is the pair to getSecretStorageKey which is in SecretStorageCallbacks. Currently the cache function sits in CryptoCallbacks which extends SecretStorageCallbacks.

@kegsay
Copy link
Member Author

kegsay commented Jan 10, 2024

Keys won't be backed up for worst case 10 seconds after realising they need to be done. Worse still, this is randomised, causing flakey tests.

// wait between 0 and `maxDelay` seconds, to avoid backup

This should be configurable. One of the playwright tests also needs to sleep(10s) as a result of this.

@richvdh richvdh added the A-Element-R Issues affecting the port of Element's crypto layer to Rust label Mar 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust T-Defect
Projects
None yet
Development

No branches or pull requests

2 participants