Skip to content

Commit 3de0c02

Browse files
authored
Remove redundant hack for using the old pickle key in rust crypto (#4282)
* Remove redundant hack for using the old pickle key in rust crypto * Fix tests
1 parent 65b9c31 commit 3de0c02

File tree

2 files changed

+2
-25
lines changed

2 files changed

+2
-25
lines changed

spec/integ/crypto/rust-crypto.spec.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -66,26 +66,6 @@ describe("MatrixClient.initRustCrypto", () => {
6666
expect(databaseNames).toEqual(expect.arrayContaining(["matrix-js-sdk::matrix-sdk-crypto"]));
6767
});
6868

69-
it("should create the meta db if given a pickleKey", async () => {
70-
const matrixClient = createClient({
71-
baseUrl: "http://test.server",
72-
userId: "@alice:localhost",
73-
deviceId: "aliceDevice",
74-
pickleKey: "testKey",
75-
});
76-
77-
// No databases.
78-
expect(await indexedDB.databases()).toHaveLength(0);
79-
80-
await matrixClient.initRustCrypto();
81-
82-
// should have two indexed dbs now
83-
const databaseNames = (await indexedDB.databases()).map((db) => db.name);
84-
expect(databaseNames).toEqual(
85-
expect.arrayContaining(["matrix-js-sdk::matrix-sdk-crypto", "matrix-js-sdk::matrix-sdk-crypto-meta"]),
86-
);
87-
});
88-
8969
it("should create the meta db if given a storageKey", async () => {
9070
const matrixClient = createClient({
9171
baseUrl: "http://test.server",
@@ -470,10 +450,9 @@ describe("MatrixClient.clearStores", () => {
470450
baseUrl: "http://test.server",
471451
userId: "@alice:localhost",
472452
deviceId: "aliceDevice",
473-
pickleKey: "testKey",
474453
});
475454

476-
await matrixClient.initRustCrypto();
455+
await matrixClient.initRustCrypto({ storagePassword: "testKey" });
477456
expect(await indexedDB.databases()).toHaveLength(2);
478457
await matrixClient.stopClient();
479458

src/client.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2232,9 +2232,7 @@ export class MatrixClient extends TypedEventEmitter<EmittedEvents, ClientEventHa
22322232
cryptoCallbacks: this.cryptoCallbacks,
22332233
storePrefix: args.useIndexedDB === false ? null : RUST_SDK_STORE_PREFIX,
22342234
storeKey: args.storageKey,
2235-
2236-
// temporary compatibility hack: if there is no storageKey nor storagePassword, fall back to the pickleKey
2237-
storePassphrase: args.storagePassword ?? this.pickleKey,
2235+
storePassphrase: args.storagePassword,
22382236

22392237
legacyCryptoStore: this.cryptoStore,
22402238
legacyPickleKey: this.pickleKey ?? "DEFAULT_KEY",

0 commit comments

Comments
 (0)