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

Error uploading one-time keys TypeError: account.unpublished_fallback_key is not a function

Open
#2,092 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Describe the bug
A undocumented error called Error uploading one-time keys TypeError: account.unpublished_fallback_key is not a function is printed in the console, when using loginWithPassword or using an access token to login.

To Reproduce
Steps to reproduce the behavior:

  1. Setup matrix-js-sdk for Encryption
  2. Try to login via password and username
this.client.loginWithPassword(username, password, (err, res) => {
    this.client.initCrypto().then(() => {
        this.client.startClient({});
    })
});
logger.js:57 Error uploading one-time keys TypeError: account.unpublished_fallback_key is not a function
    at http://localhost:4200/vendor.js:61196:39
    at http://localhost:4200/vendor.js:60952:9
    at LocalStorageCryptoStore.getAccount (http://localhost:4200/vendor.js:74620:5)
    at OlmDevice.getAccount (http://localhost:4200/vendor.js:60947:22)
    at http://localhost:4200/vendor.js:61195:16
    at LocalStorageCryptoStore.doTxn (http://localhost:4200/vendor.js:74646:28)
    at http://localhost:4200/vendor.js:61194:32
    at Generator.next (<anonymous>)
    at asyncGeneratorStep (http://localhost:4200/vendor.js:107143:24)
    at _next (http://localhost:4200/vendor.js:107165:9)

Expected behavior
I would expect the encryption to work and be better documented? It's not clear how I could add/generate key according to the implementation guide (https://matrix.org/docs/guides/end-to-end-encryption-implementation-guide) after logging in, similar to the element client, where you can import keys after logging in.

The example in the repository doesn't address this issue:
https://github.com/matrix-org/matrix-js-sdk/blob/develop/examples/crypto-browser/olm-device-export-import.js

Desktop (please complete the following information):

  • OS: Mac OS
  • Browser Chrome
  • Version 96.0.4664.110

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported loginWithPassword/initCrypto flow and compare it with examples/crypto-browser/olm-device-export-import.js and the linked end-to-end encryption implementation guide. Trace the account lookup shown in the stack trace to determine why unpublished_fallback_key is unavailable. Done means encryption initialization no longer logs the TypeError and the required key generation or import flow is documented.

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
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.