Add OS auth to local backup key viewer
This commit is contained in:
parent
cae8bd482f
commit
37422e41f5
15 changed files with 1070 additions and 12 deletions
38
ts/util/promptOSAuth.ts
Normal file
38
ts/util/promptOSAuth.ts
Normal file
|
@ -0,0 +1,38 @@
|
|||
// Copyright 2025 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import { ipcRenderer } from 'electron';
|
||||
import type {
|
||||
PromptOSAuthReasonType,
|
||||
PromptOSAuthResultType,
|
||||
} from './os/promptOSAuthMain';
|
||||
|
||||
export async function promptOSAuth(
|
||||
reason: PromptOSAuthReasonType
|
||||
): Promise<PromptOSAuthResultType> {
|
||||
return new Promise<PromptOSAuthResultType>((resolve, _reject) => {
|
||||
let localeString: string | undefined;
|
||||
|
||||
// TODO: DESKTOP-8895
|
||||
if (window.Signal.OS.isMacOS()) {
|
||||
if (reason === 'enable-backups') {
|
||||
localeString = 'enable backups';
|
||||
} else if (reason === 'view-aep') {
|
||||
localeString = 'show your backup key';
|
||||
}
|
||||
}
|
||||
|
||||
if (window.Signal.OS.isWindows()) {
|
||||
if (reason === 'enable-backups') {
|
||||
localeString = 'Verify your identity to enable backups.';
|
||||
} else if (reason === 'view-aep') {
|
||||
localeString = 'Verify your identity to view your backup key.';
|
||||
}
|
||||
}
|
||||
|
||||
ipcRenderer.once(`prompt-os-auth:${reason}`, (_, response) => {
|
||||
resolve(response ?? 'error');
|
||||
});
|
||||
ipcRenderer.send('prompt-os-auth', { reason, localeString });
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue