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

Element-R: Exceptions when setting up backup/cross-signing/etc on existing account with no 4S #26393

Closed
richvdh opened this issue Oct 18, 2023 · 2 comments · Fixed by matrix-org/matrix-js-sdk#3912
Assignees
Labels
A-Element-R Issues affecting the port of Element's crypto layer to Rust O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Element-R-Blocker A blocker for enabling Element R by default Z-Labs

Comments

@richvdh
Copy link
Member

richvdh commented Oct 18, 2023

STR:

  1. Create a new account outside Element Web (eg, via another client which doesn't automatically configure secret-storage, or via API)
  2. Log in on ER
  3. Settings -> Security & Privacy -> Set up backup
  4. Enter recovery passphrase, continue

In logs:

11:38:42.322
Uncaught (in promise) Error: No keys specified and no default key present
    store secret-storage.ts:498
    exportCrossSigningKeysToStorage CrossSigningIdentity.ts:145
    bootstrapCrossSigning CrossSigningIdentity.ts:72
    bootstrapCrossSigning rust-crypto.ts:624
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:383
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:459
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 4
[secret-storage.ts:498:22](webpack:///matrix-js-sdk/src/secret-storage.ts)
11:38:42.322
Uncaught (in promise) Error: No keys specified and no default key present
    store secret-storage.ts:498
    exportCrossSigningKeysToStorage CrossSigningIdentity.ts:150
    bootstrapCrossSigning CrossSigningIdentity.ts:72
    bootstrapCrossSigning rust-crypto.ts:624
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:383
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:459
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 4
[secret-storage.ts:498:22](webpack:///matrix-js-sdk/src/secret-storage.ts)
11:38:42.322
Uncaught (in promise) Error: No keys specified and no default key present
    store secret-storage.ts:498
    exportCrossSigningKeysToStorage CrossSigningIdentity.ts:155
    bootstrapCrossSigning CrossSigningIdentity.ts:72
    bootstrapCrossSigning rust-crypto.ts:624
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:383
    CreateSecretStorageDialog CreateSecretStorageDialog.tsx:459
    React 14
    unstable_runWithPriority scheduler.development.js:468
    React 4
        runWithPriority$1
        discreteUpdates$1
        discreteUpdates
        dispatchDiscreteEvent
[secret-storage.ts:498:22](webpack:///matrix-js-sdk/src/secret-storage.ts)

I think it works despite the errors, but the log spam is problematic and prevents the Cypress tests working correctly.

@richvdh richvdh added T-Defect S-Minor Impairs non-critical functionality or suitable workarounds exist O-Occasional Affects or can be seen by some users regularly or most users rarely A-Element-R Issues affecting the port of Element's crypto layer to Rust labels Oct 18, 2023
@BillCarsonFr BillCarsonFr added the Z-Element-R-Blocker A blocker for enabling Element R by default label Nov 8, 2023
@richvdh richvdh changed the title Element-R: Exceptions when setting up backup/cross-signing/etc on existing account Element-R: Exceptions when setting up backup/cross-signing/etc on existing account with no 4S Nov 14, 2023
@richvdh richvdh self-assigned this Nov 27, 2023
@richvdh
Copy link
Member Author

richvdh commented Nov 27, 2023

So the problem here is that bootstrapCrossSigning is being called before bootstrapSecretStorage here and bootstrapCrossSigning doesn't handle that situation well.

(It is unclear to me why the react SDK makes the calls in that order, but since the documented API of bootstrapCrossSigning includes handling that case gracefully, we should do so.)

@richvdh
Copy link
Member Author

richvdh commented Nov 27, 2023

Oh, also: bootstrapCrossSigning is actually being called twice: once at startup (from MatrixChat with this.state.view === Views.E2E_SETUP, via CreateCrossSigningDialog, because there are no published public cross-signing keys), and once when we actually try to set up key backup, from CreateSecretStorageDialog). Which explains why the js-sdk integ tests didn't find this code path

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 O-Occasional Affects or can be seen by some users regularly or most users rarely S-Minor Impairs non-critical functionality or suitable workarounds exist T-Defect Z-Element-R-Blocker A blocker for enabling Element R by default Z-Labs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants