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

feat: add did core support in resolving service endpoints function #3429

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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