github.com/hyperledger/aries-framework-go@v0.3.2/pkg/didcomm/common/service/destination.go (about) 1 /* 2 Copyright SecureKey Technologies Inc. All Rights Reserved. 3 Copyright Avast Software. All Rights Reserved. 4 5 SPDX-License-Identifier: Apache-2.0 6 */ 7 8 package service 9 10 import ( 11 "fmt" 12 13 "github.com/hyperledger/aries-framework-go/pkg/common/model" 14 "github.com/hyperledger/aries-framework-go/pkg/doc/did" 15 vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr" 16 ) 17 18 // Destination provides the recipientKeys, routingKeys, and serviceEndpoint for an outbound message. 19 type Destination struct { 20 RecipientKeys []string 21 ServiceEndpoint model.Endpoint 22 RoutingKeys []string 23 TransportReturnRoute string 24 MediaTypeProfiles []string 25 DIDDoc *did.Doc 26 } 27 28 const ( 29 didCommServiceType = "did-communication" 30 didCommV2ServiceType = "DIDCommMessaging" 31 defaultDIDCommProfile = "didcomm/aip2;env=rfc19" 32 defaultDIDCommV2Profile = "didcomm/v2" 33 legacyDIDCommServiceType = "IndyAgent" 34 ) 35 36 // GetDestination constructs a Destination struct based on the given DID and parameters 37 // It resolves the DID using the given VDR, and uses CreateDestination under the hood. 38 func GetDestination(didID string, vdr vdrapi.Registry) (*Destination, error) { 39 docResolution, err := vdr.Resolve(didID) 40 if err != nil { 41 return nil, fmt.Errorf("getDestination: failed to resolve did [%s] : %w", didID, err) 42 } 43 44 return CreateDestination(docResolution.DIDDocument) 45 }