From e8824c2c8ba6c16d82136de43fa00d636d8f73b1 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Wed, 18 Apr 2018 13:43:42 -0400 Subject: [PATCH] lint spec dir --- package.json | 4 ++-- spec/helpers.ts | 1 + spec/node/services/nodeCryptoFunction.service.spec.ts | 1 - src/services/nodeCryptoFunction.service.ts | 2 +- src/services/webCryptoFunction.service.ts | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 70467a5948..4253d44df9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/spec/helpers.ts b/spec/helpers.ts index a60a7a6673..29367d7b99 100644 --- a/spec/helpers.ts +++ b/spec/helpers.ts @@ -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()); diff --git a/spec/node/services/nodeCryptoFunction.service.spec.ts b/spec/node/services/nodeCryptoFunction.service.spec.ts index 22be44efee..e860be7126 100644 --- a/spec/node/services/nodeCryptoFunction.service.spec.ts +++ b/spec/node/services/nodeCryptoFunction.service.spec.ts @@ -59,4 +59,3 @@ function makeStaticByteArray(length: number) { } return arr; } - diff --git a/src/services/nodeCryptoFunction.service.ts b/src/services/nodeCryptoFunction.service.ts index 6f5bb9499d..9847ff198d 100644 --- a/src/services/nodeCryptoFunction.service.ts +++ b/src/services/nodeCryptoFunction.service.ts @@ -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); } } diff --git a/src/services/webCryptoFunction.service.ts b/src/services/webCryptoFunction.service.ts index 04de7af331..02351016c5 100644 --- a/src/services/webCryptoFunction.service.ts +++ b/src/services/webCryptoFunction.service.ts @@ -19,14 +19,14 @@ export class WebCryptoFunctionService implements CryptoFunctionService { async pbkdf2(password: string | ArrayBuffer, salt: string | ArrayBuffer, algorithm: 'sha256' | 'sha512', iterations: number): Promise { 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 {