bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
92 stars 55 forks source link

feat: add Uint8Array input type support to v1 #140

Closed ChALkeR closed 6 hours ago

ChALkeR commented 6 hours ago

Currently:

This PR makes v1 support any Uint8Array instances (including Buffer instances) as input, while still returning Buffer instances

In a case when several libs in the same project use tiny-secp256k1, while one creates the keys and the other one uses it, this will unblock the migration to v2 for the one creating the keys and will allow v1/v2 to coexist, easing the migration path to v2 (or to any other implementation that implements an Uint8Array-based API)

Existing tests work, new tests are added that wrap the existing testsuite and transform Buffer to Uint8Array as input

junderw commented 6 hours ago

Tested locally. Both npm test and npm run test-browser work fine.

Thanks a ton!