1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-17 08:43:33 +00:00

lint spec dir

This commit is contained in:
Kyle Spearrin
2018-04-18 13:43:42 -04:00
parent 2f76550d3e
commit e8824c2c8b
5 changed files with 8 additions and 8 deletions

View File

@@ -79,6 +79,6 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
}
private toNodeBuffer(value: ArrayBuffer): Buffer {
return Buffer.from(new Uint8Array(value) as any);;
return Buffer.from(new Uint8Array(value) as any);
}
}

View File

@@ -19,14 +19,14 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
async pbkdf2(password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512',
iterations: number): Promise<ArrayBuffer> {
if (this.isEdge) {
const len = algorithm === 'sha256' ? 32 : 64;
const forgeLen = algorithm === 'sha256' ? 32 : 64;
const passwordBytes = this.toByteString(password);
const saltBytes = this.toByteString(salt);
const derivedKeyBytes = (forge as any).pbkdf2(passwordBytes, saltBytes, iterations, len, algorithm);
const derivedKeyBytes = (forge as any).pbkdf2(passwordBytes, saltBytes, iterations, forgeLen, algorithm);
return this.fromByteStringToBuf(derivedKeyBytes);
}
const len = algorithm === 'sha256' ? 256 : 512;
const wcLen = algorithm === 'sha256' ? 256 : 512;
const passwordBuf = this.toBuf(password);
const saltBuf = this.toBuf(salt);
@@ -38,7 +38,7 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
};
const impKey = await this.subtle.importKey('raw', passwordBuf, { name: 'PBKDF2' }, false, ['deriveBits']);
return await window.crypto.subtle.deriveBits(alg, impKey, len);
return await window.crypto.subtle.deriveBits(alg, impKey, wcLen);
}
async hash(value: string | ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512'): Promise<ArrayBuffer> {