mirror of
https://github.com/CringeStudios/element-desktop.git
synced 2025-01-18 15:34:59 +01:00
Fix secret storage not being used due to bad import (#2029)
This commit is contained in:
parent
5bef889f83
commit
5d688c375a
@ -6,6 +6,8 @@ SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only
|
|||||||
Please see LICENSE files in the repository root for full details.
|
Please see LICENSE files in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import { platform } from "node:os";
|
||||||
|
|
||||||
import { test, expect } from "../../element-desktop-test.js";
|
import { test, expect } from "../../element-desktop-test.js";
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
@ -17,6 +19,7 @@ declare global {
|
|||||||
supportsEventIndexing(): Promise<boolean>;
|
supportsEventIndexing(): Promise<boolean>;
|
||||||
}
|
}
|
||||||
| undefined;
|
| undefined;
|
||||||
|
createPickleKey(userId: string, deviceId: string): Promise<string | null>;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -24,17 +27,32 @@ declare global {
|
|||||||
|
|
||||||
test.describe("App launch", () => {
|
test.describe("App launch", () => {
|
||||||
test.slow();
|
test.slow();
|
||||||
test("should launch and render the welcome view successfully and support seshat", async ({ page }) => {
|
|
||||||
|
test.beforeEach(async ({ page }) => {
|
||||||
await page.locator("#matrixchat").waitFor();
|
await page.locator("#matrixchat").waitFor();
|
||||||
await page.locator(".mx_Welcome").waitFor();
|
await page.locator(".mx_Welcome").waitFor();
|
||||||
|
});
|
||||||
|
|
||||||
|
test("should launch and render the welcome view successfully", async ({ page }) => {
|
||||||
await expect(page).toHaveURL("vector://vector/webapp/#/welcome");
|
await expect(page).toHaveURL("vector://vector/webapp/#/welcome");
|
||||||
await expect(page).toHaveScreenshot();
|
await expect(page).toHaveScreenshot();
|
||||||
|
});
|
||||||
|
|
||||||
const supported = await page.evaluate<boolean>(async () => {
|
test("should launch and render the welcome view successfully and support seshat", async ({ page }) => {
|
||||||
const indexManager = window.mxPlatformPeg.get()?.getEventIndexingManager();
|
await expect(
|
||||||
return await indexManager?.supportsEventIndexing();
|
page.evaluate<boolean>(async () => {
|
||||||
});
|
return window.mxPlatformPeg.get().getEventIndexingManager()?.supportsEventIndexing();
|
||||||
|
}),
|
||||||
|
).resolves.toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
expect(supported).toBe(true);
|
test("should launch and render the welcome view successfully and support keytar", async ({ page }) => {
|
||||||
|
test.skip(platform() === "linux", "This test does not yet support Linux");
|
||||||
|
|
||||||
|
await expect(
|
||||||
|
page.evaluate<string | null>(async () => {
|
||||||
|
return await window.mxPlatformPeg.get().createPickleKey("@user:server", "ABCDEF");
|
||||||
|
}),
|
||||||
|
).resolves.not.toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Binary file not shown.
After Width: | Height: | Size: 1.0 MiB |
Binary file not shown.
Before Width: | Height: | Size: 1.0 MiB |
@ -157,7 +157,9 @@ ipcMain.on("ipcCall", async function (_ev: IpcMainEvent, payload) {
|
|||||||
case "createPickleKey":
|
case "createPickleKey":
|
||||||
try {
|
try {
|
||||||
const pickleKey = await randomArray(32);
|
const pickleKey = await randomArray(32);
|
||||||
await keytar?.setPassword("element.io", `${args[0]}|${args[1]}`, pickleKey);
|
// We purposefully throw if keytar is not available so the caller can handle it
|
||||||
|
// rather than sending them a pickle key we did not store on their behalf.
|
||||||
|
await keytar!.setPassword("element.io", `${args[0]}|${args[1]}`, pickleKey);
|
||||||
ret = pickleKey;
|
ret = pickleKey;
|
||||||
} catch {
|
} catch {
|
||||||
ret = null;
|
ret = null;
|
||||||
|
@ -9,7 +9,7 @@ import type * as Keytar from "keytar"; // Hak dependency type
|
|||||||
|
|
||||||
let keytar: typeof Keytar | undefined;
|
let keytar: typeof Keytar | undefined;
|
||||||
try {
|
try {
|
||||||
keytar = await import("keytar");
|
({ default: keytar } = await import("keytar"));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if ((<NodeJS.ErrnoException>e).code === "MODULE_NOT_FOUND") {
|
if ((<NodeJS.ErrnoException>e).code === "MODULE_NOT_FOUND") {
|
||||||
console.log("Keytar isn't installed; secure key storage is disabled.");
|
console.log("Keytar isn't installed; secure key storage is disabled.");
|
||||||
|
Loading…
Reference in New Issue
Block a user