Skip to content

Commit d9e21e3

Browse files
authored
fix: typo in Ed25519 functions (#236)
* fix: typo in Ed25519 functions * add deprecated notices * Update deprecation comments for Ed25519 functions
1 parent 9c8cba8 commit d9e21e3

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

ed25519.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func (k *PrivateKeyEd25519) Public() (*PublicKeyEd25519, error) {
9090
if err := extractPKEYPubEd25519(k._pkey, pub); err != nil {
9191
return nil, err
9292
}
93-
pubk, err := NewPublicKeyEd25119(pub)
93+
pubk, err := NewPublicKeyEd25519(pub)
9494
if err != nil {
9595
return nil, err
9696
}
@@ -108,14 +108,24 @@ func GenerateKeyEd25519() (*PrivateKeyEd25519, error) {
108108
return priv, nil
109109
}
110110

111+
// Deprecated: use NewPrivateKeyEd25519 instead.
111112
func NewPrivateKeyEd25119(priv []byte) (*PrivateKeyEd25519, error) {
113+
return NewPrivateKeyEd25519(priv)
114+
}
115+
116+
func NewPrivateKeyEd25519(priv []byte) (*PrivateKeyEd25519, error) {
112117
if len(priv) != privateKeySizeEd25519 {
113118
panic("ed25519: bad private key length: " + strconv.Itoa(len(priv)))
114119
}
115120
return NewPrivateKeyEd25519FromSeed(priv[:seedSizeEd25519])
116121
}
117122

123+
// Deprecated: use NewPublicKeyEd25519 instead.
118124
func NewPublicKeyEd25119(pub []byte) (*PublicKeyEd25519, error) {
125+
return NewPublicKeyEd25519(pub)
126+
}
127+
128+
func NewPublicKeyEd25519(pub []byte) (*PublicKeyEd25519, error) {
119129
if len(pub) != publicKeySizeEd25519 {
120130
panic("ed25519: bad public key length: " + strconv.Itoa(len(pub)))
121131
}

ed25519_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func TestEd25519Malleability(t *testing.T) {
8282
0xb1, 0x08, 0xc3, 0xbd, 0xae, 0x36, 0x9e, 0xf5, 0x49, 0xfa,
8383
}
8484

85-
pub, err := openssl.NewPublicKeyEd25119(publicKey)
85+
pub, err := openssl.NewPublicKeyEd25519(publicKey)
8686
if err != nil {
8787
t.Fatal(err)
8888
}

0 commit comments

Comments
 (0)