mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-13374] Update all SDK uuids (#14962)
* fix: broken SDK interface * Fix all compile errors related to uuids * Fix browser desktop * Fix tests --------- Co-authored-by: Andreas Coroiu <andreas.coroiu@gmail.com>
This commit is contained in:
@@ -32,7 +32,7 @@ export function asUuid<T extends Uuid>(uuid: string): T {
|
||||
/**
|
||||
* Converts a UUID to the string representation.
|
||||
*/
|
||||
export function uuidToString<T extends Uuid>(uuid: T): string {
|
||||
export function uuidAsString<T extends Uuid>(uuid: T): string {
|
||||
return uuid as unknown as string;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ describe("DefaultSdkService", () => {
|
||||
});
|
||||
|
||||
describe("given the user is logged in", () => {
|
||||
const userId = "user-id" as UserId;
|
||||
const userId = "0da62ebd-98bb-4f42-a846-64e8555087d7" as UserId;
|
||||
beforeEach(() => {
|
||||
environmentService.getEnvironment$
|
||||
.calledWith(userId)
|
||||
|
||||
@@ -35,7 +35,7 @@ import { Environment, EnvironmentService } from "../../abstractions/environment.
|
||||
import { PlatformUtilsService } from "../../abstractions/platform-utils.service";
|
||||
import { SdkClientFactory } from "../../abstractions/sdk/sdk-client-factory";
|
||||
import { SdkLoadService } from "../../abstractions/sdk/sdk-load.service";
|
||||
import { SdkService, UserNotLoggedInError } from "../../abstractions/sdk/sdk.service";
|
||||
import { asUuid, SdkService, UserNotLoggedInError } from "../../abstractions/sdk/sdk.service";
|
||||
import { compareValues } from "../../misc/compare-values";
|
||||
import { Rc } from "../../misc/reference-counting/rc";
|
||||
import { StateProvider } from "../../state";
|
||||
@@ -218,7 +218,7 @@ export class DefaultSdkService implements SdkService {
|
||||
orgKeys: Record<OrganizationId, EncryptedOrganizationKeyData> | null,
|
||||
) {
|
||||
await client.crypto().initialize_user_crypto({
|
||||
userId,
|
||||
userId: asUuid(userId),
|
||||
email: account.email,
|
||||
method: { decryptedKey: { decrypted_user_key: userKey.keyB64 } },
|
||||
kdfParams:
|
||||
@@ -242,7 +242,7 @@ export class DefaultSdkService implements SdkService {
|
||||
organizationKeys: new Map(
|
||||
Object.entries(orgKeys ?? {})
|
||||
.filter(([_, v]) => v.type === "organization")
|
||||
.map(([k, v]) => [k, v.key as UnsignedSharedKey]),
|
||||
.map(([k, v]) => [asUuid(k), v.key as UnsignedSharedKey]),
|
||||
),
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user