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:
parent
a8f1e7858d
commit
8f225bf541
@ -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
|
||||
|
@ -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", () => {
|
||||
|
Loading…
Reference in New Issue
Block a user