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

Return ed25519 key types from their parse functions #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions ed25519_utils.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package jwt

import (
"crypto"
"crypto/ed25519"
"crypto/x509"
"encoding/pem"
Expand All @@ -14,7 +13,7 @@ var (
)

// ParseEdPrivateKeyFromPEM parses a PEM-encoded Edwards curve private key
func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
func ParseEdPrivateKeyFromPEM(key []byte) (ed25519.PrivateKey, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Given these are public functions, and the underlying types are different, I think this would be a breaking change.

We avoid breaking changes in major versions.

I do agree having parity would be nice, but not at the expense of introducing an incompatible change.

var err error

// Parse PEM block
Expand All @@ -39,7 +38,7 @@ func ParseEdPrivateKeyFromPEM(key []byte) (crypto.PrivateKey, error) {
}

// ParseEdPublicKeyFromPEM parses a PEM-encoded Edwards curve public key
func ParseEdPublicKeyFromPEM(key []byte) (crypto.PublicKey, error) {
func ParseEdPublicKeyFromPEM(key []byte) (ed25519.PublicKey, error) {
var err error

// Parse PEM block
Expand Down