1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-24 02:41:54 +01:00

use master key for device approvals still

This commit is contained in:
Jacob Fink 2023-06-20 11:18:12 -04:00
parent a8f1e7858d
commit 8f225bf541
No known key found for this signature in database
GPG Key ID: C2F7ACF05859D008
2 changed files with 6 additions and 6 deletions

View File

@ -296,13 +296,14 @@ export class AuthService implements AuthServiceAbstraction {
key: string,
requestApproved: boolean
): Promise<AuthRequestResponse> {
// TODO: This currently depends on always having the Master Key and MP Hash
// We need to change this to using a different method (possibly server auth code + user sym key)
const pubKey = Utils.fromB64ToArray(key);
// TODO(Jake): Do we need to support old encryption model here?
const userSymKey = await this.cryptoService.getUserKeyFromMemory();
if (!userSymKey) {
throw new Error("User key not found");
const masterKey = await this.cryptoService.getMasterKey();
if (!masterKey) {
throw new Error("Master key not found");
}
const encryptedKey = await this.cryptoService.rsaEncrypt(userSymKey.encKey, pubKey.buffer);
const encryptedKey = await this.cryptoService.rsaEncrypt(masterKey.encKey, pubKey.buffer);
const encryptedMasterPasswordHash = await this.cryptoService.rsaEncrypt(
Utils.fromUtf8ToArray(await this.stateService.getKeyHash()),
pubKey.buffer

View File

@ -4,7 +4,6 @@ import { Utils } from "../../misc/utils";
import { AccountKeys, EncryptionPair } from "./account";
import { SymmetricCryptoKey } from "./symmetric-crypto-key";
//TODO(Jake): Fix tests
describe("AccountKeys", () => {
describe("toJSON", () => {
it("should serialize itself", () => {