mirror of
https://github.com/bitwarden/browser.git
synced 2024-12-24 16:49:26 +01:00
lint spec dir
This commit is contained in:
parent
2f76550d3e
commit
e8824c2c8b
@ -16,8 +16,8 @@
|
||||
"prebuild": "rimraf dist/**/*",
|
||||
"build": "tsc",
|
||||
"build:watch": "tsc -watch",
|
||||
"lint": "tslint src/**/*.ts || true",
|
||||
"lint:fix": "tslint src/**/*.ts --fix",
|
||||
"lint": "tslint src/**/*.ts spec/**/*.ts || true",
|
||||
"lint:fix": "tslint src/**/*.ts spec/**/*.ts --fix",
|
||||
"test": "karma start ./spec/support/karma.conf.js --single-run",
|
||||
"test:watch": "karma start ./spec/support/karma.conf.js",
|
||||
"test:node": "npm run build && jasmine",
|
||||
|
@ -1,3 +1,4 @@
|
||||
// tslint:disable-next-line
|
||||
const TSConsoleReporter = require('jasmine-ts-console-reporter');
|
||||
jasmine.getEnv().clearReporters(); // Clear default console reporter
|
||||
jasmine.getEnv().addReporter(new TSConsoleReporter());
|
||||
|
@ -59,4 +59,3 @@ function makeStaticByteArray(length: number) {
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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> {
|
||||
|
Loading…
Reference in New Issue
Block a user