func WithProtocols(protocolSvcCreator ...api.ProtocolSvcCreator) Option {
	return func(opts *Aries) error {
		opts.protocolSvcCreators = append(opts.protocolSvcCreators, protocolSvcCreator...)
		return nil
	}
}
WithProtocols injects a protocol service to the Aries framework.
package aries
import (
	"fmt"
	"strings"
	"github.com/google/uuid"
	jsonld "github.com/piprate/json-gold/ld"
	"github.com/hyperledger/aries-framework-go/pkg/crypto"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/dispatcher"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/messenger"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/packager"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/packer"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/decorator"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/transport"
	"github.com/hyperledger/aries-framework-go/pkg/doc/ld"
	"github.com/hyperledger/aries-framework-go/pkg/doc/ldcontext/remote"
	"github.com/hyperledger/aries-framework-go/pkg/framework/aries/api"
	vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
	"github.com/hyperledger/aries-framework-go/pkg/framework/context"
	"github.com/hyperledger/aries-framework-go/pkg/kms"
	"github.com/hyperledger/aries-framework-go/pkg/secretlock"
	"github.com/hyperledger/aries-framework-go/pkg/store/did"
	ldstore "github.com/hyperledger/aries-framework-go/pkg/store/ld"
	"github.com/hyperledger/aries-framework-go/pkg/store/verifiable"
	"github.com/hyperledger/aries-framework-go/pkg/vdr"
	"github.com/hyperledger/aries-framework-go/pkg/vdr/key"
	"github.com/hyperledger/aries-framework-go/pkg/vdr/peer"
	"github.com/hyperledger/aries-framework-go/spi/storage"
)
const (
	defaultEndpoint     = "didcomm:transport/queue"
	defaultMasterKeyURI = "local-lock://default/master/key/"
)
type Aries struct {
	storeProvider              storage.Provider
	protocolStateStoreProvider storage.Provider
	protocolSvcCreators        []api.ProtocolSvcCreator
	services                   []dispatcher.ProtocolService
	msgSvcProvider             api.MessageServiceProvider
	outboundDispatcher         dispatcher.Outbound
	messenger                  service.MessengerHandler
	outboundTransports         []transport.OutboundTransport
	inboundTransports          []transport.InboundTransport
	kms                        kms.KeyManager
	kmsCreator                 kms.Creator
	secretLock                 secretlock.Service
	crypto                     crypto.Crypto
	packagerCreator            packager.Creator
	packager                   transport.Packager
	packerCreator              packer.Creator
	packerCreators             []packer.Creator
	primaryPacker              packer.Packer
	packers                    []packer.Packer
	vdrRegistry                vdrapi.Registry
	vdr                        []vdrapi.VDR
	verifiableStore            verifiable.Store
	didConnectionStore         did.ConnectionStore
	contextStore               ldstore.ContextStore
	remoteProviderStore        ldstore.RemoteProviderStore
	documentLoader             jsonld.DocumentLoader
	contextProviderURLs        []string
	transportReturnRoute       string
	id                         string
	keyType                    kms.KeyType
	keyAgreementType           kms.KeyType
	mediaTypeProfiles          []string
}
type Option func(opts *Aries) error
func New(opts ...Option) (*Aries, error) {
	frameworkOpts := &Aries{}
	for _, option := range opts {
		err := option(frameworkOpts)
		if err != nil {
			closeErr := frameworkOpts.Close()
			return nil, fmt.Errorf("close err: %v Error in option passed to New: %w", closeErr, err)
		}
	}
	frameworkOpts.id = uuid.New().String()
	err := defFrameworkOpts(frameworkOpts)
	if err != nil {
		return nil, fmt.Errorf("default option initialization failed: %w", err)
	}
	return initializeServices(frameworkOpts)
}
func initializeServices(frameworkOpts *Aries) (*Aries, error) {
	if e := createKMS(frameworkOpts); e != nil {
		return nil, e
	}
	if e := createVDR(frameworkOpts); e != nil {
		return nil, e
	}
	if err := createPackersAndPackager(frameworkOpts); err != nil {
		return nil, err
	}
	if err := createOutboundDispatcher(frameworkOpts); err != nil {
		return nil, err
	}
	if err := createMessengerHandler(frameworkOpts); err != nil {
		return nil, err
	}
	if err := createDIDConnectionStore(frameworkOpts); err != nil {
		return nil, err
	}
	if err := loadServices(frameworkOpts); err != nil {
		return nil, err
	}
	if err := startTransports(frameworkOpts); err != nil {
		return nil, err
	}
	return frameworkOpts, nil
}
func WithMessengerHandler(mh service.MessengerHandler) Option {
	return func(opts *Aries) error {
		opts.messenger = mh
		return nil
	}
}
func WithOutboundTransports(outboundTransports ...transport.OutboundTransport) Option {
	return func(opts *Aries) error {
		opts.outboundTransports = append(opts.outboundTransports, outboundTransports...)
		return nil
	}
}
func WithInboundTransport(inboundTransport ...transport.InboundTransport) Option {
	return func(opts *Aries) error {
		opts.inboundTransports = append(opts.inboundTransports, inboundTransport...)
		return nil
	}
}
func WithTransportReturnRoute(transportReturnRoute string) Option {
	return func(opts *Aries) error {
		if transportReturnRoute != decorator.TransportReturnRouteNone &&
			transportReturnRoute != decorator.TransportReturnRouteAll {
			return fmt.Errorf("invalid transport return route option : %s", transportReturnRoute)
		}
		opts.transportReturnRoute = transportReturnRoute
		return nil
	}
}
func WithStoreProvider(prov storage.Provider) Option {
	return func(opts *Aries) error {
		opts.storeProvider = prov
		return nil
	}
}
func WithProtocolStateStoreProvider(prov storage.Provider) Option {
	return func(opts *Aries) error {
		opts.protocolStateStoreProvider = prov
		return nil
	}
}