dchest / scrypt-async-js

Fast "async" scrypt implementation in JavaScript
http://dchest.github.io/scrypt-async-js/
BSD 2-Clause "Simplified" License
139 stars 26 forks source link

Make use of JS Promises #28

Closed Max13 closed 8 years ago

Max13 commented 8 years ago

At first: The least invasive changes. No indentation to make the "commit" readable. Secondly: Indentation cleanup.

Also, redondants tests are removed.

dchest commented 8 years ago

Sorry, this package was intended to be compatible even with the old IE versions, which is why it only uses typed arrays if it can detect their presence, otherwise it uses normal arrays. Promises are definitely a no-go for this, plus it's changing stable API for no reason.

Max13 commented 8 years ago

No problem, by chance, it's my needs so I will keep it forked. What about a helper? Would you accept a helper (pscrypt) which returns a Promise and doesn't touch the current API ?

dchest commented 8 years ago

It's just a few lines of code to convert this to Promise, so I don't think any helpers are required. (BTW, I'm working on a modern scrypt for JS as part of an open source cryptographic library, and it will indeed use promises.)

Also, promises won't allow us to create progress indicators — https://github.com/dchest/scrypt-async-js/issues/2 — but not sure if this feature will ever be implemented in this package.

Max13 commented 8 years ago

Fair enough. I’m waiting for your new implementation, I’m using this for now. Thx