From d249cb04a6b255bb50e2055bf5a774c4c91fc75a Mon Sep 17 00:00:00 2001 From: Mykhailo Sizov Date: Tue, 8 Nov 2022 17:21:40 +0200 Subject: [PATCH] feat: add did code support in resolving service endpoints Signed-off-by: Mykhailo Sizov --- pkg/doc/did/doc.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/pkg/doc/did/doc.go b/pkg/doc/did/doc.go index 9e30c0133c..1bebd9625f 100644 --- a/pkg/doc/did/doc.go +++ b/pkg/doc/did/doc.go @@ -686,8 +686,8 @@ func populateServices(didID, baseURI string, rawServices []map[string]interface{ } else if epEntry != nil { // DIDComm V2 format (first valid entry for now). entries, ok := epEntry.([]interface{}) if ok && len(entries) > 0 { - firstEntry, ok := entries[0].(map[string]interface{}) - if ok { + firstEntry, is := entries[0].(map[string]interface{}) + if is { epURI := stringEntry(firstEntry["uri"]) epAccept := stringArray(firstEntry["accept"]) epRoutingKeys := stringArray(firstEntry["routingKeys"]) @@ -696,6 +696,12 @@ func populateServices(didID, baseURI string, rawServices []map[string]interface{ }) } } + coreServices, ok := epEntry.(map[string]interface{}) // DID Core + if ok && len(coreServices) > 0 { + instances := stringArray(coreServices["instances"]) + origins := stringArray(coreServices["origins"]) + sp = model.NewDIDCoreEndpoint(append(instances, origins...)) + } } }