-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Should api be async? #32
Comments
I think this is a misunderstanding of how randomness is provided on modern systems. As I said in the other issue, that caveat from the manpages is misleading and has been removed and replaced with
The node docs pertaining to the linked issue say something similar:
That caveat appears to have been incorrect in older versions of electron, but that issue has apparently since been fixed, and does not reflect a fundamental issue with providing good randomness synchronously. As an aside, entropy doesn't really "become depleted" in any meaningful sense. |
Based on @bakkot's comments, it sounds like this isn't a real concern. Closing. |
I alluded to this in #31 (comment).
The issue here is that CSPRNGs require a certain amount of entropy, which is typically supplied from the underlying system (electrical noise, hamsters flipping coins... whatever) at a limited rate. If there is not enough entropy, or it becomes depleted, then either the random # source has to block until enough entropy is available, or produce values that aren't cryptographically secure. For example, from urandom Man page:
Also, this Real-world issue
Assuming this is a fundamental issue with any CSPRNG, then it may make sense to make this API async, so underlying implementations can insure RNG quality without blocking calls to this API.
The text was updated successfully, but these errors were encountered: