https://github.com/bitwarden/sdk-internal might be now free software but we currently don't want to build it as it's a huge WASM blob that is not currently used for anything. This patch will be removed once some _actual_ JS functionality gets migrated to wasm --- bitwarden-2024.10.0/apps/desktop/config/base.json.orig 2024-10-17 21:45:41.000000000 +0200 +++ bitwarden-2024.10.0/apps/desktop/config/base.json 2024-10-25 21:36:08.368540114 +0200 @@ -1,6 +1,6 @@ { "flags": { - "sdk": true + "sdk": false }, "devFlags": {} } --- clients-desktop-v2024.11.0/apps/desktop/src/app/services/services.module.ts.orig 2024-11-14 21:24:33.955145852 +0100 +++ clients-desktop-v2024.11.0/apps/desktop/src/app/services/services.module.ts 2024-11-14 21:39:37.686804726 +0100 @@ -72,7 +72,6 @@ import { Message, MessageListener, Messa import { SubjectMessageSender } from "@bitwarden/common/platform/messaging/internal"; import { TaskSchedulerService } from "@bitwarden/common/platform/scheduling"; import { MemoryStorageService } from "@bitwarden/common/platform/services/memory-storage.service"; -import { DefaultSdkClientFactory } from "@bitwarden/common/platform/services/sdk/default-sdk-client-factory"; import { NoopSdkClientFactory } from "@bitwarden/common/platform/services/sdk/noop-sdk-client-factory"; import { SystemService } from "@bitwarden/common/platform/services/system.service"; import { GlobalStateProvider, StateProvider } from "@bitwarden/common/platform/state"; @@ -344,7 +343,7 @@ const safeProviders: SafeProvider[] = [ }), safeProvider({ provide: SdkClientFactory, - useClass: flagEnabled("sdk") ? DefaultSdkClientFactory : NoopSdkClientFactory, + useClass: NoopSdkClientFactory, deps: [], }), safeProvider({ --- clients-desktop-v2024.11.0/libs/common/src/platform/abstractions/sdk/sdk.service.ts.orig 2024-11-14 21:24:34.402035860 +0100 +++ clients-desktop-v2024.11.0/libs/common/src/platform/abstractions/sdk/sdk.service.ts 2024-11-14 21:40:54.838696107 +0100 @@ -1,6 +1,5 @@ import { Observable } from "rxjs"; -import { BitwardenClient } from "@bitwarden/sdk-internal"; import { UserId } from "../../../types/guid"; @@ -14,7 +13,7 @@ export abstract class SdkService { * Retrieve a client initialized without a user. * This client can only be used for operations that don't require a user context. */ - client$: Observable; + client$: Observable; /** * Retrieve a client initialized for a specific user. @@ -27,7 +26,7 @@ export abstract class SdkService { * * @param userId */ - abstract userClient$(userId: UserId): Observable; + abstract userClient$(userId: UserId): Observable; abstract failedToInitialize(category: string, error?: Error): Promise; } --- bitwarden-2024.10.0/libs/common/src/platform/abstractions/sdk/sdk-client-factory.ts.orig 2024-10-17 21:45:41.000000000 +0200 +++ bitwarden-2024.10.0/libs/common/src/platform/abstractions/sdk/sdk-client-factory.ts 2024-10-25 21:32:14.591461794 +0200 @@ -1,10 +1,9 @@ -import type { BitwardenClient } from "@bitwarden/sdk-internal"; /** * Factory for creating SDK clients. */ export abstract class SdkClientFactory { abstract createSdkClient( - ...args: ConstructorParameters - ): Promise; + ...args: ConstructorParameters + ): Promise; } --- bitwarden-2024.10.0/libs/common/src/platform/services/sdk/noop-sdk-client-factory.ts.orig 2024-10-17 21:45:41.000000000 +0200 +++ bitwarden-2024.10.0/libs/common/src/platform/services/sdk/noop-sdk-client-factory.ts 2024-10-25 21:41:45.940577943 +0200 @@ -1,4 +1,3 @@ -import type { BitwardenClient } from "@bitwarden/sdk-internal"; import { SdkClientFactory } from "../../abstractions/sdk/sdk-client-factory"; @@ -9,8 +8,8 @@ import { SdkClientFactory } from "../../ */ export class NoopSdkClientFactory implements SdkClientFactory { createSdkClient( - ...args: ConstructorParameters - ): Promise { + ...args: ConstructorParameters + ): Promise { return Promise.reject(new Error("SDK not available")); } } --- clients/libs/common/src/platform/services/sdk/default-sdk.service.ts.orig 2024-12-12 18:52:12.448979879 +0100 +++ clients/libs/common/src/platform/services/sdk/default-sdk.service.ts 2024-12-12 19:08:41.399904218 +0100 @@ -12,12 +12,6 @@ import { } from "rxjs"; import { KeyService, KdfConfigService, KdfConfig, KdfType } from "@bitwarden/key-management"; -import { - BitwardenClient, - ClientSettings, - LogLevel, - DeviceType as SdkDeviceType, -} from "@bitwarden/sdk-internal"; import { ApiService } from "../../../abstractions/api.service"; import { EncryptedOrganizationKeyData } from "../../../admin-console/models/data/encrypted-organization-key.data"; @@ -33,10 +27,10 @@ import { compareValues } from "../../mis import { EncryptedString } from "../../models/domain/enc-string"; export class RecoverableSDKError extends Error { - sdk: BitwardenClient; + sdk: any; timeout: number; - constructor(sdk: BitwardenClient, timeout: number) { + constructor(sdk: any, timeout: number) { super(`SDK took ${timeout}s to initialize`); this.sdk = sdk; @@ -45,13 +39,13 @@ export class RecoverableSDKError extends } export class DefaultSdkService implements SdkService { - private sdkClientCache = new Map>(); + private sdkClientCache = new Map>(); client$ = this.environmentService.environment$.pipe( concatMap(async (env) => { const settings = this.toSettings(env); try { - return await this.sdkClientFactory.createSdkClient(settings, LogLevel.Info); + return await this.sdkClientFactory.createSdkClient(settings, 'unused'); } catch (e) { if (e instanceof RecoverableSDKError) { await this.failedToInitialize("sdk", e); @@ -85,7 +79,7 @@ export class DefaultSdkService implement private userAgent: string = null, ) {} - userClient$(userId: UserId): Observable { + userClient$(userId: UserId): Observable { // TODO: Figure out what happens when the user logs out if (this.sdkClientCache.has(userId)) { return this.sdkClientCache.get(userId); @@ -115,8 +109,8 @@ export class DefaultSdkService implement // switchMap is required to allow the clean-up logic to be executed when `combineLatest` emits a new value. switchMap(([env, account, kdfParams, privateKey, userKey, orgKeys]) => { // Create our own observable to be able to implement clean-up logic - return new Observable((subscriber) => { - let client: BitwardenClient; + return new Observable((subscriber) => { + let client: any; const createAndInitializeClient = async () => { if (privateKey == null || userKey == null) { @@ -124,7 +118,7 @@ export class DefaultSdkService implement } const settings = this.toSettings(env); - client = await this.sdkClientFactory.createSdkClient(settings, LogLevel.Info); + client = await this.sdkClientFactory.createSdkClient(settings, 'unused'); await this.initializeClient(client, account, kdfParams, privateKey, userKey, orgKeys); @@ -179,7 +173,7 @@ export class DefaultSdkService implement } private async initializeClient( - client: BitwardenClient, + client: any, account: AccountInfo, kdfParams: KdfConfig, privateKey: EncryptedString, @@ -215,7 +209,7 @@ export class DefaultSdkService implement }); } - private toSettings(env: Environment): ClientSettings { + private toSettings(env: Environment): any { return { apiUrl: env.getApiUrl(), identityUrl: env.getIdentityUrl(), @@ -224,7 +218,7 @@ export class DefaultSdkService implement }; } - private toDevice(device: DeviceType): SdkDeviceType { + private toDevice(device: DeviceType): any { switch (device) { case DeviceType.Android: return "Android";