fix unreachable code

This commit is contained in:
Kyle Spearrin 2018-06-13 17:06:09 -04:00
parent 0429c0557b
commit 6aa922f380
1 changed files with 6 additions and 3 deletions

View File

@ -268,15 +268,18 @@ export class CryptoService implements CryptoServiceAbstraction {
async makeEncKey(key: SymmetricCryptoKey): Promise<CipherString> { async makeEncKey(key: SymmetricCryptoKey): Promise<CipherString> {
const encKey = await this.cryptoFunctionService.randomBytes(64); const encKey = await this.cryptoFunctionService.randomBytes(64);
// TODO: remove false/true flags when we're ready to enable key stretching // TODO: Uncomment when we're ready to enable key stretching
if (false && key.key.byteLength === 32) { return this.encrypt(encKey, key);
/*
if (key.key.byteLength === 32) {
const newKey = await this.stretchKey(key); const newKey = await this.stretchKey(key);
return this.encrypt(encKey, newKey); return this.encrypt(encKey, newKey);
} else if (true || key.key.byteLength === 64) { } else if (key.key.byteLength === 64) {
return this.encrypt(encKey, key); return this.encrypt(encKey, key);
} else { } else {
throw new Error('Invalid key size.'); throw new Error('Invalid key size.');
} }
*/
} }
async stretchKey(key: SymmetricCryptoKey): Promise<SymmetricCryptoKey> { async stretchKey(key: SymmetricCryptoKey): Promise<SymmetricCryptoKey> {