func WithCreated(created *time.Time) SigningOpts {
	return func(opts *signingOpts) {
		opts.Created = created
	}
}
WithCreated is an option to pass created time option for signing
package crypto
import (
	"fmt"
	"strings"
	"time"
	ariescrypto "github.com/hyperledger/aries-framework-go/pkg/crypto"
	"github.com/hyperledger/aries-framework-go/pkg/doc/did"
	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/jsonld"
	ariessigner "github.com/hyperledger/aries-framework-go/pkg/doc/signature/signer"
	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/suite"
	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/suite/bbsblssignature2020"
	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/suite/ed25519signature2018"
	"github.com/hyperledger/aries-framework-go/pkg/doc/signature/suite/jsonwebsignature2020"
	"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable"
	vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
	"github.com/hyperledger/aries-framework-go/pkg/kms"
	"github.com/piprate/json-gold/ld"
	vcprofile "github.com/trustbloc/edge-service/pkg/doc/vc/profile"
	"github.com/trustbloc/edge-service/pkg/internal/common/diddoc"
)
const (
	Ed25519Signature2018 = "Ed25519Signature2018"
	JSONWebSignature2020 = "JsonWebSignature2020"
	BbsBlsSignature2020 = "BbsBlsSignature2020"
	Ed25519VerificationKey2018 = "Ed25519VerificationKey2018"
	JSONWebKey2020 = "JsonWebKey2020"
)
const (
	Ed25519KeyType = "Ed25519"
	P256KeyType = "P256"
)
const (
	AssertionMethod = "assertionMethod"
	Authentication = "authentication"
	CapabilityDelegation = "capabilityDelegation"
	CapabilityInvocation = "capabilityInvocation"
)
type kmsSigner struct {
	keyHandle interface{}
	crypto    ariescrypto.Crypto
	bbs       bool
}
func newKMSSigner(keyManager kms.KeyManager, c ariescrypto.Crypto, creator, signatureType string) (*kmsSigner, error) {
	keyID, err := diddoc.GetKeyIDFromVerificationMethod(creator)
	if err != nil {
		return nil, err
	}
	keyHandler, err := keyManager.Get(keyID)
	if err != nil {
		return nil, err
	}
	return &kmsSigner{keyHandle: keyHandler, crypto: c, bbs: signatureType == BbsBlsSignature2020}, nil
}
func (s *kmsSigner) Sign(data []byte) ([]byte, error) {
	if s.bbs {
		return s.crypto.SignMulti(s.textToLines(string(data)), s.keyHandle)
	}
	v, err := s.crypto.Sign(data, s.keyHandle)
	if err != nil {
		return nil, err
	}
	return v, nil
}
func (s *kmsSigner) textToLines(txt string) [][]byte {
	lines := strings.Split(txt, "\n")
	linesBytes := make([][]byte, 0, len(lines))
	for i := range lines {
		if strings.TrimSpace(lines[i]) != "" {
			linesBytes = append(linesBytes, []byte(lines[i]))
		}
	}
	return linesBytes
}
func New(keyManager kms.KeyManager, c ariescrypto.Crypto, vdr vdrapi.Registry, loader ld.DocumentLoader) *Crypto {
	return &Crypto{keyManager: keyManager, crypto: c, vdr: vdr, documentLoader: loader}
}
type signingOpts struct {
	VerificationMethod string
	Purpose            string
	Representation     string
	SignatureType      string
	Created            *time.Time
	Challenge          string
	Domain             string
}
type SigningOpts func(opts *signingOpts)
func WithVerificationMethod(verificationMethod string) SigningOpts {
	return func(opts *signingOpts) {
		opts.VerificationMethod = verificationMethod
	}
}
func WithPurpose(purpose string) SigningOpts {
	return func(opts *signingOpts) {
		opts.Purpose = purpose
	}
}
func WithSigningRepresentation(representation string) SigningOpts {
	return func(opts *signingOpts) {
		opts.Representation = representation
	}
}
func WithSignatureType(signatureType string) SigningOpts {
	return func(opts *signingOpts) {
		opts.SignatureType = signatureType
	}
}