mirror of
https://github.com/element-hq/element-desktop
synced 2025-04-21 09:03:56 +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 }) => {
|
||||
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();
|
||||
});
|
||||
|
||||
@ -70,7 +73,10 @@ test.describe("App launch", () => {
|
||||
|
||||
test("should migrate successfully", async ({ page }) => {
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
12
src/store.ts
12
src/store.ts
@ -101,8 +101,8 @@ export class Store extends ElectronStore<{
|
||||
...(await keytar.findCredentials(KEYTAR_SERVICE)),
|
||||
];
|
||||
for (const cred of credentials) {
|
||||
await this.deleteSecret(cred.account); // delete from keytar & keytar legacy
|
||||
await this.setSecret(cred.account, cred.password); // write to safeStorage & keytar for downgrade compatibility
|
||||
await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, cred.account);
|
||||
await this.setSecret(cred.account, cred.password);
|
||||
}
|
||||
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> {
|
||||
await this.safeStorageReady();
|
||||
|
||||
await keytar.deletePassword(LEGACY_KEYTAR_SERVICE, key);
|
||||
await keytar.deletePassword(KEYTAR_SERVICE, key);
|
||||
await this.deleteSecretKeytar(LEGACY_KEYTAR_SERVICE, key);
|
||||
await this.deleteSecretKeytar(KEYTAR_SERVICE, key);
|
||||
if (safeStorage.isEncryptionAvailable()) {
|
||||
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