Skip to content

Commit

Permalink
fixed integration serving and resolving
Browse files Browse the repository at this point in the history
Signed-off-by: 2byrds <[email protected]>
  • Loading branch information
2byrds committed Dec 22, 2023
1 parent 9f410b8 commit fe7c909
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 52 deletions.
3 changes: 0 additions & 3 deletions data/did.json

This file was deleted.

40 changes: 21 additions & 19 deletions integration/app/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <port>

#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 )
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
}

Expand Down Expand Up @@ -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
Expand Down
15 changes: 0 additions & 15 deletions scripts/keri/cf/dkr.json

This file was deleted.

10 changes: 5 additions & 5 deletions src/dkr/app/cli/commands/did/webs/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
# }]
# }
Expand Down
1 change: 1 addition & 0 deletions src/dkr/app/cli/dkr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 13 additions & 7 deletions src/dkr/core/webbing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion volume/dkr/examples/get_started_webs_resolve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
dkr did webs resolve --name "${ctrlName}" --did "did:webs:${hostPath}:${aid}"
6 changes: 5 additions & 1 deletion volume/dkr/examples/get_started_webs_serve.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
dkr did webs service --name "${ctrlName}" --config-dir "${configDir}" --config-file "${configFile}" &
sleep 5

pid=$!
echo "dkr did webs service running as pid: $pid"
4 changes: 3 additions & 1 deletion volume/dkr/examples/my-scripts/keri/cf/config-local.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,7 @@
],
"durls": [
"https://weboftrust.github.io/oobi/EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5"
]
],
"keri.cesr.dir": "./",
"did.doc.dir": "./"
}

0 comments on commit fe7c909

Please sign in to comment.