mirror of
https://github.com/bitwarden/browser
synced 2026-02-18 02:19:18 +00:00
[PM-27086] add SetInitialPasswordCredentialsV2
This commit is contained in:
@@ -39,6 +39,7 @@ import {
|
||||
SetInitialPasswordCredentials,
|
||||
SetInitialPasswordUserType,
|
||||
SetInitialPasswordTdeOffboardingCredentials,
|
||||
SetInitialPasswordCredentialsV2,
|
||||
} from "./set-initial-password.service.abstraction";
|
||||
|
||||
export class DefaultSetInitialPasswordService implements SetInitialPasswordService {
|
||||
@@ -210,7 +211,7 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi
|
||||
}
|
||||
|
||||
async setInitialPasswordV2(
|
||||
credentials: SetInitialPasswordCredentials,
|
||||
credentials: SetInitialPasswordCredentialsV2,
|
||||
userType: SetInitialPasswordUserType,
|
||||
userId: UserId,
|
||||
): Promise<void> {
|
||||
@@ -257,10 +258,6 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi
|
||||
userKey,
|
||||
);
|
||||
|
||||
if (unlockData.masterKeyWrappedUserKey == null) {
|
||||
throw new Error("masterKeyEncryptedUserKey not found. Could not set password.");
|
||||
}
|
||||
|
||||
let keyPair: [string, EncString] | null = null;
|
||||
let keysRequest: KeysRequest | null = null;
|
||||
|
||||
@@ -366,6 +363,9 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi
|
||||
return masterKeyEncryptedUserKey;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in PM-28143
|
||||
*/
|
||||
private async updateAccountDecryptionProperties(
|
||||
masterKey: MasterKey,
|
||||
kdfConfig: KdfConfig,
|
||||
|
||||
@@ -42,6 +42,7 @@ import { I18nPipe } from "@bitwarden/ui-common";
|
||||
|
||||
import {
|
||||
SetInitialPasswordCredentials,
|
||||
SetInitialPasswordCredentialsV2,
|
||||
SetInitialPasswordService,
|
||||
SetInitialPasswordTdeOffboardingCredentials,
|
||||
SetInitialPasswordUserType,
|
||||
@@ -284,7 +285,7 @@ export class SetInitialPasswordComponent implements OnInit {
|
||||
assertNonNullish(this.resetPasswordAutoEnroll, "resetPasswordAutoEnroll", ctx); // can have `false` as a valid value, so check non-nullish
|
||||
|
||||
try {
|
||||
const credentials: SetInitialPasswordCredentials = {
|
||||
const credentials: SetInitialPasswordCredentialsV2 = {
|
||||
newPassword: passwordInputResult.newPassword,
|
||||
newPasswordHint: passwordInputResult.newPasswordHint,
|
||||
kdfConfig: passwordInputResult.kdfConfig,
|
||||
|
||||
@@ -42,22 +42,28 @@ export const SetInitialPasswordUserType: Readonly<{
|
||||
[K in keyof typeof _SetInitialPasswordUserType]: SetInitialPasswordUserType;
|
||||
}> = Object.freeze(_SetInitialPasswordUserType);
|
||||
|
||||
/**
|
||||
* @deprecated To be removed in PM-28143
|
||||
*/
|
||||
export interface SetInitialPasswordCredentials {
|
||||
newPassword?: string; // Make required in PM-28143 (remove `?`)
|
||||
newMasterKey: MasterKey;
|
||||
newServerMasterKeyHash: string;
|
||||
newLocalMasterKeyHash: string;
|
||||
newPasswordHint: string;
|
||||
kdfConfig: KdfConfig;
|
||||
salt?: MasterPasswordSalt; // Make required in PM-28143 (remove `?`)
|
||||
orgSsoIdentifier: string;
|
||||
orgId: string;
|
||||
resetPasswordAutoEnroll: boolean;
|
||||
}
|
||||
|
||||
// The deprecated properties below will be removed in PM-28143
|
||||
/** @deprecated */
|
||||
newMasterKey?: MasterKey;
|
||||
/** @deprecated */
|
||||
newServerMasterKeyHash?: string;
|
||||
/** @deprecated */
|
||||
newLocalMasterKeyHash?: string;
|
||||
export interface SetInitialPasswordCredentialsV2 {
|
||||
newPassword: string;
|
||||
newPasswordHint: string;
|
||||
kdfConfig: KdfConfig;
|
||||
salt: MasterPasswordSalt;
|
||||
orgSsoIdentifier: string;
|
||||
orgId: string;
|
||||
resetPasswordAutoEnroll: boolean;
|
||||
}
|
||||
|
||||
export interface SetInitialPasswordTdeOffboardingCredentials {
|
||||
@@ -113,7 +119,7 @@ export abstract class SetInitialPasswordService {
|
||||
* masterKeyEncryptedUserKey or newKeyPair could not be created.
|
||||
*/
|
||||
abstract setInitialPasswordV2: (
|
||||
credentials: SetInitialPasswordCredentials,
|
||||
credentials: SetInitialPasswordCredentialsV2,
|
||||
userType: SetInitialPasswordUserType,
|
||||
userId: UserId,
|
||||
) => Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user