mirror of
https://github.com/bitwarden/browser
synced 2025-12-21 02:33:46 +00:00
[deps] Autofill: Update prettier to v3 (#7014)
* [deps] Autofill: Update prettier to v3 * prettier formatting updates --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Jonathan Prusik <jprusik@classynemesis.com>
This commit is contained in:
@@ -5,7 +5,10 @@ import { ConfigApiServiceAbstraction } from "../../abstractions/config/config-ap
|
||||
import { ServerConfigResponse } from "../../models/response/server-config.response";
|
||||
|
||||
export class ConfigApiService implements ConfigApiServiceAbstraction {
|
||||
constructor(private apiService: ApiService, private authService: AuthService) {}
|
||||
constructor(
|
||||
private apiService: ApiService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
|
||||
async get(): Promise<ServerConfigResponse> {
|
||||
const authed: boolean =
|
||||
|
||||
@@ -34,7 +34,7 @@ describe("ConfigService", () => {
|
||||
configApiService,
|
||||
authService,
|
||||
environmentService,
|
||||
logService
|
||||
logService,
|
||||
);
|
||||
configService.init();
|
||||
return configService;
|
||||
@@ -51,7 +51,7 @@ describe("ConfigService", () => {
|
||||
|
||||
serverResponseCount = 1;
|
||||
configApiService.get.mockImplementation(() =>
|
||||
Promise.resolve(serverConfigResponseFactory("server" + serverResponseCount++))
|
||||
Promise.resolve(serverConfigResponseFactory("server" + serverResponseCount++)),
|
||||
);
|
||||
|
||||
jest.useFakeTimers();
|
||||
@@ -124,7 +124,7 @@ describe("ConfigService", () => {
|
||||
|
||||
const oneHourInMs = 1000 * 3600;
|
||||
jest.advanceTimersByTime(oneHourInMs * hours + 1);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
it("when environment URLs change", (done) => {
|
||||
@@ -166,7 +166,7 @@ describe("ConfigService", () => {
|
||||
configService.serverConfig$.pipe(take(1)).subscribe(() => {
|
||||
try {
|
||||
expect(stateService.setServerConfig).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ gitHash: "server1" })
|
||||
expect.objectContaining({ gitHash: "server1" }),
|
||||
);
|
||||
done();
|
||||
} catch (e) {
|
||||
|
||||
@@ -35,7 +35,7 @@ export class ConfigService implements ConfigServiceAbstraction {
|
||||
protected refreshTimer$ = timer(ONE_HOUR_IN_MILLISECONDS, ONE_HOUR_IN_MILLISECONDS); // after 1 hour, then every hour
|
||||
|
||||
cloudRegion$ = this.serverConfig$.pipe(
|
||||
map((config) => config?.environment?.cloudRegion ?? Region.US)
|
||||
map((config) => config?.environment?.cloudRegion ?? Region.US),
|
||||
);
|
||||
|
||||
constructor(
|
||||
@@ -46,7 +46,7 @@ export class ConfigService implements ConfigServiceAbstraction {
|
||||
private logService: LogService,
|
||||
|
||||
// Used to avoid duplicate subscriptions, e.g. in browser between the background and popup
|
||||
private subscribe = true
|
||||
private subscribe = true,
|
||||
) {}
|
||||
|
||||
init() {
|
||||
@@ -61,18 +61,18 @@ export class ConfigService implements ConfigServiceAbstraction {
|
||||
// fall back to stored ServerConfig (if any)
|
||||
this.logService.error("Unable to fetch ServerConfig: " + (e as Error)?.message);
|
||||
return this.stateService.getServerConfig();
|
||||
})
|
||||
}),
|
||||
);
|
||||
|
||||
// If you need to fetch a new config when an event occurs, add an observable that emits on that event here
|
||||
merge(
|
||||
this.refreshTimer$, // an overridable interval
|
||||
this.environmentService.urls, // when environment URLs change (including when app is started)
|
||||
this._forceFetchConfig // manual
|
||||
this._forceFetchConfig, // manual
|
||||
)
|
||||
.pipe(
|
||||
concatMap(() => latestServerConfig$),
|
||||
map((data) => (data == null ? null : new ServerConfig(data)))
|
||||
map((data) => (data == null ? null : new ServerConfig(data))),
|
||||
)
|
||||
.subscribe((config) => this._serverConfig.next(config));
|
||||
|
||||
@@ -87,7 +87,7 @@ export class ConfigService implements ConfigServiceAbstraction {
|
||||
}
|
||||
|
||||
return serverConfig.featureStates[key] as T;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -121,7 +121,7 @@ export class ConfigService implements ConfigServiceAbstraction {
|
||||
}
|
||||
const serverVersion = new SemVer(serverConfig.version);
|
||||
return serverVersion.compare(minimumRequiredServerVersion) >= 0;
|
||||
})
|
||||
}),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export class ConsoleLogService implements LogServiceAbstraction {
|
||||
|
||||
constructor(
|
||||
protected isDev: boolean,
|
||||
protected filter: (level: LogLevelType) => boolean = null
|
||||
protected filter: (level: LogLevelType) => boolean = null,
|
||||
) {}
|
||||
|
||||
debug(message: string) {
|
||||
|
||||
@@ -2,7 +2,10 @@ import { CryptoService } from "../abstractions/crypto.service";
|
||||
import { EncryptService } from "../abstractions/encrypt.service";
|
||||
|
||||
export class ContainerService {
|
||||
constructor(private cryptoService: CryptoService, private encryptService: EncryptService) {}
|
||||
constructor(
|
||||
private cryptoService: CryptoService,
|
||||
private encryptService: EncryptService,
|
||||
) {}
|
||||
|
||||
attachToGlobal(global: any) {
|
||||
if (!global.bitwardenContainerService) {
|
||||
|
||||
@@ -38,7 +38,7 @@ describe("cryptoService", () => {
|
||||
encryptService,
|
||||
platformUtilService,
|
||||
logService,
|
||||
stateService
|
||||
stateService,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -165,7 +165,7 @@ describe("cryptoService", () => {
|
||||
cryptoSvcMakePinKey = jest.spyOn(cryptoService, "makePinKey");
|
||||
cryptoSvcMakePinKey.mockResolvedValue(new SymmetricCryptoKey(new Uint8Array(64)) as PinKey);
|
||||
encPin = new EncString(
|
||||
"2.jcow2vTUePO+CCyokcIfVw==|DTBNlJ5yVsV2Bsk3UU3H6Q==|YvFBff5gxWqM+UsFB6BKimKxhC32AtjF3IStpU1Ijwg="
|
||||
"2.jcow2vTUePO+CCyokcIfVw==|DTBNlJ5yVsV2Bsk3UU3H6Q==|YvFBff5gxWqM+UsFB6BKimKxhC32AtjF3IStpU1Ijwg=",
|
||||
);
|
||||
encryptService.encrypt.mockResolvedValue(encPin);
|
||||
});
|
||||
@@ -174,8 +174,8 @@ describe("cryptoService", () => {
|
||||
stateService.getProtectedPin.mockResolvedValue(protectedPin);
|
||||
stateService.getPinKeyEncryptedUserKey.mockResolvedValue(
|
||||
new EncString(
|
||||
"2.OdGNE3L23GaDZGvu9h2Brw==|/OAcNnrYwu0rjiv8+RUr3Tc+Ef8fV035Tm1rbTxfEuC+2LZtiCAoIvHIZCrM/V1PWnb/pHO2gh9+Koks04YhX8K29ED4FzjeYP8+YQD/dWo=|+12xTcIK/UVRsOyawYudPMHb6+lCHeR2Peq1pQhPm0A="
|
||||
)
|
||||
"2.OdGNE3L23GaDZGvu9h2Brw==|/OAcNnrYwu0rjiv8+RUr3Tc+Ef8fV035Tm1rbTxfEuC+2LZtiCAoIvHIZCrM/V1PWnb/pHO2gh9+Koks04YhX8K29ED4FzjeYP8+YQD/dWo=|+12xTcIK/UVRsOyawYudPMHb6+lCHeR2Peq1pQhPm0A=",
|
||||
),
|
||||
);
|
||||
|
||||
await cryptoService.setUserKey(mockUserKey, mockUserId);
|
||||
@@ -195,7 +195,7 @@ describe("cryptoService", () => {
|
||||
expect.any(EncString),
|
||||
{
|
||||
userId: mockUserId,
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
protected encryptService: EncryptService,
|
||||
protected platformUtilService: PlatformUtilsService,
|
||||
protected logService: LogService,
|
||||
protected stateService: StateService
|
||||
protected stateService: StateService,
|
||||
) {}
|
||||
|
||||
async setUserKey(key: UserKey, userId?: string): Promise<void> {
|
||||
@@ -80,7 +80,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
async isLegacyUser(masterKey?: MasterKey, userId?: string): Promise<boolean> {
|
||||
return await this.validateUserKey(
|
||||
(masterKey ?? (await this.getMasterKey(userId))) as unknown as UserKey
|
||||
(masterKey ?? (await this.getMasterKey(userId))) as unknown as UserKey,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
password,
|
||||
await this.stateService.getEmail({ userId: userId }),
|
||||
await this.stateService.getKdfType({ userId: userId }),
|
||||
await this.stateService.getKdfConfig({ userId: userId })
|
||||
await this.stateService.getKdfConfig({ userId: userId }),
|
||||
));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
password: string,
|
||||
email: string,
|
||||
kdf: KdfType,
|
||||
KdfConfig: KdfConfig
|
||||
KdfConfig: KdfConfig,
|
||||
): Promise<MasterKey> {
|
||||
return (await this.makeKey(password, email, kdf, KdfConfig)) as MasterKey;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
async encryptUserKeyWithMasterKey(
|
||||
masterKey: MasterKey,
|
||||
userKey?: UserKey
|
||||
userKey?: UserKey,
|
||||
): Promise<[UserKey, EncString]> {
|
||||
userKey ||= await this.getUserKey();
|
||||
return await this.buildProtectedSymmetricKey(masterKey, userKey.key);
|
||||
@@ -199,7 +199,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
async decryptUserKeyWithMasterKey(
|
||||
masterKey: MasterKey,
|
||||
userKey?: EncString,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
): Promise<UserKey> {
|
||||
masterKey ||= await this.getMasterKey(userId);
|
||||
if (masterKey == null) {
|
||||
@@ -243,7 +243,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
async hashMasterKey(
|
||||
password: string,
|
||||
key: MasterKey,
|
||||
hashPurpose?: HashPurpose
|
||||
hashPurpose?: HashPurpose,
|
||||
): Promise<string> {
|
||||
key ||= await this.getMasterKey();
|
||||
|
||||
@@ -274,7 +274,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
const localKeyHash = await this.hashMasterKey(
|
||||
masterPassword,
|
||||
masterKey,
|
||||
HashPurpose.LocalAuthorization
|
||||
HashPurpose.LocalAuthorization,
|
||||
);
|
||||
if (localKeyHash != null && storedPasswordHash === localKeyHash) {
|
||||
return true;
|
||||
@@ -284,7 +284,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
const serverKeyHash = await this.hashMasterKey(
|
||||
masterPassword,
|
||||
masterKey,
|
||||
HashPurpose.ServerAuthorization
|
||||
HashPurpose.ServerAuthorization,
|
||||
);
|
||||
if (serverKeyHash != null && storedPasswordHash === serverKeyHash) {
|
||||
await this.setMasterKeyHash(localKeyHash);
|
||||
@@ -297,7 +297,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
async setOrgKeys(
|
||||
orgs: ProfileOrganizationResponse[] = [],
|
||||
providerOrgs: ProfileProviderOrganizationResponse[] = []
|
||||
providerOrgs: ProfileProviderOrganizationResponse[] = [],
|
||||
): Promise<void> {
|
||||
const encOrgKeyData: { [orgId: string]: EncryptedOrganizationKeyData } = {};
|
||||
|
||||
@@ -368,7 +368,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
}
|
||||
|
||||
async makeDataEncKey<T extends OrgKey | UserKey>(
|
||||
key: T
|
||||
key: T,
|
||||
): Promise<[SymmetricCryptoKey, EncString]> {
|
||||
if (key == null) {
|
||||
throw new Error("No key provided");
|
||||
@@ -493,7 +493,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
const privateKey = await this.encryptService.decryptToBytes(
|
||||
new EncString(encPrivateKey),
|
||||
await this.getUserKeyWithLegacySupport()
|
||||
await this.getUserKeyWithLegacySupport(),
|
||||
);
|
||||
await this.stateService.setDecryptedPrivateKey(privateKey);
|
||||
return privateKey;
|
||||
@@ -511,7 +511,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
keyFingerprint,
|
||||
fingerprintMaterial,
|
||||
32,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
return this.hashPhrase(userFingerprint);
|
||||
}
|
||||
@@ -554,7 +554,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
salt: string,
|
||||
kdf: KdfType,
|
||||
kdfConfig: KdfConfig,
|
||||
pinProtectedUserKey?: EncString
|
||||
pinProtectedUserKey?: EncString,
|
||||
): Promise<UserKey> {
|
||||
pinProtectedUserKey ||= await this.stateService.getPinKeyEncryptedUserKey();
|
||||
pinProtectedUserKey ||= await this.stateService.getPinKeyEncryptedUserKeyEphemeral();
|
||||
@@ -572,7 +572,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
salt: string,
|
||||
kdf: KdfType,
|
||||
kdfConfig: KdfConfig,
|
||||
pinProtectedMasterKey?: EncString
|
||||
pinProtectedMasterKey?: EncString,
|
||||
): Promise<MasterKey> {
|
||||
if (!pinProtectedMasterKey) {
|
||||
const pinProtectedMasterKeyString = await this.stateService.getEncryptedPinProtected();
|
||||
@@ -592,7 +592,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
"bitwarden-send",
|
||||
"send",
|
||||
64,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
return new SymmetricCryptoKey(sendKey);
|
||||
}
|
||||
@@ -725,7 +725,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
const privateKey = await this.encryptService.decryptToBytes(
|
||||
new EncString(encPrivateKey),
|
||||
key
|
||||
key,
|
||||
);
|
||||
await this.cryptoFunctionService.rsaExtractPublicKey(privateKey);
|
||||
} catch (e) {
|
||||
@@ -794,13 +794,13 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
protected async storePinKey(key: UserKey, userId?: string) {
|
||||
const pin = await this.encryptService.decryptToUtf8(
|
||||
new EncString(await this.stateService.getProtectedPin({ userId: userId })),
|
||||
key
|
||||
key,
|
||||
);
|
||||
const pinKey = await this.makePinKey(
|
||||
pin,
|
||||
await this.stateService.getEmail({ userId: userId }),
|
||||
await this.stateService.getKdfType({ userId: userId }),
|
||||
await this.stateService.getKdfConfig({ userId: userId })
|
||||
await this.stateService.getKdfConfig({ userId: userId }),
|
||||
);
|
||||
const encPin = await this.encryptService.encrypt(key.key, pinKey);
|
||||
|
||||
@@ -830,7 +830,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
protected async getKeyFromStorage(
|
||||
keySuffix: KeySuffixOptions,
|
||||
userId?: string
|
||||
userId?: string,
|
||||
): Promise<UserKey> {
|
||||
if (keySuffix === KeySuffixOptions.Auto) {
|
||||
const userKey = await this.stateService.getUserKeyAutoUnlock({ userId: userId });
|
||||
@@ -877,7 +877,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
|
||||
private async buildProtectedSymmetricKey<T extends SymmetricCryptoKey>(
|
||||
encryptionKey: SymmetricCryptoKey,
|
||||
newSymKey: Uint8Array
|
||||
newSymKey: Uint8Array,
|
||||
): Promise<[T, EncString]> {
|
||||
let protectedSymKey: EncString = null;
|
||||
if (encryptionKey.key.byteLength === 32) {
|
||||
@@ -895,7 +895,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
password: string,
|
||||
salt: string,
|
||||
kdf: KdfType,
|
||||
kdfConfig: KdfConfig
|
||||
kdfConfig: KdfConfig,
|
||||
): Promise<SymmetricCryptoKey> {
|
||||
let key: Uint8Array = null;
|
||||
if (kdf == null || kdf === KdfType.PBKDF2_SHA256) {
|
||||
@@ -932,7 +932,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
saltHash,
|
||||
kdfConfig.iterations,
|
||||
kdfConfig.memory * 1024, // convert to KiB from MiB
|
||||
kdfConfig.parallelism
|
||||
kdfConfig.parallelism,
|
||||
);
|
||||
} else {
|
||||
throw new Error("Unknown Kdf.");
|
||||
@@ -973,7 +973,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
const userKey = await this.decryptUserKeyWithMasterKey(
|
||||
masterKey,
|
||||
new EncString(encryptedUserKey),
|
||||
userId
|
||||
userId,
|
||||
);
|
||||
// Migrate
|
||||
await this.stateService.setUserKeyAutoUnlock(userKey.keyB64, { userId: userId });
|
||||
@@ -988,7 +988,7 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
email: string,
|
||||
kdf: KdfType,
|
||||
kdfConfig: KdfConfig,
|
||||
oldPinKey: EncString
|
||||
oldPinKey: EncString,
|
||||
): Promise<UserKey> {
|
||||
// Decrypt
|
||||
const masterKey = await this.decryptMasterKeyWithPin(pin, email, kdf, kdfConfig, oldPinKey);
|
||||
|
||||
@@ -15,7 +15,7 @@ export class EncryptServiceImplementation implements EncryptService {
|
||||
constructor(
|
||||
protected cryptoFunctionService: CryptoFunctionService,
|
||||
protected logService: LogService,
|
||||
protected logMacFailures: boolean
|
||||
protected logMacFailures: boolean,
|
||||
) {}
|
||||
|
||||
async encrypt(plainValue: string | Uint8Array, key: SymmetricCryptoKey): Promise<EncString> {
|
||||
@@ -84,13 +84,13 @@ export class EncryptServiceImplementation implements EncryptService {
|
||||
encString.data,
|
||||
encString.iv,
|
||||
encString.mac,
|
||||
key
|
||||
key,
|
||||
);
|
||||
if (fastParams.macKey != null && fastParams.mac != null) {
|
||||
const computedMac = await this.cryptoFunctionService.hmacFast(
|
||||
fastParams.macData,
|
||||
fastParams.macKey,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
const macsEqual = await this.cryptoFunctionService.compareFast(fastParams.mac, computedMac);
|
||||
if (!macsEqual) {
|
||||
@@ -141,7 +141,7 @@ export class EncryptServiceImplementation implements EncryptService {
|
||||
encThing.dataBytes,
|
||||
encThing.ivBytes,
|
||||
key.encKey,
|
||||
"cbc"
|
||||
"cbc",
|
||||
);
|
||||
|
||||
return result ?? null;
|
||||
@@ -149,7 +149,7 @@ export class EncryptServiceImplementation implements EncryptService {
|
||||
|
||||
async decryptItems<T extends InitializerMetadata>(
|
||||
items: Decryptable<T>[],
|
||||
key: SymmetricCryptoKey
|
||||
key: SymmetricCryptoKey,
|
||||
): Promise<T[]> {
|
||||
if (items == null || items.length < 1) {
|
||||
return [];
|
||||
|
||||
@@ -16,7 +16,7 @@ const classInitializers: Record<InitializerKey, (obj: any) => any> = {
|
||||
};
|
||||
|
||||
export function getClassInitializer<T extends InitializerMetadata>(
|
||||
className: InitializerKey
|
||||
className: InitializerKey,
|
||||
): (obj: Jsonify<T>) => T {
|
||||
return classInitializers[className];
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ export class MultithreadEncryptServiceImplementation extends EncryptServiceImple
|
||||
*/
|
||||
async decryptItems<T extends InitializerMetadata>(
|
||||
items: Decryptable<T>[],
|
||||
key: SymmetricCryptoKey
|
||||
key: SymmetricCryptoKey,
|
||||
): Promise<T[]> {
|
||||
if (items == null || items.length < 1) {
|
||||
return [];
|
||||
@@ -36,8 +36,8 @@ export class MultithreadEncryptServiceImplementation extends EncryptServiceImple
|
||||
new URL(
|
||||
/* webpackChunkName: 'encrypt-worker' */
|
||||
"@bitwarden/common/platform/services/cryptography/encrypt.worker.ts",
|
||||
import.meta.url
|
||||
)
|
||||
import.meta.url,
|
||||
),
|
||||
);
|
||||
|
||||
this.restartTimeout();
|
||||
@@ -58,11 +58,11 @@ export class MultithreadEncryptServiceImplementation extends EncryptServiceImple
|
||||
items.map((jsonItem: Jsonify<T>) => {
|
||||
const initializer = getClassInitializer<T>(jsonItem.initializerKey);
|
||||
return initializer(jsonItem);
|
||||
})
|
||||
}),
|
||||
),
|
||||
takeUntil(this.clear$),
|
||||
defaultIfEmpty([])
|
||||
)
|
||||
defaultIfEmpty([]),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("EncryptService", () => {
|
||||
|
||||
it("throws if no key is provided", () => {
|
||||
return expect(encryptService.encryptToBytes(plainValue, null)).rejects.toThrow(
|
||||
"No encryption key"
|
||||
"No encryption key",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -57,7 +57,7 @@ describe("EncryptService", () => {
|
||||
expect(actual.macBytes).toEqualBuffer(mac);
|
||||
expect(actual.dataBytes).toEqualBuffer(encryptedData);
|
||||
expect(actual.buffer.byteLength).toEqual(
|
||||
1 + iv.byteLength + mac.byteLength + encryptedData.byteLength
|
||||
1 + iv.byteLength + mac.byteLength + encryptedData.byteLength,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -93,13 +93,13 @@ describe("EncryptService", () => {
|
||||
|
||||
it("throws if no key is provided", () => {
|
||||
return expect(encryptService.decryptToBytes(encBuffer, null)).rejects.toThrow(
|
||||
"No encryption key"
|
||||
"No encryption key",
|
||||
);
|
||||
});
|
||||
|
||||
it("throws if no encrypted value is provided", () => {
|
||||
return expect(encryptService.decryptToBytes(null, key)).rejects.toThrow(
|
||||
"Nothing provided for decryption"
|
||||
"Nothing provided for decryption",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ describe("EncryptService", () => {
|
||||
expect.toEqualBuffer(encBuffer.dataBytes),
|
||||
expect.toEqualBuffer(encBuffer.ivBytes),
|
||||
expect.toEqualBuffer(key.encKey),
|
||||
"cbc"
|
||||
"cbc",
|
||||
);
|
||||
|
||||
expect(actual).toEqualBuffer(decryptedBytes);
|
||||
@@ -124,7 +124,7 @@ describe("EncryptService", () => {
|
||||
|
||||
it("compares macs using CryptoFunctionService", async () => {
|
||||
const expectedMacData = new Uint8Array(
|
||||
encBuffer.ivBytes.byteLength + encBuffer.dataBytes.byteLength
|
||||
encBuffer.ivBytes.byteLength + encBuffer.dataBytes.byteLength,
|
||||
);
|
||||
expectedMacData.set(new Uint8Array(encBuffer.ivBytes));
|
||||
expectedMacData.set(new Uint8Array(encBuffer.dataBytes), encBuffer.ivBytes.byteLength);
|
||||
@@ -134,12 +134,12 @@ describe("EncryptService", () => {
|
||||
expect(cryptoFunctionService.hmac).toBeCalledWith(
|
||||
expect.toEqualBuffer(expectedMacData),
|
||||
key.macKey,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
|
||||
expect(cryptoFunctionService.compare).toBeCalledWith(
|
||||
expect.toEqualBuffer(encBuffer.macBytes),
|
||||
expect.toEqualBuffer(computedMac)
|
||||
expect.toEqualBuffer(computedMac),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
|
||||
return;
|
||||
}
|
||||
await this.setUrlsFromStorage();
|
||||
})
|
||||
}),
|
||||
)
|
||||
.subscribe();
|
||||
}
|
||||
@@ -296,7 +296,7 @@ export class EnvironmentService implements EnvironmentServiceAbstraction {
|
||||
default: {
|
||||
// Environment is self-hosted
|
||||
const envUrls = await this.stateService.getEnvironmentUrls(
|
||||
userId ? { userId: userId } : null
|
||||
userId ? { userId: userId } : null,
|
||||
);
|
||||
return Utils.getHost(envUrls.webVault || envUrls.base);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ export class AzureFileUploadService {
|
||||
private async azureUploadBlocks(
|
||||
url: string,
|
||||
data: EncArrayBuffer,
|
||||
renewalCallback: () => Promise<string>
|
||||
renewalCallback: () => Promise<string>,
|
||||
) {
|
||||
const baseUrl = Utils.getUrl(url);
|
||||
const blockSize = this.getMaxBlockSize(baseUrl.searchParams.get("sv"));
|
||||
@@ -50,7 +50,7 @@ export class AzureFileUploadService {
|
||||
|
||||
if (numBlocks > MAX_BLOCKS_PER_BLOB) {
|
||||
throw new Error(
|
||||
`Cannot upload file, exceeds maximum size of ${blockSize * MAX_BLOCKS_PER_BLOB}`
|
||||
`Cannot upload file, exceeds maximum size of ${blockSize * MAX_BLOCKS_PER_BLOB}`,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ export class AzureFileUploadService {
|
||||
|
||||
private async renewUrlIfNecessary(
|
||||
url: string,
|
||||
renewalCallback: () => Promise<string>
|
||||
renewalCallback: () => Promise<string>,
|
||||
): Promise<string> {
|
||||
const urlObject = Utils.getUrl(url);
|
||||
const expiry = new Date(urlObject.searchParams.get("se") ?? "");
|
||||
@@ -183,10 +183,10 @@ class Version {
|
||||
return a.year !== b.year
|
||||
? a.year - b.year
|
||||
: a.month !== b.month
|
||||
? a.month - b.month
|
||||
: a.day !== b.day
|
||||
? a.day - b.day
|
||||
: 0;
|
||||
? a.month - b.month
|
||||
: a.day !== b.day
|
||||
? a.day - b.day
|
||||
: 0;
|
||||
}
|
||||
year = 0;
|
||||
month = 0;
|
||||
|
||||
@@ -5,7 +5,7 @@ export class BitwardenFileUploadService {
|
||||
async upload(
|
||||
encryptedFileName: string,
|
||||
encryptedFileData: EncArrayBuffer,
|
||||
apiCall: (fd: FormData) => Promise<any>
|
||||
apiCall: (fd: FormData) => Promise<any>,
|
||||
) {
|
||||
const fd = new FormData();
|
||||
try {
|
||||
@@ -19,7 +19,7 @@ export class BitwardenFileUploadService {
|
||||
{
|
||||
filepath: encryptedFileName,
|
||||
contentType: "application/octet-stream",
|
||||
} as any
|
||||
} as any,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
|
||||
@@ -23,7 +23,7 @@ export class FileUploadService implements FileUploadServiceAbstraction {
|
||||
uploadData: { url: string; fileUploadType: FileUploadType },
|
||||
fileName: EncString,
|
||||
encryptedFileData: EncArrayBuffer,
|
||||
fileUploadMethods: FileUploadApiMethods
|
||||
fileUploadMethods: FileUploadApiMethods,
|
||||
) {
|
||||
try {
|
||||
switch (uploadData.fileUploadType) {
|
||||
@@ -31,14 +31,14 @@ export class FileUploadService implements FileUploadServiceAbstraction {
|
||||
await this.bitwardenFileUploadService.upload(
|
||||
fileName.encryptedString,
|
||||
encryptedFileData,
|
||||
(fd) => fileUploadMethods.postDirect(fd)
|
||||
(fd) => fileUploadMethods.postDirect(fd),
|
||||
);
|
||||
break;
|
||||
case FileUploadType.Azure: {
|
||||
await this.azureFileUploadService.upload(
|
||||
uploadData.url,
|
||||
encryptedFileData,
|
||||
fileUploadMethods.renewFileUploadUrl
|
||||
fileUploadMethods.renewFileUploadUrl,
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ export class I18nService extends TranslationService implements I18nServiceAbstra
|
||||
constructor(
|
||||
protected systemLanguage: string,
|
||||
protected localesDirectory: string,
|
||||
protected getLocalesJson: (formattedLocale: string) => Promise<any>
|
||||
protected getLocalesJson: (formattedLocale: string) => Promise<any>,
|
||||
) {
|
||||
super(systemLanguage, localesDirectory, getLocalesJson);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ export class NoopNotificationsService implements NotificationsServiceAbstraction
|
||||
|
||||
init(): Promise<void> {
|
||||
this.logService.info(
|
||||
"Initializing no-op notification service, no push notifications will be received"
|
||||
"Initializing no-op notification service, no push notifications will be received",
|
||||
);
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -17,7 +17,7 @@ export class SystemService implements SystemServiceAbstraction {
|
||||
private messagingService: MessagingService,
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
private reloadCallback: () => Promise<void> = null,
|
||||
private stateService: StateService
|
||||
private stateService: StateService,
|
||||
) {}
|
||||
|
||||
async startProcessReload(authService: AuthService): Promise<void> {
|
||||
|
||||
@@ -73,7 +73,7 @@ export abstract class TranslationService implements TranslationServiceAbstractio
|
||||
constructor(
|
||||
protected systemLanguage: string,
|
||||
protected localesDirectory: string,
|
||||
protected getLocalesJson: (formattedLocale: string) => Promise<any>
|
||||
protected getLocalesJson: (formattedLocale: string) => Promise<any>,
|
||||
) {
|
||||
this.systemLanguage = systemLanguage.replace("_", "-");
|
||||
}
|
||||
@@ -171,7 +171,7 @@ export abstract class TranslationService implements TranslationServiceAbstractio
|
||||
}
|
||||
messagesObj[prop] = messagesObj[prop].replace(
|
||||
new RegExp(replaceToken, "g"),
|
||||
replaceContent
|
||||
replaceContent,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ import { ValidationService as ValidationServiceAbstraction } from "../abstractio
|
||||
export class ValidationService implements ValidationServiceAbstraction {
|
||||
constructor(
|
||||
private i18nService: I18nService,
|
||||
private platformUtilsService: PlatformUtilsService
|
||||
private platformUtilsService: PlatformUtilsService,
|
||||
) {}
|
||||
|
||||
showError(data: any): string[] {
|
||||
|
||||
@@ -85,7 +85,7 @@ describe("WebCrypto Function Service", () => {
|
||||
prk32Byte,
|
||||
64,
|
||||
"BnIqJlfnHm0e/2iB/15cbHyR19ARPIcWRp4oNS22CD9BV+" +
|
||||
"/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA=="
|
||||
"/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA==",
|
||||
);
|
||||
testHkdfExpand("sha512", prk64Byte, 32, "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlk=");
|
||||
testHkdfExpand(
|
||||
@@ -93,7 +93,7 @@ describe("WebCrypto Function Service", () => {
|
||||
prk64Byte,
|
||||
64,
|
||||
"uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlkY5Pv0sB+" +
|
||||
"MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w=="
|
||||
"MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w==",
|
||||
);
|
||||
|
||||
it("should fail with prk too small", async () => {
|
||||
@@ -102,7 +102,7 @@ describe("WebCrypto Function Service", () => {
|
||||
Utils.fromB64ToArray(prk16Byte),
|
||||
"info",
|
||||
32,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
await expect(f).rejects.toEqual(new Error("prk is too small."));
|
||||
});
|
||||
@@ -113,7 +113,7 @@ describe("WebCrypto Function Service", () => {
|
||||
Utils.fromB64ToArray(prk32Byte),
|
||||
"info",
|
||||
8161,
|
||||
"sha256"
|
||||
"sha256",
|
||||
);
|
||||
await expect(f).rejects.toEqual(new Error("outputByteSize is too large."));
|
||||
});
|
||||
@@ -337,7 +337,7 @@ describe("WebCrypto Function Service", () => {
|
||||
"A1/p8BQzN9UrbdYxUY2Va5+kPLyfZXF9JsZrjeEXcaclsnHurdxVAJcnbEqYMP3UXV" +
|
||||
"4YAS/mpf+Rxe6/X0WS1boQdA0MAHSgx95hIlAraZYpiMLLiJRKeo2u8YivCdTM9V5vuAEJwf9Tof/qFsFci3sApdbATkorCT" +
|
||||
"zFOIEPF2S1zgperEP23M01mr4dWVdYN18B32YF67xdJHMbFhp5dkQwv9CmscoWq7OE5HIfOb+JAh7BEZb+CmKhM3yWJvoR/D" +
|
||||
"/5jcercUtK2o+XrzNrL4UQ7yLZcFz6Bfwb/j6ICYvqd/YJwXNE6dwlL57OfwJyCdw2rRYf0/qI00t9u8Iitw=="
|
||||
"/5jcercUtK2o+XrzNrL4UQ7yLZcFz6Bfwb/j6ICYvqd/YJwXNE6dwlL57OfwJyCdw2rRYf0/qI00t9u8Iitw==",
|
||||
);
|
||||
const decValue = await cryptoFunctionService.rsaDecrypt(data, privKey, "sha1");
|
||||
expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!");
|
||||
@@ -373,7 +373,7 @@ describe("WebCrypto Function Service", () => {
|
||||
const randomData = await cryptoFunctionService.randomBytes(16);
|
||||
const randomData2 = await cryptoFunctionService.randomBytes(16);
|
||||
expect(
|
||||
randomData.byteLength === randomData2.byteLength && randomData !== randomData2
|
||||
randomData.byteLength === randomData2.byteLength && randomData !== randomData2,
|
||||
).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -397,7 +397,7 @@ function testPbkdf2(
|
||||
algorithm: "sha256" | "sha512",
|
||||
regularKey: string,
|
||||
utf8Key: string,
|
||||
unicodeKey: string
|
||||
unicodeKey: string,
|
||||
) {
|
||||
const regularEmail = "user@example.com";
|
||||
const utf8Email = "üser@example.com";
|
||||
@@ -430,7 +430,7 @@ function testPbkdf2(
|
||||
Utils.fromUtf8ToArray(regularPassword),
|
||||
Utils.fromUtf8ToArray(regularEmail),
|
||||
algorithm,
|
||||
5000
|
||||
5000,
|
||||
);
|
||||
expect(Utils.fromBufferToB64(key)).toBe(regularKey);
|
||||
});
|
||||
@@ -440,7 +440,7 @@ function testHkdf(
|
||||
algorithm: "sha256" | "sha512",
|
||||
regularKey: string,
|
||||
utf8Key: string,
|
||||
unicodeKey: string
|
||||
unicodeKey: string,
|
||||
) {
|
||||
const ikm = Utils.fromB64ToArray("criAmKtfzxanbgea5/kelQ==");
|
||||
|
||||
@@ -477,7 +477,7 @@ function testHkdf(
|
||||
Utils.fromUtf8ToArray(regularSalt),
|
||||
Utils.fromUtf8ToArray(regularInfo),
|
||||
32,
|
||||
algorithm
|
||||
algorithm,
|
||||
);
|
||||
expect(Utils.fromBufferToB64(key)).toBe(regularKey);
|
||||
});
|
||||
@@ -487,7 +487,7 @@ function testHkdfExpand(
|
||||
algorithm: "sha256" | "sha512",
|
||||
b64prk: string,
|
||||
outputByteSize: number,
|
||||
b64ExpectedOkm: string
|
||||
b64ExpectedOkm: string,
|
||||
) {
|
||||
const info = "info";
|
||||
|
||||
@@ -497,7 +497,7 @@ function testHkdfExpand(
|
||||
Utils.fromB64ToArray(b64prk),
|
||||
info,
|
||||
outputByteSize,
|
||||
algorithm
|
||||
algorithm,
|
||||
);
|
||||
expect(Utils.fromBufferToB64(okm)).toBe(b64ExpectedOkm);
|
||||
});
|
||||
@@ -507,7 +507,7 @@ function testHash(
|
||||
algorithm: "sha1" | "sha256" | "sha512" | "md5",
|
||||
regularHash: string,
|
||||
utf8Hash: string,
|
||||
unicodeHash: string
|
||||
unicodeHash: string,
|
||||
) {
|
||||
const regularValue = "HashMe!!";
|
||||
const utf8Value = "HǻshMe!!";
|
||||
@@ -544,7 +544,7 @@ function testHmac(algorithm: "sha1" | "sha256" | "sha512", mac: string) {
|
||||
const computedMac = await cryptoFunctionService.hmac(
|
||||
Utils.fromUtf8ToArray("SignMe!!"),
|
||||
Utils.fromUtf8ToArray("secretkey"),
|
||||
algorithm
|
||||
algorithm,
|
||||
);
|
||||
expect(Utils.fromBufferToHex(computedMac)).toBe(mac);
|
||||
});
|
||||
@@ -558,7 +558,7 @@ function testHmacFast(algorithm: "sha1" | "sha256" | "sha512", mac: string) {
|
||||
const computedMac = await cryptoFunctionService.hmacFast(
|
||||
dataByteString,
|
||||
keyByteString,
|
||||
algorithm
|
||||
algorithm,
|
||||
);
|
||||
expect(Utils.fromBufferToHex(Utils.fromByteStringToArray(computedMac))).toBe(mac);
|
||||
});
|
||||
@@ -570,13 +570,13 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) {
|
||||
async () => {
|
||||
const cryptoFunctionService = getWebCryptoFunctionService();
|
||||
const keyPair = (await cryptoFunctionService.rsaGenerateKeyPair(length)).map(
|
||||
(k) => new Uint8Array(k)
|
||||
(k) => new Uint8Array(k),
|
||||
);
|
||||
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
|
||||
30000,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
password: string | Uint8Array,
|
||||
salt: string | Uint8Array,
|
||||
algorithm: "sha256" | "sha512",
|
||||
iterations: number
|
||||
iterations: number,
|
||||
): Promise<Uint8Array> {
|
||||
const wcLen = algorithm === "sha256" ? 256 : 512;
|
||||
const passwordBuf = this.toBuf(password);
|
||||
@@ -41,7 +41,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
passwordBuf,
|
||||
{ name: "PBKDF2" } as any,
|
||||
false,
|
||||
["deriveBits"]
|
||||
["deriveBits"],
|
||||
);
|
||||
const buffer = await this.subtle.deriveBits(pbkdf2Params as any, impKey, wcLen);
|
||||
return new Uint8Array(buffer);
|
||||
@@ -52,7 +52,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
salt: string | Uint8Array,
|
||||
iterations: number,
|
||||
memory: number,
|
||||
parallelism: number
|
||||
parallelism: number,
|
||||
): Promise<Uint8Array> {
|
||||
if (!this.wasmSupported) {
|
||||
throw "Webassembly support is required for the Argon2 KDF feature.";
|
||||
@@ -79,7 +79,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
salt: string | Uint8Array,
|
||||
info: string | Uint8Array,
|
||||
outputByteSize: number,
|
||||
algorithm: "sha256" | "sha512"
|
||||
algorithm: "sha256" | "sha512",
|
||||
): Promise<Uint8Array> {
|
||||
const saltBuf = this.toBuf(salt);
|
||||
const infoBuf = this.toBuf(info);
|
||||
@@ -103,7 +103,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
prk: Uint8Array,
|
||||
info: string | Uint8Array,
|
||||
outputByteSize: number,
|
||||
algorithm: "sha256" | "sha512"
|
||||
algorithm: "sha256" | "sha512",
|
||||
): Promise<Uint8Array> {
|
||||
const hashLen = algorithm === "sha256" ? 32 : 64;
|
||||
if (outputByteSize > 255 * hashLen) {
|
||||
@@ -136,7 +136,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
|
||||
async hash(
|
||||
value: string | Uint8Array,
|
||||
algorithm: "sha1" | "sha256" | "sha512" | "md5"
|
||||
algorithm: "sha1" | "sha256" | "sha512" | "md5",
|
||||
): Promise<Uint8Array> {
|
||||
if (algorithm === "md5") {
|
||||
const md = algorithm === "md5" ? forge.md.md5.create() : forge.md.sha1.create();
|
||||
@@ -148,7 +148,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
const valueBuf = this.toBuf(value);
|
||||
const buffer = await this.subtle.digest(
|
||||
{ name: this.toWebCryptoAlgorithm(algorithm) },
|
||||
valueBuf
|
||||
valueBuf,
|
||||
);
|
||||
return new Uint8Array(buffer);
|
||||
}
|
||||
@@ -156,7 +156,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
async hmac(
|
||||
value: Uint8Array,
|
||||
key: Uint8Array,
|
||||
algorithm: "sha1" | "sha256" | "sha512"
|
||||
algorithm: "sha1" | "sha256" | "sha512",
|
||||
): Promise<Uint8Array> {
|
||||
const signingAlgorithm = {
|
||||
name: "HMAC",
|
||||
@@ -238,7 +238,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
data: string,
|
||||
iv: string,
|
||||
mac: string,
|
||||
key: SymmetricCryptoKey
|
||||
key: SymmetricCryptoKey,
|
||||
): DecryptParameters<string> {
|
||||
const p = new DecryptParameters<string>();
|
||||
if (key.meta != null) {
|
||||
@@ -276,7 +276,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
aesDecryptFast(parameters: DecryptParameters<string>, mode: "cbc" | "ecb"): Promise<string> {
|
||||
const decipher = (forge as any).cipher.createDecipher(
|
||||
this.toWebCryptoAesMode(mode),
|
||||
parameters.encKey
|
||||
parameters.encKey,
|
||||
);
|
||||
const options = {} as any;
|
||||
if (mode === "cbc") {
|
||||
@@ -294,7 +294,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
data: Uint8Array,
|
||||
iv: Uint8Array,
|
||||
key: Uint8Array,
|
||||
mode: "cbc" | "ecb"
|
||||
mode: "cbc" | "ecb",
|
||||
): Promise<Uint8Array> {
|
||||
if (mode === "ecb") {
|
||||
// Web crypto does not support AES-ECB mode, so we need to do this in forge.
|
||||
@@ -314,7 +314,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
async rsaEncrypt(
|
||||
data: Uint8Array,
|
||||
publicKey: Uint8Array,
|
||||
algorithm: "sha1" | "sha256"
|
||||
algorithm: "sha1" | "sha256",
|
||||
): Promise<Uint8Array> {
|
||||
// Note: Edge browser requires that we specify name and hash for both key import and decrypt.
|
||||
// We cannot use the proper types here.
|
||||
@@ -330,7 +330,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
async rsaDecrypt(
|
||||
data: Uint8Array,
|
||||
privateKey: Uint8Array,
|
||||
algorithm: "sha1" | "sha256"
|
||||
algorithm: "sha1" | "sha256",
|
||||
): Promise<Uint8Array> {
|
||||
// Note: Edge browser requires that we specify name and hash for both key import and decrypt.
|
||||
// We cannot use the proper types here.
|
||||
@@ -440,7 +440,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
|
||||
try {
|
||||
if (typeof WebAssembly === "object" && typeof WebAssembly.instantiate === "function") {
|
||||
const module = new WebAssembly.Module(
|
||||
Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00)
|
||||
Uint8Array.of(0x0, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00),
|
||||
);
|
||||
if (module instanceof WebAssembly.Module) {
|
||||
return new WebAssembly.Instance(module) instanceof WebAssembly.Instance;
|
||||
|
||||
Reference in New Issue
Block a user