hyperledger-labs / did-webs-resolver

A reference implementation for the did:webs DID method specified here https://github.com/trustoverip/tswg-did-method-webs-specification. The original work for the reference impl started here https://github.com/WebOfTrust/did-keri-resolver
Apache License 2.0
11 stars 10 forks source link

Failing to run dkr did webs service due to KeyError: 'keri.cesr.dir' #36

Closed jruizaranguren closed 10 months ago

jruizaranguren commented 10 months ago

In order to test did.webs resolution, I'm executing the following steps (trying to avoid witnesses burden):

export CONFIG_ROOT=$(pwd)/.keri
export SOMEDID_SALT="$(kli salt)"

mkdir -p ${CONFIG_ROOT}/somedid

echo "Creating somedid config..."
echo '{
    "transferable": true,
    "wits": [],
    "toad": 0,
    "icount": 1,
    "ncount": 1,
    "isith": "1",
    "nsith": "1"}' > ${CONFIG_ROOT}/somedid/somedid_aid_config.json

echo "Creating somedid keystore..."
kli init --name somedid --salt ${SOMEDID_SALT} --nopasscode \
    --base ${CONFIG_ROOT} \
    --config-dir ${CONFIG_ROOT}
echo ""
echo "Creating somedid identifier..."
kli incept --name somedid \
    --alias somedid \
    --base ${CONFIG_ROOT} \
    -f ${CONFIG_ROOT}/somedid/somedid_aid_config.json

echo "Creating did for somedid..."
prefix="$(kli did generate --name somedid \
    --base ${CONFIG_ROOT} | awk -F':' '{print $NF}')"

echo "Generating did:webs for somedid..."
dkr did webs generate --name somedid \
    --did did:webs:danubetech.com:example:"$prefix" --base ${CONFIG_ROOT}

This results in the creation of two files at $(PWD), not related to ${CONFIG_ROOT}:

Now, when I try to run the service through:

dkr did webs service -p 8080 -n somedid --base ${CONFIG_ROOT}

I get the following error:

  File "/my/pathj/to/.venv/lib/python3.10/site-packages/dkr/core/webbing.py", line 41, in setup
    print(f"Using config property {KERI_CESR_CFG} to look for {KERI_CESR} files{data[KERI_CESR_CFG]}")
KeyError: 'keri.cesr.dir'

What would be the missing piece?

2byrds commented 10 months ago

Hi @jruizaranguren I recommend you work from my dev branch. the GETTING_STARTED there will guide you through that configuration, etc https://github.com/2byrds/did-webs-resolver/tree/getting_started I'm working on a bug in the resolver currently but for what you are doing it should be good.

2byrds commented 10 months ago

Hi @jruizaranguren I have merged the branch to main. I will create issues for the resolver bugs that i continue to work on.

jruizaranguren commented 10 months ago

@2byrds , thanks for the update. The script now creates the files at new directory:

And then, running the service raises:

  File "/my/path/to/venv/lib/python3.10/site-packages/keri/db/dbing.py", line 448, in getVal
    with self.env.begin(db=db, write=False, buffers=True) as txn:
lmdb.InvalidParameterError: mdb_txn_begin: Invalid argument

The reliance of keri code in general on certain path structures is quite annoying, and It makes it quite difficult to consider it for production usages. I think users should be in full control on where store things (identifiers, logs, configurations, etc.).

2byrds commented 10 months ago

mdb_txn_begin

@jruizaranguren my intention is for the getting started to be easy, so that people can understand how did:webs works. Then getting into production would be the next priority and i'm happy to work with you to adjust. The mdb_txn_begin error doesn't look familiar. Are you able to provide a longer log in a new issue?

jruizaranguren commented 10 months ago

@2byrds, sorry, my bad, I could not reproduce that issue. The server appears to launch with the following command:

> dkr did webs service -p 8080 -n didme --base ${CONFIG_ROOT} 

And then raises a type error. Is just a conversion issue? I can fix it if you want:

Loading existing habery didme /my/path/to/.keri None <keri.app.configing.Configer object at 0x7f879d94b2b0>
Added route /did.json
Loading did.json files from directory ./
Looking for did.json file ./clean.sh
Skipping ./clean.sh/did.json as it is not a file
Looking for did.json file ./createdid.sh
Skipping ./createdid.sh/did.json as it is not a file
Looking for did.json file ./.keri
Skipping ./.keri/did.json as it is not a file
Looking for did.json file ./EFY6fmskZsx3rI6DEKLawUv2tSxdgwVj0_kPhTku6cEY
registering /EFY6fmskZsx3rI6DEKLawUv2tSxdgwVj0_kPhTku6cEY/did.json
Using keri cesr dir ./
Loading keri.cesr files from directory ./
Looking for keri.cesr file ./clean.sh
Skipping ./clean.sh/keri.cesr as it is not a file
Looking for keri.cesr file ./createdid.sh
Skipping ./createdid.sh/keri.cesr as it is not a file
Looking for keri.cesr file ./.keri
Skipping ./.keri/keri.cesr as it is not a file
Looking for keri.cesr file ./EFY6fmskZsx3rI6DEKLawUv2tSxdgwVj0_kPhTku6cEY
registering /EFY6fmskZsx3rI6DEKLawUv2tSxdgwVj0_kPhTku6cEY/keri.cesr
Launched web server capable of serving KERI AIDs as did:webs DIDs on: 8080
Traceback (most recent call last):
  File "/my/path/to/.venv/bin/dkr", line 8, in <module>
    sys.exit(main())
  File "/my/path/to/.venv/lib/python3.10/site-packages/dkr/app/cli/dkr.py", line 33, in main
    raise ex
  File "/my/path/to/.venv/lib/python3.10/site-packages/dkr/app/cli/dkr.py", line 30, in main
    directing.runController(doers=doers, expire=0.0)
  File "/my/path/to/.venv/lib/python3.10/site-packages/keri/app/directing.py", line 728, in runController
    doist.do(doers=doers)
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/base/doing.py", line 149, in do
    self.enter()  # runs enter context on each doer
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/base/doing.py", line 230, in enter
    next(dog)  # run enter by advancing to first yield
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/base/doing.py", line 560, in do
    self.enter()
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/core/http/serving.py", line 1354, in enter
    self.server.reopen()
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/core/http/serving.py", line 667, in reopen
    return self.servant.reopen()
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/core/tcp/serving.py", line 161, in reopen
    return self.open()
  File "/my/path/to/.venv/lib/python3.10/site-packages/hio/core/tcp/serving.py", line 145, in open
    self.ss.bind(self.ha)
TypeError: 'str' object cannot be interpreted as an integer
jruizaranguren commented 10 months ago

Then getting into production would be the next priority and i'm happy to work with you to adjust.

Sure, even source of problems comes from keripy and its coupling to a certain directory structure and defaults.