-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
Closed
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.
Description
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.
Metadata
Metadata
Assignees
Labels
cryptoIssues and PRs related to the crypto subsystem.Issues and PRs related to the crypto subsystem.discussIssues opened for discussions and feedbacks.Issues opened for discussions and feedbacks.