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

feat: export normalizePrivateKey #10

Merged

Conversation

SergeyVolynkin
Copy link
Contributor

Hi @paulmillr, thank you for the effort you put into this library!

Would it be possible to export normPrivKey on the npm package?
We plan to use it for account derivation logic with grindKey which does not always result in a padded private key.

@paulmillr
Copy link
Owner

Can you export it as normalizePrivateKey?

@SergeyVolynkin
Copy link
Contributor Author

SergeyVolynkin commented Jul 20, 2024

@paulmillr renamed the exported function to normalizePrivateKey in e9e1bb7

Please let me know if you'd prefer the export alias solution instead:

export { normPrivateKey as normalizePrivateKey };
function normPrivateKey(privKey: Hex): string {
  return u.bytesToHex(ensureBytes(privKey)).padStart(64, '0');
}

@paulmillr
Copy link
Owner

Please also add some kind of test. It can be basic, like, 1-3 lines of code.

And fix failing CI.

@SergeyVolynkin SergeyVolynkin changed the title feat: export normPrivKey feat: export normalizePrivateKey Jul 21, 2024
@SergeyVolynkin
Copy link
Contributor Author

Thank you @paulmillr

  1. Added test
  2. Opened fix: resolve TS warning after upgrade to "typescript": "5.5.2" #11 to fix CI, as it fails for unrelated change (started to fail after TS upgrade to v5.5

@paulmillr paulmillr merged commit bb6fc5a into paulmillr:main Jul 21, 2024
0 of 2 checks passed
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

Successfully merging this pull request may close these issues.

2 participants