mirror of
https://github.com/bitwarden/browser.git
synced 2024-11-15 10:35:20 +01:00
Make secure storage support sync
This commit is contained in:
parent
e09c528da9
commit
6e7fbc4e10
2
apps/desktop/desktop_native/index.d.ts
vendored
2
apps/desktop/desktop_native/index.d.ts
vendored
@ -12,7 +12,7 @@ export namespace passwords {
|
|||||||
export function setPassword(service: string, account: string, password: string): Promise<void>
|
export function setPassword(service: string, account: string, password: string): Promise<void>
|
||||||
/** Delete the stored password from the keychain. */
|
/** Delete the stored password from the keychain. */
|
||||||
export function deletePassword(service: string, account: string): Promise<void>
|
export function deletePassword(service: string, account: string): Promise<void>
|
||||||
export function hasPasswordManagement(): boolean
|
export function osSupportsSecuredStorage(): boolean
|
||||||
}
|
}
|
||||||
export namespace biometrics {
|
export namespace biometrics {
|
||||||
export function prompt(hwnd: Buffer, message: string): Promise<boolean>
|
export function prompt(hwnd: Buffer, message: string): Promise<boolean>
|
||||||
|
@ -42,7 +42,7 @@ pub mod passwords {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[napi]
|
#[napi]
|
||||||
pub fn has_password_management() -> bool {
|
pub fn os_supports_secured_storage() -> bool {
|
||||||
super::password::has_password_management()
|
super::password::has_password_management()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,7 @@ import { DefaultStateProvider } from "@bitwarden/common/platform/state/implement
|
|||||||
import { StateEventRegistrarService } from "@bitwarden/common/platform/state/state-event-registrar.service";
|
import { StateEventRegistrarService } from "@bitwarden/common/platform/state/state-event-registrar.service";
|
||||||
import { MemoryStorageService as MemoryStorageServiceForStateProviders } from "@bitwarden/common/platform/state/storage/memory-storage.service";
|
import { MemoryStorageService as MemoryStorageServiceForStateProviders } from "@bitwarden/common/platform/state/storage/memory-storage.service";
|
||||||
/* eslint-enable import/no-restricted-paths */
|
/* eslint-enable import/no-restricted-paths */
|
||||||
|
import { passwords } from "@bitwarden/desktop-native";
|
||||||
|
|
||||||
import { DesktopAutofillSettingsService } from "./autofill/services/desktop-autofill-settings.service";
|
import { DesktopAutofillSettingsService } from "./autofill/services/desktop-autofill-settings.service";
|
||||||
import { MenuMain } from "./main/menu/menu.main";
|
import { MenuMain } from "./main/menu/menu.main";
|
||||||
@ -47,7 +48,6 @@ import { DesktopCredentialStorageListener } from "./platform/main/desktop-creden
|
|||||||
import { MainCryptoFunctionService } from "./platform/main/main-crypto-function.service";
|
import { MainCryptoFunctionService } from "./platform/main/main-crypto-function.service";
|
||||||
import { DesktopSettingsService } from "./platform/services/desktop-settings.service";
|
import { DesktopSettingsService } from "./platform/services/desktop-settings.service";
|
||||||
import { ElectronLogMainService } from "./platform/services/electron-log.main.service";
|
import { ElectronLogMainService } from "./platform/services/electron-log.main.service";
|
||||||
import { ELECTRON_SUPPORTS_SECURE_STORAGE } from "./platform/services/electron-platform-utils.service";
|
|
||||||
import { ElectronStateService } from "./platform/services/electron-state.service";
|
import { ElectronStateService } from "./platform/services/electron-state.service";
|
||||||
import { ElectronStorageService } from "./platform/services/electron-storage.service";
|
import { ElectronStorageService } from "./platform/services/electron-storage.service";
|
||||||
import { I18nMainService } from "./platform/services/i18n.main.service";
|
import { I18nMainService } from "./platform/services/i18n.main.service";
|
||||||
@ -179,7 +179,7 @@ export class Main {
|
|||||||
this.tokenService = new TokenService(
|
this.tokenService = new TokenService(
|
||||||
singleUserStateProvider,
|
singleUserStateProvider,
|
||||||
globalStateProvider,
|
globalStateProvider,
|
||||||
ELECTRON_SUPPORTS_SECURE_STORAGE,
|
passwords.osSupportsSecuredStorage(),
|
||||||
illegalSecureStorageService,
|
illegalSecureStorageService,
|
||||||
this.keyGenerationService,
|
this.keyGenerationService,
|
||||||
this.encryptService,
|
this.encryptService,
|
||||||
|
@ -18,6 +18,10 @@ export class DesktopCredentialStorageListener {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
|
// Handle password management detection sync
|
||||||
|
ipcMain.on("osSupportsSecuredStorage", (event) => {
|
||||||
|
event.returnValue = passwords.osSupportsSecuredStorage();
|
||||||
|
});
|
||||||
ipcMain.handle("keytar", async (event: any, message: any) => {
|
ipcMain.handle("keytar", async (event: any, message: any) => {
|
||||||
try {
|
try {
|
||||||
let serviceName = this.serviceName;
|
let serviceName = this.serviceName;
|
||||||
|
@ -34,6 +34,7 @@ const passwords = {
|
|||||||
ipcRenderer.invoke("keytar", { action: "setPassword", key, keySuffix, value }),
|
ipcRenderer.invoke("keytar", { action: "setPassword", key, keySuffix, value }),
|
||||||
delete: (key: string, keySuffix: string): Promise<void> =>
|
delete: (key: string, keySuffix: string): Promise<void> =>
|
||||||
ipcRenderer.invoke("keytar", { action: "deletePassword", key, keySuffix }),
|
ipcRenderer.invoke("keytar", { action: "deletePassword", key, keySuffix }),
|
||||||
|
osSupportsSecuredStorage: (): boolean => ipcRenderer.sendSync("osSupportsSecuredStorage"),
|
||||||
};
|
};
|
||||||
|
|
||||||
const biometric = {
|
const biometric = {
|
||||||
|
Loading…
Reference in New Issue
Block a user