1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-15 07:43:35 +00:00

[BEEEP] [EC-141] Rust - Windows hello (#2635)

This commit is contained in:
Oscar Hinton
2022-07-25 13:24:13 +02:00
committed by GitHub
parent 05f6a30672
commit 0c1bd57cfd
25 changed files with 379 additions and 2026 deletions

View File

@@ -169,13 +169,12 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
return await this.stateService.getEnableBiometric();
}
authenticateBiometric(): Promise<boolean> {
return new Promise((resolve) => {
const val = ipcRenderer.sendSync("biometric", {
action: "authenticate",
});
resolve(val);
async authenticateBiometric(): Promise<boolean> {
const val = await ipcRenderer.invoke("biometric", {
action: "authenticate",
});
return val;
}
supportsSecureStorage(): boolean {

View File

@@ -5,39 +5,37 @@ import { StorageOptions } from "@bitwarden/common/models/domain/storageOptions";
export class ElectronRendererSecureStorageService implements AbstractStorageService {
async get<T>(key: string, options?: StorageOptions): Promise<T> {
const val = ipcRenderer.sendSync("keytar", {
const val = await ipcRenderer.invoke("keytar", {
action: "getPassword",
key: key,
keySuffix: options?.keySuffix ?? "",
});
return Promise.resolve(val != null ? (JSON.parse(val) as T) : null);
return val != null ? (JSON.parse(val) as T) : null;
}
async has(key: string, options?: StorageOptions): Promise<boolean> {
const val = ipcRenderer.sendSync("keytar", {
const val = await ipcRenderer.invoke("keytar", {
action: "hasPassword",
key: key,
keySuffix: options?.keySuffix ?? "",
});
return Promise.resolve(!!val);
return !!val;
}
async save(key: string, obj: any, options?: StorageOptions): Promise<any> {
ipcRenderer.sendSync("keytar", {
await ipcRenderer.invoke("keytar", {
action: "setPassword",
key: key,
keySuffix: options?.keySuffix ?? "",
value: JSON.stringify(obj),
});
return Promise.resolve();
}
async remove(key: string, options?: StorageOptions): Promise<any> {
ipcRenderer.sendSync("keytar", {
await ipcRenderer.invoke("keytar", {
action: "deletePassword",
key: key,
keySuffix: options?.keySuffix ?? "",
});
return Promise.resolve();
}
}