Add Public() method
This commit is contained in:
@@ -2,6 +2,7 @@ package crypto
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"crypto"
|
||||
"crypto/rand"
|
||||
"crypto/sha512"
|
||||
"encoding/base64"
|
||||
@@ -45,6 +46,12 @@ func (priv *PrivateKey) Seed() []byte {
|
||||
return seed[:]
|
||||
}
|
||||
|
||||
func (priv *PrivateKey) Public() crypto.PublicKey {
|
||||
p := &PublicKey{}
|
||||
newPublicKey(p, priv.pub[:])
|
||||
return p
|
||||
}
|
||||
|
||||
func (priv *PrivateKey) PublicKey() []byte {
|
||||
pub := priv.pub
|
||||
return pub[:]
|
||||
@@ -412,3 +419,5 @@ func verifyWithDom(pub *PublicKey, message, sig []byte, domPrefix, context strin
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ crypto.PrivateKey = (*PrivateKey)(nil)
|
||||
|
||||
Reference in New Issue
Block a user