From 1823aaa5e0bb72f028a84ee5c5ec1e049cb4421f Mon Sep 17 00:00:00 2001 From: Jared Allard Date: Tue, 25 Feb 2025 11:28:39 -0800 Subject: [PATCH] add back from bytes --- sign/keys.go | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/sign/keys.go b/sign/keys.go index a6869b8..2ac787c 100644 --- a/sign/keys.go +++ b/sign/keys.go @@ -30,6 +30,7 @@ import ( "math/big" Ed "crypto/ed25519" + "golang.org/x/crypto/scrypt" "gopkg.in/yaml.v2" ) @@ -179,14 +180,14 @@ func makePrivateKeyFromBytes(sk *PrivateKey, buf []byte) error { return nil } -/* // Make a private key from 64-bytes of extended Ed25519 key func PrivateKeyFromBytes(buf []byte) (*PrivateKey, error) { var sk PrivateKey - - return makePrivateKeyFromBytes(&sk, buf) + if err := makePrivateKeyFromBytes(&sk, buf); err != nil { + return nil, err + } + return &sk, nil } -*/ // Given a secret key, return the corresponding Public Key func (sk *PrivateKey) PublicKey() *PublicKey { @@ -404,14 +405,14 @@ func makePublicKeyFromBytes(pk *PublicKey, b []byte) error { return nil } -/* // Make a public key from a byte string func PublicKeyFromBytes(b []byte) (*PublicKey, error) { var pk PublicKey - - makePublicKeyFromBytes(&pk, b) + if err := makePublicKeyFromBytes(&pk, b); err != nil { + return nil, err + } + return &pk, nil } -*/ // Serialize a PublicKey into file 'fn' with a human readable 'comment'. // If 'ovwrite' is true, overwrite the file if it exists.