Bump wasm-crypto (#745)

* Bump wasm-crypto

* Use x-randomvalues for randomAsU8a
This commit is contained in:
Jaco Greeff
2020-11-07 11:18:06 +01:00
committed by GitHub
parent aef8003d50
commit d751c03d45
11 changed files with 184 additions and 105 deletions
+12
View File
@@ -0,0 +1,12 @@
// Copyright 2017-2020 @polkadot/x-randomvalues authors & contributors
// SPDX-License-Identifier: Apache-2.0
import crypto from 'crypto';
export default function getRandomValues <T extends Uint8Array> (arr: T): T {
return crypto.randomBytes(arr.length).reduce((arr, value, index) => {
arr[index] = value;
return arr;
}, arr);
}