func (h *Handler) Sign(ctx context.Context, req *pb.SignRequest) (*pb.SignResponse, error) {
	log.Trace().Msg("Handling request")
	res := &pb.SignResponse{}
	if req == nil {
		log.Warn().Str("result", "denied").Msg("Request not specified")
		res.State = pb.ResponseState_DENIED
		return res, nil
	}
	if req.GetAccount() == "" && req.GetPublicKey() == nil {
		log.Warn().Str("result", "denied").Msg("Neither account nor public key specified")
		res.State = pb.ResponseState_DENIED
		return res, nil
	}
	if !strings.Contains(req.GetAccount(), "/") {
		log.Warn().Str("result", "denied").Msg("Invalid account specified")
		res.State = pb.ResponseState_DENIED
		return res, nil
	}
	data := &rules.SignData{
		Domain: req.Domain,
		Data:   req.Data,
	}
	result, signature := h.signer.SignGeneric(ctx, handlers.GenerateCredentials(ctx), req.GetAccount(), req.GetPublicKey(), data)
	switch result {
	case core.ResultSucceeded:
		res.State = pb.ResponseState_SUCCEEDED
		res.Signature = signature
	case core.ResultDenied:
		res.State = pb.ResponseState_DENIED
	case core.ResultFailed:
		res.State = pb.ResponseState_FAILED
	default:
		res.State = pb.ResponseState_UNKNOWN
	}
	log.Trace().Str("result", "succeeded").Msg("Success")
	return res, nil
}
Sign signs generic data.
package signer
import (
	context "context"
	"strings"
	"github.com/attestantio/dirk/core"
	"github.com/attestantio/dirk/rules"
	"github.com/attestantio/dirk/services/api/grpc/handlers"
	pb "github.com/wealdtech/eth2-signer-api/pb/v1"
)