Rename X25519 helpers to follow constructor naming scheme#29
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // CurveX25519 returns the underlying X25519 curve instance. | ||
| func CurveX25519() stdecdh.Curve { return x25519Curve } | ||
|
|
||
| // New returns a KeyExchange helper bound to the X25519 curve. | ||
| func New() KeyExchange { return x25519Impl } | ||
| // NewX25519 returns a KeyExchange helper bound to the X25519 curve. | ||
| func NewX25519() KeyExchange { return x25519Impl } | ||
|
|
||
| // GenerateKey creates a new private key using crypto/rand. | ||
| func GenerateKey() (*stdecdh.PrivateKey, error) { return x25519Impl.GenerateKey() } | ||
| // GenerateKeyX25519 creates a new private key using crypto/rand. | ||
| func GenerateKeyX25519() (*stdecdh.PrivateKey, error) { return x25519Impl.GenerateKey() } | ||
|
|
||
| // NewPrivateKey constructs a private key from scalar bytes. | ||
| func NewPrivateKey(d []byte) (*stdecdh.PrivateKey, error) { return x25519Impl.NewPrivateKey(d) } | ||
| // NewPrivateKeyX25519 constructs a private key from scalar bytes. | ||
| func NewPrivateKeyX25519(d []byte) (*stdecdh.PrivateKey, error) { return x25519Impl.NewPrivateKey(d) } | ||
|
|
||
| // NewPublicKey parses a 32-byte Montgomery u-coordinate public key. | ||
| func NewPublicKey(b []byte) (*stdecdh.PublicKey, error) { return x25519Impl.NewPublicKey(b) } | ||
| // NewPublicKeyX25519 parses a 32-byte Montgomery u-coordinate public key. | ||
| func NewPublicKeyX25519(b []byte) (*stdecdh.PublicKey, error) { return x25519Impl.NewPublicKey(b) } | ||
|
|
||
| // SharedSecret performs the X25519 Diffie-Hellman operation between private and peer. | ||
| func SharedSecret(p *stdecdh.PrivateKey, peer *stdecdh.PublicKey) ([]byte, error) { | ||
| // SharedSecretX25519 performs the X25519 Diffie-Hellman operation between private and peer. | ||
| func SharedSecretX25519(p *stdecdh.PrivateKey, peer *stdecdh.PublicKey) ([]byte, error) { |
There was a problem hiding this comment.
Preserve deprecated X25519 helpers for backward compatibility
The rename in ecdh/x25519.go drops the previous exported helpers (Curve, New, GenerateKey, NewPrivateKey, NewPublicKey, SharedSecret) without leaving deprecated wrappers. Any downstream module that imports ecdh.New() or the other original names will now fail to compile even though there is no major version bump or compatibility notice. If the intent was only to align naming with NewP256/NewP384, consider keeping the old identifiers as thin wrappers that call the new *X25519 functions so existing users are not broken, or otherwise signal a breaking change via a v2 module.
Useful? React with 👍 / 👎.
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_68fb2cc7032883259bf4cc6ca98f6789