diff --git a/aggregator/auth.go b/aggregator/auth.go index 9764f1a..fe11c7a 100644 --- a/aggregator/auth.go +++ b/aggregator/auth.go @@ -36,12 +36,8 @@ func (r *RpcServer) GetKey(ctx context.Context, payload *avsproto.GetKeyReq) (*a if strings.Contains(payload.Signature, ".") { authenticated, err := auth.VerifyJwtKeyForUser(r.config.JwtSecret, payload.Signature, submitAddress) - if err != nil { - return nil, err - } - - if !authenticated { - return nil, status.Errorf(codes.Unauthenticated, auth.InvalidAPIKey) + if err != nil || !authenticated { + return nil, status.Errorf(codes.Unauthenticated, "%s: %s", auth.AuthenticationError, auth.InvalidAPIKey) } } else { // We need to have 3 things to verify the signature: the signature, the hash of the original data, and the public key of the signer. With this information we can determine if the private key holder of the public key pair did indeed sign the message