diff --git a/data/did.json b/data/did.json deleted file mode 100644 index 0f2b3c0..0000000 --- a/data/did.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "did": "did:keri:EJPiEYcCDjg6PdtffDzGB579qsQA2enwfx29EdGIU3Vj:http://127.0.0.1:5643/oobi/EJPiEYcCDjg6PdtffDzGB579qsQA2enwfx29EdGIU3Vj/witness/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM" -} diff --git a/integration/app/integration.sh b/integration/app/integration.sh index 94998e5..b6f54c2 100755 --- a/integration/app/integration.sh +++ b/integration/app/integration.sh @@ -4,21 +4,24 @@ # Run this script from the base resolver directory, like # did-webs-resolver% ./integration/app/integration.sh # +# If there is an error you can search for running services (on mac) with +# sudo lsof -i -P -n | grep LISTEN | grep #print commands -set -x +# set -x #save this current directory, this is where the integration_clienting file also is ORIG_CUR_DIR=$( pwd ) -CTRL_NAME="controller" +controller="controller" +host="127.0.0.1" KERI_BRANCH="main" # KERI_TAG="c3a6fc455b5fac194aa9c264e48ea2c52328d4c5" KERI_PRIMARY_STORAGE="/usr/local/var/keri/" KERI_FALLBACK_STORAGE="${HOME}/.keri/" db_files=() -db_names=("$CTRL_NAME" wan wes wil wit wub wyz) +db_names=("$controller" wan wes wil wit wub wyz) for db_name in "${db_names[@]}"; do path="${KERI_PRIMARY_STORAGE}*/${db_name}*" db_files+=( $path ) @@ -56,10 +59,10 @@ function genDidWebs() { echo "Skipping generate did:webs did document" else echo "Generating did:webs DID Document and KERI event stream" - start_webs="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs.sh" - if [ -f "${start_webs}" ]; then + start_webs_gen="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs_gen.sh" + if [ -f "${start_webs_gen}" ]; then echo "Found get started script to generate did:webs" - source "${start_webs}" "${CTRL_NAME}" "labs.hyperledger.org:did-webs-resolver:pages" "EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP" + source "${start_webs_gen}" "${controller}" "${host}%3a7676" "EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP" sleep 3 echo "Completed loading generating did:webs" else @@ -118,13 +121,13 @@ function createKeriId() { fi create_keri_id=${run_kload_input:-$default_kload} if [ "${create_keri_id}" == "n" ]; then - echo "Skipping load KERI data" + echo "Skipping create KERI id" else - echo "Running load KERI data" + echo "Running create KERI id" create_aid_script="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_create_id.sh" if [ -f "${create_aid_script}" ]; then - echo "Found get started keri script" - source "${create_aid_script}" "${CTRL_NAME}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" "incept-wits.json" + echo "Found get started create id script" + source "${create_aid_script}" "${controller}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" "incept-wits.json" sleep 3 echo "Completed creating KERI identity" else @@ -148,15 +151,13 @@ function resolveDIDAndKeriEvents() { echo "Resolving did:webs DID Document and Keri Events" res_webs_script="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs_resolve.sh" if [ -f "${res_webs_script}" ]; then - echo "Found get started keri script" - source "${res_webs_script}" "${CTRL_NAME}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" + echo "Found get started resolve script" + source "${res_webs_script}" "${controller}" "${host}%3a7676" "EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP" sleep 3 echo "Completed creating KERI identity" else echo "Couldn't find get started keri script" fi - dkr did webs resolve --name wan --did did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha - sleep 3 fi } @@ -203,13 +204,14 @@ function serveDidAndKeriEvents() { if [ "${serve_webs}" == "n" ]; then echo "Skipping serving did:webs DID Document and Keri Events" else - srv_webs_script="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs_resolve.sh" + srv_webs_script="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs_serve.sh" if [ -f "${srv_webs_script}" ]; then echo "Found get started serve script" - source "${srv_webs_script}" "${CTRL_NAME}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" - servePid=$! - sleep 3 - echo "Serving did:webs and keri events" + source "${srv_webs_script}" "${controller}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" + servePid=$! + echo "Serving did:webs and keri events @pid ${servePid}" + echo "DID doc served at http://${host}:7676/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/did.json" + echo "KERI CESR at http://${host}:7676/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/keri.cesr" else echo "Couldn't find get started serve script" fi diff --git a/scripts/keri/cf/dkr.json b/scripts/keri/cf/dkr.json deleted file mode 100755 index 54c417a..0000000 --- a/scripts/keri/cf/dkr.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "dt": "2022-01-20T12:57:59.823350+00:00", - "did:web": { - "gleif/root": "EDP1vHcw_wc4M__Fj53-cJaBnZZASd-aMTaSyWEQ-PC2", - "gleif/external": "EINmHd5g7iV-UldkkkKyBIH052bIyxZNBn9pq-zNrYoS", - "gleif/internal": "EFcrtYzHx11TElxDmEDx355zm7nJhbmdcIluw7UMbUIL" - }, - "keri.cesr.dir": "./keri_cesr", - "did.json.dir": "./did_json", - "iurls": [ - "http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller", - "http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller", - "http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller" - ] -} \ No newline at end of file diff --git a/src/dkr/app/cli/commands/did/webs/resolve.py b/src/dkr/app/cli/commands/did/webs/resolve.py index 470d256..4b737d4 100644 --- a/src/dkr/app/cli/commands/did/webs/resolve.py +++ b/src/dkr/app/cli/commands/did/webs/resolve.py @@ -158,16 +158,16 @@ def compare_dicts(expected, actual, path=""): # # Test with the provided dictionaries # expected_dict = { -# 'id': 'did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha', -# 'verificationMethod': [{'id': 'did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha#key-0', 'type': 'Ed25519VerificationKey2020', 'controller': 'did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha', 'publicKeyMultibase': 'z2fD7Rmbbggzwa4SNpYKWi6csiiUcVeyUTgGzDtMrqC7b'}] +# 'id': 'did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha', +# 'verificationMethod': [{'id': 'did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha#key-0', 'type': 'Ed25519VerificationKey2020', 'controller': 'did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha', 'publicKeyMultibase': 'z2fD7Rmbbggzwa4SNpYKWi6csiiUcVeyUTgGzDtMrqC7b'}] # } # actual_dict = { -# "id": "did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", +# "id": "did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", # "verificationMethod": [{ -# "id": "did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha#key-0", +# "id": "did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha#key-0", # "type": "Ed25519VerificationKey2020", -# "controller": "did:webs:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", +# "controller": "did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", # "publicKeyMultibase": "z2fD7Rmbbggzwa4SNpYKWi6csiiUcVeyUTgGzDtMrqC7b" # }] # } diff --git a/src/dkr/app/cli/dkr.py b/src/dkr/app/cli/dkr.py index ac85c8e..52dd90d 100644 --- a/src/dkr/app/cli/dkr.py +++ b/src/dkr/app/cli/dkr.py @@ -26,6 +26,7 @@ def main(): try: doers = args.handler(args) + # print(f"doers={doers}") directing.runController(doers=doers, expire=0.0) except Exception as ex: diff --git a/src/dkr/core/webbing.py b/src/dkr/core/webbing.py index 713a39f..0554faf 100644 --- a/src/dkr/core/webbing.py +++ b/src/dkr/core/webbing.py @@ -13,11 +13,12 @@ from dkr.core import didding CESR_MIME = "application/cesr" -DD_DEFAULT_DIR = "./did_json" +DD_DEFAULT_DIR = "./" +DD_DIR_CFG = "did.doc.dir" DID_JSON = "did.json" -KC_DEFAULT_DIR = "./keri_cesr" +KC_DEFAULT_DIR = "./" KERI_CESR = "keri.cesr" -KERI_CESR_CFG = "keri.cesr.dir" +KC_DIR_CFG = "keri.cesr.dir" def setup(app, hby, cf): @@ -37,10 +38,15 @@ def setup(app, hby, cf): web = data["did:web"] loadEnds(app, hby, web) - loadFileEnds(app, DidJsonResourceEnd(), DID_JSON, DD_DEFAULT_DIR) - print(f"Using config property {KERI_CESR_CFG} to look for {KERI_CESR} files{data[KERI_CESR_CFG]}") - print(f"Found config {data[KERI_CESR_CFG]}") - loadFileEnds(app, KeriCesrWebResourceEnd(hby), KERI_CESR, data[KERI_CESR_CFG]) + if DD_DIR_CFG in data: + print(f"Using config property {DD_DIR_CFG} to look for {DID_JSON} files: {data[DD_DIR_CFG]}") + default_did_dir = data[DD_DIR_CFG] if DD_DIR_CFG in data else DD_DEFAULT_DIR + loadFileEnds(app, DidJsonResourceEnd(), DID_JSON, default_did_dir) + if KC_DIR_CFG in data: + print(f"Using config property {KC_DIR_CFG} to look for {KERI_CESR} files: {data[KC_DIR_CFG]}") + default_cesr_dir = data[KC_DIR_CFG] if KC_DIR_CFG in data else KC_DEFAULT_DIR + print(f"Using keri cesr dir {default_cesr_dir}") + loadFileEnds(app, KeriCesrWebResourceEnd(hby), KERI_CESR, default_cesr_dir) def loadEnds(app, hby, web): """ Load endpoints for all AIDs or configured AIDs only diff --git a/volume/dkr/examples/get_started_webs_resolve.sh b/volume/dkr/examples/get_started_webs_resolve.sh index 4797910..9b08871 100755 --- a/volume/dkr/examples/get_started_webs_resolve.sh +++ b/volume/dkr/examples/get_started_webs_resolve.sh @@ -8,4 +8,4 @@ hostPath=$2 aid=$3 # generate controller did:webs for EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP at labs.hyperledger.org -dkr did webs generate --name "${ctrlName}" --did "did:webs:${hostPath}:${aid}" \ No newline at end of file +dkr did webs resolve --name "${ctrlName}" --did "did:webs:${hostPath}:${aid}" \ No newline at end of file diff --git a/volume/dkr/examples/get_started_webs_serve.sh b/volume/dkr/examples/get_started_webs_serve.sh index 1bed2ed..f83c200 100755 --- a/volume/dkr/examples/get_started_webs_serve.sh +++ b/volume/dkr/examples/get_started_webs_serve.sh @@ -8,4 +8,8 @@ configDir=$2 configFile=$3 # serve controller did:webs for EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP at 127.0.0.1: -dkr did webs service --name "${ctrlName}" --config-dir "${configDir}" --config-file "${configFile}" --http 7676 \ No newline at end of file +dkr did webs service --name "${ctrlName}" --config-dir "${configDir}" --config-file "${configFile}" & +sleep 5 + +pid=$! +echo "dkr did webs service running as pid: $pid" \ No newline at end of file diff --git a/volume/dkr/examples/my-scripts/keri/cf/config-local.json b/volume/dkr/examples/my-scripts/keri/cf/config-local.json index f90c9c7..1b02013 100755 --- a/volume/dkr/examples/my-scripts/keri/cf/config-local.json +++ b/volume/dkr/examples/my-scripts/keri/cf/config-local.json @@ -7,5 +7,7 @@ ], "durls": [ "https://weboftrust.github.io/oobi/EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5" - ] + ], + "keri.cesr.dir": "./", + "did.doc.dir": "./" } \ No newline at end of file