Skip to content

Conversation

paulmillr
Copy link
Owner

@paulmillr paulmillr commented May 17, 2025

  • New types, split by kind
    • Curve opts: EdwardsOpts, WeierstrassOpts: (a, b, d, p, n, h, Gx, Gy) (no more Fp)
    • Curve optional params: EdwardsExtraOpts, WeierstrassExtraOpts, containing e.g. redefined Fp, Fn, uvRatio, wrapPrivateKey, allowInfinityPoint, fromBytes, toBytes
    • Signing interfaces: ECDSA, EdDSA (getPublicKey, sign, verify)
    • Signing interface optional params: ECDSAOpts, EdDSAOpts hash, lowS, adjustScalarBytes
  • Every Point now has Fp and Fn static properties, similar to BASE & ZERO
  • Compatibility layer for old code until v2

Example usage of new interface:

const p256_Point = weierstrass({
  a: BigInt('0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc'),
  b: BigInt('0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b'),
  p: BigInt('0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff'),
  n: BigInt('0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551'),
  Gx: BigInt('0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296'),
  Gy: BigInt('0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5'),
  h: BigInt(1),
});
const p256 = ecdsa(p256_Point, { hash: sha256 });

@paulmillr
Copy link
Owner Author

cc @mahnunchik

@paulmillr paulmillr marked this pull request as ready for review May 20, 2025 18:18
@mahnunchik
Copy link
Contributor

Looks good! Are you going to release this changes before v2?

@paulmillr
Copy link
Owner Author

yes, last versions of v1 would be transitional: old APIs will become deprecated, new APIs will become available.

@paulmillr paulmillr merged commit b5e74d6 into main May 29, 2025
14 checks passed
@paulmillr paulmillr deleted the ecdsa-eddsa branch July 17, 2025 00:42
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