Added Sign method to PrivateKey
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
|
||||||
"filippo.io/edwards25519"
|
"filippo.io/edwards25519"
|
||||||
@@ -46,6 +47,10 @@ func (priv *PrivateKey) Seed() []byte {
|
|||||||
return seed[:]
|
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 {
|
func (priv *PrivateKey) Public() crypto.PublicKey {
|
||||||
p := &PublicKey{}
|
p := &PublicKey{}
|
||||||
newPublicKey(p, priv.pub[:])
|
newPublicKey(p, priv.pub[:])
|
||||||
@@ -420,4 +425,7 @@ func verifyWithDom(pub *PublicKey, message, sig []byte, domPrefix, context strin
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ crypto.PrivateKey = (*PrivateKey)(nil)
|
var (
|
||||||
|
_ crypto.PrivateKey = (*PrivateKey)(nil)
|
||||||
|
_ crypto.Signer = (*PrivateKey)(nil)
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user