-
Notifications
You must be signed in to change notification settings - Fork 4
feat: noble curve replace elliptic #56
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
base: master
Are you sure you want to change the base?
Conversation
8feec72 to
be75748
Compare
1ac76a6 to
c6f6dce
Compare
This reverts commit 55af097.
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.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
ieow
left a comment
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.
lgtm
| opts?: { iv?: Buffer; ephemPrivateKey?: Buffer; padding?: boolean } | ||
| publicKeyTo: Uint8Array, | ||
| msg: Uint8Array, | ||
| opts?: { iv?: Uint8Array; ephemPrivateKey?: Uint8Array } |
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.
why remove the option of padding?
| // that used elliptic's BN.toArray() which didn't include leading zeros. | ||
| // Use derivePadded() if you need a fixed 32-byte output. | ||
| const sharedSecret = secp256k1.getSharedSecret(privateKeyA, publicKeyB); | ||
| const Px = sharedSecret.subarray(sharedSecret.length - 32); |
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.
sharedSecret is always 33 bytes. you can just slice the first byte to get Px.
Can u try this?
Motivation and Context
Jira Link:
Description
How has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note
High Risk
High risk because it rewrites cryptography primitives (ECDSA/ECDH/ECIES) and changes the public API’s binary types from
BuffertoUint8Array, which can break consumers and subtly alter crypto outputs if mismatched.Overview
Switches the library’s secp256k1 backend from
ellipticto@noble/curvesand standardizes all inputs/outputs (includingEcies) onUint8Arrayinstead ofBuffer, updating key validation, signing/verifying, ECDH derivation (including padded/unpadded behavior), and ECIES encrypt/decrypt plumbing.Adds a Node-only backward-compatibility test suite (via
eccrypto-old) to compare outputs acrossgetPublic*,sign/verify,derive*, andencrypt/decrypt, adjusts browser test config to exclude those tests, and refreshes README usage/API docs plus dependency/lockfile changes to dropellipticin favor of@noble/curves.Written by Cursor Bugbot for commit b3052af. This will update automatically on new commits. Configure here.