1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-20 18:23:31 +00:00

node crypto aes implementations

This commit is contained in:
Kyle Spearrin
2018-04-18 08:50:02 -04:00
parent 866de1278f
commit 172f2de4ff
2 changed files with 50 additions and 8 deletions

View File

@@ -102,10 +102,10 @@ export class WebCryptoFunctionService implements CryptoFunctionService {
return await this.subtle.decrypt({ name: 'AES-CBC', iv: iv }, impKey, data);
}
randomBytes(length: number): ArrayBuffer {
randomBytes(length: number): Promise<ArrayBuffer> {
const arr = new Uint8Array(length);
this.crypto.getRandomValues(arr);
return arr.buffer;
return Promise.resolve(arr.buffer);
}
private toBuf(value: string | ArrayBuffer): ArrayBuffer {