aboutsummaryrefslogtreecommitdiffstats
path: root/packages/main/src/infrastructure/electron/impl
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-22 00:53:48 +0200
committerLibravatar Kristóf Marussy <kristof@marussy.com>2022-05-16 00:55:02 +0200
commit1184eb13f0bbe4768bf3dbd6cd31adf10c6c8dfe (patch)
tree78e6c699d8a232c948b40f643299f7af95a29215 /packages/main/src/infrastructure/electron/impl
parentfeat(renderer): Insecure connection warning (diff)
downloadsophie-1184eb13f0bbe4768bf3dbd6cd31adf10c6c8dfe.tar.gz
sophie-1184eb13f0bbe4768bf3dbd6cd31adf10c6c8dfe.tar.zst
sophie-1184eb13f0bbe4768bf3dbd6cd31adf10c6c8dfe.zip
feat: Certificate viewer
Show certificates with an interface modeled after firefox's certificate viewer so that they can be inspected before trusting. The current implementation assumes that each certificate has a unique fingerprint (collisions are astronomically unlikely). Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'packages/main/src/infrastructure/electron/impl')
-rw-r--r--packages/main/src/infrastructure/electron/impl/electronShell.ts15
1 files changed, 14 insertions, 1 deletions
diff --git a/packages/main/src/infrastructure/electron/impl/electronShell.ts b/packages/main/src/infrastructure/electron/impl/electronShell.ts
index be1cbe3..f7f7001 100644
--- a/packages/main/src/infrastructure/electron/impl/electronShell.ts
+++ b/packages/main/src/infrastructure/electron/impl/electronShell.ts
@@ -18,7 +18,9 @@
18 * SPDX-License-Identifier: AGPL-3.0-only 18 * SPDX-License-Identifier: AGPL-3.0-only
19 */ 19 */
20 20
21import { app, shell } from 'electron'; 21import { writeFile } from 'node:fs/promises';
22
23import { app, dialog, shell } from 'electron';
22import { getLogger } from 'loglevel'; 24import { getLogger } from 'loglevel';
23 25
24import type MainEnv from '../../../stores/MainEnv'; 26import type MainEnv from '../../../stores/MainEnv';
@@ -34,6 +36,17 @@ const electronShell: MainEnv = {
34 openAboutDialog(): void { 36 openAboutDialog(): void {
35 app.showAboutPanel(); 37 app.showAboutPanel();
36 }, 38 },
39 async saveTextFile(filename: string, value: string): Promise<void> {
40 const result = await dialog.showSaveDialog({
41 defaultPath: filename,
42 });
43 if (result.canceled || result.filePath === undefined) {
44 log.debug('Saving file', filename, 'canceled');
45 return;
46 }
47 await writeFile(result.filePath, value, 'utf8');
48 log.debug('Saved file', filename, 'to', result.filePath);
49 },
37}; 50};
38 51
39export default electronShell; 52export default electronShell;