mirror of
https://github.com/bitwarden/browser
synced 2026-02-12 22:44:11 +00:00
Replace uses of encstring with unsigned shared key
This commit is contained in:
@@ -236,7 +236,7 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi
|
||||
orgPublicKey,
|
||||
);
|
||||
|
||||
if (orgPublicKeyEncryptedUserKey == null || !orgPublicKeyEncryptedUserKey.encryptedString) {
|
||||
if (orgPublicKeyEncryptedUserKey == null || !orgPublicKeyEncryptedUserKey) {
|
||||
throw new Error(
|
||||
"orgPublicKeyEncryptedUserKey not found. Could not handle reset password auto enroll.",
|
||||
);
|
||||
@@ -244,7 +244,7 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi
|
||||
|
||||
const enrollmentRequest = new OrganizationUserResetPasswordEnrollmentRequest();
|
||||
enrollmentRequest.masterPasswordHash = masterKeyHash;
|
||||
enrollmentRequest.resetPasswordKey = orgPublicKeyEncryptedUserKey.encryptedString;
|
||||
enrollmentRequest.resetPasswordKey = orgPublicKeyEncryptedUserKey;
|
||||
|
||||
await this.organizationUserApiService.putOrganizationUserResetPasswordEnrollment(
|
||||
orgId,
|
||||
|
||||
@@ -34,6 +34,7 @@ import { CsprngArray } from "@bitwarden/common/types/csprng";
|
||||
import { UserId } from "@bitwarden/common/types/guid";
|
||||
import { MasterKey, UserKey, UserPrivateKey, UserPublicKey } from "@bitwarden/common/types/key";
|
||||
import { DEFAULT_KDF_CONFIG, KdfConfigService, KeyService } from "@bitwarden/key-management";
|
||||
import { UnsignedSharedKey } from "@bitwarden/sdk-internal";
|
||||
|
||||
import { DefaultSetInitialPasswordService } from "./default-set-initial-password.service.implementation";
|
||||
import {
|
||||
@@ -111,7 +112,7 @@ describe("DefaultSetInitialPasswordService", () => {
|
||||
let keysRequest: KeysRequest;
|
||||
|
||||
let organizationKeys: OrganizationKeysResponse;
|
||||
let orgPublicKeyEncryptedUserKey: EncString;
|
||||
let orgPublicKeyEncryptedUserKey: UnsignedSharedKey;
|
||||
|
||||
let userDecryptionOptions: UserDecryptionOptions;
|
||||
let userDecryptionOptionsSubject: BehaviorSubject<UserDecryptionOptions>;
|
||||
@@ -145,7 +146,7 @@ describe("DefaultSetInitialPasswordService", () => {
|
||||
privateKey: "orgPrivateKey",
|
||||
publicKey: "orgPublicKey",
|
||||
} as OrganizationKeysResponse;
|
||||
orgPublicKeyEncryptedUserKey = new EncString("orgPublicKeyEncryptedUserKey");
|
||||
orgPublicKeyEncryptedUserKey = "orgPublicKeyEncryptedUserKey" as UnsignedSharedKey;
|
||||
|
||||
userDecryptionOptions = new UserDecryptionOptions({ hasMasterPassword: true });
|
||||
userDecryptionOptionsSubject = new BehaviorSubject(userDecryptionOptions);
|
||||
@@ -164,7 +165,7 @@ describe("DefaultSetInitialPasswordService", () => {
|
||||
|
||||
enrollmentRequest = new OrganizationUserResetPasswordEnrollmentRequest();
|
||||
enrollmentRequest.masterPasswordHash = credentials.newServerMasterKeyHash;
|
||||
enrollmentRequest.resetPasswordKey = orgPublicKeyEncryptedUserKey.encryptedString;
|
||||
enrollmentRequest.resetPasswordKey = orgPublicKeyEncryptedUserKey;
|
||||
});
|
||||
|
||||
interface MockConfig {
|
||||
@@ -449,7 +450,7 @@ describe("DefaultSetInitialPasswordService", () => {
|
||||
if (property === "orgPublicKeyEncryptedUserKey") {
|
||||
orgPublicKeyEncryptedUserKey = null;
|
||||
} else {
|
||||
orgPublicKeyEncryptedUserKey.encryptedString = "" as EncryptedString;
|
||||
orgPublicKeyEncryptedUserKey = "" as UnsignedSharedKey;
|
||||
}
|
||||
|
||||
setupMocks({ ...defaultMockConfig, resetPasswordAutoEnroll: true });
|
||||
|
||||
Reference in New Issue
Block a user