Add Public() method

This commit is contained in:
2026-02-14 18:01:46 +01:00
parent fba89b1966
commit 7e56dc0eb1

View File

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