v1 supports Buffer instances as input and returns Buffer instances as output
v2 supports any Uint8Array instances (including Buffer instances) as input and returns Uint8Array
v1 has 148k downloads/week, v2 has 38k downloads/week
i.e. 80% of usage is on v1
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
Currently:
Buffer
instances as input and returnsBuffer
instances as outputUint8Array
instances (includingBuffer
instances) as input and returnsUint8Array
This PR makes v1 support any
Uint8Array
instances (includingBuffer
instances) as input, while still returningBuffer
instancesIn 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