> var webCrypto = require('isomorphic-webcrypto');
undefined
> webCrypto.getRandomValues(new Uint8Array(100)).length
100
> webCrypto.getRandomValues(new Uint8Array(65536)).length
Thrown:
RangeError [ERR_OUT_OF_RANGE]: The value of "size" is out of range. It must be >= 0 && <= 2147483647. Received 4294967296
at assertSize (internal/crypto/random.js:36:11)
at Object.randomBytes (internal/crypto/random.js:48:10)
at Crypto.getRandomValues (/home/alx/ws/testWebCrypto/node_modules/@trust/webcrypto/src/Crypto.js:54:31)
at repl:1:11
at Script.runInThisContext (vm.js:123:20)
at REPLServer.defaultEval (repl.js:384:29)
at bound (domain.js:415:14)
at REPLServer.runBound [as eval] (domain.js:428:12)
at REPLServer.onLine (repl.js:700:10)
at REPLServer.emit (events.js:205:15)
Hello! Thanks for the great library!
Is this correct behavior, considering https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues (find
65536
)?