1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-06 00:13:28 +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:
renovate[bot]
2023-11-29 16:15:20 -05:00
committed by GitHub
parent 4ff5f38e89
commit 28de9439be
1145 changed files with 5898 additions and 5612 deletions

View File

@@ -82,7 +82,7 @@ describe("NodeCrypto Function Service", () => {
prk32Byte,
64,
"BnIqJlfnHm0e/2iB/15cbHyR19ARPIcWRp4oNS22CD9BV+" +
"/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA=="
"/queOZenPNkDhmlVyL2WZ3OSU5+7ISNF5NhNfvZA==",
);
testHkdfExpand("sha512", prk64Byte, 32, "uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlk=");
testHkdfExpand(
@@ -90,7 +90,7 @@ describe("NodeCrypto Function Service", () => {
prk64Byte,
64,
"uLWbMWodSBms5uGJ5WTRTesyW+MD7nlpCZvagvIRXlkY5Pv0sB+" +
"MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w=="
"MqvaopmkC6sD/j89zDwTV9Ib2fpucUydO8w==",
);
it("should fail with prk too small", async () => {
@@ -99,7 +99,7 @@ describe("NodeCrypto Function Service", () => {
Utils.fromB64ToArray(prk16Byte),
"info",
32,
"sha256"
"sha256",
);
await expect(f).rejects.toEqual(new Error("prk is too small."));
});
@@ -110,7 +110,7 @@ describe("NodeCrypto Function Service", () => {
Utils.fromB64ToArray(prk32Byte),
"info",
8161,
"sha256"
"sha256",
);
await expect(f).rejects.toEqual(new Error("outputByteSize is too large."));
});
@@ -252,7 +252,7 @@ describe("NodeCrypto 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 nodeCryptoFunctionService.rsaDecrypt(data, privKey, "sha1");
expect(Utils.fromBufferToUtf8(decValue)).toBe("EncryptMe!");
@@ -289,7 +289,7 @@ describe("NodeCrypto Function Service", () => {
const randomData = await nodeCryptoFunctionService.randomBytes(16);
const randomData2 = await nodeCryptoFunctionService.randomBytes(16);
expect(
randomData.byteLength === randomData2.byteLength && randomData !== randomData2
randomData.byteLength === randomData2.byteLength && randomData !== randomData2,
).toBeTruthy();
});
});
@@ -308,7 +308,7 @@ function testPbkdf2(
algorithm: "sha256" | "sha512",
regularKey: string,
utf8Key: string,
unicodeKey: string
unicodeKey: string,
) {
const regularEmail = "user@example.com";
const utf8Email = "üser@example.com";
@@ -341,7 +341,7 @@ function testPbkdf2(
Utils.fromUtf8ToArray(regularPassword),
Utils.fromUtf8ToArray(regularEmail),
algorithm,
5000
5000,
);
expect(Utils.fromBufferToB64(key)).toBe(regularKey);
});
@@ -351,7 +351,7 @@ function testHkdf(
algorithm: "sha256" | "sha512",
regularKey: string,
utf8Key: string,
unicodeKey: string
unicodeKey: string,
) {
const ikm = Utils.fromB64ToArray("criAmKtfzxanbgea5/kelQ==");
@@ -388,7 +388,7 @@ function testHkdf(
Utils.fromUtf8ToArray(regularSalt),
Utils.fromUtf8ToArray(regularInfo),
32,
algorithm
algorithm,
);
expect(Utils.fromBufferToB64(key)).toBe(regularKey);
});
@@ -398,7 +398,7 @@ function testHkdfExpand(
algorithm: "sha256" | "sha512",
b64prk: string,
outputByteSize: number,
b64ExpectedOkm: string
b64ExpectedOkm: string,
) {
const info = "info";
@@ -408,7 +408,7 @@ function testHkdfExpand(
Utils.fromB64ToArray(b64prk),
info,
outputByteSize,
algorithm
algorithm,
);
expect(Utils.fromBufferToB64(okm)).toBe(b64ExpectedOkm);
});
@@ -418,7 +418,7 @@ function testHash(
algorithm: "sha1" | "sha256" | "sha512" | "md5",
regularHash: string,
utf8Hash: string,
unicodeHash: string
unicodeHash: string,
) {
const regularValue = "HashMe!!";
const utf8Value = "HǻshMe!!";
@@ -514,7 +514,7 @@ function testRsaGenerateKeyPair(length: 1024 | 2048 | 4096) {
const publicKey = await cryptoFunctionService.rsaExtractPublicKey(keyPair[1]);
expect(Utils.fromBufferToB64(keyPair[0])).toBe(Utils.fromBufferToB64(publicKey));
},
30000
30000,
);
}

View File

@@ -14,7 +14,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
password: string | Uint8Array,
salt: string | Uint8Array,
algorithm: "sha256" | "sha512",
iterations: number
iterations: number,
): Promise<Uint8Array> {
const len = algorithm === "sha256" ? 32 : 64;
const nodePassword = this.toNodeValue(password);
@@ -35,7 +35,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
salt: string | Uint8Array,
iterations: number,
memory: number,
parallelism: number
parallelism: number,
): Promise<Uint8Array> {
const nodePassword = this.toNodeValue(password);
const nodeSalt = this.toNodeBuffer(this.toUint8Buffer(salt));
@@ -58,7 +58,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
salt: string | Uint8Array,
info: string | Uint8Array,
outputByteSize: number,
algorithm: "sha256" | "sha512"
algorithm: "sha256" | "sha512",
): Promise<Uint8Array> {
const saltBuf = this.toUint8Buffer(salt);
const prk = await this.hmac(ikm, saltBuf, algorithm);
@@ -70,7 +70,7 @@ export class NodeCryptoFunctionService 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) {
@@ -103,7 +103,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
hash(
value: string | Uint8Array,
algorithm: "sha1" | "sha256" | "sha512" | "md5"
algorithm: "sha1" | "sha256" | "sha512" | "md5",
): Promise<Uint8Array> {
const nodeValue = this.toNodeValue(value);
const hash = crypto.createHash(algorithm);
@@ -114,7 +114,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
hmac(
value: Uint8Array,
key: Uint8Array,
algorithm: "sha1" | "sha256" | "sha512"
algorithm: "sha1" | "sha256" | "sha512",
): Promise<Uint8Array> {
const nodeValue = this.toNodeBuffer(value);
const nodeKey = this.toNodeBuffer(key);
@@ -145,7 +145,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
hmacFast(
value: Uint8Array,
key: Uint8Array,
algorithm: "sha1" | "sha256" | "sha512"
algorithm: "sha1" | "sha256" | "sha512",
): Promise<Uint8Array> {
return this.hmac(value, key, algorithm);
}
@@ -167,7 +167,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
data: string,
iv: string,
mac: string,
key: SymmetricCryptoKey
key: SymmetricCryptoKey,
): DecryptParameters<Uint8Array> {
const p = new DecryptParameters<Uint8Array>();
p.encKey = key.encKey;
@@ -191,7 +191,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
async aesDecryptFast(
parameters: DecryptParameters<Uint8Array>,
mode: "cbc" | "ecb"
mode: "cbc" | "ecb",
): Promise<string> {
const decBuf = await this.aesDecrypt(parameters.data, parameters.iv, parameters.encKey, mode);
return Utils.fromBufferToUtf8(decBuf);
@@ -201,7 +201,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
data: Uint8Array,
iv: Uint8Array,
key: Uint8Array,
mode: "cbc" | "ecb"
mode: "cbc" | "ecb",
): Promise<Uint8Array> {
const nodeData = this.toNodeBuffer(data);
const nodeIv = mode === "ecb" ? null : this.toNodeBuffer(iv);
@@ -214,7 +214,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
rsaEncrypt(
data: Uint8Array,
publicKey: Uint8Array,
algorithm: "sha1" | "sha256"
algorithm: "sha1" | "sha256",
): Promise<Uint8Array> {
if (algorithm === "sha256") {
throw new Error("Node crypto does not support RSA-OAEP SHA-256");
@@ -228,7 +228,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
rsaDecrypt(
data: Uint8Array,
privateKey: Uint8Array,
algorithm: "sha1" | "sha256"
algorithm: "sha1" | "sha256",
): Promise<Uint8Array> {
if (algorithm === "sha256") {
throw new Error("Node crypto does not support RSA-OAEP SHA-256");
@@ -274,7 +274,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
const privateKey = Utils.fromByteStringToArray(privateKeyByteString);
resolve([publicKey, privateKey]);
}
},
);
});
}