@@ -24,6 +24,7 @@ import (
2424 "github.com/hyperledger/aries-framework-go/pkg/didcomm/transport"
2525 "github.com/hyperledger/aries-framework-go/pkg/doc/did"
2626 vdrapi "github.com/hyperledger/aries-framework-go/pkg/framework/aries/api/vdr"
27+ "github.com/hyperledger/aries-framework-go/pkg/internal/didcommutil"
2728 "github.com/hyperledger/aries-framework-go/pkg/kms"
2829 "github.com/hyperledger/aries-framework-go/pkg/kms/localkms"
2930 connectionstore "github.com/hyperledger/aries-framework-go/pkg/store/connection"
@@ -455,7 +456,7 @@ func (ctx *context) handleInboundRequest(request *Request, options *options,
455456
456457 var serviceType string
457458 if len (requestDidDoc .Service ) > 0 {
458- serviceType = requestDidDoc .Service [0 ].Type
459+ serviceType = didcommutil . GetServiceType ( requestDidDoc .Service [0 ].Type )
459460 } else {
460461 accept , e := destination .ServiceEndpoint .Accept ()
461462 if e != nil {
@@ -713,6 +714,7 @@ func (ctx *context) getMyDIDDoc(pubDID string, routerConnections []string, servi
713714 }
714715 case didCommV2ServiceType :
715716 svc = did.Service {
717+ Type : didCommV2ServiceType ,
716718 ServiceEndpoint : model .NewDIDCommV2Endpoint ([]model.DIDCommV2Endpoint {
717719 {URI : serviceEndpoint , RoutingKeys : routingKeys },
718720 }),
@@ -736,7 +738,7 @@ func (ctx *context) getMyDIDDoc(pubDID string, routerConnections []string, servi
736738 }
737739
738740 if newService {
739- switch newDID .Service [0 ].Type {
741+ switch didcommutil . GetServiceType ( newDID .Service [0 ].Type ) {
740742 case didCommServiceType , "IndyAgent" :
741743 recKey , _ := fingerprint .CreateDIDKey (newDID .VerificationMethod [0 ].Value )
742744 newDID .Service [0 ].RecipientKeys = []string {recKey }
@@ -748,6 +750,9 @@ func (ctx *context) getMyDIDDoc(pubDID string, routerConnections []string, servi
748750 }
749751
750752 newDID .Service [0 ].RecipientKeys = recKeys
753+
754+ default :
755+ return nil , fmt .Errorf ("getMyDIDDoc: invalid DID Doc service type: '%v'" , newDID .Service [0 ].Type )
751756 }
752757 }
753758
@@ -1123,6 +1128,8 @@ func (ctx *context) getServiceBlock(i *OOBInvitation) (*did.Service, error) {
11231128 // RFC0587: In case the accept property is set in both the DID service block and the out-of-band message,
11241129 // the out-of-band property takes precedence.
11251130 if isDIDCommV2 (i .MediaTypeProfiles ) {
1131+ block .Type = didCommV2ServiceType
1132+
11261133 uri , err := block .ServiceEndpoint .URI ()
11271134 if err != nil {
11281135 logger .Debugf ("block ServiceEndpoint URI empty for DIDcomm V2, skipping it." )
@@ -1137,6 +1144,7 @@ func (ctx *context) getServiceBlock(i *OOBInvitation) (*did.Service, error) {
11371144 {URI : uri , Accept : i .MediaTypeProfiles , RoutingKeys : routingKeys },
11381145 })
11391146 } else {
1147+ block .Type = didCommServiceType
11401148 block .Accept = i .MediaTypeProfiles
11411149 }
11421150 }
@@ -1251,7 +1259,9 @@ func recipientKeyAsDIDKey(doc *did.Doc) (string, error) {
12511259 err error
12521260 )
12531261
1254- switch doc .Service [0 ].Type {
1262+ serviceType := didcommutil .GetServiceType (doc .Service [0 ].Type )
1263+
1264+ switch serviceType {
12551265 case vdrapi .DIDCommServiceType :
12561266 return recipientKey (doc )
12571267 case vdrapi .DIDCommV2ServiceType :
0 commit comments