You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-07-30 04:23:07 +03:00
Save the key backup key to 4S during bootstrapCrossSigning
(#4542)
* Save the key backup key to secret storage When setting up secret storage, if we have a key backup key in cache (like we do for the cross signing secrets). * Add test * Get the key directly from the olmMachine saves converting it needlessly into a buffer to turn it back into a base64 string * Overwrite backup keyin storage if different * Fix test * Add integ test * Test failure case for sonar * Unused import * Missed return * Also check active backup version
This commit is contained in:
@ -3121,6 +3121,32 @@ describe.each(Object.entries(CRYPTO_BACKENDS))("crypto (%s)", (backend: string,
|
||||
const mskId = await aliceClient.getCrypto()!.getCrossSigningKeyId(CrossSigningKey.Master)!;
|
||||
expect(signatures![aliceClient.getUserId()!][`ed25519:${mskId}`]).toBeDefined();
|
||||
});
|
||||
|
||||
newBackendOnly("should upload existing megolm backup key to a new 4S store", async () => {
|
||||
const backupKeyTo4SPromise = awaitMegolmBackupKeyUpload();
|
||||
|
||||
// we need these to set up the mocks but we don't actually care whether they
|
||||
// resolve because we're not testing those things in this test.
|
||||
awaitCrossSigningKeyUpload("master");
|
||||
awaitCrossSigningKeyUpload("user_signing");
|
||||
awaitCrossSigningKeyUpload("self_signing");
|
||||
awaitSecretStorageKeyStoredInAccountData();
|
||||
|
||||
mockSetupCrossSigningRequests();
|
||||
mockSetupMegolmBackupRequests("1");
|
||||
|
||||
await aliceClient.getCrypto()!.bootstrapCrossSigning({});
|
||||
await aliceClient.getCrypto()!.resetKeyBackup();
|
||||
|
||||
await aliceClient.getCrypto()!.bootstrapSecretStorage({
|
||||
setupNewSecretStorage: true,
|
||||
createSecretStorageKey,
|
||||
setupNewKeyBackup: false,
|
||||
});
|
||||
|
||||
await backupKeyTo4SPromise;
|
||||
expect(accountDataAccumulator.accountDataEvents.get("m.megolm_backup.v1")).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Manage Key Backup", () => {
|
||||
|
Reference in New Issue
Block a user