@@ -1317,7 +1317,7 @@ func (r *didKeyResolver) Resolve(id string) (*verifier.PublicKey, error) {
13171317// ErrKeyNotFound is returned when key is not found.
13181318var ErrKeyNotFound = errors .New ("key not found" )
13191319
1320- // nolint:funlen,gocognit,gocyclo
1320+ // nolint:funlen,gocognit,gocyclo,nestif
13211321func populateRawServices (services []Service , didID , baseURI string ) []map [string ]interface {} {
13221322 var rawServices []map [string ]interface {}
13231323
@@ -1389,7 +1389,7 @@ func populateRawServices(services []Service, didID, baseURI string) []map[string
13891389
13901390 rawService [jsonldType ] = services [i ].Type
13911391
1392- if services [i ].ServiceEndpoint .Type () == model .DIDCommV2 { // DIDComm V2
1392+ if services [i ].ServiceEndpoint .Type () == model .DIDCommV2 { //nolint: gocritic
13931393 serviceEndpointMap := []map [string ]interface {}{{"uri" : sepURI }}
13941394 if len (sepAccept ) > 0 {
13951395 serviceEndpointMap [0 ]["accept" ] = sepAccept
@@ -1400,8 +1400,15 @@ func populateRawServices(services []Service, didID, baseURI string) []map[string
14001400 }
14011401
14021402 rawService [jsonldServicePoint ] = serviceEndpointMap
1403- } else { // DIDComm V1, default is generic endpoint as string URI
1403+ } else if services [ i ]. ServiceEndpoint . Type () == model . DIDCommV1 {
14041404 rawService [jsonldServicePoint ] = sepURI
1405+ } else {
1406+ bytes , err := services [i ].ServiceEndpoint .MarshalJSON ()
1407+ if err != nil {
1408+ logger .Warnf (err .Error ())
1409+ }
1410+
1411+ rawService [jsonldServicePoint ] = json .RawMessage (bytes )
14051412 }
14061413
14071414 rawService [jsonldPriority ] = services [i ].Priority
0 commit comments