incorporates code review comments from @raulk; changes KeyPairFromKey to KeyPairFromStdKey and improves godoc.

This commit is contained in:
adam 2019-09-20 23:37:38 -07:00
parent 23811ec09b
commit 2b32a36d90
No known key found for this signature in database
GPG Key ID: A3800EBCEEF67348
3 changed files with 5 additions and 5 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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)
}