Closed dappelt closed 6 years ago
else resolve(buf.readUInt32BE(0))? Or would trying to resolve the promise fail silently if it's already rejected?
Should be ok without else. Whatever is called first of resolve/reject will be the result of the promise, see https://jsfiddle.net/0y5ovcwp/1/
... and resolve(buf.readUInt32BE(0)
fails silently if reject() was called before.
The synchronous version of crypto.randomBytes() is also used in ilp3/lib/psk.js
That's not used in the connector though
On Tue, Nov 28, 2017, 5:42 AM dappelt notifications@github.com wrote:
The synchronous version of crypto.randomBytes() is also used in ilp3/lib/psk.js
— You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub https://github.com/emschwartz/ilp3/issues/6#issuecomment-347483512, or mute the thread https://github.com/notifications/unsubscribe-auth/ADHIkk1D18c4rRIng6CN00uTcKSiVbZgks5s6-OIgaJpZM4QrlTg .
--
Evan Schwartz Software Engineer
In edge cases, crypto.randomBytes() will take longer to complete, which would make your connector unresponsive. Excerpt from the node docs:
It's better to be on the safe side and call .randomBytes() asynchronically. Here is a snippet: