diff --git a/apps/browser/src/background/nativeMessaging.background.ts b/apps/browser/src/background/nativeMessaging.background.ts index 8b845cf3567..a20d70701b8 100644 --- a/apps/browser/src/background/nativeMessaging.background.ts +++ b/apps/browser/src/background/nativeMessaging.background.ts @@ -409,7 +409,7 @@ export class NativeMessagingBackground { // eslint-disable-next-line @typescript-eslint/no-floating-promises this.sendUnencrypted({ command: "setupEncryption", - publicKey: Utils.fromBufferToB64(publicKey), + publicKey: Utils.fromArrayToB64(publicKey), userId: userId, messageId: this.messageId++, }); diff --git a/apps/cli/src/auth/commands/login.command.ts b/apps/cli/src/auth/commands/login.command.ts index 89d774b443b..95bd0b38095 100644 --- a/apps/cli/src/auth/commands/login.command.ts +++ b/apps/cli/src/auth/commands/login.command.ts @@ -425,7 +425,7 @@ export class LoginCommand { private async validatedParams() { const key = await this.cryptoFunctionService.randomBytes(64); - process.env.BW_SESSION = Utils.fromBufferToB64(key); + process.env.BW_SESSION = Utils.fromArrayToB64(key); } private async handleSuccessResponse(response: AuthResult): Promise { diff --git a/apps/cli/src/key-management/commands/unlock.command.ts b/apps/cli/src/key-management/commands/unlock.command.ts index c88d9ae1cc4..151c21b7443 100644 --- a/apps/cli/src/key-management/commands/unlock.command.ts +++ b/apps/cli/src/key-management/commands/unlock.command.ts @@ -125,7 +125,7 @@ export class UnlockCommand { private async setNewSessionKey() { const key = await this.cryptoFunctionService.randomBytes(64); - process.env.BW_SESSION = Utils.fromBufferToB64(key); + process.env.BW_SESSION = Utils.fromArrayToB64(key); } private async successResponse() { diff --git a/apps/cli/src/platform/services/node-env-secure-storage.service.ts b/apps/cli/src/platform/services/node-env-secure-storage.service.ts index 64865340000..4c704f63271 100644 --- a/apps/cli/src/platform/services/node-env-secure-storage.service.ts +++ b/apps/cli/src/platform/services/node-env-secure-storage.service.ts @@ -69,7 +69,7 @@ export class NodeEnvSecureStorageService implements AbstractStorageService { throw new Error("Value didn't encrypt."); } - return Utils.fromBufferToB64(encValue.buffer); + return Utils.fromArrayToB64(encValue.buffer); } private async decrypt(encValue: string): Promise { @@ -86,7 +86,7 @@ export class NodeEnvSecureStorageService implements AbstractStorageService { return null; } - return Utils.fromBufferToB64(decValue); + return Utils.fromArrayToB64(decValue); // FIXME: Remove when updating file. Eslint update // eslint-disable-next-line @typescript-eslint/no-unused-vars } catch (e) { diff --git a/apps/cli/src/tools/send/commands/receive.command.ts b/apps/cli/src/tools/send/commands/receive.command.ts index a412f7c1667..05669b41924 100644 --- a/apps/cli/src/tools/send/commands/receive.command.ts +++ b/apps/cli/src/tools/send/commands/receive.command.ts @@ -143,7 +143,7 @@ export class SendReceiveCommand extends DownloadCommand { "sha256", 100000, ); - return Utils.fromBufferToB64(passwordHash); + return Utils.fromArrayToB64(passwordHash); } private async sendRequest( diff --git a/apps/cli/src/tools/send/models/send.response.ts b/apps/cli/src/tools/send/models/send.response.ts index a0c1d3f83c6..6db0ede4092 100644 --- a/apps/cli/src/tools/send/models/send.response.ts +++ b/apps/cli/src/tools/send/models/send.response.ts @@ -108,7 +108,7 @@ export class SendResponse implements BaseResponse { this.accessUrl = sendLinkBaseUrl + this.accessId + "/" + o.urlB64Key; this.name = o.name; this.notes = o.notes; - this.key = Utils.fromBufferToB64(o.key); + this.key = Utils.fromArrayToB64(o.key); this.type = o.type; this.maxAccessCount = o.maxAccessCount; this.accessCount = o.accessCount; diff --git a/apps/desktop/src/key-management/biometrics/os-biometrics-linux.service.ts b/apps/desktop/src/key-management/biometrics/os-biometrics-linux.service.ts index 400918a69bb..44442b29202 100644 --- a/apps/desktop/src/key-management/biometrics/os-biometrics-linux.service.ts +++ b/apps/desktop/src/key-management/biometrics/os-biometrics-linux.service.ts @@ -62,7 +62,7 @@ export default class OsBiometricsServiceLinux implements OsBiometricService { const clientKeyHalf = await this.getOrCreateBiometricEncryptionClientKeyHalf(userId, key); const storageDetails = await this.getStorageDetails({ - clientKeyHalfB64: clientKeyHalf ? Utils.fromBufferToB64(clientKeyHalf) : undefined, + clientKeyHalfB64: clientKeyHalf ? Utils.fromArrayToB64(clientKeyHalf) : undefined, }); await biometrics.setBiometricSecret( SERVICE, @@ -103,7 +103,7 @@ export default class OsBiometricsServiceLinux implements OsBiometricService { } else { let clientKeyPartB64: string | null = null; if (this.clientKeyHalves.has(userId)) { - clientKeyPartB64 = Utils.fromBufferToB64(this.clientKeyHalves.get(userId)!); + clientKeyPartB64 = Utils.fromArrayToB64(this.clientKeyHalves.get(userId)!); } const encValue = new EncString(value); this.setIv(encValue.iv); diff --git a/apps/desktop/src/services/biometric-message-handler.service.ts b/apps/desktop/src/services/biometric-message-handler.service.ts index ca4ea14c1e0..205caba90fc 100644 --- a/apps/desktop/src/services/biometric-message-handler.service.ts +++ b/apps/desktop/src/services/biometric-message-handler.service.ts @@ -159,7 +159,7 @@ export class BiometricMessageHandlerService { } const connectedApp = { - publicKey: Utils.fromBufferToB64(remotePublicKey), + publicKey: Utils.fromArrayToB64(remotePublicKey), sessionSecret: null, trusted: false, } as ConnectedApp; @@ -307,7 +307,7 @@ export class BiometricMessageHandlerService { appId: appId, command: "setupEncryption", messageId: -1, // to indicate to the other side that this is a new desktop client. refactor later to use proper versioning - sharedSecret: Utils.fromBufferToB64(encryptedSecret), + sharedSecret: Utils.fromArrayToB64(encryptedSecret), }); } diff --git a/apps/desktop/src/services/duckduckgo-message-handler.service.ts b/apps/desktop/src/services/duckduckgo-message-handler.service.ts index fb3309c5b2a..54071ffa785 100644 --- a/apps/desktop/src/services/duckduckgo-message-handler.service.ts +++ b/apps/desktop/src/services/duckduckgo-message-handler.service.ts @@ -130,7 +130,7 @@ export class DuckDuckGoMessageHandlerService { version: NativeMessagingVersion.Latest, payload: { status: "success", - sharedKey: Utils.fromBufferToB64(encryptedSecret), + sharedKey: Utils.fromArrayToB64(encryptedSecret), }, }); // FIXME: Remove when updating file. Eslint update diff --git a/apps/web/src/app/key-management/key-rotation/model/public-key-encryption-key-pair-request.model.ts b/apps/web/src/app/key-management/key-rotation/model/public-key-encryption-key-pair-request.model.ts index 7504b599e16..b58e4b2984d 100644 --- a/apps/web/src/app/key-management/key-rotation/model/public-key-encryption-key-pair-request.model.ts +++ b/apps/web/src/app/key-management/key-rotation/model/public-key-encryption-key-pair-request.model.ts @@ -13,7 +13,7 @@ export class PublicKeyEncryptionKeyPairRequestModel { signedPublicKey: SignedPublicKey | null, ) { this.wrappedPrivateKey = wrappedPrivateKey; - this.publicKey = Utils.fromBufferToB64(publicKey); + this.publicKey = Utils.fromArrayToB64(publicKey); this.signedPublicKey = signedPublicKey; } } diff --git a/apps/web/src/app/key-management/key-rotation/request/account-keys.request.ts b/apps/web/src/app/key-management/key-rotation/request/account-keys.request.ts index 2c8964a3588..9a1533a68a6 100644 --- a/apps/web/src/app/key-management/key-rotation/request/account-keys.request.ts +++ b/apps/web/src/app/key-management/key-rotation/request/account-keys.request.ts @@ -29,7 +29,7 @@ export class AccountKeysRequest { static fromV1CryptographicState(state: V1UserCryptographicState): AccountKeysRequest { const request = new AccountKeysRequest(); request.userKeyEncryptedAccountPrivateKey = state.publicKeyEncryptionKeyPair.wrappedPrivateKey; - request.accountPublicKey = Utils.fromBufferToB64(state.publicKeyEncryptionKeyPair.publicKey); + request.accountPublicKey = Utils.fromArrayToB64(state.publicKeyEncryptionKeyPair.publicKey); request.publicKeyEncryptionKeyPair = new PublicKeyEncryptionKeyPairRequestModel( state.publicKeyEncryptionKeyPair.wrappedPrivateKey, state.publicKeyEncryptionKeyPair.publicKey, @@ -47,7 +47,7 @@ export class AccountKeysRequest { const request = new AccountKeysRequest(); request.userKeyEncryptedAccountPrivateKey = state.publicKeyEncryptionKeyPair.wrappedPrivateKey!; - request.accountPublicKey = Utils.fromBufferToB64(state.publicKeyEncryptionKeyPair.publicKey); + request.accountPublicKey = Utils.fromArrayToB64(state.publicKeyEncryptionKeyPair.publicKey); request.publicKeyEncryptionKeyPair = new PublicKeyEncryptionKeyPairRequestModel( state.publicKeyEncryptionKeyPair.wrappedPrivateKey, state.publicKeyEncryptionKeyPair.publicKey, diff --git a/apps/web/src/app/tools/send/send-access/access.component.ts b/apps/web/src/app/tools/send/send-access/access.component.ts index 273f1c8c979..1581ce49e79 100644 --- a/apps/web/src/app/tools/send/send-access/access.component.ts +++ b/apps/web/src/app/tools/send/send-access/access.component.ts @@ -106,7 +106,7 @@ export class AccessComponent implements OnInit { "sha256", SEND_KDF_ITERATIONS, ); - this.accessRequest.password = Utils.fromBufferToB64(passwordHash); + this.accessRequest.password = Utils.fromArrayToB64(passwordHash); } let sendResponse: SendAccessResponse = null; if (this.loading) { diff --git a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access.service.ts b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access.service.ts index 137eadb30b5..11272cb5aa6 100644 --- a/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access.service.ts +++ b/bitwarden_license/bit-web/src/app/secrets-manager/service-accounts/access/access.service.ts @@ -92,7 +92,7 @@ export class AccessService { ); const result = new AccessTokenCreationResponse(r); this._accessToken.next(null); - const keyB64 = Utils.fromBufferToB64(key.material); + const keyB64 = Utils.fromArrayToB64(key.material); return `${this._accessTokenVersion}.${result.id}.${result.clientSecret}:${keyB64}`; } diff --git a/libs/admin-console/package.json b/libs/admin-console/package.json index 5e934006d0d..c61aedca145 100644 --- a/libs/admin-console/package.json +++ b/libs/admin-console/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/angular/package.json b/libs/angular/package.json index 0b9111f88fb..bc2f3793674 100644 --- a/libs/angular/package.json +++ b/libs/angular/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.implementation.ts b/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.implementation.ts index 2f5c43e2db9..24434fc0b78 100644 --- a/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.implementation.ts +++ b/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.implementation.ts @@ -111,7 +111,7 @@ export class DefaultSetInitialPasswordService implements SetInitialPasswordServi const existingUserPublicKey = await firstValueFrom(this.keyService.userPublicKey$(userId)); if (existingUserPrivateKey != null && existingUserPublicKey != null) { - const existingUserPublicKeyB64 = Utils.fromBufferToB64(existingUserPublicKey); + const existingUserPublicKeyB64 = Utils.fromArrayToB64(existingUserPublicKey); // Existing key pair keyPair = [ diff --git a/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.spec.ts b/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.spec.ts index af4505371d3..cc98b664859 100644 --- a/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.spec.ts +++ b/libs/angular/src/auth/password-management/set-initial-password/default-set-initial-password.service.spec.ts @@ -78,7 +78,7 @@ describe("DefaultSetInitialPasswordService", () => { accountCryptographicStateService = mock(); userId = "userId" as UserId; - userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; userKeyEncString = new EncString("masterKeyEncryptedUserKey"); masterKeyEncryptedUserKey = [userKey, userKeyEncString]; @@ -126,7 +126,7 @@ describe("DefaultSetInitialPasswordService", () => { beforeEach(() => { // Mock function parameters credentials = { - newMasterKey: new SymmetricCryptoKey(new Uint8Array(32).buffer as CsprngArray) as MasterKey, + newMasterKey: new SymmetricCryptoKey(new Uint8Array(32)) as MasterKey, newServerMasterKeyHash: "newServerMasterKeyHash", newLocalMasterKeyHash: "newLocalMasterKeyHash", newPasswordHint: "newPasswordHint", @@ -732,7 +732,7 @@ describe("DefaultSetInitialPasswordService", () => { beforeEach(() => { // Mock function parameters credentials = { - newMasterKey: new SymmetricCryptoKey(new Uint8Array(32).buffer as CsprngArray) as MasterKey, + newMasterKey: new SymmetricCryptoKey(new Uint8Array(32)) as MasterKey, newServerMasterKeyHash: "newServerMasterKeyHash", newPasswordHint: "newPasswordHint", }; diff --git a/libs/auth/package.json b/libs/auth/package.json index cab83bd3b8d..ea7a956e951 100644 --- a/libs/auth/package.json +++ b/libs/auth/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts index 040d4d3c121..fc91f220138 100644 --- a/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts +++ b/libs/auth/src/angular/login-via-auth-request/login-via-auth-request.component.ts @@ -676,7 +676,7 @@ export class LoginViaAuthRequestComponent implements OnInit, OnDestroy { private async decryptViaApprovedAuthRequest( authRequestResponse: AuthRequestResponse, - privateKey: ArrayBuffer, + privateKey: Uint8Array, userId: UserId, ): Promise { /** diff --git a/libs/auth/src/angular/login/default-login-component.service.ts b/libs/auth/src/angular/login/default-login-component.service.ts index 2d50a0ffeb7..547562d63e2 100644 --- a/libs/auth/src/angular/login/default-login-component.service.ts +++ b/libs/auth/src/angular/login/default-login-component.service.ts @@ -96,7 +96,7 @@ export class DefaultLoginComponentService implements LoginComponentService { const codeVerifier = await this.passwordGenerationService.generatePassword(passwordOptions); const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, "sha256"); - const codeChallenge = Utils.fromBufferToUrlB64(codeVerifierHash); + const codeChallenge = Utils.fromArrayToUrlB64(codeVerifierHash); // Save SSO params await this.ssoLoginService.setSsoState(state); diff --git a/libs/auth/src/angular/registration/registration-finish/default-registration-finish.service.spec.ts b/libs/auth/src/angular/registration/registration-finish/default-registration-finish.service.spec.ts index 608e0ac64b9..0791ae28534 100644 --- a/libs/auth/src/angular/registration/registration-finish/default-registration-finish.service.spec.ts +++ b/libs/auth/src/angular/registration/registration-finish/default-registration-finish.service.spec.ts @@ -56,7 +56,7 @@ describe("DefaultRegistrationFinishService", () => { beforeEach(() => { email = "test@email.com"; emailVerificationToken = "emailVerificationToken"; - masterKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as MasterKey; + masterKey = new SymmetricCryptoKey(new Uint8Array(64)) as MasterKey; passwordInputResult = { newMasterKey: masterKey, newServerMasterKeyHash: "newServerMasterKeyHash", @@ -66,7 +66,7 @@ describe("DefaultRegistrationFinishService", () => { newPassword: "newPassword", }; - userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; userKeyEncString = new EncString("userKeyEncrypted"); userKeyPair = ["publicKey", new EncString("privateKey")]; diff --git a/libs/auth/src/angular/sso/sso.component.ts b/libs/auth/src/angular/sso/sso.component.ts index f5167cb84cc..fac331b3151 100644 --- a/libs/auth/src/angular/sso/sso.component.ts +++ b/libs/auth/src/angular/sso/sso.component.ts @@ -357,7 +357,7 @@ export class SsoComponent implements OnInit { if (codeChallenge == null) { const codeVerifier = await this.passwordGenerationService.generatePassword(passwordOptions); const codeVerifierHash = await this.cryptoFunctionService.hash(codeVerifier, "sha256"); - codeChallenge = Utils.fromBufferToUrlB64(codeVerifierHash); + codeChallenge = Utils.fromArrayToUrlB64(codeVerifierHash); await this.ssoLoginService.setCodeVerifier(codeVerifier); } diff --git a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts index 1bfbfd8d004..1077bc024e9 100644 --- a/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts +++ b/libs/auth/src/common/abstractions/auth-request.service.abstraction.ts @@ -72,7 +72,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract setUserKeyAfterDecryptingSharedUserKey( authReqResponse: AuthRequestResponse, - authReqPrivateKey: ArrayBuffer, + authReqPrivateKey: Uint8Array, userId: UserId, ): Promise; /** @@ -83,7 +83,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract setKeysAfterDecryptingSharedMasterKeyAndHash( authReqResponse: AuthRequestResponse, - authReqPrivateKey: ArrayBuffer, + authReqPrivateKey: Uint8Array, userId: UserId, ): Promise; /** @@ -94,7 +94,7 @@ export abstract class AuthRequestServiceAbstraction { */ abstract decryptPubKeyEncryptedUserKey( pubKeyEncryptedUserKey: string, - privateKey: ArrayBuffer, + privateKey: Uint8Array, ): Promise; /** * Decrypts a `MasterKey` and `MasterKeyHash` from a public key encrypted `MasterKey` and `MasterKeyHash`. @@ -106,7 +106,7 @@ export abstract class AuthRequestServiceAbstraction { abstract decryptPubKeyEncryptedMasterKeyAndHash( pubKeyEncryptedMasterKey: string, pubKeyEncryptedMasterKeyHash: string, - privateKey: ArrayBuffer, + privateKey: Uint8Array, ): Promise<{ masterKey: MasterKey; masterKeyHash: string }>; /** diff --git a/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts index 4703472d480..6b21f675bf2 100644 --- a/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/auth-request-login.strategy.spec.ts @@ -74,9 +74,9 @@ describe("AuthRequestLoginStrategy", () => { const accessCode = "ACCESS_CODE"; const authRequestId = "AUTH_REQUEST_ID"; const decMasterKey = new SymmetricCryptoKey( - new Uint8Array(64).buffer as CsprngArray, + new Uint8Array(64) ) as MasterKey; - const decUserKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + const decUserKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; const decMasterKeyHash = "LOCAL_PASSWORD_HASH"; beforeEach(async () => { @@ -160,8 +160,8 @@ describe("AuthRequestLoginStrategy", () => { decMasterKeyHash, ); - const masterKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as MasterKey; - const userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + const masterKey = new SymmetricCryptoKey(new Uint8Array(64)) as MasterKey; + const userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; masterPasswordService.masterKeySubject.next(masterKey); masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); diff --git a/libs/auth/src/common/login-strategies/login.strategy.spec.ts b/libs/auth/src/common/login-strategies/login.strategy.spec.ts index 113f9f3f0d9..714124e039d 100644 --- a/libs/auth/src/common/login-strategies/login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/login.strategy.spec.ts @@ -208,10 +208,10 @@ describe("LoginStrategy", () => { beforeEach(() => { userKey = new SymmetricCryptoKey( - new Uint8Array(userKeyBytesLength).buffer as CsprngArray, + new Uint8Array(userKeyBytesLength), ) as UserKey; masterKey = new SymmetricCryptoKey( - new Uint8Array(masterKeyBytesLength).buffer as CsprngArray, + new Uint8Array(masterKeyBytesLength), ) as MasterKey; const mockVaultTimeoutAction = VaultTimeoutAction.Lock; diff --git a/libs/auth/src/common/login-strategies/password-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/password-login.strategy.spec.ts index 4188b779d81..0b83e1c37cc 100644 --- a/libs/auth/src/common/login-strategies/password-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/password-login.strategy.spec.ts @@ -198,7 +198,7 @@ describe("PasswordLoginStrategy", () => { }); it("sets keys after a successful authentication", async () => { - const userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + const userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; masterPasswordService.masterKeySubject.next(masterKey); masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue(userKey); @@ -420,7 +420,7 @@ describe("PasswordLoginStrategy", () => { apiService.postIdentityToken.mockResolvedValue(tokenResponse); masterPasswordService.masterKeySubject.next(masterKey); masterPasswordService.mock.decryptUserKeyWithMasterKey.mockResolvedValue( - new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey, + new SymmetricCryptoKey(new Uint8Array(64)) as UserKey, ); await passwordLoginStrategy.logIn(credentials); diff --git a/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts index 484beb785d3..886d918ddb5 100644 --- a/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts @@ -248,11 +248,11 @@ describe("SsoLoginStrategy", () => { describe("Trusted Device Decryption", () => { const deviceKeyBytesLength = 64; - const mockDeviceKeyRandomBytes = new Uint8Array(deviceKeyBytesLength).buffer as CsprngArray; + const mockDeviceKeyRandomBytes = new Uint8Array(deviceKeyBytesLength); const mockDeviceKey: DeviceKey = new SymmetricCryptoKey(mockDeviceKeyRandomBytes) as DeviceKey; const userKeyBytesLength = 64; - const mockUserKeyRandomBytes = new Uint8Array(userKeyBytesLength).buffer as CsprngArray; + const mockUserKeyRandomBytes = new Uint8Array(userKeyBytesLength); const mockUserKey: UserKey = new SymmetricCryptoKey(mockUserKeyRandomBytes) as UserKey; const mockEncDevicePrivateKey = @@ -511,7 +511,7 @@ describe("SsoLoginStrategy", () => { it("gets and sets the master key if Key Connector is enabled and the user doesn't have a master password", async () => { const masterKey = new SymmetricCryptoKey( - new Uint8Array(64).buffer as CsprngArray, + new Uint8Array(64), ) as MasterKey; apiService.postIdentityToken.mockResolvedValue(tokenResponse); @@ -541,9 +541,9 @@ describe("SsoLoginStrategy", () => { }); it("decrypts and sets the user key if Key Connector is enabled and the user doesn't have a master password", async () => { - const userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; + const userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; const masterKey = new SymmetricCryptoKey( - new Uint8Array(64).buffer as CsprngArray, + new Uint8Array(64), ) as MasterKey; apiService.postIdentityToken.mockResolvedValue(tokenResponse); diff --git a/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts index 02613e527ec..3cb25c513ef 100644 --- a/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/user-api-login.strategy.spec.ts @@ -207,8 +207,8 @@ describe("UserApiLoginStrategy", () => { }); it("decrypts and sets the user key if Key Connector is enabled", async () => { - const userKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as UserKey; - const masterKey = new SymmetricCryptoKey(new Uint8Array(64).buffer as CsprngArray) as MasterKey; + const userKey = new SymmetricCryptoKey(new Uint8Array(64)) as UserKey; + const masterKey = new SymmetricCryptoKey(new Uint8Array(64)) as MasterKey; const tokenResponse = identityTokenResponseFactory(); tokenResponse.apiUseKeyConnector = true; diff --git a/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts b/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts index 2ae79f46d7c..97393aa367e 100644 --- a/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts +++ b/libs/auth/src/common/login-strategies/webauthn-login.strategy.spec.ts @@ -402,10 +402,10 @@ function randomBytes(length: number): Uint8Array { // so we need to mock them and assign them to the global object to make them available // for the tests export class MockAuthenticatorAssertionResponse implements AuthenticatorAssertionResponse { - clientDataJSON: ArrayBuffer = randomBytes(32).buffer; - authenticatorData: ArrayBuffer = randomBytes(196).buffer; - signature: ArrayBuffer = randomBytes(72).buffer; - userHandle: ArrayBuffer = randomBytes(16).buffer; + clientDataJSON: ArrayBuffer = randomBytes(32).buffer as ArrayBuffer; + authenticatorData: ArrayBuffer = randomBytes(196).buffer as ArrayBuffer; + signature: ArrayBuffer = randomBytes(72).buffer as ArrayBuffer; + userHandle: ArrayBuffer = randomBytes(16).buffer as ArrayBuffer; clientDataJSONB64Str = Utils.fromBufferToUrlB64(this.clientDataJSON); authenticatorDataB64Str = Utils.fromBufferToUrlB64(this.authenticatorData); @@ -417,7 +417,7 @@ export class MockPublicKeyCredential implements PublicKeyCredential { authenticatorAttachment = "cross-platform"; id = "mockCredentialId"; type = "public-key"; - rawId: ArrayBuffer = randomBytes(32).buffer; + rawId: ArrayBuffer = randomBytes(32).buffer as ArrayBuffer; rawIdB64Str = Utils.fromBufferToB64(this.rawId); response: MockAuthenticatorAssertionResponse = new MockAuthenticatorAssertionResponse(); diff --git a/libs/auth/src/common/services/auth-request/auth-request.service.ts b/libs/auth/src/common/services/auth-request/auth-request.service.ts index ba4b9eaf174..c554cb296a8 100644 --- a/libs/auth/src/common/services/auth-request/auth-request.service.ts +++ b/libs/auth/src/common/services/auth-request/auth-request.service.ts @@ -213,7 +213,7 @@ export class AuthRequestService implements AuthRequestServiceAbstraction { ); const masterKey = new SymmetricCryptoKey(decryptedMasterKeyArrayBuffer) as MasterKey; - const masterKeyHash = Utils.fromBufferToUtf8(decryptedMasterKeyHashArrayBuffer); + const masterKeyHash = Utils.fromArrayToUtf8(decryptedMasterKeyHashArrayBuffer); return { masterKey, diff --git a/libs/auth/src/common/services/auth-request/default-login-via-auth-request-cache.service.ts b/libs/auth/src/common/services/auth-request/default-login-via-auth-request-cache.service.ts index 8b947c41c46..0060996c2d2 100644 --- a/libs/auth/src/common/services/auth-request/default-login-via-auth-request-cache.service.ts +++ b/libs/auth/src/common/services/auth-request/default-login-via-auth-request-cache.service.ts @@ -34,7 +34,7 @@ export class LoginViaAuthRequestCacheService { // will not be parsable by the cryptography library after coming out of storage. this.defaultLoginViaAuthRequestCache.set({ id: id, - privateKey: Utils.fromBufferToB64(privateKey.buffer), + privateKey: Utils.fromArrayToB64(privateKey), accessCode: accessCode, } as LoginViaAuthRequestView); } diff --git a/libs/billing/package.json b/libs/billing/package.json index 3afd267cc23..3d61dcfba6c 100644 --- a/libs/billing/package.json +++ b/libs/billing/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest --passWithNoTests" } diff --git a/libs/common/package.json b/libs/common/package.json index ad2771e2fff..db7c1e52410 100644 --- a/libs/common/package.json +++ b/libs/common/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/common/src/auth/abstractions/webauthn/webauthn-login-prf-key.service.abstraction.ts b/libs/common/src/auth/abstractions/webauthn/webauthn-login-prf-key.service.abstraction.ts index 191bcaf44a8..6000f964055 100644 --- a/libs/common/src/auth/abstractions/webauthn/webauthn-login-prf-key.service.abstraction.ts +++ b/libs/common/src/auth/abstractions/webauthn/webauthn-login-prf-key.service.abstraction.ts @@ -7,11 +7,11 @@ export abstract class WebAuthnLoginPrfKeyServiceAbstraction { /** * Get the salt used to generate the PRF-output used when logging in with WebAuthn. */ - abstract getLoginWithPrfSalt(): Promise; + abstract getLoginWithPrfSalt(): Promise; /** * Create a symmetric key from the PRF-output by stretching it. * This should be used as `UpstreamKey` with `RotateableKeySet`. */ - abstract createSymmetricKeyFromPrf(prf: ArrayBuffer): Promise; + abstract createSymmetricKeyFromPrf(prf: Uint8Array): Promise; } diff --git a/libs/common/src/auth/models/domain/admin-auth-req-storable.ts b/libs/common/src/auth/models/domain/admin-auth-req-storable.ts index bdb74ebbc6b..3a8a83c0431 100644 --- a/libs/common/src/auth/models/domain/admin-auth-req-storable.ts +++ b/libs/common/src/auth/models/domain/admin-auth-req-storable.ts @@ -17,7 +17,7 @@ export class AdminAuthRequestStorable { toJSON() { return { id: this.id, - privateKey: Utils.fromBufferToByteString(this.privateKey), + privateKey: Utils.fromArrayToByteString(this.privateKey), }; } diff --git a/libs/common/src/auth/models/response/two-factor-web-authn.response.ts b/libs/common/src/auth/models/response/two-factor-web-authn.response.ts index 35b6830b0df..4a3cc7954ff 100644 --- a/libs/common/src/auth/models/response/two-factor-web-authn.response.ts +++ b/libs/common/src/auth/models/response/two-factor-web-authn.response.ts @@ -41,7 +41,7 @@ export class ChallengeResponse extends BaseResponse implements PublicKeyCredenti super(response); this.attestation = this.getResponseProperty("attestation"); this.authenticatorSelection = this.getResponseProperty("authenticatorSelection"); - this.challenge = Utils.fromUrlB64ToArray(this.getResponseProperty("challenge")); + this.challenge = Utils.fromUrlB64ToArray(this.getResponseProperty("challenge")).buffer as ArrayBuffer; this.excludeCredentials = this.getResponseProperty("excludeCredentials").map((c: any) => { c.id = Utils.fromUrlB64ToArray(c.id).buffer; return c; diff --git a/libs/common/src/auth/send-access/services/default-send-token.service.ts b/libs/common/src/auth/send-access/services/default-send-token.service.ts index 4d3376fd5b6..f3875717612 100644 --- a/libs/common/src/auth/send-access/services/default-send-token.service.ts +++ b/libs/common/src/auth/send-access/services/default-send-token.service.ts @@ -159,7 +159,7 @@ export class DefaultSendTokenService implements SendTokenServiceAbstraction { // Convert the Uint8Array to a base64 encoded string which is required // for the server to be able to compare the password hash. - const sendHashedPasswordB64 = Utils.fromBufferToB64( + const sendHashedPasswordB64 = Utils.fromArrayToB64( sendHashedPasswordArray, ) as SendHashedPasswordB64; diff --git a/libs/common/src/auth/services/webauthn-login/response/assertion-options.response.ts b/libs/common/src/auth/services/webauthn-login/response/assertion-options.response.ts index b7ac7354f27..eb17a9f3088 100644 --- a/libs/common/src/auth/services/webauthn-login/response/assertion-options.response.ts +++ b/libs/common/src/auth/services/webauthn-login/response/assertion-options.response.ts @@ -19,6 +19,7 @@ export class AssertionOptionsResponse ...c, id: Utils.fromUrlB64ToArray(c.id).buffer, })); + // @ts-ignore - ArrayBuffer compatibility issue with fetch in Node.js, safe at runtime this.challenge = Utils.fromUrlB64ToArray(this.getResponseProperty("challenge")); this.extensions = this.getResponseProperty("extensions"); this.rpId = this.getResponseProperty("rpId"); diff --git a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts index 7c57d62c131..64ae5d3c555 100644 --- a/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts +++ b/libs/common/src/auth/services/webauthn-login/webauthn-login-prf-key.service.ts @@ -8,12 +8,12 @@ const LoginWithPrfSalt = "passwordless-login"; export class WebAuthnLoginPrfKeyService implements WebAuthnLoginPrfKeyServiceAbstraction { constructor(private cryptoFunctionService: CryptoFunctionService) {} - async getLoginWithPrfSalt(): Promise { + async getLoginWithPrfSalt(): Promise { return await this.cryptoFunctionService.hash(LoginWithPrfSalt, "sha256"); } - async createSymmetricKeyFromPrf(prf: ArrayBuffer): Promise { - return (await this.stretchKey(new Uint8Array(prf))) as PrfKey; + async createSymmetricKeyFromPrf(prf: Uint8Array): Promise { + return (await this.stretchKey(prf) as PrfKey); } // TODO: use keyGenerationService.stretchKey diff --git a/libs/common/src/key-management/crypto/key-generation/default-key-generation.service.ts b/libs/common/src/key-management/crypto/key-generation/default-key-generation.service.ts index 5f5da741707..9aa7dcde495 100644 --- a/libs/common/src/key-management/crypto/key-generation/default-key-generation.service.ts +++ b/libs/common/src/key-management/crypto/key-generation/default-key-generation.service.ts @@ -30,7 +30,7 @@ export class DefaultKeyGenerationService implements KeyGenerationService { ): Promise<{ salt: string; material: CsprngArray; derivedKey: SymmetricCryptoKey }> { if (salt == null) { const bytes = await this.cryptoFunctionService.randomBytes(32); - salt = Utils.fromBufferToUtf8(bytes); + salt = Utils.fromArrayToUtf8(bytes); } const material = await this.cryptoFunctionService.aesGenerateKey(bitLength); const key = await this.cryptoFunctionService.hkdf(material, salt, purpose, 64, "sha256"); diff --git a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts index a5da0c82382..fcf89563b3a 100644 --- a/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts +++ b/libs/common/src/key-management/crypto/services/encrypt.service.implementation.ts @@ -209,7 +209,7 @@ export class EncryptServiceImplementation implements EncryptService { async hash(value: string | Uint8Array, algorithm: "sha1" | "sha256" | "sha512"): Promise { const hashArray = await this.cryptoFunctionService.hash(value, algorithm); - return Utils.fromBufferToB64(hashArray); + return Utils.fromArrayToB64(hashArray); } async encapsulateKeyUnsigned( diff --git a/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts index ee0b5cab902..7616546d42a 100644 --- a/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts +++ b/libs/common/src/key-management/crypto/services/web-crypto-function.service.ts @@ -38,16 +38,18 @@ export class WebCryptoFunctionService implements CryptoFunctionService { const passwordBuf = this.toBuf(password); const saltBuf = this.toBuf(salt); + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime const pbkdf2Params: Pbkdf2Params = { name: "PBKDF2", - salt: saltBuf, + salt: saltBuf.buffer as any, iterations: iterations, hash: { name: this.toWebCryptoAlgorithm(algorithm) }, }; + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime const impKey = await this.subtle.importKey( "raw", - passwordBuf, + passwordBuf.buffer as any, { name: "PBKDF2" } as any, false, ["deriveBits"], @@ -66,14 +68,16 @@ export class WebCryptoFunctionService implements CryptoFunctionService { const saltBuf = this.toBuf(salt); const infoBuf = this.toBuf(info); + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime const hkdfParams: HkdfParams = { name: "HKDF", - salt: saltBuf, - info: infoBuf, + salt: saltBuf as any, + info: infoBuf as any, hash: { name: this.toWebCryptoAlgorithm(algorithm) }, }; - const impKey = await this.subtle.importKey("raw", ikm, { name: "HKDF" } as any, false, [ + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime + const impKey = await this.subtle.importKey("raw", ikm as any, { name: "HKDF" } as any, false, [ "deriveBits", ]); const buffer = await this.subtle.deriveBits(hkdfParams as any, impKey, outputByteSize * 8); @@ -128,9 +132,10 @@ export class WebCryptoFunctionService implements CryptoFunctionService { } const valueBuf = this.toBuf(value); + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime const buffer = await this.subtle.digest( { name: this.toWebCryptoAlgorithm(algorithm) }, - valueBuf, + valueBuf as any, ); return new Uint8Array(buffer); } @@ -145,8 +150,10 @@ export class WebCryptoFunctionService implements CryptoFunctionService { hash: { name: this.toWebCryptoAlgorithm(algorithm) }, }; - const impKey = await this.subtle.importKey("raw", key, signingAlgorithm, false, ["sign"]); - const buffer = await this.subtle.sign(signingAlgorithm, impKey, value); + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime + const impKey = await this.subtle.importKey("raw", key as any, signingAlgorithm, false, ["sign"]); + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime + const buffer = await this.subtle.sign(signingAlgorithm, impKey, value as any); return new Uint8Array(buffer); } @@ -194,15 +201,18 @@ export class WebCryptoFunctionService implements CryptoFunctionService { return { iv: forge.util.decode64(iv), data: forge.util.decode64(data), - encKey: forge.util.createBuffer(innerKey.encryptionKey).getBytes(), + // @ts-ignore - Uint8Array type compatibility issue, safe at runtime + encKey: forge.util.createBuffer(innerKey.encryptionKey as any).getBytes(), } as CbcDecryptParameters; } else if (innerKey.type === EncryptionType.AesCbc256_HmacSha256_B64) { const macData = forge.util.decode64(iv) + forge.util.decode64(data); return { iv: forge.util.decode64(iv), data: forge.util.decode64(data), - encKey: forge.util.createBuffer(innerKey.encryptionKey).getBytes(), - macKey: forge.util.createBuffer(innerKey.authenticationKey).getBytes(), + // @ts-ignore - Uint8Array type compatibility issue, safe at runtime + encKey: forge.util.createBuffer(innerKey.encryptionKey as any).getBytes(), + // @ts-ignore - Uint8Array type compatibility issue, safe at runtime + macKey: forge.util.createBuffer(innerKey.authenticationKey as any).getBytes(), mac: forge.util.decode64(mac!), macData, } as CbcDecryptParameters; @@ -248,7 +258,8 @@ export class WebCryptoFunctionService implements CryptoFunctionService { const result = await this.aesDecryptFast({ mode: "ecb", parameters }); return Utils.fromByteStringToArray(result); } - const impKey = await this.subtle.importKey("raw", key, { name: "AES-CBC" } as any, false, [ + // @ts-ignore - ArrayBufferLike compatibility issue with Web Crypto API, safe at runtime + const impKey = await this.subtle.importKey("raw", key as any, { name: "AES-CBC" } as any, false, [ "decrypt", ]); @@ -256,7 +267,8 @@ export class WebCryptoFunctionService implements CryptoFunctionService { if (iv == null) { throw new Error("IV is required for CBC mode."); } - const buffer = await this.subtle.decrypt({ name: "AES-CBC", iv: iv }, impKey, data); + // @ts-expect-error - ArrayBufferLike compatibility issue, safe at runtime + const buffer = await this.subtle.decrypt({ name: "AES-CBC", iv: iv }, impKey, data as any); return new Uint8Array(buffer); } @@ -313,12 +325,12 @@ export class WebCryptoFunctionService implements CryptoFunctionService { return Promise.resolve(arr as CsprngArray); } - private toBuf(value: string | Uint8Array): Uint8Array { - let buf: Uint8Array; + private toBuf(value: string | Uint8Array): Uint8Array { + let buf: Uint8Array; if (typeof value === "string") { - buf = Utils.fromUtf8ToArray(value); + buf = Utils.fromUtf8ToArray(value) as Uint8Array; } else { - buf = value; + buf = value as Uint8Array; } return buf; } @@ -328,7 +340,8 @@ export class WebCryptoFunctionService implements CryptoFunctionService { if (typeof value === "string") { bytes = forge.util.encodeUtf8(value); } else { - bytes = Utils.fromBufferToByteString(value); + // @ts-expect-error - Uint8Array type compatibility issue, safe at runtime + bytes = Utils.fromBufferToByteString(value as any); } return bytes; } diff --git a/libs/common/src/key-management/key-connector/services/key-connector.service.ts b/libs/common/src/key-management/key-connector/services/key-connector.service.ts index 751f1ec8594..f51ac456a39 100644 --- a/libs/common/src/key-management/key-connector/services/key-connector.service.ts +++ b/libs/common/src/key-management/key-connector/services/key-connector.service.ts @@ -131,7 +131,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { async migrateUser(keyConnectorUrl: string, userId: UserId) { const masterKey = await firstValueFrom(this.masterPasswordService.masterKey$(userId)); const keyConnectorRequest = new KeyConnectorUserKeyRequest( - Utils.fromBufferToB64(masterKey.inner().encryptionKey), + Utils.fromArrayToB64(masterKey.inner().encryptionKey), ); try { @@ -278,7 +278,7 @@ export class KeyConnectorService implements KeyConnectorServiceAbstraction { kdfConfig, ); const keyConnectorRequest = new KeyConnectorUserKeyRequest( - Utils.fromBufferToB64(masterKey.inner().encryptionKey), + Utils.fromArrayToB64(masterKey.inner().encryptionKey), ); await this.masterPasswordService.setMasterKey(masterKey, userId); diff --git a/libs/common/src/key-management/master-password/services/master-password.service.ts b/libs/common/src/key-management/master-password/services/master-password.service.ts index c2947b2263d..9a25277fd37 100644 --- a/libs/common/src/key-management/master-password/services/master-password.service.ts +++ b/libs/common/src/key-management/master-password/services/master-password.service.ts @@ -262,7 +262,7 @@ export class MasterPasswordService implements InternalMasterPasswordServiceAbstr kdf, )) as MasterKey; - const masterPasswordAuthenticationHash = Utils.fromBufferToB64( + const masterPasswordAuthenticationHash = Utils.fromArrayToB64( await this.cryptoFunctionService.pbkdf2( masterKey.toEncoded(), password, diff --git a/libs/common/src/platform/misc/utils.ts b/libs/common/src/platform/misc/utils.ts index 136b0ac394f..918081c4ddf 100644 --- a/libs/common/src/platform/misc/utils.ts +++ b/libs/common/src/platform/misc/utils.ts @@ -128,6 +128,45 @@ export class Utils { return arr; } + static fromArrayToHex(arr: Uint8Array | null): string | null { + if (arr == null) { + return null; + } + return this.fromBufferToHex(arr.buffer as ArrayBuffer); + } + + static fromArrayToB64(arr: Uint8Array | null): string | null { + if (arr == null) { + return null; + } + + return this.fromBufferToB64(arr.buffer as ArrayBuffer); + } + + static fromArrayToUrlB64(arr: Uint8Array | null): string | null { + if (arr == null) { + return null; + } + + return this.fromBufferToUrlB64(arr.buffer as ArrayBuffer); + } + + static fromArrayToByteString(arr: Uint8Array | null): string | null { + if (arr == null) { + return null; + } + + return this.fromBufferToByteString(arr.buffer as ArrayBuffer); + } + + static fromArrayToUtf8(arr: Uint8Array | null): string | null { + if (arr == null) { + return null; + } + + return this.fromBufferToUtf8(arr.buffer as ArrayBuffer); + } + /** * Convert binary data into a Base64 string. * @@ -301,7 +340,7 @@ export class Utils { } static fromUtf8ToUrlB64(utfStr: string): string { - return Utils.fromBufferToUrlB64(Utils.fromUtf8ToArray(utfStr)); + return Utils.fromArrayToUrlB64(Utils.fromUtf8ToArray(utfStr)); } static fromB64ToUtf8(b64Str: string): string { diff --git a/libs/common/src/platform/models/domain/symmetric-crypto-key.ts b/libs/common/src/platform/models/domain/symmetric-crypto-key.ts index 1fdca04aceb..e97841ed011 100644 --- a/libs/common/src/platform/models/domain/symmetric-crypto-key.ts +++ b/libs/common/src/platform/models/domain/symmetric-crypto-key.ts @@ -83,7 +83,7 @@ export class SymmetricCryptoKey { * @returns The serialized key in base64 format */ toBase64(): string { - return Utils.fromBufferToB64(this.toEncoded()); + return Utils.fromArrayToB64(this.toEncoded()); } /** diff --git a/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts b/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts index 6d9457389ca..a4975388bc9 100644 --- a/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts +++ b/libs/common/src/platform/server-notifications/internal/worker-webpush-connection.service.spec.ts @@ -28,7 +28,7 @@ const mockUser1 = "testUser1" as UserId; const createSub = (key: string) => { return { - options: { applicationServerKey: Utils.fromUrlB64ToArray(key), userVisibleOnly: true }, + options: { applicationServerKey: Utils.fromUrlB64ToArray(key).buffer as ArrayBuffer, userVisibleOnly: true }, endpoint: `web.push.endpoint/?${Utils.newGuid()}`, expirationTime: 5, getKey: () => null, diff --git a/libs/common/src/platform/services/fido2/fido2-client.service.ts b/libs/common/src/platform/services/fido2/fido2-client.service.ts index 503ffef8241..43f66753a0f 100644 --- a/libs/common/src/platform/services/fido2/fido2-client.service.ts +++ b/libs/common/src/platform/services/fido2/fido2-client.service.ts @@ -181,7 +181,7 @@ export class Fido2ClientService< }; const clientDataJSON = JSON.stringify(collectedClientData); const clientDataJSONBytes = Utils.fromByteStringToArray(clientDataJSON); - const clientDataHash = await crypto.subtle.digest({ name: "SHA-256" }, clientDataJSONBytes); + const clientDataHash = await crypto.subtle.digest({ name: "SHA-256" }, clientDataJSONBytes.buffer as ArrayBuffer); const makeCredentialParams = mapToMakeCredentialParams({ params, credTypesAndPubKeyAlgs, diff --git a/libs/common/src/platform/services/fido2/guid-utils.spec.ts b/libs/common/src/platform/services/fido2/guid-utils.spec.ts index c58bd2720fa..d7794eade4f 100644 --- a/libs/common/src/platform/services/fido2/guid-utils.spec.ts +++ b/libs/common/src/platform/services/fido2/guid-utils.spec.ts @@ -43,7 +43,7 @@ describe("guid-utils", () => { it.each(workingExamples)( "returns UUID in standard format when given a valid UUID array buffer", (expected, input) => { - const result = guidToStandardFormat(input); + const result = guidToStandardFormat(input.buffer as ArrayBuffer); expect(result).toEqual(expected); }, diff --git a/libs/common/src/platform/services/file-upload/azure-file-upload.service.ts b/libs/common/src/platform/services/file-upload/azure-file-upload.service.ts index 02adcfee22e..016d6628510 100644 --- a/libs/common/src/platform/services/file-upload/azure-file-upload.service.ts +++ b/libs/common/src/platform/services/file-upload/azure-file-upload.service.ts @@ -31,6 +31,7 @@ export class AzureFileUploadService { }); const request = new Request(url, { + // @ts-ignore - ArrayBuffer compatibility issue with fetch in Node.js, safe at runtime body: data.buffer, cache: "no-store", method: "PUT", diff --git a/libs/common/src/platform/services/file-upload/bitwarden-file-upload.service.ts b/libs/common/src/platform/services/file-upload/bitwarden-file-upload.service.ts index 93594405302..fe79ecb1096 100644 --- a/libs/common/src/platform/services/file-upload/bitwarden-file-upload.service.ts +++ b/libs/common/src/platform/services/file-upload/bitwarden-file-upload.service.ts @@ -10,7 +10,7 @@ export class BitwardenFileUploadService { const fd = new FormData(); if (Utils.isBrowser) { - const blob = new Blob([encryptedFileData.buffer], { type: "application/octet-stream" }); + const blob = new Blob([Buffer.from(encryptedFileData.buffer)], { type: "application/octet-stream" }); fd.append("data", blob, encryptedFileName); } else if (Utils.isNode) { fd.append( diff --git a/libs/common/src/services/audit.service.ts b/libs/common/src/services/audit.service.ts index 7762c2cbd93..b6f33d78b8e 100644 --- a/libs/common/src/services/audit.service.ts +++ b/libs/common/src/services/audit.service.ts @@ -55,7 +55,7 @@ export class AuditService implements AuditServiceAbstraction { */ protected async fetchLeakedPasswordCount(password: string): Promise { const hashBytes = await this.cryptoFunctionService.hash(password, "sha1"); - const hash = Utils.fromBufferToHex(hashBytes).toUpperCase(); + const hash = Utils.fromArrayToHex(hashBytes).toUpperCase(); const hashStart = hash.substr(0, 5); const hashEnding = hash.substr(5); diff --git a/libs/common/src/tools/password-strength/password-strength.service.ts b/libs/common/src/tools/password-strength/password-strength.service.ts index 77854943acd..3d9df6dd1ab 100644 --- a/libs/common/src/tools/password-strength/password-strength.service.ts +++ b/libs/common/src/tools/password-strength/password-strength.service.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import * as zxcvbn from "zxcvbn"; +import zxcvbn from "zxcvbn"; import { PasswordStrengthServiceAbstraction } from "./password-strength.service.abstraction"; diff --git a/libs/common/src/tools/send/models/view/send.view.ts b/libs/common/src/tools/send/models/view/send.view.ts index 54657b12438..31e2a777974 100644 --- a/libs/common/src/tools/send/models/view/send.view.ts +++ b/libs/common/src/tools/send/models/view/send.view.ts @@ -49,7 +49,7 @@ export class SendView implements View { } get urlB64Key(): string { - return Utils.fromBufferToUrlB64(this.key); + return Utils.fromArrayToUrlB64(this.key); } get maxAccessCountReached(): boolean { @@ -74,7 +74,7 @@ export class SendView implements View { return Utils.merge( { ...this }, { - key: Utils.fromBufferToB64(this.key), + key: Utils.fromArrayToB64(this.key), }, ); } diff --git a/libs/common/src/vault/abstractions/cipher.service.ts b/libs/common/src/vault/abstractions/cipher.service.ts index 0d3a0b99fcb..266e16f3f5b 100644 --- a/libs/common/src/vault/abstractions/cipher.service.ts +++ b/libs/common/src/vault/abstractions/cipher.service.ts @@ -157,7 +157,7 @@ export abstract class CipherService implements UserKeyRotationDataProvider; diff --git a/libs/common/src/vault/services/cipher.service.ts b/libs/common/src/vault/services/cipher.service.ts index d25aa62ea3a..99fff2365a7 100644 --- a/libs/common/src/vault/services/cipher.service.ts +++ b/libs/common/src/vault/services/cipher.service.ts @@ -1803,7 +1803,7 @@ export class CipherService implements CipherServiceAbstraction { const fd = new FormData(); try { - const blob = new Blob([encData.buffer], { type: "application/octet-stream" }); + const blob = new Blob([Buffer.from(encData.buffer)], { type: "application/octet-stream" }); fd.append("key", dataEncKey[1].encryptedString); fd.append("data", blob, encFileName.encryptedString); fd.append("lastKnownRevisionDate", lastKnownRevisionDate.toISOString()); diff --git a/libs/dirt/card/package.json b/libs/dirt/card/package.json index d6fc1841888..6d8d8313df0 100644 --- a/libs/dirt/card/package.json +++ b/libs/dirt/card/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest --passWithNoTests" } diff --git a/libs/importer/package.json b/libs/importer/package.json index 2c85c78cb66..753a9f30bbb 100644 --- a/libs/importer/package.json +++ b/libs/importer/package.json @@ -15,7 +15,7 @@ "scripts": { "test": "jest", "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" } } diff --git a/libs/importer/src/components/import.component.ts b/libs/importer/src/components/import.component.ts index 0ff62b00e78..2516a9e8213 100644 --- a/libs/importer/src/components/import.component.ts +++ b/libs/importer/src/components/import.component.ts @@ -16,7 +16,7 @@ import { } from "@angular/core"; import { takeUntilDestroyed } from "@angular/core/rxjs-interop"; import { FormBuilder, ReactiveFormsModule, Validators } from "@angular/forms"; -import * as JSZip from "jszip"; +import JSZip from "jszip"; import { Observable, Subject, diff --git a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts index 24523214dda..4069f36d3c8 100644 --- a/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts +++ b/libs/importer/src/components/lastpass/lastpass-direct-import.service.ts @@ -204,6 +204,6 @@ export class LastPassDirectImportService { const appId = await this.appIdService.getAppId(); const id = "lastpass" + appId + email; const idHash = await this.cryptoFunctionService.hash(id, "sha256"); - return ClientInfo.createClientInfo(Utils.fromBufferToHex(idHash)); + return ClientInfo.createClientInfo(Utils.fromArrayToHex(idHash)); } } diff --git a/libs/importer/src/importers/lastpass/access/services/client.ts b/libs/importer/src/importers/lastpass/access/services/client.ts index b0f119fb8e0..43cd6ef2873 100644 --- a/libs/importer/src/importers/lastpass/access/services/client.ts +++ b/libs/importer/src/importers/lastpass/access/services/client.ts @@ -111,7 +111,7 @@ export class Client { private isComplete(chunks: Chunk[]): boolean { if (chunks.length > 0 && chunks[chunks.length - 1].id === "ENDM") { - const okChunk = Utils.fromBufferToUtf8(chunks[chunks.length - 1].payload); + const okChunk = Utils.fromArrayToUtf8(chunks[chunks.length - 1].payload); return okChunk === "OK"; } return false; @@ -523,7 +523,7 @@ export class Client { ["method", PlatformToUserAgent.get(clientInfo.platform)], ["xml", "2"], ["username", username], - ["hash", Utils.fromBufferToHex(hash.buffer)], + ["hash", Utils.fromArrayToHex(hash)], ["iterations", keyIterationCount], ["includeprivatekeyenc", "1"], ["outofbandsupported", "1"], diff --git a/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts b/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts index 168d76e2c70..30deef51545 100644 --- a/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts +++ b/libs/importer/src/importers/lastpass/access/services/crypto-utils.ts @@ -18,7 +18,7 @@ export class CryptoUtils { const key = await this.deriveKey(username, password, iterationCount); if (iterationCount == 1) { return await this.cryptoFunctionService.hash( - Utils.fromBufferToHex(key.buffer) + password, + Utils.fromArrayToHex(key) + password, "sha256", ); } @@ -92,7 +92,7 @@ export class CryptoUtils { return ""; } const plain = await this.cryptoFunctionService.aesDecrypt(data, iv, encryptionKey, mode); - return Utils.fromBufferToUtf8(plain); + return Utils.fromArrayToUtf8(plain); } private async decryptAes256EcbPlain(data: Uint8Array, encryptionKey: Uint8Array) { @@ -100,7 +100,7 @@ export class CryptoUtils { } private async decryptAes256EcbBase64(data: Uint8Array, encryptionKey: Uint8Array) { - const d = Utils.fromB64ToArray(Utils.fromBufferToUtf8(data)); + const d = Utils.fromB64ToArray(Utils.fromArrayToUtf8(data)); return this.decryptAes256(d, encryptionKey, "ecb"); } @@ -111,8 +111,8 @@ export class CryptoUtils { } private async decryptAes256CbcBase64(data: Uint8Array, encryptionKey: Uint8Array) { - const d = Utils.fromB64ToArray(Utils.fromBufferToUtf8(data.subarray(26))); - const iv = Utils.fromB64ToArray(Utils.fromBufferToUtf8(data.subarray(1, 25))); + const d = Utils.fromB64ToArray(Utils.fromArrayToUtf8(data.subarray(26))); + const iv = Utils.fromB64ToArray(Utils.fromArrayToUtf8(data.subarray(1, 25))); return this.decryptAes256(d, encryptionKey, "cbc", iv); } } diff --git a/libs/importer/src/importers/lastpass/access/services/parser.ts b/libs/importer/src/importers/lastpass/access/services/parser.ts index 427ae3441c1..3f229486148 100644 --- a/libs/importer/src/importers/lastpass/access/services/parser.ts +++ b/libs/importer/src/importers/lastpass/access/services/parser.ts @@ -42,7 +42,7 @@ export class Parser { // Read all items // 0: id - id = Utils.fromBufferToUtf8(this.readItem(reader)); + id = Utils.fromArrayToUtf8(this.readItem(reader)); // 1: name step = 1; @@ -72,7 +72,7 @@ export class Parser { placeholder, ) : // URL is not encrypted - Utils.fromBufferToUtf8(this.decodeHexLoose(Utils.fromBufferToUtf8(urlEncoded))); + Utils.fromArrayToUtf8(this.decodeHexLoose(Utils.fromArrayToUtf8(urlEncoded))); // Ignore "group" accounts. They have no credentials. if (url == "http://group") { @@ -89,7 +89,7 @@ export class Parser { // 5: fav (is favorite) step = 5; - const isFavorite = Utils.fromBufferToUtf8(this.readItem(reader)) === "1"; + const isFavorite = Utils.fromArrayToUtf8(this.readItem(reader)) === "1"; // 6: sharedfromaid (?) this.skipItem(reader); @@ -118,7 +118,7 @@ export class Parser { // 11: sn (is secure note) step = 11; - const isSecureNote = Utils.fromBufferToUtf8(this.readItem(reader)) === "1"; + const isSecureNote = Utils.fromArrayToUtf8(this.readItem(reader)) === "1"; // Parse secure note if (options.parseSecureNotesToAccount && isSecureNote) { @@ -284,17 +284,17 @@ export class Parser { const reader = new BinaryReader(chunk.payload); // Id - id = Utils.fromBufferToUtf8(this.readItem(reader)); + id = Utils.fromArrayToUtf8(this.readItem(reader)); // Key const folderKey = this.readItem(reader); - const rsaEncryptedFolderKey = Utils.fromHexToArray(Utils.fromBufferToUtf8(folderKey)); + const rsaEncryptedFolderKey = Utils.fromHexToArray(Utils.fromArrayToUtf8(folderKey)); const decFolderKey = await this.cryptoFunctionService.rsaDecrypt( rsaEncryptedFolderKey, rsaKey, "sha1", ); - const key = Utils.fromHexToArray(Utils.fromBufferToUtf8(decFolderKey)); + const key = Utils.fromHexToArray(Utils.fromArrayToUtf8(decFolderKey)); // Name const encryptedName = this.readItem(reader); @@ -384,7 +384,7 @@ export class Parser { } private readId(reader: BinaryReader): string { - return Utils.fromBufferToUtf8(reader.readBytes(4)); + return Utils.fromArrayToUtf8(reader.readBytes(4)); } private readSize(reader: BinaryReader): number { diff --git a/libs/importer/src/importers/lastpass/access/vault.ts b/libs/importer/src/importers/lastpass/access/vault.ts index cc54b3f2620..257f148eda9 100644 --- a/libs/importer/src/importers/lastpass/access/vault.ts +++ b/libs/importer/src/importers/lastpass/access/vault.ts @@ -64,7 +64,7 @@ export class Vault { this.cryptoUtils.ExclusiveOr(k1, k2), "sha256", ); - const hiddenPassword = Utils.fromBufferToB64(hiddenPasswordArr); + const hiddenPassword = Utils.fromArrayToB64(hiddenPasswordArr); this.accounts = await this.client.openVault( federatedUser.username, hiddenPassword, diff --git a/libs/key-management-ui/package.json b/libs/key-management-ui/package.json index 9a05bf07c63..1ea2f8a326e 100644 --- a/libs/key-management-ui/package.json +++ b/libs/key-management-ui/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/key-management/package.json b/libs/key-management/package.json index 6751163e6e8..9d2922e3add 100644 --- a/libs/key-management/package.json +++ b/libs/key-management/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/key-management/src/key.service.spec.ts b/libs/key-management/src/key.service.spec.ts index c0af62fe6e9..b234c7459af 100644 --- a/libs/key-management/src/key.service.spec.ts +++ b/libs/key-management/src/key.service.spec.ts @@ -1421,13 +1421,13 @@ describe("keyService", () => { const mockPrivateKeyEncString = makeEncString("encryptedPrivateKey"); cryptoFunctionService.rsaGenerateKeyPair.mockResolvedValue(mockKeyPair); - jest.spyOn(Utils, "fromBufferToB64").mockReturnValue(mockPublicKeyB64); + jest.spyOn(Utils, "fromArrayToB64").mockReturnValue(mockPublicKeyB64); encryptService.wrapDecapsulationKey.mockResolvedValue(mockPrivateKeyEncString); const [publicKey, privateKey] = await keyService.makeKeyPair(mockKey); expect(cryptoFunctionService.rsaGenerateKeyPair).toHaveBeenCalledWith(2048); - expect(Utils.fromBufferToB64).toHaveBeenCalledWith(mockKeyPair[0]); + expect(Utils.fromArrayToB64).toHaveBeenCalledWith(mockKeyPair[0]); expect(encryptService.wrapDecapsulationKey).toHaveBeenCalledWith(mockKeyPair[1], mockKey); expect(publicKey).toBe(mockPublicKeyB64); expect(privateKey).toBe(mockPrivateKeyEncString); diff --git a/libs/key-management/src/key.service.ts b/libs/key-management/src/key.service.ts index 621a8135d1e..004e63cecfd 100644 --- a/libs/key-management/src/key.service.ts +++ b/libs/key-management/src/key.service.ts @@ -337,7 +337,7 @@ export class DefaultKeyService implements KeyServiceAbstraction { "sha256", iterations, ); - return Utils.fromBufferToB64(hash); + return Utils.fromArrayToB64(hash); } async compareKeyHash( @@ -510,7 +510,7 @@ export class DefaultKeyService implements KeyServiceAbstraction { } const keyPair = await this.cryptoFunctionService.rsaGenerateKeyPair(2048); - const publicB64 = Utils.fromBufferToB64(keyPair[0]); + const publicB64 = Utils.fromArrayToB64(keyPair[0]); const privateEnc = await this.encryptService.wrapDecapsulationKey(keyPair[1], key); return [publicB64, privateEnc]; } diff --git a/libs/node/package.json b/libs/node/package.json index 6a375a2a5ad..0923585a436 100644 --- a/libs/node/package.json +++ b/libs/node/package.json @@ -15,7 +15,7 @@ "scripts": { "test": "jest", "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" } } diff --git a/libs/node/src/node-utils.ts b/libs/node/src/node-utils.ts index 2ba0bef8494..067ba37601f 100644 --- a/libs/node/src/node-utils.ts +++ b/libs/node/src/node-utils.ts @@ -31,6 +31,7 @@ export class NodeUtils { // https://stackoverflow.com/a/31394257 static bufferToArrayBuffer(buf: Buffer): ArrayBuffer { - return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength); + // @ts-ignore - Buffer is a subclass of Uint8Array, safe at runtime + return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.byteLength) as ArrayBuffer; } } diff --git a/libs/node/src/services/node-crypto-function.service.spec.ts b/libs/node/src/services/node-crypto-function.service.spec.ts deleted file mode 100644 index 28a6c127d44..00000000000 --- a/libs/node/src/services/node-crypto-function.service.spec.ts +++ /dev/null @@ -1,548 +0,0 @@ -import { SdkLoadService } from "@bitwarden/common/platform/abstractions/sdk/sdk-load.service"; -import { Utils } from "@bitwarden/common/platform/misc/utils"; -import { EcbDecryptParameters } from "@bitwarden/common/platform/models/domain/decrypt-parameters"; -import { SymmetricCryptoKey } from "@bitwarden/common/platform/models/domain/symmetric-crypto-key"; - -import { NodeCryptoFunctionService } from "./node-crypto-function.service"; - -class TestSdkLoadService extends SdkLoadService { - protected override load(): Promise { - // Simulate successful WASM load - return Promise.resolve(); - } -} - -const RsaPublicKey = - "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAl0Vawl/toXzkEvB82FEtqHP" + - "4xlU2ab/v0crqIfXfIoWF/XXdHGIdrZeilnRXPPJT1B9dTsasttEZNnua/0Rek/cjNDHtzT52irfoZYS7X6HNIfOi54Q+egP" + - "RQ1H7iNHVZz3K8Db9GCSKPeC8MbW6gVCzb15esCe1gGzg6wkMuWYDFYPoh/oBqcIqrGah7firqB1nDedzEjw32heP2DAffVN" + - "084iTDjiWrJNUxBJ2pDD5Z9dT3MzQ2s09ew1yMWK2z37rT3YerC7OgEDmo3WYo3xL3qYJznu3EO2nmrYjiRa40wKSjxsTlUc" + - "xDF+F0uMW8oR9EMUHgepdepfAtLsSAQIDAQAB"; -const RsaPrivateKey = - "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCXRVrCX+2hfOQS8Hz" + - "YUS2oc/jGVTZpv+/Ryuoh9d8ihYX9dd0cYh2tl6KWdFc88lPUH11Oxqy20Rk2e5r/RF6T9yM0Me3NPnaKt+hlhLtfoc0h86L" + - "nhD56A9FDUfuI0dVnPcrwNv0YJIo94LwxtbqBULNvXl6wJ7WAbODrCQy5ZgMVg+iH+gGpwiqsZqHt+KuoHWcN53MSPDfaF4/" + - "YMB99U3TziJMOOJask1TEEnakMPln11PczNDazT17DXIxYrbPfutPdh6sLs6AQOajdZijfEvepgnOe7cQ7aeatiOJFrjTApK" + - "PGxOVRzEMX4XS4xbyhH0QxQeB6l16l8C0uxIBAgMBAAECggEASaWfeVDA3cVzOPFSpvJm20OTE+R6uGOU+7vh36TX/POq92q" + - "Buwbd0h0oMD32FxsXywd2IxtBDUSiFM9699qufTVuM0Q3tZw6lHDTOVG08+tPdr8qSbMtw7PGFxN79fHLBxejjO4IrM9lapj" + - "WpxEF+11x7r+wM+0xRZQ8sNFYG46aPfIaty4BGbL0I2DQ2y8I57iBCAy69eht59NLMm27fRWGJIWCuBIjlpfzET1j2HLXUIh" + - "5bTBNzqaN039WH49HczGE3mQKVEJZc/efk3HaVd0a1Sjzyn0QY+N1jtZN3jTRbuDWA1AknkX1LX/0tUhuS3/7C3ejHxjw4Dk" + - "1ZLo5/QKBgQDIWvqFn0+IKRSu6Ua2hDsufIHHUNLelbfLUMmFthxabcUn4zlvIscJO00Tq/ezopSRRvbGiqnxjv/mYxucvOU" + - "BeZtlus0Q9RTACBtw9TGoNTmQbEunJ2FOSlqbQxkBBAjgGEppRPt30iGj/VjAhCATq2MYOa/X4dVR51BqQAFIEwKBgQDBSIf" + - "TFKC/hDk6FKZlgwvupWYJyU9RkyfstPErZFmzoKhPkQ3YORo2oeAYmVUbS9I2iIYpYpYQJHX8jMuCbCz4ONxTCuSIXYQYUcU" + - "q4PglCKp31xBAE6TN8SvhfME9/MvuDssnQinAHuF0GDAhF646T3LLS1not6Vszv7brwSoGwKBgQC88v/8cGfi80ssQZeMnVv" + - "q1UTXIeQcQnoY5lGHJl3K8mbS3TnXE6c9j417Fdz+rj8KWzBzwWXQB5pSPflWcdZO886Xu/mVGmy9RWgLuVFhXwCwsVEPjNX" + - "5ramRb0/vY0yzenUCninBsIxFSbIfrPtLUYCc4hpxr+sr2Mg/y6jpvQKBgBezMRRs3xkcuXepuI2R+BCXL1/b02IJTUf1F+1" + - "eLLGd7YV0H+J3fgNc7gGWK51hOrF9JBZHBGeOUPlaukmPwiPdtQZpu4QNE3l37VlIpKTF30E6mb+BqR+nht3rUjarnMXgAoE" + - "Z18y6/KIjpSMpqC92Nnk/EBM9EYe6Cf4eA9ApAoGAeqEUg46UTlJySkBKURGpIs3v1kkf5I0X8DnOhwb+HPxNaiEdmO7ckm8" + - "+tPVgppLcG0+tMdLjigFQiDUQk2y3WjyxP5ZvXu7U96jaJRI8PFMoE06WeVYcdIzrID2HvqH+w0UQJFrLJ/0Mn4stFAEzXKZ" + - "BokBGnjFnTnKcs7nv/O8="; - -const Sha1Mac = "4d4c223f95dc577b665ec4ccbcb680b80a397038"; -const Sha256Mac = "6be3caa84922e12aaaaa2f16c40d44433bb081ef323db584eb616333ab4e874f"; -const Sha512Mac = - "21910e341fa12106ca35758a2285374509326c9fbe0bd64e7b99c898f841dc948c58ce66d3504d8883c" + - "5ea7817a0b7c5d4d9b00364ccd214669131fc17fe4aca"; - -describe("NodeCrypto Function Service", () => { - beforeAll(async () => { - await new TestSdkLoadService().loadAndInit(); - }); - - describe("pbkdf2", () => { - const regular256Key = "pj9prw/OHPleXI6bRdmlaD+saJS4awrMiQsQiDjeu2I="; - const utf8256Key = "yqvoFXgMRmHR3QPYr5pyR4uVuoHkltv9aHUP63p8n7I="; - const unicode256Key = "ZdeOata6xoRpB4DLp8zHhXz5kLmkWtX5pd+TdRH8w8w="; - - const regular512Key = - "liTi/Ke8LPU1Qv+Vl7NGEVt/XMbsBVJ2kQxtVG/Z1/JFHFKQW3ZkI81qVlwTiCpb+cFXzs+57" + - "eyhhx5wfKo5Cg=="; - const utf8512Key = - "df0KdvIBeCzD/kyXptwQohaqUa4e7IyFUyhFQjXCANu5T+scq55hCcE4dG4T/MhAk2exw8j7ixRN" + - "zXANiVZpnw=="; - const unicode512Key = - "FE+AnUJaxv8jh+zUDtZz4mjjcYk0/PZDZm+SLJe3XtxtnpdqqpblX6JjuMZt/dYYNMOrb2+mD" + - "L3FiQDTROh1lg=="; - - testPbkdf2("sha256", regular256Key, utf8256Key, unicode256Key); - testPbkdf2("sha512", regular512Key, utf8512Key, unicode512Key); - }); - - describe("hkdf", () => { - const regular256Key = "qBUmEYtwTwwGPuw/z6bs/qYXXYNUlocFlyAuuANI8Pw="; - const utf8256Key = "6DfJwW1R3txgiZKkIFTvVAb7qVlG7lKcmJGJoxR2GBU="; - const unicode256Key = "gejGI82xthA+nKtKmIh82kjw+ttHr+ODsUoGdu5sf0A="; - - const regular512Key = "xe5cIG6ZfwGmb1FvsOedM0XKOm21myZkjL/eDeKIqqM="; - const utf8512Key = "XQMVBnxVEhlvjSFDQc77j5GDE9aorvbS0vKnjhRg0LY="; - const unicode512Key = "148GImrTbrjaGAe/iWEpclINM8Ehhko+9lB14+52lqc="; - - testHkdf("sha256", regular256Key, utf8256Key, unicode256Key); - testHkdf("sha512", regular512Key, utf8512Key, unicode512Key); - }); - - describe("hkdfExpand", () => { - const prk16Byte = "criAmKtfzxanbgea5/kelQ=="; - const prk32Byte = "F5h4KdYQnIVH4rKH0P9CZb1GrR4n16/sJrS0PsQEn0Y="; - const prk64Byte = - "ssBK0mRG17VHdtsgt8yo4v25CRNpauH+0r2fwY/E9rLyaFBAOMbIeTry+" + - "gUJ28p8y+hFh3EI9pcrEWaNvFYonQ=="; - - testHkdfExpand("sha256", prk32Byte, 32, "BnIqJlfnHm0e/2iB/15cbHyR19ARPIcWRp4oNS22CD8="); - testHkdfExpand( - "sha256", - prk32Byte, - 64, - "BnIqJlfnHm0e/2iB/15cbHyR19ARPIcWRp4oNS22CD9BV+" + - "/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA==", - ); - testHkdfExpand("sha512", prk64Byte, 32, "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlk="); - testHkdfExpand( - "sha512", - prk64Byte, - 64, - "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlkY5Pv0sB+" + - "MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w==", - ); - - it("should fail with prk too small", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const f = cryptoFunctionService.hkdfExpand( - Utils.fromB64ToArray(prk16Byte), - "info", - 32, - "sha256", - ); - await expect(f).rejects.toEqual(new Error("prk is too small.")); - }); - - it("should fail with outputByteSize is too large", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const f = cryptoFunctionService.hkdfExpand( - Utils.fromB64ToArray(prk32Byte), - "info", - 8161, - "sha256", - ); - await expect(f).rejects.toEqual(new Error("outputByteSize is too large.")); - }); - }); - - describe("hash", () => { - const regular1Hash = "2a241604fb921fad12bf877282457268e1dccb70"; - const utf81Hash = "85672798dc5831e96d6c48655d3d39365a9c88b6"; - const unicode1Hash = "39c975935054a3efc805a9709b60763a823a6ad4"; - - const regular256Hash = "2b8e96031d352a8655d733d7a930b5ffbea69dc25cf65c7bca7dd946278908b2"; - const utf8256Hash = "25fe8440f5b01ed113b0a0e38e721b126d2f3f77a67518c4a04fcde4e33eeb9d"; - const unicode256Hash = "adc1c0c2afd6e92cefdf703f9b6eb2c38e0d6d1a040c83f8505c561fea58852e"; - - const regular512Hash = - "c15cf11d43bde333647e3f559ec4193bb2edeaa0e8b902772f514cdf3f785a3f49a6e02a4b87b3" + - "b47523271ad45b7e0aebb5cdcc1bc54815d256eb5dcb80da9d"; - const utf8512Hash = - "035c31a877a291af09ed2d3a1a293e69c3e079ea2cecc00211f35e6bce10474ca3ad6e30b59e26118" + - "37463f20969c5bc95282965a051a88f8cdf2e166549fcdd"; - const unicode512Hash = - "2b16a5561af8ad6fe414cc103fc8036492e1fc6d9aabe1b655497054f760fe0e34c5d100ac773d" + - "9f3030438284f22dbfa20cb2e9b019f2c98dfe38ce1ef41bae"; - - const regularMd5 = "5eceffa53a5fd58c44134211e2c5f522"; - const utf8Md5 = "3abc9433c09551b939c80aa0aa3174e1"; - const unicodeMd5 = "85ae134072c8d81257933f7045ba17ca"; - - testHash("sha1", regular1Hash, utf81Hash, unicode1Hash); - testHash("sha256", regular256Hash, utf8256Hash, unicode256Hash); - testHash("sha512", regular512Hash, utf8512Hash, unicode512Hash); - testHash("md5", regularMd5, utf8Md5, unicodeMd5); - }); - - describe("hmac", () => { - testHmac("sha1", Sha1Mac); - testHmac("sha256", Sha256Mac); - testHmac("sha512", Sha512Mac); - }); - - describe("compare", () => { - testCompare(false); - }); - - describe("hmacFast", () => { - testHmac("sha1", Sha1Mac, true); - testHmac("sha256", Sha256Mac, true); - testHmac("sha512", Sha512Mac, true); - }); - - describe("compareFast", () => { - testCompare(true); - }); - - describe("aesEncrypt CBC mode", () => { - it("should successfully encrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const iv = makeStaticByteArray(16); - const key = makeStaticByteArray(32); - const data = Utils.fromUtf8ToArray("EncryptMe!"); - const encValue = await nodeCryptoFunctionService.aesEncrypt(data, iv, key); - expect(Utils.fromBufferToB64(encValue)).toBe("ByUF8vhyX4ddU9gcooznwA=="); - }); - - it("should successfully encrypt and then decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const iv = makeStaticByteArray(16); - const key = makeStaticByteArray(32); - const value = "EncryptMe!"; - const data = Utils.fromUtf8ToArray(value); - const encValue = await nodeCryptoFunctionService.aesEncrypt(data, iv, key); - const decValue = await nodeCryptoFunctionService.aesDecrypt(encValue, iv, key, "cbc"); - expect(Utils.fromBufferToUtf8(decValue)).toBe(value); - }); - }); - - describe("aesDecryptFast CBC mode", () => { - it("should successfully decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const iv = Utils.fromBufferToB64(makeStaticByteArray(16)); - const symKey = new SymmetricCryptoKey(makeStaticByteArray(32)); - const data = "ByUF8vhyX4ddU9gcooznwA=="; - const parameters = nodeCryptoFunctionService.aesDecryptFastParameters(data, iv, null, symKey); - const decValue = await nodeCryptoFunctionService.aesDecryptFast({ mode: "cbc", parameters }); - expect(decValue).toBe("EncryptMe!"); - }); - }); - - describe("aesDecryptFast ECB mode", () => { - it("should successfully decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const parameters: EcbDecryptParameters = { - encKey: makeStaticByteArray(32), - data: Utils.fromB64ToArray("z5q2XSxYCdQFdI+qK2yLlw=="), - }; - const decValue = await nodeCryptoFunctionService.aesDecryptFast({ mode: "ecb", parameters }); - expect(decValue).toBe("EncryptMe!"); - }); - }); - - describe("aesDecrypt CBC mode", () => { - it("should successfully decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const iv = makeStaticByteArray(16); - const key = makeStaticByteArray(32); - const data = Utils.fromB64ToArray("ByUF8vhyX4ddU9gcooznwA=="); - const decValue = await nodeCryptoFunctionService.aesDecrypt(data, iv, key, "cbc"); - expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!"); - }); - - it("throws if IV is not provided", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const key = makeStaticByteArray(32); - const data = Utils.fromB64ToArray("ByUF8vhyX4ddU9gcooznwA=="); - await expect( - async () => await nodeCryptoFunctionService.aesDecrypt(data, null, key, "cbc"), - ).rejects.toThrow("Invalid initialization vector"); - }); - }); - - describe("aesDecrypt ECB mode", () => { - it("should successfully decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const key = makeStaticByteArray(32); - const data = Utils.fromB64ToArray("z5q2XSxYCdQFdI+qK2yLlw=="); - const decValue = await nodeCryptoFunctionService.aesDecrypt(data, null, key, "ecb"); - expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!"); - }); - }); - - describe("rsaEncrypt", () => { - it("should successfully encrypt and then decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const pubKey = Utils.fromB64ToArray(RsaPublicKey); - const privKey = Utils.fromB64ToArray(RsaPrivateKey); - const value = "EncryptMe!"; - const data = Utils.fromUtf8ToArray(value); - const encValue = await nodeCryptoFunctionService.rsaEncrypt(data, pubKey, "sha1"); - const decValue = await nodeCryptoFunctionService.rsaDecrypt(encValue, privKey, "sha1"); - expect(Utils.fromBufferToUtf8(decValue)).toBe(value); - }); - }); - - describe("rsaDecrypt", () => { - it("should successfully decrypt data", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const privKey = Utils.fromB64ToArray(RsaPrivateKey); - const data = Utils.fromB64ToArray( - "A1/p8BQzN9UrbdYxUY2Va5+kPLyfZXF9JsZrjeEXcaclsnHurdxVAJcnbEqYMP3UXV" + - "4YAS/mpf+Rxe6/X0WS1boQdA0MAHSgx95hIlAraZYpiMLLiJRKeo2u8YivCdTM9V5vuAEJwf9Tof/qFsFci3sApdbATkorCT" + - "zFOIEPF2S1zgperEP23M01mr4dWVdYN18B32YF67xdJHMbFhp5dkQwv9CmscoWq7OE5HIfOb+JAh7BEZb+CmKhM3yWJvoR/D" + - "/5jcercUtK2o+XrzNrL4UQ7yLZcFz6Bfwb/j6ICYvqd/YJwXNE6dwlL57OfwJyCdw2rRYf0/qI00t9u8Iitw==", - ); - const decValue = await nodeCryptoFunctionService.rsaDecrypt(data, privKey, "sha1"); - expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!"); - }); - }); - - describe("rsaExtractPublicKey", () => { - it("should successfully extract key", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const privKey = Utils.fromB64ToArray(RsaPrivateKey); - const publicKey = await nodeCryptoFunctionService.rsaExtractPublicKey(privKey); - expect(Utils.fromBufferToB64(publicKey)).toBe(RsaPublicKey); - }); - }); - - describe("rsaGenerateKeyPair", () => { - testRsaGenerateKeyPair(2048); - - // Generating 4096 bit keys is really slow with Forge lib. - // Maybe move to something else if we ever want to generate keys of this size. - // testRsaGenerateKeyPair(4096); - }); - - describe("randomBytes", () => { - it("should make a value of the correct length", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const randomData = await nodeCryptoFunctionService.randomBytes(16); - expect(randomData.byteLength).toBe(16); - }); - - it("should not make the same value twice", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const randomData = await nodeCryptoFunctionService.randomBytes(16); - const randomData2 = await nodeCryptoFunctionService.randomBytes(16); - expect( - randomData.byteLength === randomData2.byteLength && randomData !== randomData2, - ).toBeTruthy(); - }); - }); - - describe("aesGenerateKey", () => { - it("should delegate to randomBytes", async () => { - const nodeCryptoFunctionService = new NodeCryptoFunctionService(); - const spy = jest.spyOn(nodeCryptoFunctionService, "randomBytes"); - await nodeCryptoFunctionService.aesGenerateKey(256); - expect(spy).toHaveBeenCalledWith(32); - }); - }); -}); - -function testPbkdf2( - algorithm: "sha256" | "sha512", - regularKey: string, - utf8Key: string, - unicodeKey: string, -) { - const regularEmail = "user@example.com"; - const utf8Email = "üser@example.com"; - - const regularPassword = "password"; - const utf8Password = "pǻssword"; - const unicodePassword = "😀password🙏"; - - it("should create valid " + algorithm + " key from regular input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.pbkdf2(regularPassword, regularEmail, algorithm, 5000); - expect(Utils.fromBufferToB64(key)).toBe(regularKey); - }); - - it("should create valid " + algorithm + " key from utf8 input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.pbkdf2(utf8Password, utf8Email, algorithm, 5000); - expect(Utils.fromBufferToB64(key)).toBe(utf8Key); - }); - - it("should create valid " + algorithm + " key from unicode input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.pbkdf2(unicodePassword, regularEmail, algorithm, 5000); - expect(Utils.fromBufferToB64(key)).toBe(unicodeKey); - }); - - it("should create valid " + algorithm + " key from array buffer input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.pbkdf2( - Utils.fromUtf8ToArray(regularPassword), - Utils.fromUtf8ToArray(regularEmail), - algorithm, - 5000, - ); - expect(Utils.fromBufferToB64(key)).toBe(regularKey); - }); -} - -function testHkdf( - algorithm: "sha256" | "sha512", - regularKey: string, - utf8Key: string, - unicodeKey: string, -) { - const ikm = Utils.fromB64ToArray("criAmKtfzxanbgea5/kelQ=="); - - const regularSalt = "salt"; - const utf8Salt = "üser_salt"; - const unicodeSalt = "😀salt🙏"; - - const regularInfo = "info"; - const utf8Info = "üser_info"; - const unicodeInfo = "😀info🙏"; - - it("should create valid " + algorithm + " key from regular input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.hkdf(ikm, regularSalt, regularInfo, 32, algorithm); - expect(Utils.fromBufferToB64(key)).toBe(regularKey); - }); - - it("should create valid " + algorithm + " key from utf8 input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.hkdf(ikm, utf8Salt, utf8Info, 32, algorithm); - expect(Utils.fromBufferToB64(key)).toBe(utf8Key); - }); - - it("should create valid " + algorithm + " key from unicode input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.hkdf(ikm, unicodeSalt, unicodeInfo, 32, algorithm); - expect(Utils.fromBufferToB64(key)).toBe(unicodeKey); - }); - - it("should create valid " + algorithm + " key from array buffer input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const key = await cryptoFunctionService.hkdf( - ikm, - Utils.fromUtf8ToArray(regularSalt), - Utils.fromUtf8ToArray(regularInfo), - 32, - algorithm, - ); - expect(Utils.fromBufferToB64(key)).toBe(regularKey); - }); -} - -function testHkdfExpand( - algorithm: "sha256" | "sha512", - b64prk: string, - outputByteSize: number, - b64ExpectedOkm: string, -) { - const info = "info"; - - it("should create valid " + algorithm + " " + outputByteSize + " byte okm", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const okm = await cryptoFunctionService.hkdfExpand( - Utils.fromB64ToArray(b64prk), - info, - outputByteSize, - algorithm, - ); - expect(Utils.fromBufferToB64(okm)).toBe(b64ExpectedOkm); - }); -} - -function testHash( - algorithm: "sha1" | "sha256" | "sha512" | "md5", - regularHash: string, - utf8Hash: string, - unicodeHash: string, -) { - const regularValue = "HashMe!!"; - const utf8Value = "HǻshMe!!"; - const unicodeValue = "😀HashMe!!!🙏"; - - it("should create valid " + algorithm + " hash from regular input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const hash = await cryptoFunctionService.hash(regularValue, algorithm); - expect(Utils.fromBufferToHex(hash)).toBe(regularHash); - }); - - it("should create valid " + algorithm + " hash from utf8 input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const hash = await cryptoFunctionService.hash(utf8Value, algorithm); - expect(Utils.fromBufferToHex(hash)).toBe(utf8Hash); - }); - - it("should create valid " + algorithm + " hash from unicode input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const hash = await cryptoFunctionService.hash(unicodeValue, algorithm); - expect(Utils.fromBufferToHex(hash)).toBe(unicodeHash); - }); - - it("should create valid " + algorithm + " hash from array buffer input", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const hash = await cryptoFunctionService.hash(Utils.fromUtf8ToArray(regularValue), algorithm); - expect(Utils.fromBufferToHex(hash)).toBe(regularHash); - }); -} - -function testHmac(algorithm: "sha1" | "sha256" | "sha512", mac: string, fast = false) { - it("should create valid " + algorithm + " hmac", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const value = Utils.fromUtf8ToArray("SignMe!!"); - const key = Utils.fromUtf8ToArray("secretkey"); - let computedMac: ArrayBuffer; - if (fast) { - computedMac = await cryptoFunctionService.hmacFast(value, key, algorithm); - } else { - computedMac = await cryptoFunctionService.hmac(value, key, algorithm); - } - expect(Utils.fromBufferToHex(computedMac)).toBe(mac); - }); -} - -function testCompare(fast = false) { - it("should successfully compare two of the same values", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const a = new Uint8Array(2); - a[0] = 1; - a[1] = 2; - const equal = fast - ? await cryptoFunctionService.compareFast(a, a) - : await cryptoFunctionService.compare(a, a); - expect(equal).toBe(true); - }); - - it("should successfully compare two different values of the same length", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const a = new Uint8Array(2); - a[0] = 1; - a[1] = 2; - const b = new Uint8Array(2); - b[0] = 3; - b[1] = 4; - const equal = fast - ? await cryptoFunctionService.compareFast(a, b) - : await cryptoFunctionService.compare(a, b); - expect(equal).toBe(false); - }); - - it("should successfully compare two different values of different lengths", async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const a = new Uint8Array(2); - a[0] = 1; - a[1] = 2; - const b = new Uint8Array(2); - b[0] = 3; - const equal = fast - ? await cryptoFunctionService.compareFast(a, b) - : await cryptoFunctionService.compare(a, b); - expect(equal).toBe(false); - }); -} - -function testRsaGenerateKeyPair(length: 2048) { - it( - "should successfully generate a " + length + " bit key pair", - async () => { - const cryptoFunctionService = new NodeCryptoFunctionService(); - const keyPair = await cryptoFunctionService.rsaGenerateKeyPair(length); - expect(keyPair[0] == null || keyPair[1] == null).toBe(false); - const publicKey = await cryptoFunctionService.rsaExtractPublicKey(keyPair[1]); - expect(Utils.fromBufferToB64(keyPair[0])).toBe(Utils.fromBufferToB64(publicKey)); - }, - 30000, - ); -} - -function makeStaticByteArray(length: number) { - const arr = new Uint8Array(length); - for (let i = 0; i < length; i++) { - arr[i] = i; - } - return arr; -} diff --git a/libs/node/src/services/node-crypto-function.service.ts b/libs/node/src/services/node-crypto-function.service.ts index 49dbc65ca84..ca8e70f204b 100644 --- a/libs/node/src/services/node-crypto-function.service.ts +++ b/libs/node/src/services/node-crypto-function.service.ts @@ -75,7 +75,8 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { t.set(previousT); t.set(infoArr, previousT.length); t.set([i + 1], t.length - 1); - previousT = await this.hmac(t, prk, algorithm); + // @ts-ignore - ArrayBufferLike compatibility issue with Node.js crypto, safe at runtime + previousT = (await this.hmac(t, prk, algorithm)) as Uint8Array; okm.set(previousT, runningOkmLength); runningOkmLength += previousT.length; if (runningOkmLength >= outputByteSize) { @@ -190,7 +191,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { | { mode: "ecb"; parameters: EcbDecryptParameters }): Promise { const iv = mode === "cbc" ? parameters.iv : null; const decBuf = await this.aesDecrypt(parameters.data, iv, parameters.encKey, mode); - return Utils.fromBufferToUtf8(decBuf); + return Utils.fromArrayToUtf8(decBuf); } aesDecrypt( @@ -285,7 +286,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { } private toPemPrivateKey(key: Uint8Array): string { - const byteString = Utils.fromBufferToByteString(key); + const byteString = Utils.fromArrayToByteString(key); const asn1 = forge.asn1.fromDer(byteString); const privateKey = forge.pki.privateKeyFromAsn1(asn1); const rsaPrivateKey = forge.pki.privateKeyToAsn1(privateKey); @@ -294,7 +295,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService { } private toPemPublicKey(key: Uint8Array): string { - const byteString = Utils.fromBufferToByteString(key); + const byteString = Utils.fromArrayToByteString(key); const asn1 = forge.asn1.fromDer(byteString); const publicKey = forge.pki.publicKeyFromAsn1(asn1); return forge.pki.publicKeyToPem(publicKey); diff --git a/libs/platform/package.json b/libs/platform/package.json index b063def1a9b..933c498839c 100644 --- a/libs/platform/package.json +++ b/libs/platform/package.json @@ -15,7 +15,7 @@ "scripts": { "test": "jest", "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" } } diff --git a/libs/pricing/package.json b/libs/pricing/package.json index 9d5ec85c1bc..bd1d70032d7 100644 --- a/libs/pricing/package.json +++ b/libs/pricing/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" }, "private": true diff --git a/libs/tools/export/vault-export/vault-export-core/package.json b/libs/tools/export/vault-export/vault-export-core/package.json index 887f64a2f0c..b1694e6d98b 100644 --- a/libs/tools/export/vault-export/vault-export-core/package.json +++ b/libs/tools/export/vault-export/vault-export-core/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts b/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts index 620f465789c..2581d44c323 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/base-vault-export.service.ts @@ -25,7 +25,7 @@ export class BaseVaultExportService { ): Promise { const kdfConfig: KdfConfig = await this.kdfConfigService.getKdfConfig(userId); - const salt = Utils.fromBufferToB64(await this.cryptoFunctionService.randomBytes(16)); + const salt = Utils.fromArrayToB64(await this.cryptoFunctionService.randomBytes(16)); const key = await this.keyGenerationService.deriveVaultExportKey(password, salt, kdfConfig); diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts index 33dde9ae51a..923fc66d0e2 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.spec.ts @@ -449,7 +449,7 @@ describe("VaultExportService", () => { mac.encryptedString = "mac" as EncryptedString; data.encryptedString = "encData" as EncryptedString; - jest.spyOn(Utils, "fromBufferToB64").mockReturnValue(salt); + jest.spyOn(Utils, "fromArrayToB64").mockReturnValue(salt); cipherService.getAllDecrypted.mockResolvedValue(UserCipherViews.slice(0, 1)); exportedVault = await exportService.getPasswordProtectedExport(userId, password); diff --git a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts index ddda96b21e0..c64f21a2925 100644 --- a/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts +++ b/libs/tools/export/vault-export/vault-export-core/src/services/individual-vault-export.service.ts @@ -1,6 +1,6 @@ // FIXME: Update this file to be type safe and remove this and next line // @ts-strict-ignore -import * as JSZip from "jszip"; +import JSZip from "jszip"; import * as papa from "papaparse"; import { firstValueFrom } from "rxjs"; diff --git a/libs/tools/export/vault-export/vault-export-ui/package.json b/libs/tools/export/vault-export/vault-export-ui/package.json index 2a2d2dc599d..0d1759148ee 100644 --- a/libs/tools/export/vault-export/vault-export-ui/package.json +++ b/libs/tools/export/vault-export/vault-export-ui/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest --passWithNoTests" } diff --git a/libs/tools/generator/components/package.json b/libs/tools/generator/components/package.json index 4e6ddd39df7..21ba8afa861 100644 --- a/libs/tools/generator/components/package.json +++ b/libs/tools/generator/components/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest --passWithNoTests" } diff --git a/libs/tools/generator/core/package.json b/libs/tools/generator/core/package.json index 00adf1c7e52..9af120d5a67 100644 --- a/libs/tools/generator/core/package.json +++ b/libs/tools/generator/core/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/tools/generator/extensions/history/package.json b/libs/tools/generator/extensions/history/package.json index 2e61910941a..abce33ce4e1 100644 --- a/libs/tools/generator/extensions/history/package.json +++ b/libs/tools/generator/extensions/history/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/tools/generator/extensions/legacy/package.json b/libs/tools/generator/extensions/legacy/package.json index eaf07d0e3ed..c624fd2fbce 100644 --- a/libs/tools/generator/extensions/legacy/package.json +++ b/libs/tools/generator/extensions/legacy/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/tools/generator/extensions/navigation/package.json b/libs/tools/generator/extensions/navigation/package.json index 96b1eb3c3bb..4a255cb5b66 100644 --- a/libs/tools/generator/extensions/navigation/package.json +++ b/libs/tools/generator/extensions/navigation/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/tools/send/send-ui/package.json b/libs/tools/send/send-ui/package.json index 1bfdf87da10..389e7b09229 100644 --- a/libs/tools/send/send-ui/package.json +++ b/libs/tools/send/send-ui/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch", "test": "jest" } diff --git a/libs/ui/common/package.json b/libs/ui/common/package.json index 0cc6d4b153f..5f6445bd713 100644 --- a/libs/ui/common/package.json +++ b/libs/ui/common/package.json @@ -14,7 +14,7 @@ "license": "GPL-3.0", "scripts": { "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" }, "exports": { diff --git a/libs/vault/package.json b/libs/vault/package.json index 3d065320520..ae62aeb55b5 100644 --- a/libs/vault/package.json +++ b/libs/vault/package.json @@ -15,7 +15,7 @@ "scripts": { "test": "jest", "clean": "rimraf dist", - "build": "npm run clean && tsc", + "build": "npm run clean && tsgo", "build:watch": "npm run clean && tsc -watch" } } diff --git a/libs/vault/src/components/download-attachment/download-attachment.component.ts b/libs/vault/src/components/download-attachment/download-attachment.component.ts index 31ed609637c..2ede63b35d1 100644 --- a/libs/vault/src/components/download-attachment/download-attachment.component.ts +++ b/libs/vault/src/components/download-attachment/download-attachment.component.ts @@ -123,7 +123,7 @@ export class DownloadAttachmentComponent { this.fileDownloadService.download({ fileName: attachment.fileName, - blobData: decBuf, + blobData: decBuf.buffer as ArrayBuffer, }); } catch { this.toastService.showToast({ diff --git a/package-lock.json b/package-lock.json index 78b9dce23db..5a7c74dd7b0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,6 +32,7 @@ "@microsoft/signalr": "8.0.7", "@microsoft/signalr-protocol-msgpack": "8.0.7", "@ng-select/ng-select": "20.7.0", + "@typescript/native-preview": "7.0.0-dev.20260119.1", "big-integer": "1.6.52", "braintree-web-drop-in": "1.46.0", "buffer": "6.0.3", @@ -944,6 +945,7 @@ "integrity": "sha512-5H40lAFF4CKY32C4HOp6bTlOF1f4WsGCwe7FjFQp9A+T7yoCBiHpIWt2JKTwV4sBoTKVDZOnuf0GG+UVKjQT4A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@angular-devkit/core": "20.3.12", "rxjs": "7.8.2" @@ -1103,6 +1105,7 @@ "integrity": "sha512-yDBHV9kQNcr2/sUr9jghVyz9C3Y5G2zUM2H2lo+9mKv4sFgbA8s8Z9t8D1jiTkGoO/NoIfKMyKWr4s6CN23ZwQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@ampproject/remapping": "^2.2.0", "@babel/code-frame": "^7.27.1", @@ -1604,6 +1607,7 @@ "integrity": "sha512-9GUyuksjw70uNpb1MTYWsH9MQHOHY6kwfnkafC24+7aOMZn9+rVMBxRbLvw756mrBFbIsFg6Xw9IkR2Fnn3k+Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "chokidar": "^4.0.0", "immutable": "^5.0.2", @@ -1713,6 +1717,7 @@ "integrity": "sha512-4JLXU0tD6OZNVqlwzm3HGEhAHufSiyv+skb7q0d2367VDMzrU1Q/ZeepvkcHH0rZie6uqEtTQQe0OEOOluH3Mg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -1792,6 +1797,7 @@ "integrity": "sha512-ReFxd/UOoVDr3+kIUjmYILQZF89qg62POdY7a7OqBH7plmInFlYVSEDouJvGqj3LVCPiqTk2ZOSChbhS/eLxXA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "ajv": "8.17.1", "ajv-formats": "3.0.1", @@ -2156,6 +2162,7 @@ "integrity": "sha512-CVskZnF38IIxVVlKWi1VCz7YH/gHMJu2IY9bD1AVoBBGIe0xA4FRXJkW2Y+EDs9vQqZTkZZljhK5gL65Ro1PeQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@angular-eslint/bundled-angular-compiler": "20.7.0", "eslint-scope": "^9.0.0" @@ -2202,6 +2209,7 @@ "resolved": "https://registry.npmjs.org/@angular/animations/-/animations-20.3.15.tgz", "integrity": "sha512-ikyKfhkxoqQA6JcBN0B9RaN6369sM1XYX81Id0lI58dmWCe7gYfrTp8ejqxxKftl514psQO3pkW8Gn1nJ131Gw==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2626,6 +2634,7 @@ "resolved": "https://registry.npmjs.org/@angular/common/-/common-20.3.15.tgz", "integrity": "sha512-k4mCXWRFiOHK3bUKfWkRQQ8KBPxW8TAJuKLYCsSHPCpMz6u0eA1F0VlrnOkZVKWPI792fOaEAWH2Y4PTaXlUHw==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2642,6 +2651,7 @@ "resolved": "https://registry.npmjs.org/@angular/compiler/-/compiler-20.3.15.tgz", "integrity": "sha512-lMicIAFAKZXa+BCZWs3soTjNQPZZXrF/WMVDinm8dQcggNarnDj4UmXgKSyXkkyqK5SLfnLsXVzrX6ndVT6z7A==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2655,6 +2665,7 @@ "integrity": "sha512-8sJoxodxsfyZ8eJ5r6Bx7BCbazXYgsZ1+dE8t5u5rTQ6jNggwNtYEzkyReoD5xvP+MMtRkos3xpwq4rtFnpI6A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/core": "7.28.3", "@jridgewell/sourcemap-codec": "^1.4.14", @@ -2863,6 +2874,7 @@ "resolved": "https://registry.npmjs.org/@angular/core/-/core-20.3.15.tgz", "integrity": "sha512-NMbX71SlTZIY9+rh/SPhRYFJU0pMJYW7z/TBD4lqiO+b0DTOIg1k7Pg9ydJGqSjFO1Z4dQaA6TteNuF99TJCNw==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2888,6 +2900,7 @@ "resolved": "https://registry.npmjs.org/@angular/forms/-/forms-20.3.15.tgz", "integrity": "sha512-gS5hQkinq52pm/7mxz4yHPCzEcmRWjtUkOVddPH0V1BW/HMni/p4Y6k2KqKBeGb9p8S5EAp6PDxDVLOPukp3mg==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2906,6 +2919,7 @@ "resolved": "https://registry.npmjs.org/@angular/platform-browser/-/platform-browser-20.3.15.tgz", "integrity": "sha512-TxRM/wTW/oGXv/3/Iohn58yWoiYXOaeEnxSasiGNS1qhbkcKtR70xzxW6NjChBUYAixz2ERkLURkpx3pI8Q6Dw==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -2928,6 +2942,7 @@ "resolved": "https://registry.npmjs.org/@angular/platform-browser-dynamic/-/platform-browser-dynamic-20.3.15.tgz", "integrity": "sha512-RizuRdBt0d6ongQ2y8cr8YsXFyjF8f91vFfpSNw+cFj+oiEmRC1txcWUlH5bPLD9qSDied8qazUi0Tb8VPQDGw==", "license": "MIT", + "peer": true, "dependencies": { "tslib": "^2.3.0" }, @@ -3018,6 +3033,7 @@ "integrity": "sha512-e7jT4DxYvIDLk1ZHmU/m/mB19rex9sv0c2ftBtjSBv+kVM/902eh0fINUzD7UwLLNR+jU585GxUJ8/EBfAM5fw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.5", @@ -5987,6 +6003,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" }, @@ -6009,6 +6026,7 @@ } ], "license": "MIT", + "peer": true, "engines": { "node": ">=18" } @@ -6037,6 +6055,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -6450,7 +6469,6 @@ "dev": true, "license": "BSD-2-Clause", "optional": true, - "peer": true, "dependencies": { "cross-dirname": "^0.1.0", "debug": "^4.3.4", @@ -7783,6 +7801,7 @@ "integrity": "sha512-nqhDw2ZcAUrKNPwhjinJny903bRhI0rQhiDz1LksjeRxqa36i3l75+4iXbOy0rlDpLJGxqtgoPavQjmmyS5UJw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@inquirer/checkbox": "^4.2.1", "@inquirer/confirm": "^5.1.14", @@ -9004,21 +9023,6 @@ "@msgpack/msgpack": "^2.7.0" } }, - "node_modules/@microsoft/signalr/node_modules/utf-8-validate": { - "version": "5.0.10", - "resolved": "https://registry.npmjs.org/utf-8-validate/-/utf-8-validate-5.0.10.tgz", - "integrity": "sha512-Z6czzLq4u8fPOyx7TU6X3dvUZVvoJmxSQ+IcrlmagKhilxlhZgxPK6C5Jqbkw1IDUmFTM+cz9QDnnLTwDz/2gQ==", - "hasInstallScript": true, - "license": "MIT", - "optional": true, - "peer": true, - "dependencies": { - "node-gyp-build": "^4.3.0" - }, - "engines": { - "node": ">=6.14.2" - } - }, "node_modules/@microsoft/signalr/node_modules/ws": { "version": "7.5.10", "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", @@ -12668,6 +12672,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -12931,6 +12936,7 @@ "integrity": "sha512-DhGl4xMVFGVIyMwswXeyzdL4uXD5OGILGX5N8Y+f6W7LhC1Ze2poSNrkF/fedpVDHEEZ+PHFW0vL14I+mm8K3Q==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@octokit/auth-token": "^6.0.0", "@octokit/graphql": "^9.0.3", @@ -14321,6 +14327,7 @@ "integrity": "sha512-JfaUD6fC7ySLg5duRdaWZ0FUUXrgUvqbZe/agCbSyOaIHOtJdhGaPjOC3vuXTAcV8/8/wWmbu0iXFMD08iKvdw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@mdx-js/react": "^3.0.0", "@storybook/csf-plugin": "9.1.16", @@ -14758,6 +14765,7 @@ "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "@swc/counter": "^0.1.3", "@swc/types": "^0.1.23" @@ -15014,7 +15022,6 @@ "integrity": "sha512-o4PXJQidqJl82ckFaXUeoAW+XysPLauYI43Abki5hABd853iMhitooc6znOnczgbTYmEP6U6/y1ZyKAIsvMKGg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.10.4", "@babel/runtime": "^7.12.5", @@ -15035,7 +15042,6 @@ "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "dequal": "^2.0.3" } @@ -15254,8 +15260,7 @@ "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.4.tgz", "integrity": "sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/babel__core": { "version": "7.20.5", @@ -15519,8 +15524,7 @@ "resolved": "https://registry.npmjs.org/@types/hammerjs/-/hammerjs-2.0.46.tgz", "integrity": "sha512-ynRvcq6wvqexJ9brDMS4BnBLzmr0e14d6ZJTEShTBWKymQiHwlAyGu0ZPEFI2Fh1U53F7tN9ufClWM5KvqkKOw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/har-format": { "version": "1.2.16", @@ -15828,6 +15832,7 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.3.tgz", "integrity": "sha512-1N9SBnWYOJTrNZCdh/yJE+t910Y128BoyY+zBLWhL3r0TYzlTmFdXrPwHL9DyFZmlEXNQQolTZh3KHV31QDhyA==", "license": "MIT", + "peer": true, "dependencies": { "undici-types": "~6.21.0" } @@ -15925,8 +15930,7 @@ "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@types/proper-lockfile": { "version": "4.1.4", @@ -16357,6 +16361,7 @@ "integrity": "sha512-67kYYShjBR0jNI5vsf/c3WG4u+zDnCTHTPqVMQguffaWWFs7artgwKmfwdifl+r6XyM5LYLas/dInj2T0SgJyw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/scope-manager": "8.31.0", "@typescript-eslint/types": "8.31.0", @@ -16502,6 +16507,7 @@ "integrity": "sha512-0mYH3emanku0vHw2aRLNGqe7EXh9WHEhi7kZzscrMDf6IIRUQ5Jk4wp1QrledE/36KtdZrVfKnE32eZCf/vaVQ==", "dev": true, "license": "MIT", + "peer": true, "engines": { "node": "^18.18.0 || ^20.9.0 || >=21.1.0" }, @@ -16573,6 +16579,7 @@ "integrity": "sha512-qi6uPLt9cjTFxAb1zGNgTob4x9ur7xC6mHQJ8GwEzGMGE9tYniublmJaowOJ9V2jUzxrltTPfdG2nKlWsq0+Ww==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.4.0", "@typescript-eslint/scope-manager": "8.31.0", @@ -16650,6 +16657,115 @@ "url": "https://opencollective.com/eslint" } }, + "node_modules/@typescript/native-preview": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview/-/native-preview-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-Tf74TdJVJlLRMN0W9VXK8jc0Gor9+wFRm40qTLt2JeHiPpSF5TEN/pHPjlf4Id1wDSJXH9p5/U1wFS3s5TS2PQ==", + "license": "Apache-2.0", + "bin": { + "tsgo": "bin/tsgo.js" + }, + "optionalDependencies": { + "@typescript/native-preview-darwin-arm64": "7.0.0-dev.20260119.1", + "@typescript/native-preview-darwin-x64": "7.0.0-dev.20260119.1", + "@typescript/native-preview-linux-arm": "7.0.0-dev.20260119.1", + "@typescript/native-preview-linux-arm64": "7.0.0-dev.20260119.1", + "@typescript/native-preview-linux-x64": "7.0.0-dev.20260119.1", + "@typescript/native-preview-win32-arm64": "7.0.0-dev.20260119.1", + "@typescript/native-preview-win32-x64": "7.0.0-dev.20260119.1" + } + }, + "node_modules/@typescript/native-preview-darwin-arm64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-arm64/-/native-preview-darwin-arm64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-siuRD9Shh5gVrgYG5HEWxFxG/dkZa4ndupGWKMfM4DwMG7zLeFayi6sB9yiwpD0d203ts01D7uTnTCALdiWXmQ==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-darwin-x64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-darwin-x64/-/native-preview-darwin-x64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-ivqxCrbLXUqZU1OMojVRCnVx5gC/twgi7gKzBXMBLGOgfTkhajbHk/71J3OQhJwzR3T2ISG6FTfXKHhQMtgkkg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@typescript/native-preview-linux-arm": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm/-/native-preview-linux-arm-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-Bev1d6NCgCmcGOgmdFG514tWRt2lNUSFjQ9RVnN86tSm+bl5p9Lv6TQjc38Ow9vY11J71IZs9HNN1AKWfBCj2Q==", + "cpu": [ + "arm" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-arm64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-arm64/-/native-preview-linux-arm64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-ttNri2Ui1CzlLnPJN0sQ4XBgrCMq4jjtxouitRGh7+YlToG561diLERjOwIhNfTzPDKRMS7XO090WoepbvzFpA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-linux-x64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-linux-x64/-/native-preview-linux-x64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-mwsjGZqUKju3SKPzlDuKhKgt9Ht8seA5OBhorvRZk2B5lwlH0gDsApGK4t50TcnzjpbWI85FVxI6wTq1T36dMg==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@typescript/native-preview-win32-arm64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-arm64/-/native-preview-win32-arm64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-463QnUaRCUhY/Flj/XinORTbBYuxoMthgJiBU1vu7mipLo2Yaipkkgn1ArGHkV9mjWBa7QIPCWg/V2KIEoVdcA==", + "cpu": [ + "arm64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@typescript/native-preview-win32-x64": { + "version": "7.0.0-dev.20260119.1", + "resolved": "https://registry.npmjs.org/@typescript/native-preview-win32-x64/-/native-preview-win32-x64-7.0.0-dev.20260119.1.tgz", + "integrity": "sha512-039WAg5xJjqrRYVHMR9Y2y83dYSLofbyx/22Gc6ur3b/nR8u1wdErK9uwrguL3lxpKDo6qdhnkGlbX8FP0Bz+g==", + "cpu": [ + "x64" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@ungap/structured-clone": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.3.0.tgz", @@ -17505,6 +17621,7 @@ "integrity": "sha512-nrUSn7hzt7J6JWgWGz78ZYI8wj+gdIJdk0Ynjpp8l+trkn58Uqsf6RYrYkEK+3X18EX+TNdtJI0WxAtc+L84SQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "argparse": "^2.0.1" }, @@ -17565,6 +17682,7 @@ "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", + "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -17699,6 +17817,7 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -18441,6 +18560,7 @@ "integrity": "sha512-Xm7bpRXnDSX2YE2YFfBk2FnF0ep6tmG7xPh8iHee8MIcrgq762Nkce856dYtJYLkuIoYZvGfTs/PbZhideTcEg==", "dev": true, "license": "MPL-2.0", + "peer": true, "engines": { "node": ">=4" } @@ -19227,6 +19347,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "baseline-browser-mapping": "^2.9.0", "caniuse-lite": "^1.0.30001759", @@ -19317,6 +19438,7 @@ "integrity": "sha512-WDtdLmJvAuNNPzByAYpRo2rF1Mmradw6gvWsQKf63476DDXmomT9zUiGypLcG4ibIM67vhAj8jJRdbmEws2Aqw==", "hasInstallScript": true, "license": "MIT", + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -19970,6 +20092,7 @@ "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "readdirp": "^4.0.1" }, @@ -21068,8 +21191,7 @@ "integrity": "sha512-+R08/oI0nl3vfPcqftZRpytksBXDzOUveBq/NBVx0sUp1axwzPQrKinNx5yd5sxPu8j1wIy8AfnVQ+5eFdha6Q==", "dev": true, "license": "MIT", - "optional": true, - "peer": true + "optional": true }, "node_modules/cross-env": { "version": "10.1.0", @@ -22066,6 +22188,7 @@ "integrity": "sha512-59CAAjAhTaIMCN8y9kD573vDkxbs1uhDcrFLHSgutYdPcGOU35Rf95725snvzEOy4BFB7+eLJ8djCNPmGwG67w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "app-builder-lib": "26.0.12", "builder-util": "26.0.11", @@ -22190,8 +22313,7 @@ "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/dom-converter": { "version": "0.2.0", @@ -22675,7 +22797,6 @@ "dev": true, "hasInstallScript": true, "license": "MIT", - "peer": true, "dependencies": { "@electron/asar": "^3.2.1", "debug": "^4.1.1", @@ -22696,7 +22817,6 @@ "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "graceful-fs": "^4.1.2", "jsonfile": "^4.0.0", @@ -22712,7 +22832,6 @@ "integrity": "sha512-m6F1R3z8jjlf2imQHS2Qez5sjKWQzbuuhuJ/FKYFRZvPE3PuHcSMVZzfsLhGVOkfd20obL5SWEBew5ShlquNxg==", "dev": true, "license": "MIT", - "peer": true, "optionalDependencies": { "graceful-fs": "^4.1.6" } @@ -22723,7 +22842,6 @@ "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">= 4.0.0" } @@ -23118,6 +23236,7 @@ "devOptional": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "bin": { "esbuild": "bin/esbuild" }, @@ -23159,6 +23278,7 @@ "integrity": "sha512-H2/S7Pm8a9CL1uhp9OvjwrBh5Pvx0H8qVOxNu8Wed9Y7qv56MPtq+GGM8RJpq6glYJn9Wspr8uw7l55uyinNeg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "debug": "^4.3.4" }, @@ -23246,6 +23366,7 @@ "integrity": "sha512-Hx0MOjPh6uK9oq9nVsATZKE/Wlbai7KFjfCuw9UHaguDW3x+HF0O5nIi3ud39TWgrTjTO5nHxmL3R1eANinWHQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.12.1", @@ -23422,6 +23543,7 @@ "integrity": "sha512-ixmkI62Rbc2/w8Vfxyh1jQRTdRTF52VxwRVHl/ykPAmqG+Nb7/kNn+byLP0LxPgI7zWA16Jt82SybJInmMia3A==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@rtsao/scc": "^1.1.0", "array-includes": "^3.1.8", @@ -24644,6 +24766,7 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -25812,6 +25935,7 @@ "integrity": "sha512-4xynFbKNNk+WlzXeQQ+6YYsH2g7mpfPszQZUi3ovKlj+pDmngQ7vRXjrrmGROabmKwyQkcgcX5hqfOwHbFmK5g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/html-minifier-terser": "^6.0.0", "html-minifier-terser": "^6.0.2", @@ -27576,6 +27700,7 @@ "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/core": "^29.7.0", "@jest/types": "^29.6.3", @@ -27618,6 +27743,7 @@ "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/expect": "^29.7.0", @@ -27982,6 +28108,7 @@ "integrity": "sha512-k9iQbsf9OyOfdzWH8HDmrRT0gSIcX+FLNW7IQq94tFX0gynPwqDTW0Ho6iMVNjGz/nb+l/vW3dWM2bbLLpkbXA==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/fake-timers": "^29.7.0", @@ -28231,6 +28358,7 @@ "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/environment": "^29.7.0", "@jest/fake-timers": "^29.7.0", @@ -28784,6 +28912,7 @@ "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@jest/console": "^29.7.0", "@jest/environment": "^29.7.0", @@ -29645,6 +29774,7 @@ "resolved": "https://registry.npmjs.org/koa/-/koa-3.1.1.tgz", "integrity": "sha512-KDDuvpfqSK0ZKEO2gCPedNjl5wYpfj+HNiuVRlbhd1A88S3M0ySkdf2V/EJ4NWt5dwh5PXCdcenrKK2IQJAxsg==", "license": "MIT", + "peer": true, "dependencies": { "accepts": "^1.3.8", "content-disposition": "~0.5.4", @@ -29836,6 +29966,7 @@ "integrity": "sha512-kdTwsyRuncDfjEs0DlRILWNvxhDG/Zij4YLO4TMJgDLW+8OzpfkdPnRgrsRuY1o+oaxJGWsps5f/RVBgGmmN0w==", "dev": true, "license": "Apache-2.0", + "peer": true, "dependencies": { "copy-anything": "^2.0.1", "parse-node-version": "^1.0.1", @@ -30234,6 +30365,7 @@ "integrity": "sha512-SL0JY3DaxylDuo/MecFeiC+7pedM0zia33zl0vcjgwcq1q1FWWF1To9EIauPbl8GbMCU0R2e0uJ8bZunhYKD2g==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "cli-truncate": "^4.0.0", "colorette": "^2.0.20", @@ -30390,6 +30522,7 @@ "resolved": "https://registry.npmjs.org/lit/-/lit-3.3.1.tgz", "integrity": "sha512-Ksr/8L3PTapbdXJCk+EJVB78jDodUMaP54gD24W186zGRARvwrsPfS60wae/SSCTCNZVPd1chXqio1qHQmu4NA==", "license": "BSD-3-Clause", + "peer": true, "dependencies": { "@lit/reactive-element": "^2.1.0", "lit-element": "^4.2.0", @@ -30869,7 +31002,6 @@ "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", "dev": true, "license": "MIT", - "peer": true, "bin": { "lz-string": "bin/bin.js" } @@ -32472,6 +32604,7 @@ "resolved": "https://registry.npmjs.org/multer/-/multer-2.0.2.tgz", "integrity": "sha512-u7f2xaZ/UG8oLXHvtF/oWTRvT44p9ecwBBqTwgJVq0+4BW1g8OW01TyMEGWBHbyMOYVHXslaut7qEQ1meATXgw==", "license": "MIT", + "peer": true, "dependencies": { "append-field": "^1.0.0", "busboy": "^1.6.0", @@ -32778,14 +32911,6 @@ "dev": true, "license": "MIT" }, - "node_modules/node-addon-api": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-6.1.0.tgz", - "integrity": "sha512-+eawOlIgy680F0kBzPUNFhMZGtJ1YmqM6l4+Crf4IkImjYrO/mqPwRMh352g23uIaQKFItcQ64I7KMaJxHgAVA==", - "dev": true, - "license": "MIT", - "optional": true - }, "node_modules/node-api-version": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/node-api-version/-/node-api-version-0.2.1.tgz", @@ -33896,6 +34021,7 @@ "dev": true, "hasInstallScript": true, "license": "MIT", + "peer": true, "dependencies": { "@napi-rs/wasm-runtime": "0.2.4", "@yarnpkg/lockfile": "^1.1.0", @@ -35949,6 +36075,7 @@ } ], "license": "MIT", + "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -36702,7 +36829,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "dependencies": { "commander": "^9.4.0" }, @@ -36720,7 +36846,6 @@ "dev": true, "license": "MIT", "optional": true, - "peer": true, "engines": { "node": "^12.20.0 || >=14" } @@ -36780,6 +36905,7 @@ "integrity": "sha512-QgODejq9K3OzoBbuyobZlUhznP5SKwPqp+6Q6xw6o8gnhr4O85L2U915iM2IDcfF2NPXVaM9zlo9tdwipnYwzg==", "dev": true, "license": "MIT", + "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, @@ -36886,7 +37012,6 @@ "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "ansi-regex": "^5.0.1", "ansi-styles": "^5.0.0", @@ -36902,7 +37027,6 @@ "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=10" }, @@ -37260,6 +37384,7 @@ "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -37273,6 +37398,7 @@ "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -37286,8 +37412,7 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", "dev": true, - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/read-binary-file-arch": { "version": "1.0.6", @@ -38184,6 +38309,7 @@ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-7.8.1.tgz", "integrity": "sha512-AA3TVj+0A2iuIoQkWEK/tqFjBq2j+6PO6Y0zJcvzLAFhEFIO3HL0vls9hWLncZbAAbK0mar7oZ4V079I/qPMxg==", "license": "Apache-2.0", + "peer": true, "dependencies": { "tslib": "^2.1.0" } @@ -40007,6 +40133,7 @@ "integrity": "sha512-kfr6kxQAjA96ADlH6FMALJwJ+eM80UqXy106yVHNgdsAP/CdzkkicglRAhZAvUycXK9AeadF6KZ00CWLtVMN4w==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@storybook/global": "^5.0.0", "@testing-library/jest-dom": "^6.6.3", @@ -40595,6 +40722,7 @@ "integrity": "sha512-6A2rnmW5xZMdw11LYjhcI5846rt9pbLSabY5XPxo+XWdxwZaFEn47Go4NzFiHu9sNNmr/kXivP1vStfvMaK1GQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@alloc/quick-lru": "^5.2.0", "arg": "^5.0.2", @@ -40819,7 +40947,6 @@ "integrity": "sha512-yYrrsWnrXMcdsnu/7YMYAofM1ktpL5By7vZhf15CrXijWWrEYZks5AXBudalfSWJLlnen/QUJUB5aoB0kqZUGA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "mkdirp": "^0.5.1", "rimraf": "~2.6.2" @@ -40860,7 +40987,6 @@ "integrity": "sha512-9T9UjW3r0UW5c1Q7GTwllptXwhvYmEzFhzMfZ9H7FQWt+uZePjZPjBP/W1ZEyZ1twGWom5/56TF4lPcqjnDHcg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -40873,7 +40999,6 @@ "deprecated": "Glob versions prior to v9 are no longer supported", "dev": true, "license": "ISC", - "peer": true, "dependencies": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", @@ -40895,7 +41020,6 @@ "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "license": "ISC", - "peer": true, "dependencies": { "brace-expansion": "^1.1.7" }, @@ -40909,7 +41033,6 @@ "integrity": "sha512-FP+p8RB8OWpF3YZBCrP5gtADmtXApB5AMLn+vdyA+PyxCjrCs00mjyUozssO33cwDeT3wNGdLxJ5M//YqtHAJw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "minimist": "^1.2.6" }, @@ -40924,7 +41047,6 @@ "deprecated": "Rimraf versions prior to v4 are no longer supported", "dev": true, "license": "ISC", - "peer": true, "dependencies": { "glob": "^7.1.3" }, @@ -41527,6 +41649,7 @@ "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "license": "MIT", + "peer": true, "dependencies": { "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", @@ -41672,7 +41795,8 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD" + "license": "0BSD", + "peer": true }, "node_modules/tsscmp": { "version": "1.0.6", @@ -42212,6 +42336,7 @@ "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", "license": "Apache-2.0", + "peer": true, "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" @@ -42226,6 +42351,7 @@ "integrity": "sha512-u+93F0sB0An8WEAPtwxVhFby573E8ckdjwUUQUj9QA4v8JAvgtoDdIyYR3XFwFHq2W1KJ1AurwJCO+w+Y1ixyQ==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@typescript-eslint/eslint-plugin": "8.31.0", "@typescript-eslint/parser": "8.31.0", @@ -42759,6 +42885,7 @@ "integrity": "sha512-EYZR+OpIXp9Y1eG1iueg8KRsY8TuT8VNgnanZ0uA3STqhHQTLwbl+WX76/9X5OY12yQubymBpaBSmMPkSTQcKA==", "hasInstallScript": true, "license": "MIT", + "peer": true, "dependencies": { "node-gyp-build": "^4.3.0" }, @@ -42820,6 +42947,7 @@ "https://github.com/sponsors/ctavan" ], "license": "MIT", + "peer": true, "bin": { "uuid": "dist/esm/bin/uuid" } @@ -43003,6 +43131,7 @@ "integrity": "sha512-uzcxnSDVjAopEUjljkWh8EIrg6tlzrjFUfMcR1EVsRDGwf/ccef0qQPRyOrROwhrTDaApueq+ja+KLPlzR/zdg==", "devOptional": true, "license": "MIT", + "peer": true, "dependencies": { "esbuild": "^0.25.0", "fdir": "^6.5.0", @@ -43368,6 +43497,7 @@ "integrity": "sha512-HU1JOuV1OavsZ+mfigY0j8d1TgQgbZ6M+J75zDkpEAwYeXjWSqrGJtgnPblJjd/mAyTNQ7ygw0MiKOn6etz8yw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -43417,6 +43547,7 @@ "integrity": "sha512-MfwFQ6SfwinsUVi0rNJm7rHZ31GyTcpVE5pgVA3hwFRb7COD4TzjUUwhGWKfO50+xdc2MQPuEBBJoqIMGt3JDw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@discoveryjs/json-ext": "^0.6.1", "@webpack-cli/configtest": "^3.0.1", @@ -43543,6 +43674,7 @@ "integrity": "sha512-QcQ72gh8a+7JO63TAx/6XZf/CWhgMzu5m0QirvPfGvptOusAxG12w2+aua1Jkjr7hzaWDnJ2n6JFeexMHI+Zjg==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/bonjour": "^3.5.13", "@types/connect-history-api-fallback": "^1.5.4", @@ -43601,6 +43733,7 @@ "integrity": "sha512-dVd04UKsfpINUnK0yBoYHDF3xu7xVH4BuDotC/xGuycx4CgbP48X/KF/586bcObxT0HENHXEU8Nqtu6NR+eKhw==", "dev": true, "license": "MIT", + "peer": true, "dependencies": { "@types/body-parser": "*", "@types/express-serve-static-core": "^4.17.33", @@ -44739,6 +44872,7 @@ "integrity": "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ==", "dev": true, "license": "MIT", + "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } @@ -44757,7 +44891,8 @@ "version": "0.15.1", "resolved": "https://registry.npmjs.org/zone.js/-/zone.js-0.15.1.tgz", "integrity": "sha512-XE96n56IQpJM7NAoXswY3XRLcWFW83xe0BiAOeMD7K5k5xecOeul3Qcpx6GqEeeHNkW5DWL5zOyTbEfB4eti8w==", - "license": "MIT" + "license": "MIT", + "peer": true }, "node_modules/zwitch": { "version": "2.0.4", diff --git a/package.json b/package.json index 1cfddb16c42..dd2a681136c 100644 --- a/package.json +++ b/package.json @@ -162,8 +162,8 @@ "@angular/platform-browser": "20.3.15", "@angular/platform-browser-dynamic": "20.3.15", "@angular/router": "20.3.15", - "@bitwarden/sdk-internal": "0.2.0-main.450", "@bitwarden/commercial-sdk-internal": "0.2.0-main.450", + "@bitwarden/sdk-internal": "0.2.0-main.450", "@electron/fuses": "1.8.0", "@emotion/css": "11.13.5", "@koa/multer": "4.0.0", @@ -171,6 +171,7 @@ "@microsoft/signalr": "8.0.7", "@microsoft/signalr-protocol-msgpack": "8.0.7", "@ng-select/ng-select": "20.7.0", + "@typescript/native-preview": "7.0.0-dev.20260119.1", "big-integer": "1.6.52", "braintree-web-drop-in": "1.46.0", "buffer": "6.0.3", diff --git a/scripts/test-types.js b/scripts/test-types.js index f71f236c607..f752336432f 100644 --- a/scripts/test-types.js +++ b/scripts/test-types.js @@ -34,6 +34,6 @@ concurrently([ }, ...files.map((file) => ({ name: path.basename(path.dirname(file)), - command: `npx tsc --noEmit --project ${file}`, + command: `npx tsgo --noEmit --project ${file}`, })), ]); diff --git a/tsconfig.base.json b/tsconfig.base.json index d91e8cb9890..bdfa0cda855 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -12,12 +12,12 @@ "emitDecoratorMetadata": true, "declaration": false, "outDir": "dist", - "baseUrl": ".", "resolveJsonModule": true, "allowJs": true, "sourceMap": true, "skipLibCheck": true, "paths": { + "*": ["./*"], "@bitwarden/admin-console/common": ["./libs/admin-console/src/common"], "@bitwarden/angular/*": ["./libs/angular/src/*"], "@bitwarden/assets": ["./libs/assets/src/index.ts"],