Skip to content

Rename X25519 helpers to follow constructor naming scheme#29

Merged
AeonDave merged 1 commit into
mainfrom
codex/update-x25519-constructor-usage
Oct 24, 2025
Merged

Rename X25519 helpers to follow constructor naming scheme#29
AeonDave merged 1 commit into
mainfrom
codex/update-x25519-constructor-usage

Conversation

@AeonDave
Copy link
Copy Markdown
Owner

Summary

  • rename the X25519 key exchange helpers to the NewX25519 naming convention used by the other curves
  • update kem and hybrid adapters, benchmarks, tests, and documentation to use the renamed helpers

Testing

  • go test ./...

https://chatgpt.com/codex/tasks/task_e_68fb2cc7032883259bf4cc6ca98f6789

@AeonDave AeonDave merged commit c203545 into main Oct 24, 2025
2 checks passed
@AeonDave AeonDave deleted the codex/update-x25519-constructor-usage branch October 24, 2025 07:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread ecdh/x25519.go
Comment on lines +12 to +28
// 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) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant