-
Notifications
You must be signed in to change notification settings - Fork 31
feat: decouple ecpair from tiny-secp256k1 (allow injecting ecc lib) #4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: decouple ecpair from tiny-secp256k1 (allow injecting ecc lib) #4
Conversation
…the needed ECC lib - no functional changes have been made (only refactoring) - TinySecp256k1Interface follows the "tiny-secp256k1" version 1.1.6 of the interface - tiny-secp256k1 moved to dev dependencies - fromXXX() functions declare as return type the `ECPairInterface` instead of the `ECPair` class - `ECPair` class is no longer exported
Signer and SignerAsync are interfaces that are being used in bitcoinjs-lib in Psbt etc... so adding more constraints would be a breaking change and we don't want to do that. Right now, just leave those interfaces alone. Once proper taproot is supported, we will probably add a new interface for schnorr. |
linter is failing... (tslint should exclude test files tbh) |
Updated:
|
Please remove |
Done! |
README.md
Outdated
const tinysecp = require('tiny-secp256k1'); | ||
const ECPair: ECPairAPI = ECPairFactory(tinysecp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ECPairAPI
is not imported.
Also, I think you want to put const tinysecp: TinySecp256k1Interface = ...
LGTM other than the README stuff. |
Great! |
Thanks a ton. Published as 2.0.0 |
Closes: #3
Summary
bip32
ecpair
fromtiny-secp256k1
ecc
lib must be provided by the consumer ofecpair
(see tests for details)TinySecp256k1Interface
interface only exposes the methods required byecpair
testecc.ts
checks the methos ofTinySecp256k1Interface
ECPair
is no longer directly exported, but insteadECPairInterface
is exposedsignSchnorr()
andverifySchnorr()
have been addedThe changes are split in 4 commits which can be cherry picked if needed.
Further comments
SignerAsync
is usedsignSchnorr()
- has been added to this interface