mirror of
https://github.com/bitwarden/browser.git
synced 2025-02-20 02:01:47 +01:00
check storage for user key if missing in memory
This commit is contained in:
parent
817b491fb6
commit
167f404f91
@ -12,6 +12,7 @@ import {
|
|||||||
EmergencyAccessGranteeDetailsResponse,
|
EmergencyAccessGranteeDetailsResponse,
|
||||||
EmergencyAccessGrantorDetailsResponse,
|
EmergencyAccessGrantorDetailsResponse,
|
||||||
} from "@bitwarden/common/auth/models/response/emergency-access.response";
|
} 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 { CryptoService } from "@bitwarden/common/platform/abstractions/crypto.service";
|
||||||
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
import { I18nService } from "@bitwarden/common/platform/abstractions/i18n.service";
|
||||||
import { LogService } from "@bitwarden/common/platform/abstractions/log.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.
|
// Encrypt the user key with the grantees public key, and send it to bitwarden for escrow.
|
||||||
private async doConfirmation(details: EmergencyAccessGranteeDetailsResponse) {
|
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 publicKeyResponse = await this.apiService.getUserPublicKey(details.granteeId);
|
||||||
const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
const publicKey = Utils.fromB64ToArray(publicKeyResponse.publicKey);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user