mirror of
https://github.com/libp2p/go-libp2p-core.git
synced 2025-03-13 11:00:10 +08:00
incorporates code review comments from @raulk; changes KeyPairFromKey to KeyPairFromStdKey and improves godoc.
This commit is contained in:
parent
23811ec09b
commit
2b32a36d90
@ -11,8 +11,8 @@ import (
|
||||
"golang.org/x/crypto/ed25519"
|
||||
)
|
||||
|
||||
// KeyPairFromKey generates a new private and public key from an input private key
|
||||
func KeyPairFromKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
|
||||
// KeyPairFromStdKey wraps standard library (and secp256k1) private keys in libp2p/go-libp2p-core/crypto keys
|
||||
func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
|
||||
if priv == nil {
|
||||
return nil, nil, ErrNilPrivateKey
|
||||
}
|
||||
|
@ -13,8 +13,8 @@ import (
|
||||
"golang.org/x/crypto/ed25519"
|
||||
)
|
||||
|
||||
// KeyPairFromKey generates a new private and public key from an input private key
|
||||
func KeyPairFromKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
|
||||
// KeyPairFromStdKey wraps standard library (and secp256k1) private keys in libp2p/go-libp2p-core/crypto keys
|
||||
func KeyPairFromStdKey(priv crypto.PrivateKey) (PrivKey, PubKey, error) {
|
||||
if priv == nil {
|
||||
return nil, nil, ErrNilPrivateKey
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ func TestKeyPairFromKey(t *testing.T) {
|
||||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("%v", i), func(t *testing.T) {
|
||||
priv, pub, err := KeyPairFromKey(tt.in)
|
||||
priv, pub, err := KeyPairFromStdKey(tt.in)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user