urbit / urbit-key-generation

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

Bundling with Parcel fails #62

Closed shrugs closed 5 years ago

shrugs commented 5 years ago

When bundling within a Parcel/typescript project, the isomorphic-crypto import is actually under crypto.default, not the top-level crypto import, so references to it return undefined. I expect this is because it treats the dependency as a modern es6 module rather than a commonjs require (or something like that, i don't really understand JS anyway).

Anyway, importing the urbit-key-generation/dist is a fine stopgap for now.

jtobin commented 5 years ago

isomorphic-webcrypto is a weird dependency that's really only in our library for legacy reasons. Its SHA-256 implementation is asynchronous for some reason, which never sat well with me.

I pushed up a branch that axes isomorphic-webcrypto and replaces it with js-sha256. Want to try using it with your Parcel build and see if it works any better?

(I'll probably wind up merging this in anyway, as the latter library seems superior here.)

shrugs commented 5 years ago

Confirmed working on my end (and feels faster, just maybe?). Check it out at https://github.com/shrugs/azid / https://azid.shrugs.now.sh

jtobin commented 5 years ago

Sweet, I'll merge it in and push a release. And your project looks great!