Skip to content
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

Suggestion: Support HEX prefix on private keys #86

Open
sondreb opened this issue Apr 3, 2021 · 0 comments
Open

Suggestion: Support HEX prefix on private keys #86

sondreb opened this issue Apr 3, 2021 · 0 comments

Comments

@sondreb
Copy link

sondreb commented Apr 3, 2021

The .from method on Secp256k1KeyPair takes an option argument that can be privateKeyHex. If this provided value is prefixed with '0x' then the method fails without any errors and simply generates a key pair without the private key.

The change could be applied here (and probably other places where the keys as HEX is allowed):

export const privateKeyBase58FromPrivateKeyHex = (privateKeyHex: string) => {

Could be handled with something like this:

privateKeyHex = privateKeyHex.startsWith('0x') ? privateKeyHex.substring(2) : privateKeyHex;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant