diff --git a/signer/bls/cerberus/cerberus.go b/signer/bls/cerberus/cerberus.go index c8b87db8..51d6e429 100644 --- a/signer/bls/cerberus/cerberus.go +++ b/signer/bls/cerberus/cerberus.go @@ -9,6 +9,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/credentials" "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/metadata" sdkBls "github.com/Layr-Labs/eigensdk-go/crypto/bls" "github.com/Layr-Labs/eigensdk-go/signer/bls/types" @@ -21,6 +22,8 @@ type Config struct { URL string PublicKeyHex string + SignerAPIKey string + // Optional: in case if your signer uses local keystore Password string @@ -35,6 +38,7 @@ type Signer struct { kmsClient v1.KeyManagerClient pubKeyHex string password string + signerAPIKey string } func New(cfg Config) (Signer, error) { @@ -61,6 +65,7 @@ func New(cfg Config) (Signer, error) { kmsClient: kmsClient, pubKeyHex: cfg.PublicKeyHex, password: cfg.Password, + signerAPIKey: cfg.SignerAPIKey, }, nil } @@ -69,6 +74,9 @@ func (s Signer) Sign(ctx context.Context, msg []byte) ([]byte, error) { return nil, types.ErrInvalidMessageLength } + // Pass the API key to the signer client + ctx = metadata.AppendToOutgoingContext(ctx, "authorization", s.signerAPIKey) + resp, err := s.signerClient.SignGeneric(ctx, &v1.SignGenericRequest{ Data: msg, PublicKeyG1: s.pubKeyHex, @@ -86,6 +94,9 @@ func (s Signer) SignG1(ctx context.Context, msg []byte) ([]byte, error) { return nil, types.ErrInvalidMessageLength } + // Pass the API key to the signer client + ctx = metadata.AppendToOutgoingContext(ctx, "authorization", s.signerAPIKey) + resp, err := s.signerClient.SignG1(ctx, &v1.SignG1Request{ Data: msg, PublicKeyG1: s.pubKeyHex, diff --git a/signer/bls/signer.go b/signer/bls/signer.go index ccbcb1d2..ed7b8bbc 100644 --- a/signer/bls/signer.go +++ b/signer/bls/signer.go @@ -49,6 +49,7 @@ func NewSigner(cfg types.SignerConfig) (Signer, error) { Password: cfg.CerberusPassword, EnableTLS: cfg.EnableTLS, TLSCertFilePath: cfg.TLSCertFilePath, + SignerAPIKey: cfg.CerberusAPIKey, }) case types.PrivateKey: return privatekey.New(privatekey.Config{ diff --git a/signer/bls/types/types.go b/signer/bls/types/types.go index 8a3e9fa7..2edab232 100644 --- a/signer/bls/types/types.go +++ b/signer/bls/types/types.go @@ -35,4 +35,6 @@ type SignerConfig struct { EnableTLS bool // TLSCertFilePath is the path to the TLS cert file TLSCertFilePath string + // CerberusAPIKey is the API key for the cerberus signer + CerberusAPIKey string } diff --git a/signer/go.mod b/signer/go.mod index 34d47dc2..58ba9627 100644 --- a/signer/go.mod +++ b/signer/go.mod @@ -5,8 +5,9 @@ go 1.21.13 replace github.com/Layr-Labs/eigensdk-go => ../../eigensdk-go require ( - github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 + github.com/Layr-Labs/cerberus-api v0.0.2-0.20250117193600-e69c5e8b08fd github.com/Layr-Labs/eigensdk-go v0.1.13 + github.com/consensys/gnark-crypto v0.12.1 github.com/stretchr/testify v1.9.0 google.golang.org/grpc v1.64.1 ) @@ -15,7 +16,6 @@ require ( github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect github.com/consensys/bavard v0.1.13 // indirect - github.com/consensys/gnark-crypto v0.12.1 // indirect github.com/crate-crypto/go-kzg-4844 v1.0.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect diff --git a/signer/go.sum b/signer/go.sum index 873dadf4..3d523201 100644 --- a/signer/go.sum +++ b/signer/go.sum @@ -1,7 +1,7 @@ github.com/DataDog/zstd v1.4.5 h1:EndNeuB0l9syBZhut0wns3gV1hL8zX8LIu6ZiVHWLIQ= github.com/DataDog/zstd v1.4.5/go.mod h1:1jcaCB/ufaK+sKp1NBhlGmpz41jOoPQ35bpF36t7BBo= -github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5 h1:s24M6HYObEuV9OSY36jUM09kp5fOhuz/g1ev2qWDPzU= -github.com/Layr-Labs/cerberus-api v0.0.2-0.20250108174619-d5e1eb03fbd5/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= +github.com/Layr-Labs/cerberus-api v0.0.2-0.20250117193600-e69c5e8b08fd h1:prMzW4BY6KZtWEanf5EIsyHzIZKCNV2mVIXrE6glRRM= +github.com/Layr-Labs/cerberus-api v0.0.2-0.20250117193600-e69c5e8b08fd/go.mod h1:Lm4fhzy0S3P7GjerzuseGaBFVczsIKmEhIjcT52Hluo= github.com/StackExchange/wmi v1.2.1 h1:VIkavFPXSjcnS+O8yTq7NI32k0R5Aj+v39y29VYDOSA= github.com/StackExchange/wmi v1.2.1/go.mod h1:rcmrprowKIVzvc+NUiLncP2uuArMWLCbu9SBzvHz7e8= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40=