mirror of
https://github.com/element-hq/element-desktop
synced 2025-04-21 17:13:57 +02:00
Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
bb314423bf
commit
600679c0f7
@ -57,7 +57,10 @@ test.describe("App launch", () => {
|
|||||||
|
|
||||||
test("should be supported", async ({ page }) => {
|
test("should be supported", async ({ page }) => {
|
||||||
await expect(
|
await expect(
|
||||||
page.evaluate(() => window.mxPlatformPeg.get().createPickleKey(userId, deviceId)),
|
page.evaluate(
|
||||||
|
([userId, deviceId]) => window.mxPlatformPeg.get().createPickleKey(userId, deviceId),
|
||||||
|
[userId, deviceId],
|
||||||
|
),
|
||||||
).resolves.not.toBeNull();
|
).resolves.not.toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -70,7 +73,10 @@ test.describe("App launch", () => {
|
|||||||
|
|
||||||
test("should migrate successfully", async ({ page }) => {
|
test("should migrate successfully", async ({ page }) => {
|
||||||
await expect(
|
await expect(
|
||||||
page.evaluate(() => window.mxPlatformPeg.get().getPickleKey(userId, deviceId)),
|
page.evaluate(
|
||||||
|
([userId, deviceId]) => window.mxPlatformPeg.get().getPickleKey(userId, deviceId),
|
||||||
|
[userId, deviceId],
|
||||||
|
),
|
||||||
).resolves.toBe(pickleKey);
|
).resolves.toBe(pickleKey);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
12
src/store.ts
12
src/store.ts
@ -101,8 +101,8 @@ export class Store extends ElectronStore<{
|
|||||||
...(await keytar.findCredentials(KEYTAR_SERVICE)),
|
...(await keytar.findCredentials(KEYTAR_SERVICE)),
|
||||||
];
|
];
|
||||||
for (const cred of credentials) {
|
for (const cred of credentials) {
|
||||||
await this.deleteSecret(cred.account); // delete from keytar & keytar legacy
|
await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, cred.account);
|
||||||
await this.setSecret(cred.account, cred.password); // write to safeStorage & keytar for downgrade compatibility
|
await this.setSecret(cred.account, cred.password);
|
||||||
}
|
}
|
||||||
console.info(`Store migration done: found ${credentials.length} credentials`);
|
console.info(`Store migration done: found ${credentials.length} credentials`);
|
||||||
}
|
}
|
||||||
@ -161,10 +161,14 @@ export class Store extends ElectronStore<{
|
|||||||
public async deleteSecret(key: string): Promise<void> {
|
public async deleteSecret(key: string): Promise<void> {
|
||||||
await this.safeStorageReady();
|
await this.safeStorageReady();
|
||||||
|
|
||||||
await keytar.deletePassword(LEGACY_KEYTAR_SERVICE, key);
|
await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, key);
|
||||||
await keytar.deletePassword(KEYTAR_SERVICE, key);
|
await this.deleteSecretKeytar(KEYTAR_SERVICE, key);
|
||||||
if (safeStorage.isEncryptionAvailable()) {
|
if (safeStorage.isEncryptionAvailable()) {
|
||||||
this.delete(this.getSecretStorageKey(key));
|
this.delete(this.getSecretStorageKey(key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async deleteSecretKeytar(namespace: string, key: string): Promise<void> {
|
||||||
|
await keytar.deletePassword(namespace, key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user