diff --git a/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts b/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts index a6c5c0dab0..932e54b102 100644 --- a/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts +++ b/apps/web/src/app/auth/settings/emergency-access/emergency-access.component.ts @@ -12,6 +12,7 @@ import { EmergencyAccessGranteeDetailsResponse, EmergencyAccessGrantorDetailsResponse, } from "@bitwarden/common/auth/models/response/emergency-access.response"; +import { KeySuffixOptions } from "@bitwarden/common/enums"; import { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service"; import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service"; import { LogService } from "@bitwarden/common/platform/abstractions/log.service"; @@ -302,7 +303,11 @@ export class EmergencyAccessComponent implements OnInit { // Encrypt the user key with the grantees public key, and send it to bitwarden for escrow. private async doConfirmation(details: EmergencyAccessGranteeDetailsResponse) { - const userKey = await this.cryptoService.getUserKeyFromMemory(); + let userKey = await this.cryptoService.getUserKeyFromMemory(); + userKey ||= await this.cryptoService.getUserKeyFromStorage(KeySuffixOptions.Auto); + if (!userKey) { + throw new Error("No user key found"); + } const publicKeyResponse = await this.apiService.getUserPublicKey(details.granteeId); const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);