From c5ffb53d14b0345214fcf6019337eadbbcf1661b Mon Sep 17 00:00:00 2001 From: Madhur Shrimal Date: Wed, 11 Dec 2024 13:34:46 -0800 Subject: [PATCH] add a public key method --- signer/bls/cerberus/cerberus.go | 4 ++++ signer/bls/local/local.go | 5 +++++ signer/bls/signer.go | 2 ++ 3 files changed, 11 insertions(+) diff --git a/signer/bls/cerberus/cerberus.go b/signer/bls/cerberus/cerberus.go index 39239e2a..0b318516 100644 --- a/signer/bls/cerberus/cerberus.go +++ b/signer/bls/cerberus/cerberus.go @@ -87,3 +87,7 @@ func (s Signer) GetOperatorId() (string, error) { publicKey := pubkey.Deserialize(pkBytes) return publicKey.GetOperatorID(), nil } + +func (s Signer) GetPublicKeyHex() string { + return s.pubKeyHex +} diff --git a/signer/bls/local/local.go b/signer/bls/local/local.go index 74272b29..1c942057 100644 --- a/signer/bls/local/local.go +++ b/signer/bls/local/local.go @@ -2,6 +2,7 @@ package local import ( "context" + "encoding/hex" sdkBls "github.com/Layr-Labs/eigensdk-go/crypto/bls" "github.com/Layr-Labs/eigensdk-go/signer/bls/types" @@ -40,3 +41,7 @@ func (s Signer) Sign(ctx context.Context, msg []byte) ([]byte, error) { func (s Signer) GetOperatorId() (string, error) { return s.key.PubKey.GetOperatorID(), nil } + +func (s Signer) GetPublicKeyHex() string { + return hex.EncodeToString(s.key.PubKey.Serialize()) +} diff --git a/signer/bls/signer.go b/signer/bls/signer.go index 7bf2c14c..cc6025ef 100644 --- a/signer/bls/signer.go +++ b/signer/bls/signer.go @@ -15,6 +15,8 @@ type Signer interface { // GetOperatorId returns the operator ID of the signer. // This is hash of the G1 public key of the signer GetOperatorId() (string, error) + + GetPublicKeyHex() string } // NewSigner creates a new Signer instance based on the provided configuration.