You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reproduced on Node.js 8.4 on Mac and 8.2 on Linux.
Currently, we show the following error when crypto.randomBytes is called with a non-integer:
> crypto.randomBytes(19660.79999999999)
TypeError: size must be a number >= 0
at TypeError (native)
Which is confusing, since it is in fact a number bigger than 0.
To add to the confusion, we ran into this issue myself when using a third party package (myspeed) using another package (noisegen) that did division that should probably have been an integer number but wasn't.
We should either:
Fix the error message
Fix the API to accept a non-integer. By changing the check to check if a number is passed and coerce it to a UInt32. Personally I'm in favor of that.
Pinging @nodejs/crypto and @mrbar42 who discovered this
Would love it if some people weighed in.
The text was updated successfully, but these errors were encountered:
This change adds the ability to pass a double into randomBytes.
PR-URL: nodejs/node#15130Fixes: nodejs/node#15118
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reproduced on Node.js 8.4 on Mac and 8.2 on Linux.
Currently, we show the following error when
crypto.randomBytes
is called with a non-integer:Which is confusing, since it is in fact a number bigger than 0.
To add to the confusion, we ran into this issue myself when using a third party package (myspeed) using another package (noisegen) that did division that should probably have been an integer number but wasn't.
We should either:
Pinging @nodejs/crypto and @mrbar42 who discovered this
Would love it if some people weighed in.
The text was updated successfully, but these errors were encountered: