matrix-org / matrix-org/matrix-js-sdk
Unknown error on key re-upload using memory stores.
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.2k
- Forks
- 704
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 40
Description
The matrix-js-sdk (26.0.0) crashes shortly after sign-in giving the following error:
Unknown error code: MatrixError: [401] Unknown message
With a url endpoint: /_matrix/client/r0/devices/<DEVICE ID>
The homeserver shows an error:
SynapseError: 400 - One time key signed_curve25519:<KEY> already exists.
I have asked in the channel and someone suggested it is caused by using memory stores and it is forgetting that it has already uploaded the key for the device.
What is going on here - how is the key persisting between sessions when memory stores are being used? Should it not be generating a new device key every startup? Shouldn't the matrix-js-sdk be aware of this response and provide a better error message?
The code being used can be found here: https://github.com/saul-jb/matrix-js-sdk/tree/feat/crypto-node-ts-example/examples/crypto-node
Note, this does not seem to occur on the matrix.org homeserver but occurs on my personal one (Synapse 1.85.2).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the examples/crypto-node code referenced in the issue and trace its memory-store and key-upload setup. Reproduce the failure against Synapse 1.85.2 using the /_matrix/client/r0/devices/ endpoint, then inspect how the SDK handles the duplicate one-time-key response. Done means the cause is identified and the SDK either avoids the duplicate upload or reports the server error clearly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 32/100