bip32 icon indicating copy to clipboard operation
bip32 copied to clipboard

Refactor code to use Uint8Array instead of Buffer

Open pajasevi opened this issue 2 years ago • 3 comments

This PR is a refactor of the code to use Uint8Arrays instead of Buffer, which would basically make this library usable in the browser without any polyfill for Node.js internals.

I've had an issue with extending typeforce (due to no support for Uint8Array), which is IMO outdated library which doesn't have ES6 support, doesn't even translate type safety to Typescript and is very hard to extend properly. I would be in favor of getting rid of it and using custom type guards instead but didn't want to inlude such change yet in this PR.

I am aware of the fact that this change might warrant releasing a major version of the library but that is unavoidable in this case.

Let me know what you think and we can discuss

pajasevi avatar Jan 06 '24 21:01 pajasevi

Failing coverage check is apparently caused by the file/code used for typeforce extension. Suggestions?

pajasevi avatar Jan 06 '24 22:01 pajasevi

I've given up trying to update typeforce. Please let me know what you think about well maintained libraries we can use that are easy to audit and meet requirements. (ie. doesn't trigger unsafe-eval, doesn't cause issues with browsers etc.)

https://github.com/bitcoinjs/bitcoinjs-lib/issues/2030

junderw avatar Jan 06 '24 22:01 junderw

Hi @junderw. I don't want to sound pushy or anything because I know you are very busy and the whole bitcoinjs ecosystem is very complex. I just wanted to ask for a possible ETA of having this merged? Months maybe?

The discussion in https://github.com/bitcoinjs/bitcoinjs-lib/issues/2030 did not really have any conclusion.

What can I do to help? Would it help if I implemented Typia or zod typechecks in a separate PR, for this repo?

pajasevi avatar Mar 06 '24 23:03 pajasevi