github.com/hyperledger/aries-framework-go@v0.3.2/pkg/framework/aries/api/protocol.go (about)

     1  /*
     2  Copyright SecureKey Technologies Inc. All Rights Reserved.
     3  
     4  SPDX-License-Identifier: Apache-2.0
     5  */
     6  
     7  package api
     8  
     9  import (
    10  	"errors"
    11  
    12  	"github.com/piprate/json-gold/ld"
    13  
    14  	"github.com/hyperledger/aries-framework-go/pkg/crypto"
    15  	"github.com/hyperledger/aries-framework-go/pkg/didcomm/common/service"
    16  	"github.com/hyperledger/aries-framework-go/pkg/didcomm/dispatcher"
    17  	"github.com/hyperledger/aries-framework-go/pkg/didcomm/transport"
    18  	vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
    19  	"github.com/hyperledger/aries-framework-go/pkg/kms"
    20  	"github.com/hyperledger/aries-framework-go/pkg/secretlock"
    21  	"github.com/hyperledger/aries-framework-go/pkg/store/did"
    22  	"github.com/hyperledger/aries-framework-go/pkg/store/verifiable"
    23  	"github.com/hyperledger/aries-framework-go/spi/storage"
    24  )
    25  
    26  // ErrSvcNotFound is returned when service not found.
    27  var ErrSvcNotFound = errors.New("service not found")
    28  
    29  // Provider interface for protocol ctx.
    30  type Provider interface {
    31  	OutboundDispatcher() dispatcher.Outbound
    32  	InboundDIDCommMessageHandler() func() service.InboundHandler
    33  	Messenger() service.Messenger
    34  	Service(id string) (interface{}, error)
    35  	StorageProvider() storage.Provider
    36  	KMS() kms.KeyManager
    37  	SecretLock() secretlock.Service
    38  	Crypto() crypto.Crypto
    39  	Packager() transport.Packager
    40  	ServiceEndpoint() string
    41  	RouterEndpoint() string
    42  	VDRegistry() vdrapi.Registry
    43  	ProtocolStateStorageProvider() storage.Provider
    44  	InboundMessageHandler() transport.InboundMessageHandler
    45  	VerifiableStore() verifiable.Store
    46  	DIDConnectionStore() did.ConnectionStore
    47  	JSONLDDocumentLoader() ld.DocumentLoader
    48  	KeyType() kms.KeyType
    49  	KeyAgreementType() kms.KeyType
    50  	MediaTypeProfiles() []string
    51  	AriesFrameworkID() string
    52  	ServiceMsgTypeTargets() []dispatcher.MessageTypeTarget
    53  }
    54  
    55  // ProtocolSvcCreator struct sets initialization functions for a protocol service.
    56  type ProtocolSvcCreator struct {
    57  	// Create creates new protocol service.
    58  	Create func(prv Provider) (dispatcher.ProtocolService, error)
    59  	// Init initializes given instance of a protocol service.
    60  	Init           func(svc dispatcher.ProtocolService, prv Provider) error
    61  	ServicePointer dispatcher.ProtocolService
    62  }
    63  
    64  // MessageServiceProvider is provider of message services.
    65  type MessageServiceProvider interface {
    66  	// Services returns list of available message services in this message handler
    67  	Services() []dispatcher.MessageService
    68  }