matrix-org / matrix-org/matrix-js-sdk

Rust crypto mini warts

Open
#3,985 3 comments 0 reactions 0 assignees View on GitHub
A-Element-R T-Defect
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

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..

Contributor guide

Open the contributing guide

Research direction

Start with src/rust-crypto/rust-crypto.ts:1073 and the CreateSecretStorageOpts definition, then read src/crypto/key_passphrase.ts at line 55. Check how the browser Buffer use, required secret-storage key, and global.Olm dependency behave. Done means each of the three listed Rust crypto concerns is addressed without relying on unavailable browser globals.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.