func (p *Provider) KMS() kms.KeyManager {
	return p.kms
}
KMS returns a Key Management Service.
package context
import (
	"encoding/json"
	"errors"
	"fmt"
	"strings"
	"time"
	"github.com/btcsuite/btcutil/base58"
	"github.com/cenkalti/backoff/v4"
	jsonld "github.com/piprate/json-gold/ld"
	"github.com/hyperledger/aries-framework-go/pkg/common/log"
	"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/packer"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/protocol/didexchange"
	"github.com/hyperledger/aries-framework-go/pkg/didcomm/transport"
	"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/kms"
	"github.com/hyperledger/aries-framework-go/pkg/secretlock"
	"github.com/hyperledger/aries-framework-go/pkg/store/did"
	"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/fingerprint"
	"github.com/hyperledger/aries-framework-go/spi/storage"
)
const (
	defaultGetDIDsMaxRetries = 3
	kaIdentifier             = "#"
)
var logger = log.New("aries-framework/pkg/framework/context")
type Provider struct {
	services                   []dispatcher.ProtocolService
	msgSvcProvider             api.MessageServiceProvider
	storeProvider              storage.Provider
	protocolStateStoreProvider storage.Provider
	kms                        kms.KeyManager
	secretLock                 secretlock.Service
	crypto                     crypto.Crypto
	packager                   transport.Packager
	primaryPacker              packer.Packer
	packers                    []packer.Packer
	serviceEndpoint            string
	routerEndpoint             string
	outboundDispatcher         dispatcher.Outbound
	messenger                  service.MessengerHandler
	outboundTransports         []transport.OutboundTransport
	vdr                        vdrapi.Registry
	verifiableStore            verifiable.Store
	didConnectionStore         did.ConnectionStore
	contextStore               ld.ContextStore
	remoteProviderStore        ld.RemoteProviderStore
	documentLoader             jsonld.DocumentLoader
	transportReturnRoute       string
	frameworkID                string
	keyType                    kms.KeyType
	keyAgreementType           kms.KeyType
	mediaTypeProfiles          []string
	getDIDsMaxRetries          uint64
	getDIDsBackOffDuration     time.Duration
}
type inboundHandler struct {
	handlers []dispatcher.ProtocolService
}
func (in *inboundHandler) HandleInbound(msg service.DIDCommMsg, ctx service.DIDCommContext) (string, error) {
	for i := range in.handlers {
		if in.handlers[i].Accept(msg.Type()) {
			return in.handlers[i].HandleInbound(msg, ctx)
		}
	}
	return "", fmt.Errorf("no inbound handlers for msg type: %s", msg.Type())
}
func New(opts ...ProviderOption) (*Provider, error) {
	ctxProvider := Provider{
		getDIDsMaxRetries:      defaultGetDIDsMaxRetries,
		getDIDsBackOffDuration: time.Second,
	}
	for _, opt := range opts {
		err := opt(&ctxProvider)
		if err != nil {
			return nil, fmt.Errorf("option failed: %w", err)
		}
	}
	return &ctxProvider, nil
}
func (p *Provider) OutboundDispatcher() dispatcher.Outbound {
	return p.outboundDispatcher
}
func (p *Provider) OutboundTransports() []transport.OutboundTransport {
	return p.outboundTransports
}
func (p *Provider) Service(id string) (interface{}, error) {
	for _, v := range p.services {
		if v.Name() == id {
			return v, nil
		}
	}
	return nil, api.ErrSvcNotFound
}