1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-07-30 04:23:07 +03:00

Element-R: implement {get,store}SessionBackupPrivateKey (#3622)

This commit is contained in:
Richard van der Hoff
2023-07-26 12:00:43 +01:00
committed by GitHub
parent 29b815b678
commit 0e95df5dba
6 changed files with 75 additions and 10 deletions

View File

@ -503,6 +503,16 @@ describe("RustCrypto", () => {
);
});
});
describe("get|storeSessionBackupPrivateKey", () => {
it("can save and restore a key", async () => {
const key = "testtesttesttesttesttesttesttest";
const rustCrypto = await makeTestRustCrypto();
await rustCrypto.storeSessionBackupPrivateKey(new TextEncoder().encode(key));
const fetched = await rustCrypto.getSessionBackupPrivateKey();
expect(new TextDecoder().decode(fetched!)).toEqual(key);
});
});
});
/** build a basic RustCrypto instance for testing