Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

Commit

Permalink
feat: add did code support in resolving service endpoints
Browse files Browse the repository at this point in the history
Signed-off-by: Mykhailo Sizov <[email protected]>
  • Loading branch information
mishasizov-SK committed Nov 8, 2022
1 parent b2cd6a8 commit d249cb0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/doc/did/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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...))
}
}
}

Expand Down

0 comments on commit d249cb0

Please sign in to comment.