-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add example for using in production #1239
Conversation
Maybe we can force |
The address.js is test script. And it is example for using the library. I mean remove "rng" function for using it in real code. |
@dcousens I agree. Adding more comments probably won't help a person who copy pastes without understanding what's going on. Adding logic to prevent rng setting would be good. IMO, this should be something like: } while (!ecc.isPrivate(d))
if (typeof global.it !== 'function' &&
d.equals(Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'))) {
throw new Error('DO NOT COPY PASTE THE EXAMPLE RNG FROM TESTS!!!')
}
return fromPrivateKey(d, options) |
We put it in the |
Finding default value of rng attribute doesn't take much time, but I used my time for searching it. It will be nice if there's an comments in testcode like this PR. |
In case someone copy pastes, instead of getting a dangerous key, they will get a random key, and a console error.
Why not throw, don't encourage copy pasting |
Because I have seen copy-pasters in action, and they will:
That said, maybe there's a better way... But sitting around thinking of the ways someone can shoot themselves in the foot seems less productive then making sure the gun they use only shoots nerf foam darts... I'll make another PR with another suggestion that:
|
No description provided.