1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-15 10:35:20 +01:00

Store auth tokens based on accessibility of secure storage

This commit is contained in:
Matt Gibson 2024-04-16 16:22:06 -04:00 committed by Matt Gibson
parent 6e7fbc4e10
commit d7c3016582
No known key found for this signature in database
GPG Key ID: 963EE038B0581878
2 changed files with 9 additions and 6 deletions

View File

@ -37,7 +37,10 @@ import {
LogService as LogServiceAbstraction,
} from "@bitwarden/common/platform/abstractions/log.service";
import { MessagingService as MessagingServiceAbstraction } from "@bitwarden/common/platform/abstractions/messaging.service";
import { PlatformUtilsService as PlatformUtilsServiceAbstraction } from "@bitwarden/common/platform/abstractions/platform-utils.service";
import {
PlatformUtilsService,
PlatformUtilsService as PlatformUtilsServiceAbstraction,
} from "@bitwarden/common/platform/abstractions/platform-utils.service";
import { StateService as StateServiceAbstraction } from "@bitwarden/common/platform/abstractions/state.service";
import { AbstractStorageService } from "@bitwarden/common/platform/abstractions/storage.service";
import { SystemService as SystemServiceAbstraction } from "@bitwarden/common/platform/abstractions/system.service";
@ -64,7 +67,6 @@ import { DesktopSettingsService } from "../../platform/services/desktop-settings
import { ElectronCryptoService } from "../../platform/services/electron-crypto.service";
import { ElectronLogRendererService } from "../../platform/services/electron-log.renderer.service";
import {
ELECTRON_SUPPORTS_SECURE_STORAGE,
ElectronPlatformUtilsService,
} from "../../platform/services/electron-platform-utils.service";
import { ElectronRendererMessageSender } from "../../platform/services/electron-renderer-message.sender";
@ -135,7 +137,10 @@ const safeProviders: SafeProvider[] = [
// the TokenService having to inject the PlatformUtilsService which introduces a
// circular dependency on Desktop only.
provide: SUPPORTS_SECURE_STORAGE,
useValue: ELECTRON_SUPPORTS_SECURE_STORAGE,
useFactory: (platformUtilsService: PlatformUtilsService) => {
return platformUtilsService.supportsSecureStorage();
},
deps: [PlatformUtilsServiceAbstraction],
}),
safeProvider({
provide: I18nServiceAbstraction,

View File

@ -8,8 +8,6 @@ import {
import { ClipboardWriteMessage } from "../types/clipboard";
export const ELECTRON_SUPPORTS_SECURE_STORAGE = true;
export class ElectronPlatformUtilsService implements PlatformUtilsService {
constructor(
protected i18nService: I18nService,
@ -144,7 +142,7 @@ export class ElectronPlatformUtilsService implements PlatformUtilsService {
}
supportsSecureStorage(): boolean {
return ELECTRON_SUPPORTS_SECURE_STORAGE;
return ipc.platform.passwords.osSupportsSecuredStorage();
}
getAutofillKeyboardShortcut(): Promise<string> {