Skip to content
Snippets Groups Projects
Commit 0a0aa669 authored by Steffen Schulze's avatar Steffen Schulze
Browse files

fix for universal resolver

parent 9c372119
No related branches found
No related tags found
1 merge request!10Refactoring
Pipeline #54020 passed with warnings with stages
in 2 minutes and 36 seconds
env: DEV # DEV, PROD
logLevel: "info" # info, debug, warning, error
label: My Mediator
port: 8080
url: "http://localhost:8080"
port: 8081
url: "http://localhost:8081"
tokenExpiration: 500000
didcomm:
resolverUrl: "http://localhost:8081"
resolverUrl: "http://localhost:8080"
messageEncrypted: false
# database
......@@ -14,8 +14,8 @@ db:
host: "localhost"
port: 9042
user: "cassandra"
password: "cassandra"
keyspace: "dcc"
password: "f0U5AoZtVk"
keyspace: "didcomm_space"
dbName: "cassandra"
# config for cloudEventProdvider
......
......@@ -41,15 +41,19 @@ services:
- test
uni-resolverAlpha:
image: uport/uni-resolver-driver-did-uport:4.3.0
image: universalresolver/uni-resolver-web:latest
container_name: uni-resolverAlpha
ports:
- "8082:8081"
- "8080:8080"
healthcheck:
test: curl --fail http://uni-resolverAlpha:8081/health || exit 1
test: curl --fail http://uni-resolver:8080/1.0/testIdentifers || exit 1
interval: 10s
timeout: 5s
retries: 5
environment:
uniresolver_web_driver_url_did_jwk: http://did-jwk-driver:8080
uniresolver_web_driver_url_did_peer: http://uni-resolver-driver-did-uport:8081
uniresolver_web_driver_url_did_web: http://did-jwk-driver:8080
networks:
- test
......
......@@ -41,15 +41,32 @@ services:
- test
uni-resolverBeta:
image: uport/uni-resolver-driver-did-uport:4.3.0
image: universalresolver/uni-resolver-web:latest
container_name: uni-resolverBeta
ports:
- "8083:8081"
- "8080:8080"
healthcheck:
test: curl --fail http://uni-resolverBeta:8081/health || exit 1
test: curl --fail http://uni-resolver:8080/1.0/testIdentifers || exit 1
interval: 10s
timeout: 5s
retries: 5
environment:
uniresolver_web_driver_url_did_jwk: http://did-jwk-driver:8080
uniresolver_web_driver_url_did_peer: http://uni-resolver-driver-did-uport:8081
uniresolver_web_driver_url_did_web: http://did-jwk-driver:8080
networks:
- test
uni-resolver-driver-did-uport:
image: uport/uni-resolver-driver-did-uport:5.0.0
ports:
- "8083:8081"
networks:
- test
did-jwk-driver:
image: transmute/restricted-resolver:latest
ports:
- "8134:8080"
networks:
- test
......
......@@ -2,8 +2,8 @@ version: "3"
networks:
test:
name: test_network
driver: bridge
name: testnetwork
driver: bridge
services:
#didcomconnector:
......@@ -26,15 +26,31 @@ services:
- test
uni-resolver:
image: uport/uni-resolver-driver-did-uport:4.3.0
image: universalresolver/uni-resolver-web:latest
container_name: uni-resolver
ports:
- "8081:8081"
- "8080:8080"
healthcheck:
test: curl --fail http://uni-resolver:8081/health || exit 1
test: curl --fail http://uni-resolver:8080/1.0/testIdentifers || exit 1
interval: 10s
timeout: 5s
retries: 5
environment:
uniresolver_web_driver_url_did_jwk: http://did-jwk-driver:8080
uniresolver_web_driver_url_did_peer: http://uni-resolver-driver-did-uport:8081
uniresolver_web_driver_url_did_web: http://did-jwk-driver:8080
networks:
- test
uni-resolver-driver-did-uport:
image: uport/uni-resolver-driver-did-uport:5.0.0
ports:
- "8083:8081"
networks:
- test
did-jwk-driver:
image: transmute/restricted-resolver:latest
ports:
- "8134:8080"
networks:
- test
......
This diff is collapsed.
This diff is collapsed.
......@@ -222,7 +222,7 @@ func checkMode() error {
}
func checkResolver(resolverUrl string) error {
queryUrl, err := url.JoinPath(resolverUrl, "/health")
queryUrl, err := url.JoinPath(resolverUrl, "/1.0/testIdentifiers")
if err != nil {
return err
}
......
......@@ -112,14 +112,40 @@ func (u *UniverseDidResolver) ResolveDid(did string) (*didcomm.DidDoc, error) {
if err != nil {
return nil, err
}
var didDocJSON DidDocumentJSON
err = json.Unmarshal(body, &didDocJSON)
var dict map[string]interface{}
err = json.Unmarshal(body, &dict)
if err != nil {
config.Logger.Error("Unmarshaling has failed:", "err", err)
return nil, err
}
didDoc := u.didDocJsonToDidDoc(didDocJSON)
return didDoc, nil
_, isDriver := dict["didDocument"]
if isDriver {
var didDocJSON DidDocumentJSON
err = json.Unmarshal(body, &didDocJSON)
if err != nil {
uT, ok := err.(*json.UnmarshalTypeError)
if ok {
if uT.Field != "didDocument.@context" {
config.Logger.Error("Unmarshaling has failed:", "err", err)
return nil, err
}
}
}
didDoc := u.didDocJsonToDidDoc(didDocJSON)
return didDoc, nil
}
var didDoc didcomm.DidDoc
err = json.Unmarshal(body, &didDoc)
return &didDoc, err
}
func (u *UniverseDidResolver) ResolveDidAsJson(did string) (*DidDocumentJSON, error) {
......@@ -136,13 +162,38 @@ func (u *UniverseDidResolver) ResolveDidAsJson(did string) (*DidDocumentJSON, er
if err != nil {
return nil, err
}
var didDocJSON DidDocumentJSON
err = json.Unmarshal(body, &didDocJSON)
var dict map[string]interface{}
err = json.Unmarshal(body, &dict)
if err != nil {
config.Logger.Error("Unmarshaling has failed:", "err", err)
return nil, err
}
return &didDocJSON, nil
_, isDriver := dict["didDocument"]
var didDocJSON DidDocumentJSON
if isDriver {
err = json.Unmarshal(body, &didDocJSON)
uT, ok := err.(*json.UnmarshalTypeError)
if ok {
if uT.Field != "didDocument.@context" {
config.Logger.Error("Unmarshaling has failed:", "err", err)
return nil, err
}
}
} else {
var didDoc DidDocument
err = json.Unmarshal(body, &didDoc)
didDocJSON = DidDocumentJSON{
DidDocument: didDoc,
}
}
return &didDocJSON, err
}
func (u *UniverseDidResolver) didDocJsonToDidDoc(ddJson DidDocumentJSON) *didcomm.DidDoc {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment