bitcoinjs-lib icon indicating copy to clipboard operation
bitcoinjs-lib copied to clipboard

Migrate from Buffer to native Uint8Array

Open tiero opened this issue 2 years ago • 2 comments
trafficstars

Since Buffer is a subclass of Uint8Array, is there any plans to migrate the library to use them to have native support in browsers without polyfills? https://nodejs.dev/en/api/v18/buffer/

tiero avatar Dec 15 '22 14:12 tiero

This would be a good feature. I might work on it, if others think this is necessary.

ChrisCho-H avatar Jan 05 '24 01:01 ChrisCho-H

Feel free to work on it.

I think the biggest hold out is bip174 which might be tough.

I made a few tools in uint8array-tools (we use them in tiny-secp256k1) that can help with some of the Buffer APIs we use. You can add more tools to that if needed.

Switching away from Buffers should probably be a major version bump, and I think we can also move OPS to enum etc.

Whatever you want to work on, feel free.

If you have questions, asking here is fine. I am also available on Matrix (see the README)

junderw avatar Jan 05 '24 03:01 junderw