bitcoinjs / bip38

BIP38 is a standard process to encrypt Bitcoin and crypto currency private keys that is less susceptible to brute force attacks thus protecting the user.
http://cryptocoinjs.com/modules/currency/bip38/
MIT License
206 stars 100 forks source link

Add asynchronous support #41

Closed woodser closed 4 years ago

woodser commented 6 years ago

BIP38 encryption should really be asynchronous. Otherwise the browser blocks and the user does not receive progress updates until after a key is fully encrypted.

I've implemented asynchronous support bip38 and scryptsy here and here for consideration.

junderw commented 5 years ago
  1. Your modifications look good (besides adding the gitignore stuff)
  2. You should make a pull request to scryptsy with an additional Async method (instead of replacing it)
  3. imo, result callbacks should just return promises, and since v8 is the oldest LTS still supported, switching to async / await would be reasonable IMO.

That being said. BIP38 is discouraged for implementation, so spending a lot of time on it is not priority. Though I would be open to adding async to it if you can get async merged in scryptsy. (I don't have merge rights there)

junderw commented 5 years ago

Made an async pull request for scryptsy https://github.com/cryptocoinjs/scryptsy/pull/13

junderw commented 5 years ago

It was merged and published in 2.1.0

I can start working on this.

junderw commented 5 years ago

Fair warning though... using async on scryptsy decreases performance. (we didn't get some sort of C implementation or WASM or something, we just added await promise setImmediate)

junderw commented 5 years ago

WIP that currently has all tests passing for Async methods (does not mean it's safe) is #50

Let me know if you have any questions and can help review.

junderw commented 4 years ago

3.1.0 published