-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add ECPair.toUncheckedHex() and ECPair.fromUncheckedHex(hex, network, compressed) #1077
Conversation
NACK, already in #1070 |
The motivation of this PR is to encapsulate initialization from hex. It looks like #1070 does not permit a caller to initialize an ECPair from a hex string without using BitcoinJS's internal Buffer class. Please correct me if I'm wrong. Otherwise I think initializing from unchecked hex should be added and I can make the PR off of #1070 if you agree? |
@woodser |
I've been reading through #1070. If I understand correctly, ECPair is going to accept a buffer as its first constructor argument, and the way to get the hexadecimal private key will be The hex will not be padded so it may contain fewer than 64 characters for some private keys, such as this LTC private key: T34MuTEaRxt3kj6dn2MMHbvSPQHrsBjKrdz6WtwrLe1KzCzYkMup. Shouldn't it be padded to conform to 64 characters? Also, is Thanks. |
Lines 51 to 57 in d7eb6c8
Note specifically Line 52 in d7eb6c8
|
That is what we did previously 👍 |
Ok, thanks! |
This PR adds the ability to get the private key as unchecked hex (without network or compression information) and initialize a new ECPair from unchecked hex, network, and compression.
This is helpful to minimize the encoded data for encryption and splitting with Shamir's Secret Sharing which is why other libraries usually offer this in their API.
I'm using this API in the CryptoStorage tool here and here.