self.crypto
This commit is contained in:
parent
5022ebef3e
commit
f4430c5f08
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -425,7 +425,7 @@ function randBytes (byteLength, forceLength = false) {
|
||||||
{ // browser
|
{ // browser
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
const buf = new Uint8Array(byteLength)
|
const buf = new Uint8Array(byteLength)
|
||||||
crypto.getRandomValues(buf)
|
self.crypto.getRandomValues(buf)
|
||||||
// If fixed length is required we put the first bit to 1 -> to get the necessary bitLength
|
// If fixed length is required we put the first bit to 1 -> to get the necessary bitLength
|
||||||
if (forceLength) buf[0] = buf[0] | 128
|
if (forceLength) buf[0] = buf[0] | 128
|
||||||
resolve(buf)
|
resolve(buf)
|
||||||
|
|
Loading…
Reference in New Issue