bitcoinjs / tiny-secp256k1

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

ecc library invalid #136

Open bucko13 opened 2 months ago

bucko13 commented 2 months ago

I'm trying to use this to init bitcoinjs-lib. When running in a test (see #62) I get an error : ecc library invalid.

Versions:

tiny-secp256k1@2.2.3
bitcoinjs-lib@6.1.5

When digging in to this a little, I was able to get the validation to pass by changing the isUint8Array function. If that becomes a no_op then the rest of the validations pass. If I change it to:

function isUint8Array(value) {
    return value instanceof Buffer
}

it passes.

It's possible there's some weird polyfill going on in my environment which is why it's passing for some and not others. That said, when looking at the validation in bitcoinjs-lib (which maybe this should be filed there?) it does convert a point hex to a Buffer but then the validation library here checks to see if it's an instance of Uint8Array.