1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 01:03:35 +00:00

refactor crypto service to use crypto functions

This commit is contained in:
Kyle Spearrin
2018-04-21 23:14:04 -04:00
parent cda2814192
commit fc1114a6bd
15 changed files with 211 additions and 329 deletions

View File

@@ -32,7 +32,7 @@ export class NodeCryptoFunctionService implements CryptoFunctionService {
hmac(value: ArrayBuffer, key: ArrayBuffer, algorithm: 'sha1' | 'sha256' | 'sha512'): Promise<ArrayBuffer> {
const nodeValue = this.toNodeBuffer(value);
const nodeKey = this.toNodeBuffer(value);
const nodeKey = this.toNodeBuffer(key);
const hmac = crypto.createHmac(algorithm, nodeKey);
hmac.update(nodeValue);
return Promise.resolve(this.toArrayBuffer(hmac.digest()));