urbit / urbit-key-generation

Key derivation and HD wallet generation functions for Urbit
MIT License
15 stars 8 forks source link

Prune dependencies #40

Closed jtobin closed 5 years ago

jtobin commented 5 years ago

Resolves #39.

This mainly just replaces the unnecessary and bloated-feeling ethereumjs-util with the specific things we need from it: keccak and secp256k1. Additionally it feels better to swap the hdkey dependency for the more-standard bip32 (which we used previously).

Surprisingly I can't find a better single alternative to replace what we currently use isomorphic-webcrypto (SHA-256) and tweetnacl (SHA-512, Ed25519) for. tweetnacl, unlike plain-old nacl, doesn't implement a SHA-256 function. Meanwhile, isomorphic-webcrypto exports both SHA-256 and SHA-512, but doesn't implement Ed25519.

I also checked sjcl, the Stanford Javascript Crypto Library, which implements SHA-256 and Ed25519. But that inexplicably doesn't export SHA-512, even though there's an implementation in the library itself. So, I guess we'll stick with two 'comprehensive' crypto dependencies for the time being.