mirror of
https://github.com/bitwarden/browser
synced 2026-02-06 19:53:59 +00:00
Fix tests
This commit is contained in:
@@ -1023,6 +1023,7 @@ const safeProviders: SafeProvider[] = [
|
||||
KeyGenerationServiceAbstraction,
|
||||
EncryptService,
|
||||
LogService,
|
||||
CryptoFunctionServiceAbstraction,
|
||||
],
|
||||
}),
|
||||
safeProvider({
|
||||
|
||||
@@ -3,11 +3,20 @@
|
||||
import { mock } from "jest-mock-extended";
|
||||
import { ReplaySubject, Observable } from "rxjs";
|
||||
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { KdfConfig } from "@bitwarden/key-management";
|
||||
|
||||
import { ForceSetPasswordReason } from "../../../auth/models/domain/force-set-password-reason";
|
||||
import { EncString } from "../../../platform/models/domain/enc-string";
|
||||
import { UserId } from "../../../types/guid";
|
||||
import { MasterKey, UserKey } from "../../../types/key";
|
||||
import { InternalMasterPasswordServiceAbstraction } from "../abstractions/master-password.service.abstraction";
|
||||
import {
|
||||
MasterKeyWrappedUserKey,
|
||||
MasterPasswordAuthenticationData,
|
||||
MasterPasswordUnlockData,
|
||||
} from "../types/master-password.types";
|
||||
|
||||
export class FakeMasterPasswordService implements InternalMasterPasswordServiceAbstraction {
|
||||
mock = mock<InternalMasterPasswordServiceAbstraction>();
|
||||
@@ -71,4 +80,38 @@ export class FakeMasterPasswordService implements InternalMasterPasswordServiceA
|
||||
): Promise<UserKey> {
|
||||
return this.mock.decryptUserKeyWithMasterKey(masterKey, userId, userKey);
|
||||
}
|
||||
|
||||
makeMasterPasswordAuthenticationData(
|
||||
password: string,
|
||||
kdf: KdfConfig,
|
||||
salt: string,
|
||||
userId: UserId,
|
||||
): Promise<MasterPasswordAuthenticationData> {
|
||||
return this.mock.makeMasterPasswordAuthenticationData(password, kdf, salt, userId);
|
||||
}
|
||||
|
||||
makeMasterPasswordUnlockData(
|
||||
password: string,
|
||||
kdf: KdfConfig,
|
||||
salt: string,
|
||||
userKey: UserKey,
|
||||
): Promise<MasterPasswordUnlockData> {
|
||||
return this.mock.makeMasterPasswordUnlockData(password, kdf, salt, userKey);
|
||||
}
|
||||
|
||||
makeMasterKeyWrappedUserKey(
|
||||
password: string,
|
||||
kdf: KdfConfig,
|
||||
salt: string,
|
||||
userKey: UserKey,
|
||||
): Promise<MasterKeyWrappedUserKey> {
|
||||
return this.mock.makeMasterKeyWrappedUserKey(password, kdf, salt, userKey);
|
||||
}
|
||||
|
||||
unwrapMasterKeyWrappedUserKey(
|
||||
password: string,
|
||||
masterPasswordUnlockData: MasterPasswordUnlockData,
|
||||
): Promise<UserKey> {
|
||||
return this.mock.unwrapMasterKeyWrappedUserKey(password, masterPasswordUnlockData);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user