1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-19 02:44:01 +00:00

Replace uses of encstring with unsigned shared key

This commit is contained in:
Bernd Schoolmann
2025-12-12 15:55:43 +01:00
parent 3735f1c106
commit 9afce480de
42 changed files with 183 additions and 157 deletions

View File

@@ -1,6 +1,7 @@
import { EncryptedString } from "@bitwarden/common/key-management/crypto/models/enc-string";
import { UnsignedSharedKey } from "@bitwarden/sdk-internal";
export class OrganizationUserConfirmRequest {
key: EncryptedString | undefined;
key: UnsignedSharedKey | undefined;
defaultUserCollectionName: EncryptedString | undefined;
}

View File

@@ -18,6 +18,7 @@ import { CsprngArray } from "@bitwarden/common/types/csprng";
import { OrganizationId } from "@bitwarden/common/types/guid";
import { OrgKey } from "@bitwarden/common/types/key";
import { KeyService } from "@bitwarden/key-management";
import { UnsignedSharedKey } from "@bitwarden/sdk-internal";
import { DefaultOrganizationUserService } from "./default-organization-user.service";
@@ -36,7 +37,7 @@ describe("DefaultOrganizationUserService", () => {
const mockPublicKey = new Uint8Array(64) as CsprngArray;
const mockRandomBytes = new Uint8Array(64) as CsprngArray;
const mockOrgKey = new SymmetricCryptoKey(mockRandomBytes) as OrgKey;
const mockEncryptedKey = { encryptedString: "encrypted-key" } as EncString;
const mockEncryptedKey = "encrypted-key" as UnsignedSharedKey;
const mockEncryptedCollectionName = { encryptedString: "encrypted-collection-name" } as EncString;
const mockDefaultCollectionName = "My Items";
@@ -116,7 +117,7 @@ describe("DefaultOrganizationUserService", () => {
mockOrganization.id,
mockUserId,
{
key: mockEncryptedKey.encryptedString,
key: mockEncryptedKey,
defaultUserCollectionName: mockEncryptedCollectionName.encryptedString,
} as OrganizationUserConfirmRequest,
);

View File

@@ -46,7 +46,7 @@ export class DefaultOrganizationUserService implements OrganizationUserService {
return combineLatest([encryptedKey$, encryptedCollectionName$]).pipe(
map(([key, collectionName]) => ({
key: key.encryptedString,
key: key,
defaultUserCollectionName: collectionName.encryptedString,
})),
);