Added Sign method to PrivateKey

This commit is contained in:
2026-02-14 18:12:33 +01:00
parent 7e56dc0eb1
commit 1d56998dd3

View File

@@ -9,6 +9,7 @@ import (
"encoding/hex"
"encoding/json"
"errors"
"io"
"strconv"
"filippo.io/edwards25519"
@@ -46,6 +47,10 @@ func (priv *PrivateKey) Seed() []byte {
return seed[:]
}
func (priv *PrivateKey) Sign(_ io.Reader, digest []byte, _ crypto.SignerOpts) (signature []byte, err error) {
return Sign(priv, digest), nil
}
func (priv *PrivateKey) Public() crypto.PublicKey {
p := &PublicKey{}
newPublicKey(p, priv.pub[:])
@@ -420,4 +425,7 @@ func verifyWithDom(pub *PublicKey, message, sig []byte, domPrefix, context strin
return nil
}
var _ crypto.PrivateKey = (*PrivateKey)(nil)
var (
_ crypto.PrivateKey = (*PrivateKey)(nil)
_ crypto.Signer = (*PrivateKey)(nil)
)