From 7e56dc0eb14c77a56183831bf8d3ff95af815542 Mon Sep 17 00:00:00 2001 From: maze Date: Sat, 14 Feb 2026 18:01:46 +0100 Subject: [PATCH] Add Public() method --- protocol/meshcore/crypto/ed25519.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/protocol/meshcore/crypto/ed25519.go b/protocol/meshcore/crypto/ed25519.go index 0a36029..bfc9d91 100644 --- a/protocol/meshcore/crypto/ed25519.go +++ b/protocol/meshcore/crypto/ed25519.go @@ -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)