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
+2 -2
View File
@@ -1,7 +1,7 @@
// Copyright 2017-2020 @polkadot/util-crypto authors & contributors
// SPDX-License-Identifier: Apache-2.0
import nacl from 'tweetnacl';
import getRandomValues from '@polkadot/x-randomvalues';
/**
* @name randomAsU8a
@@ -18,5 +18,5 @@ import nacl from 'tweetnacl';
* ```
*/
export default function randomAsU8a (length = 32): Uint8Array {
return nacl.randomBytes(length);
return getRandomValues(new Uint8Array(length));
}