diff --git a/GETTING_STARTED.md b/GETTING_STARTED.md new file mode 100644 index 0000000..8cb0a89 --- /dev/null +++ b/GETTING_STARTED.md @@ -0,0 +1,568 @@ +# Developers - Getting Started + +Welcome to the `did:webs` reference implementation Getting Started guide. + +Thank you to Markus Sabadello @peacekeeper from DanubeTech who created the original guide for IIW37 [here](https://github.com/peacekeeper/did-webs-iiw-tutorial) + +If you're running into trouble in the process below, be sure to check the section [Trouble Shooting](#trouble-shooting) below. + +Let's get started! We'll use docker to setup and run in a simple environment. + +## Run Docker build +``` +docker compose build --no-cache +``` + +## Run Docker containers for the keri witness network and the `did:webs` generator and resolver environment + +``` +docker compose down +docker compose up -d +``` + +## Enter the dkr docker environment command line to begin running keri, etc. commands + +``` +docker compose exec webs /bin/bash +``` + +## Create your KERI identifier +Execute the following commands to create your KERI identifier that secures your did:webs DID: +* From the dkr Docker container shell, go to the `examples` dir +``` +cd volume/dkr/examples +``` + +### Create a cryptographic salt to secure your KERI identifier +``` +kli salt +``` +The example salt we use in the scripts: +``` +0AAQmsjh-C7kAJZQEzdrzwB7 +``` + + +### Create the KERI AID ```ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe``` +#### initialize your environment with a name, salt, and config file + +`command:` +``` +kli init --name controller --salt 0AAQmsjh-C7kAJZQEzdrzwB7 --nopasscode --config-dir /usr/local/var/webs/volume/dkr/examples/my-scripts --config-file config-docker +``` + +```output:``` +``` +KERI Keystore created at: /usr/local/var/keri/ks/controller +KERI Database created at: /usr/local/var/keri/db/controller +KERI Credential Store created at: /usr/local/var/keri/reg/controller + +Loading 3 OOBIs... +http://witnesshost:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller succeeded +http://witnesshost:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller succeeded +http://witnesshost:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller succeeded +``` + +#### create your AID by creating it's first event, the inception event + +`command:` +``` +kli incept --name controller --alias controller --file /usr/local/var/webs/volume/dkr/examples/my-scripts/incept.json +``` + +```output:``` +``` +bash-5.1# kli incept --name controller --alias controller --file ./my-scripts/incept.json +Prefix ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe + Public key 1: DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr +``` +Your AID is ```ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe``` and your current public key is ```DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr``` + +#### Additional info +The AID config-file in the container is at ./my-scripts/keri/cf/config-docker.json and contains the KERI OOBIs of the witnesses that we'll use: +In this case they are available from the witness network that we started in the docker-compose. If you `cat` the config at `/usr/local/var/webs/volume/dkr/examples/my-scripts/keri/cf/config-docker.json` you should see: + +`config:` +```json +{ + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + "http://witnesshost:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller", + "http://witnesshost:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller", + "http://witnesshost:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller" + ] +} +``` + +## (Optional) Perform more KERI operations + +Optionally use `kli` to perform additional KERI operations such as key rotation, threshold signatures, etc., see KERI docs for details. + +See [a key rotation example](#example-key-rotation) below. + + +## Decide your web address for did:webs + +Find a web address (host, optional port, optional path) that you control. + +Example web address with host `labs.hyperledger.org`, no optional port, and optional path `pages`: + +``` +https://labs.hyperledger.org/did-webs-resolver/pages/ +``` + +## Generate your did:webs identifier files using your KERI AID + +Note: Replace with your actual web address and AID + +You should pick the web address (host, optional port, optional path) where you will host the did:webs identifier. For this example we'll use the docker service we've created at host `did-webs-service` and with optional port `7676`. NOTE the spec requires the colon `:` before an optional port to be encoded as `%3a` in the did:webs identifier. + +`command:` +``` +dkr did webs generate --name controller --did "did:webs:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe" +``` + +`output:` +``` +Generating CESR event stream data from hab +Generating ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe KEL CESR events +Writing CESR events to ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/keri.cesr: +{"v":"KERI10JSON00012b_","t":"icp","d":"ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe","i":"ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe","s":"0","kt":"1","k":["DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr"],"nt":"1","n":["ELa775aLyane1vdiJEuexP8zrueiIoG995pZPGJiBzGX"],"bt":"0","b":[],"c":[],"a":[]}-VAn-AABAADjfOjbPu9OWce59OQIc-y3Su4kvfC2BAd_e_NLHbXcOK8-3s6do5vBfrxQ1kDyvFGCPMcSl620dLMZ4QDYlvME-EAB0AAAAAAAAAAAAAAAAAAAAAAA1AAG2023-12-26T20c12c58d336072p00c00 + + "didDocument": { + "id": "did:web:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", + "verificationMethod": [ + { + "id": "#DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr", + "type": "JsonWebKey", + "controller": "did:web:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", + "publicKeyJwk": { + "kid": "DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr", + "kty": "OKP", + "crv": "Ed25519", + "x": "evT4j6Yw3uHpwsw5NEmSR8-4x3S-BA-s6Thjd51oeOs" + } + } + ], + "service": [], + "alsoKnownAs": [] + } + ... with additional output continuing... +``` + +This creates files `did.json` and `keri.cesr` under local path `./volume/dkr/examples//did.json` + +You can access these files either from within your Docker container or on your local computer filesystem. +- `/volume/dkr/examples/` (local path on your computer) +- `/usr/local/var/webs/volume/dkr/examples/` (local path in the Docker container) + + +## Upload did.json and keri.cesr to the web address (host, optional port, optional path) that corresponds to the + +E.g. using git, Github pages, FTP, SCP, etc. + +## Example: serve from docker +You can run the docker example service to serve the did.json and keri.cesr files for the other docker containers: + +First, lets copy our generated files to the directory we'll serve from. On your local machine (or within the container) you can copy `volume/dkr/examples/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe` to `volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe`: + +``` +docker compose exec did-webs-service /bin/bash +``` + +``` +dkr did webs service --name webserve --config-dir /usr/local/var/webs/volume/dkr/examples/my-scripts --config-file config-docker +``` + +It will search for AID named directories and for the two files (`did.json` and `keri.cesr`) under those directories. The search occurs from the directory specified in the config-file properties: +``` + "keri.cesr.dir": "/usr/local/var/webs/volume/dkr/pages/", + "did.doc.dir": "/usr/local/var/webs/volume/dkr/pages/" +``` + +And when a file is found by the service, there will be logs like: +``` +Looking for did.json file /usr/local/var/webs/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe +registering /ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/did.json +``` + +It will serve it at a URL that you can CURL from any other docker container (for instance from the webs container) like: + +``` +curl -GET http://did-webs-service:7676/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/did.json +``` +and +``` +curl -GET http://did-webs-service:7676/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/keri.cesr +``` +### Example: Resolve AID as did:webs using local resolver + +Back in the webs docker container, you can resolve the DID from the did-webs-service: + +Initialize a `verifier` environment: +``` +kli init --name verifier --nopasscode +``` +Resolve the did:webs for the `controller` did: +``` +dkr did webs resolve --name verifier --did "did:webs:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe" +``` + +## Example: WOT-terms install using GIT + +We choose `WOT-terms` as our [DESTINATION LOCAL REPO] + +``` +cd [PATH TO LOCAL SOURCE REPO did-webs-iiw37-tutorial]/volume/dkr/did_json/ENbWS51Pw1rmxz5QIfK5kp3ODaEeQcZjqQNrLpc6mMQq +cp did.json ~/apps/WOT-terms/ +cd ../../keri_cesr/ENbWS51Pw1rmxz5QIfK5kp3ODaEeQcZjqQNrLpc6mMQq +cp keri.cesr ~/apps/WOT-terms/ +``` + +Result in local WOT-terms repo +``` +[DESTINATION LOCAL REPO]: git status + +Untracked files: + (use "git add ..." to include in what will be committed) + did.json + keri.cesr + +git add . +git commit -m "prepare upload did:webs documents to WOT-terms" +git push upstream main +``` +If you get the expected output of the push action, the files are on the controlled webserver. + +### Check if files are available on your server + +Note: Replace with your actual web address and AID + +https://peacekeeper.github.io/did-webs-iiw37-tutorial/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/did.json + +https://peacekeeper.github.io/did-webs-iiw37-tutorial/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/keri.cesr + + +### (Optional) Resolve AID as did:keri using local resolver + +Optionally resolve the AID locally as did:keri, given an OOBI as resolution option. + +Note: Replace with your actual AID + +``` +dkr did keri resolve --name controller --did did:keri:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP --oobi http://witnesshost:5642/oobi/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha +``` + +### (Optional) Resolve AID as did:webs using local resolver + +Optionally resolve the AID locally as did:webs. + +Note: Replace with your actual web address and AID + +``` +dkr did webs resolve --name controller --did did:webs:peacekeeper.github.io:did-webs-iiw37-tutorial:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP +``` + +### Resolve as did:web using Universal Resolver + +https://dev.uniresolver.io/#did:web:peacekeeper.github.io:did-webs-iiw37-tutorial:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP + +### Resolve as did:webs using Universal Resolver + +https://dev.uniresolver.io/#did:webs:peacekeeper.github.io:did-webs-iiw37-tutorial:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP + +### Example key rotation + +Use the following two commands in your running Docker container. + +``` +kli rotate --name controller --alias controller +``` +Be sure to repeat the `dkr webs generate` command: +``` +dkr did webs generate --name controller --did did:webs:blockchainbird.org:did-webs:EG8GsKYdICKs-zI6odM6tvCmxRT2J-7UkZFqA77agtb8 --oobi http://witnesshost:5642/oobi/EG8GsKYdICKs-zI6odM6tvCmxRT2J-7UkZFqA77agtb8/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha +``` +Now upload the overwritten `did.json` and `keri.cesr` again to the public spot. + +### Result + +A diff comparison of the old (in green) and the new (in red) **did.json**: +![did.json new in red versus old in green](./images/diff-did-json.png) +A diff comparison of the old (right) and the new (left) **keri.cesr**; in blue the added part: +![keri.cesr new in red versus old in green](./images/diff-keri-cesr.png) + +## Trouble shooting + +### If you are using an Apple Silicon (M1) mac then you might need to: +* In Docker, select `Use Rosetta for x86/amd64 emulation on Apple Silicon` +* Before running docker compose `export DOCKER_DEFAULT_PLATFORM=linux/amd64` + +### Your docker container is already up- and running? + +#### Do you have a witness up for another identifier? +Then the `kli incept --name controller --alias controller --file "/keripy/my-scripts/my-incept.json"` command will give this response: + +`ERR: Already incepted pre=[Your prefix of another AID].` + +#### Solution +Various solutions if you're a Docker expert. If not, we'll go down the more rigorous path: + +1. Step out of the running container with `exit` +2. and then `docker compose down`. This should respond with: + +[+] Running 3/3 + ⠿ Container dkr Removed 0.0s + ⠿ Container witnesshost Removed 13.7s + ⠿ Network did-webs-iiw37-tutorial_default Removed 3.1s +Now you could continue with: +``` +docker compose up -d +docker compose exec dkr /bin/bash +``` +### Special attention Github Pages: web address +There's no problem that we know of when you use Github pages in a bare-bones manner. However, if you use static page generators to populate your github pages (e.g. Jekyll or Docusaurus) be sure to choose the right spot of your files and extract the right paths of the links needed to resolve: + +#### Example +This is the web address of the `docusaurus` directory: +https://weboftrust.github.io/WOT-terms/test/did-webs-iiw37-tutorial/ + +But the exact spot to extract the files as text would be something like: +``` +http://raw.githubusercontent.com/WOT-terms/test/did-webs-iiw37-tutorial/[your AID] +``` +The reason for this confusion is that a static page generator like Docusaurus or Jekyll might interfere with the location, visibility and accessibility of your files on Github Pages. + +We advise to choose a simple public directory that you control and we won't go into more detail on how to deal with static site generators. + +Example: +``` +dkr did keri resolve --name dkr --did did:keri:EPaP4GgZsB6Ww-SeSO2gwNDMNpC7-DN51X5AqiJFWkw6 --oobi http://witnesshost:5642/oobi/EPaP4GgZsB6Ww-SeSO2gwNDMNpC7-DN51X5AqiJFWkw6/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha +``` + +``` + did:keri:123, oobi --------------------------------- --------------------- + O -----------------> | | | | + -|- <----------------- | dkr did keri resolve | <----> | KERI WATCHER POOL | + / \ diddoc, metadata | | | | + --------------------------------- --------------------- +``` + +### `dkr did keri resolver-service` + +**Expose did:keri resolver as an HTTP web service.** (Can be deployed as Universal Resolver driver) + +Example: +``` +dkr did keri resolver-service --name dkr --port 7678 +``` + +``` + --------------------------------- --------------------- + | | | | + | dkr did keri resolver-service | <----> | KERI WATCHER POOL | + | | | | + --------------------------------- --------------------- + HTTPS + HTTP GET ^ | 200 OK + did:keri:123 | | diddoc + oobi | v metadata + + o + -|- + / \ +``` + +## did:webs + +### `dkr did webs generate` + +**Generate a did:webs DID document and KEL/TEL file.** + +Example: +``` +dkr did webs generate --name dkr --did did:webs:danubetech.com:example:EPaP4GgZsB6Ww-SeSO2gwNDMNpC7-DN51X5AqiJFWkw6 +``` + +``` + --------------------------------- + did.json, keri.cesr | | + ---------------------> | ANY WEB SERVER /123/did.json | + | | /123/keri.cesr | + | UPLOAD --------------------------------- + | + | + did:webs:dom:123 --------------------------------- --------------------- + O -----------------> | | | | + -|- <----------------- | dkr did webs generate | <----> | KERI WATCHER POOL | + / \ did.json, keri.cesr | | | | + --------------------------------- --------------------- +``` + +### `dkr did webs service` + +**Launch web server capable of serving KERI AIDs as did:webs and did:web DIDs.** + +Example: +``` +dkr did webs service --name dkr --port 7676 +``` + +``` + --------------------------------- --------------------- + | | | | + | dkr did webs service | <----> | KERI WATCHER POOL | + | | | | + --------------------------------- --------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + /123/keri.cesr | v keri.cesr + + did:webs:dom:123 --------------------------------- + O -----------------> | | + -|- <----------------- | ANY DID:WEBS RESOLVER | <----- (verify did.json/keri.cesr) + / \ diddoc, metadata | | + --------------------------------- +``` + +``` + --------------------------------- --------------------- + | | | | + | dkr did webs service | <----> | KERI WATCHER POOL | + | | | | + --------------------------------- --------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + | v + + did:web:dom:123 --------------------------------- + O -----------------> | | + -|- <----------------- | ANY DID:WEB RESOLVER | + / \ diddoc | | + --------------------------------- +``` + +### `dkr did webs resolve` + +**Resolve a did:webs DID.** + +Example: +``` +dkr did webs resolve --name dkr --did did:webs:danubetech.com:example:EPaP4GgZsB6Ww-SeSO2gwNDMNpC7-DN51X5AqiJFWkw6 +``` + +``` + --------------------------------- --------------------- + | | | | + | dkr did webs service | <----> | KERI WATCHER POOL | + | | | | + --------------------------------- --------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + /123/keri.cesr | v keri.cesr + + did:webs:dom:123 --------------------------------- + O -----------------> | | + -|- <----------------- | dkr did webs resolve | <----- (verify did.json/keri.cesr) + / \ diddoc, metadata | | + --------------------------------- +``` + +``` + --------------------------------- + | | + | ANY WEB SERVER /123/did.json | + | /123/keri.cesr | + --------------------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + /123/keri.cesr | v keri.cesr + + did:webs:dom:123 --------------------------------- + O -----------------> | | + -|- <----------------- | dkr did webs resolve | <----- (verify did.json/keri.cesr) + / \ diddoc, metadata | | + --------------------------------- +``` + +``` + --------------------------------- + | | + | ANY WEB SERVER /123/did.json | + | /123/keri.cesr | + --------------------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + | v + + did:web:dom:123 --------------------------------- + O -----------------> | | + -|- <----------------- | ANY DID:WEB RESOLVER | + / \ diddoc | | + --------------------------------- +``` + +### `dkr did webs resolver-service` + +**Expose did:webs resolver as an HTTP web service.** (Can be deployed as Universal Resolver driver) + +Example: +``` +dkr did keri resolve --name dkr --port 7677 +``` + +``` + --------------------------------- --------------------- + | | | | + | dkr did webs service | <----> | KERI WATCHER POOL | + | | | | + --------------------------------- --------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + /123/keri.cesr | v keri.cesr + + --------------------------------- + | | + | dkr did webs resolver-service | <----- (verify did.json/keri.cesr) + | | + --------------------------------- + HTTPS + HTTP GET ^ | 200 OK + did:webs:123 | | diddoc + oobi | v metadata + + o + -|- + / \ +``` + +``` + --------------------------------- + | | + | ANY WEB SERVER /123/did.json | + | /123/keri.cesr | + --------------------------------- + HTTPS + HTTP GET ^ | 200 OK + /123/did.json | | did.json + /123/keri.cesr | v keri.cesr + + --------------------------------- + | | + | dkr did webs resolver-service | <----- (verify did.json/keri.cesr) + | | + --------------------------------- + HTTPS + HTTP GET ^ | 200 OK + did:webs:123 | | diddoc + | v metadata + + o + -|- + / \ +``` diff --git a/Makefile b/Makefile index dc04d6b..67e614c 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -.PHONY: build-did-keri-resolver -build-did-keri-resolver: - @docker buildx build --platform=linux/amd64 --no-cache -f images/did-keri-resolver.dockerfile --tag weboftrust/did-keri-resolver:latest --tag weboftrust/did-keri-resolver:0.1.0 . +.PHONY: build-did-webs-resolver +build-did-webs-resolver: + @docker buildx build --platform=linux/amd64 --no-cache -f images/did-webs-resolver.dockerfile --tag weboftrust/did-webs-resolver:latest --tag weboftrust/did-webs-resolver:0.1.0 . .PHONY: build-did-web build-did-web: @docker build --platform=linux/amd64 -f images/did-web.dockerfile --tag weboftrust/did-web:latest --tag weboftrust/did-web:0.1.0 . -.PHONY: run-did-keri-resolver +.PHONY: run-did-webs-resolver run-agent: - @docker run -p 5921:5921 -p 5923:5923 --name agent weboftrust/did-keri-resolver:0.1.0 + @docker run -p 5921:5921 -p 5923:5923 --name agent weboftrust/did-webs-resolver:0.1.0 .PHONY: push-all push-all: diff --git a/README.md b/README.md index fa71fc0..5f13f33 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +# Introduction + +Welcome to the `did:webs` reference implementation repository. See the did:webs [specification](https://trustoverip.github.io/tswg-did-method-webs-specification/) for more information. + +Thank you to Phil Feairheller @pfeairheller from GLEIF who started this work [here](https://github.com/WebOfTrust/did-keri-resolver) + +# Developers - Getting Started + +Developers who want to jump into using the `did:webs` reference implementation should follow the [Getting Started](./GETTING_STARTED.md) guide. + +Thank you to Markus Sabadello @peacekeeper from DanubeTech who started the original tutorial for IIW37 [here](https://github.com/peacekeeper/did-webs-iiw-tutorial) + # dkr did:keri/did:webs DID Resolver Reference Implementation 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/docker-compose.yml b/docker-compose.yml index 3460d93..7fd9983 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,29 @@ version: "3" services: - dkr: - container_name: dkr - hostname: dkr + witnesshost: + container_name: witnesshost + hostname: witnesshost + image: gleif/keri:latest + platform: linux/amd64 + tty: true + ports: + - 5642:5642 # witness + - 5643:5643 # witness + - 5644:5644 # witness + entrypoint: kli witness demo + + webs: + container_name: webs + hostname: webs build: context: . - dockerfile: ./images/dkr.dockerfile - image: gleif/dkr:latest + dockerfile: ./images/webs.dockerfile + image: 2byrds/webs:latest tty: true + volumes: + - ~/VSCode/did-keri-resolver/volume/dkr/examples:/usr/local/var/webs/volume/dkr/examples + - ~/VSCode/did-keri-resolver/volume/dkr/pages:/usr/local/var/webs/volume/dkr/pages did-webs-service: container_name: did-webs-service @@ -17,31 +32,23 @@ services: context: . dockerfile: ./images/did-webs-service.dockerfile depends_on: - - dkr - image: gleif/did-webs-service:latest + - webs ports: - 7676:7676 + tty: true + volumes: + - ~/VSCode/did-keri-resolver/volume/dkr/examples:/usr/local/var/webs/volume/dkr/examples + - ~/VSCode/did-keri-resolver/volume/dkr/pages:/usr/local/var/webs/volume/dkr/pages did-webs-resolver-service: - container_name: did-webs-resolver-service - hostname: did-webs-resolver-service + container_name: did-webs-resolver + hostname: did-webs-resolver build: context: . dockerfile: ./images/did-webs-resolver-service.dockerfile - depends_on: - - dkr - image: gleif/did-webs-resolver-service:latest + image: did-webs-resolver:latest ports: - 7677:7677 - - did-keri-resolver-service: - container_name: did-keri-resolver-service - hostname: did-keri-resolver-service - build: - context: . - dockerfile: ./images/did-keri-resolver-service.dockerfile + tty: true depends_on: - - dkr - image: gleif/did-keri-resolver-service:latest - ports: - - 7678:7678 + - webs diff --git a/images/did-keri-resolver-service.dockerfile b/images/did-keri-resolver-service.dockerfile index 0a2a9bc..ecd18ba 100644 --- a/images/did-keri-resolver-service.dockerfile +++ b/images/did-keri-resolver-service.dockerfile @@ -1,5 +1,5 @@ -FROM gleif/dkr:latest +FROM 2byrds/webs:latest EXPOSE 7678 -CMD ["/usr/local/var/did-keri-resolver/scripts/did-keri-resolver-service.sh"] +CMD ["/usr/local/var/webs/scripts/webs-resolver-service.sh"] \ No newline at end of file diff --git a/images/did-webs-resolver-service.dockerfile b/images/did-webs-resolver-service.dockerfile index 9290de9..a4fe485 100644 --- a/images/did-webs-resolver-service.dockerfile +++ b/images/did-webs-resolver-service.dockerfile @@ -1,5 +1,5 @@ -FROM gleif/dkr:latest +FROM 2byrds/webs:latest EXPOSE 7677 -CMD ["/usr/local/var/did-keri-resolver/scripts/did-webs-resolver-service.sh"] +WORKDIR /usr/local/var/webs/volume/dkr/examples \ No newline at end of file diff --git a/images/did-webs-service.dockerfile b/images/did-webs-service.dockerfile index 0afba1c..5566b4c 100644 --- a/images/did-webs-service.dockerfile +++ b/images/did-webs-service.dockerfile @@ -1,5 +1,5 @@ -FROM gleif/dkr:latest +FROM 2byrds/webs:latest EXPOSE 7676 -CMD ["/usr/local/var/did-keri-resolver/scripts/did-webs-service.sh"] +WORKDIR /usr/local/var/webs/volume/dkr/pages \ No newline at end of file diff --git a/images/dkr.dockerfile b/images/dkr.dockerfile deleted file mode 100644 index 314f9c0..0000000 --- a/images/dkr.dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -FROM gleif/keri:latest - - - -WORKDIR /usr/local/var - -RUN mkdir did-keri-resolver -COPY . /usr/local/var/did-keri-resolver - -WORKDIR /usr/local/var/did-keri-resolver - -RUN pip install -r requirements.txt diff --git a/images/webs.dockerfile b/images/webs.dockerfile new file mode 100644 index 0000000..37f6693 --- /dev/null +++ b/images/webs.dockerfile @@ -0,0 +1,10 @@ +FROM gleif/keri:latest + +WORKDIR /usr/local/var + +RUN mkdir webs +COPY . /usr/local/var/webs + +WORKDIR /usr/local/var/webs/ + +RUN pip install -r requirements.txt diff --git a/integration/app/integration.sh b/integration/app/integration.sh index a15a17f..a8c3119 100755 --- a/integration/app/integration.sh +++ b/integration/app/integration.sh @@ -4,57 +4,89 @@ # 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 +# print commands +set -x #save this current directory, this is where the integration_clienting file also is ORIG_CUR_DIR=$( pwd ) -KERI_PRIMARY_STORAGE="/usr/local/var/keri" -KERI_FALLBACK_STORAGE="${HOME}/.keri" - -KERI_DEV_BRANCH="development" -# KERI_DEV_TAG="c3a6fc455b5fac194aa9c264e48ea2c52328d4c5" +controller="my-controller" +csalt="0AAQmsjh-C7kAJZQEzdrzwB7" +verifier="my-verifier" +vsalt="0ABPTOtI5Qy8dCYNSs3uoCHe" +host="127.0.0.1" +caid="ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_" +vaid="EKK9_Aau-htVcu8HyAZCIUkTFMqyVB6I2LCa_GhMYWm2" + +KERI_BRANCH="main" +# KERI_TAG="c3a6fc455b5fac194aa9c264e48ea2c52328d4c5" +KERI_PRIMARY_STORAGE="/usr/local/var/keri/" +KERI_FALLBACK_STORAGE="${HOME}/.keri/" +db_files=() +db_names=("$controller" "$verifier" wan wes wil wit wub wyz) +for db_name in "${db_names[@]}"; do + path="${KERI_PRIMARY_STORAGE}*/${db_name}*" + db_files+=( $path ) + path="${KERI_FALLBACK_STORAGE}*/${db_name}*" + db_files+=( $path ) +done prompt="y" -function intro() { - echo "Welcome to the integration test setup/run/teardown script" - read -p "Enable prompts?, [y]: " enablePrompts - prompt=${enablePrompts:-"y"} - if [ "${prompt}" != "n" ]; then - echo "Prompts enabled" + +function cleanKeri() { + echo "Cleaning KERI data" + #clean up any old KERI data + default_clean_keri="y" + if [ "${prompt}" == "y" ]; then + read -p "Clean keri dbs ${db_files[*]} (y/n)? [${default_clean_keri}]: " cleanKeriInput + fi + clean_keri_data=${cleanKeriInput:-$default_clean_keri} + if [ "${clean_keri_data}" == "n" ]; then + echo "Skipping clean KERI data" else - echo "Skipping prompts, using defaults" + echo "Running clean KERI data" + for db_file in "${db_files[@]}"; do rm -R "$db_file";done + echo "Cleaned KERI data" fi } function genDidWebs() { + default_gen_webs="y" if [ "${prompt}" == "y" ]; then - read -p "Generate did:webs (y/n)? [n]: " runGenDid + default_gen_webs="n" + read -p "Generate did:webs (y/n)? [${default_gen_webs}]: " runGenDid fi - runGenDidWebs=${runGenDid:-"y"} - if [ "${runGenDidWebs}" == "n" ]; then + run_gen_webs=${runGenDid:-$default_gen_webs} + if [ "${run_gen_webs}" == "n" ]; then echo "Skipping generate did:webs did document" else - echo "Generating did:webs DID Document" - # if [ "${prompt}" == "y" ]; then - # read -p "Name the identity [searcher]: " runGenDid - # fi - dkr did webs generate --name=wan --did=did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha --oobi http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller + echo "Generating did:webs DID Document and KERI event stream" + 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_gen}" "${controller}" "${host}%3a7676" "${caid}" + sleep 3 + echo "Completed loading generating did:webs" + cp -R "${ORIG_CUR_DIR}/${caid}" "${ORIG_CUR_DIR}/volume/dkr/pages/${caid}" + else + echo "Couldn't find get started did:webs script" + fi fi } function getKeripyDir() { # Check if the environment variable is set if [ -z "$KERIPY_DIR" ]; then - default_value="../keripy" # Prompt the user for input with a default value + default_keri_dir="../keripy" if [ "${prompt}" == "y" ]; then - read -p "Set keripy dir [${default_value}]: " keriDirInput + read -p "Set keripy dir [${default_keri_dir}]: " keriDirInput fi # Set the value to the user input or the default value - KERIPY_DIR=${keriDirInput:-$default_value} + KERIPY_DIR=${keriDirInput:-$default_keri_dir} fi # Use the value of the environment variable echo "$KERIPY_DIR" @@ -74,34 +106,40 @@ function installPythonUpdates() { fi } -function loadKeriData() { +function intro() { + echo "Welcome to the integration test setup/run/teardown script" + read -p "Enable prompts?, [y]: " enablePrompts + prompt=${enablePrompts:-"y"} + if [ "${prompt}" != "n" ]; then + echo "Prompts enabled" + else + echo "Skipping prompts, using defaults" + fi +} + +function createKeriIds() { cd ${ORIG_CUR_DIR} || exit kloadPid=-1 - keriDir=$(getKeripyDir) - echo "Keripy dir set to: ${keriDir}" + default_kload="y" if [ "${prompt}" == "y" ]; then - read -p "Run load keri data (y/n)? [y]: " runKload + default_kload="n" + read -p "Run create keri id (y/n)? [${default_kload}]: " run_kload_input fi - runLoadKeriData=${runKload:-"n"} - if [ "${runLoadKeriData}" == "n" ]; then - echo "Skipping load KERI data" + create_keri_id=${run_kload_input:-$default_kload} + if [ "${create_keri_id}" == "n" ]; then + echo "Skipping create KERI id" else - echo "Running load KERI data" - scriptsDir="${keriDir}/scripts" - if [ -d "${scriptsDir}" ]; then - echo "Found keri scripts dir" - demoScriptsDir="${scriptsDir}/demo" - if [ -d "${demoScriptsDir}" ]; then - echo "Found keri demo scripts dir" - cd ${demoScriptsDir} || exit - source demo-script.sh - source ./basic/query-for-anchor.sh - echo "Completed loading KERI data" - else - echo "Couldn't find keri demo scripts dir" - fi + 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 create id script" + source "${create_aid_script}" "${controller}" "${csalt}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts/incept-wits.json" + sleep 3 + source "${create_aid_script}" "${verifier}" "${vsalt}" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts" "config-local-verifier" "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts/incept.json" + sleep 3 + echo "Completed creating KERI identity" else - echo "Couldn't find keri scripts dir" + echo "Couldn't find get started keri script" fi fi cd "${ORIG_CUR_DIR}" || exit @@ -109,18 +147,27 @@ function loadKeriData() { } function resolveDIDAndKeriEvents() { + default_res_webs="y" if [ "${prompt}" == "y" ]; then - read -p "Resolve did:webs and keri events (y/n)? [n]: " resolveKeriEvents + default_res_webs="n" + read -p "Resolve did:webs and keri events (y/n)? [${default_res_webs}]: " res_webs_input fi - resolveDidsAndKeriEvents=${resolveKeriEvents:-"y"} - if [ "${resolveDidsAndKeriEvents}" == "n" ]; then + res_webs=${res_webs_input:-$default_res_webs} + if [ "${res_webs}" == "n" ]; then echo "Skipping resolving did:webs DID Document and Keri Events" else echo "Resolving did:webs DID Document and Keri Events" - # if [ "${prompt}" == "y" ]; then - # read -p "Name the identity [searcher]: " runGenDid - # fi - dkr did webs resolve --name wan --did did:webs:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha + res_webs_script="${ORIG_CUR_DIR}/volume/dkr/examples/get_started_webs_resolve.sh" + if [ -f "${res_webs_script}" ]; then + echo "Found get started resolve script" + # kli init --name "${verifier}" --salt 0ABPTOtI5Qy8dCYNSs3uoCHe --nopasscode + # kli incept --name "${verifier}" --alias "${verifier}" --file "${ORIG_CUR_DIR}/volume/dkr/examples/my-scripts/incept.json" + source "${res_webs_script}" "${verifier}" "${host}%3a7676" "${caid}" + sleep 3 + echo "Resolved did:webs identity" + else + echo "Couldn't find get started keri script" + fi fi } @@ -129,18 +176,21 @@ function runKeri() { witPid=-1 keriDir=$(getKeripyDir) echo "Keripy dir set to: ${keriDir}" + + default_wit="y" if [ "${prompt}" == "y" ]; then - read -p "Run witness network (y/n)? [y]: " runWitNet + default_wit="n" + read -p "Run witness network (y/n)? [${default_wit}]: " runWitNet fi - runWit=${runWitNet:-"y"} + runWit=${runWitNet:-$default_wit} if [ "${runWit}" == "y" ]; then if [ -d "${keriDir}" ]; then #run a clean witness network echo "Launching a clean witness network" cd "${keriDir}" || exit - updateFromGit ${KERI_DEV_BRANCH} + updateFromGit ${KERI_BRANCH} installPythonUpdates "keri" - rm -rf "${KERI_PRIMARY_STORAGE:?}/*";rm -Rf "${KERI_FALLBACK_STORAGE:?}/*";kli witness demo & + kli witness demo & witPid=$! sleep 5 echo "Clean witness network launched" @@ -155,32 +205,37 @@ function runKeri() { } function serveDidAndKeriEvents() { + default_serve_webs="y" if [ "${prompt}" == "y" ]; then - read -p "Serve dids and keri events (y/n)? [n]: " serveKeriEvents + default_serve_webs="n" + read -p "Serve dids and keri events (y/n)? [${default_serve_webs}]: " serveKeriEvents fi - serveDidsAndKeriEvents=${serveKeriEvents:-"y"} - if [ "${serveDidsAndKeriEvents}" == "n" ]; then - echo "Skipping serving did:webs did document and keri events" + serve_webs=${serveKeriEvents:-$default_serve_webs} + if [ "${serve_webs}" == "n" ]; then + echo "Skipping serving did:webs DID Document and Keri Events" else - echo "Serving did:webs DID Document and Keri Events" - # if [ "${prompt}" == "y" ]; then - # read -p "Name the identity [searcher]: " runGenDid - # fi - dkr did webs service --config-dir=./scripts --config-file=dkr.json & - servePid=$! - sleep 5 - echo "Serving dids and keri events" + 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}" "${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/${caid}/did.json" + echo "KERI CESR at http://${host}:7676/${caid}/keri.cesr" + else + echo "Couldn't find get started serve script" + fi fi } function updateFromGit() { branch=$1 commit=$2 - + default_up_git="n" if [ "${prompt}" == "y" ]; then - read -p "Update git repo ${branch} ${commit}?, [n]: " upGitInput + read -p "Update git repo ${branch} ${commit}?, [${default_up_git}]: " upGitInput fi - update=${upGitInput:-"n"} + update=${upGitInput:-$default_up_git} if [ "${update}" == "y" ]; then echo "Updating git branch ${branch} ${commit}" fetch=$(git fetch) @@ -199,33 +254,25 @@ function updateFromGit() { fi } -runInt="test_salty" -while [ "${runInt}" != "n" ] +run_main_loop="y" +while [ "${run_main_loop}" != "n" ] do intro echo "Setting up..." - runKeri + cleanKeri - sleep 3 - - loadKeriData + runKeri - sleep 3 + createKeriIds genDidWebs - sleep 3 - serveDidAndKeriEvents - sleep 3 - resolveDIDAndKeriEvents - sleep 3 - # runMultisig # echo "" @@ -233,7 +280,7 @@ do # if [ "${prompt}" == "y" ]; then # fi read -p "Your servers still running, hit enter to tear down: " teardown - echo "Tearing down any leftover processes" + echo "Tearing down any leftover processes ${teardown}" # #tear down the signify client # kill "$signifyPid" >/dev/null 2>&1 # # tear down the keria cloud agent @@ -245,8 +292,11 @@ do # tear down the witness network kill $witPid >/dev/null 2>&1 - read -p "Run again [n]?: " runAgain - runInt=${runAgain:-"n"} + default_run_again="n" + if [ "${prompt}" == "y" ]; then + read -p "Run again [${default_run_again}]?: " run_main_again + fi + run_main_loop=${run_main_again:-$default_run_again} done echo "Done" \ No newline at end of file diff --git a/scripts/did-keri-resolver-service.sh b/scripts/did-keri-resolver-service.sh deleted file mode 100755 index 1187589..0000000 --- a/scripts/did-keri-resolver-service.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -dkr did keri resolver-service --config-dir=./scripts diff --git a/scripts/did-webs-resolver-service.sh b/scripts/did-webs-resolver-service.sh index 7c255ac..81183d3 100755 --- a/scripts/did-webs-resolver-service.sh +++ b/scripts/did-webs-resolver-service.sh @@ -1,3 +1,3 @@ #!/bin/bash -dkr did webs resolver-service --config-dir=./scripts +dkr did webs resolver-service --config-dir=./scripts \ No newline at end of file diff --git a/scripts/did-webs-service.sh b/scripts/did-webs-service.sh deleted file mode 100755 index a4ea7d0..0000000 --- a/scripts/did-webs-service.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -dkr did webs service --config-dir=./scripts 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/setup.py b/setup.py index d6bf151..fff84fe 100644 --- a/setup.py +++ b/setup.py @@ -32,13 +32,13 @@ setup( name='dkr', - version='0.0.1', # also change in src/did-keri-resolver/__init__.py + version='0.0.1', # also change in src/did-webs-resolver/__init__.py license='Apache Software License 2.0', - description='did:keri DID Method Resolver', - long_description="did:keri DID Method Resolver.", + description='did:webs DID Method Resolver', + long_description="did:webs DID Method Resolver.", author='Philip S. Feairheller', author_email='pfeairheller@gmail.com', - url='https://github.com/WebOfTrust/kara', + url='https://github.com/hyperledger-labs/did-webs-resolver', packages=find_packages('src'), package_dir={'': 'src'}, py_modules=[splitext(basename(path))[0] for path in glob('src/*.py')], diff --git a/src/dkr/app/cli/commands/did/webs/generate.py b/src/dkr/app/cli/commands/did/webs/generate.py index 3fb9e52..3e7de51 100644 --- a/src/dkr/app/cli/commands/did/webs/generate.py +++ b/src/dkr/app/cli/commands/did/webs/generate.py @@ -32,14 +32,14 @@ parser.add_argument('--passcode', help='22 character encryption passcode for keystore (is not saved)', dest="bran", default=None) # passcode => bran parser.add_argument("--did", "-d", help="DID to generate (did:webs method)", required=True) -parser.add_argument("--oobi", "-o", help="OOBI to use for resolving the AID", required=False) +# parser.add_argument("--oobi", "-o", help="OOBI to use for resolving the AID", required=False) parser.add_argument('-da', '--da_reg', required=False, default=None, help="Name of regery to find designated aliases attestation. Default is None.") def handler(args): - gen = Generator(name=args.name, base=args.base, bran=args.bran, did=args.did, oobi=args.oobi, da_reg=args.da_reg) + gen = Generator(name=args.name, base=args.base, bran=args.bran, did=args.did, oobi=None, da_reg=args.da_reg) return [gen] class Generator(doing.DoDoer): @@ -53,7 +53,7 @@ def __init__(self, name, base, bran, did, oobi, da_reg): hbyDoer = habbing.HaberyDoer(habery=self.hby) # setup doer obl = oobiing.Oobiery(hby=self.hby) self.did = did - self.oobi = oobi + # self.oobi = oobi self.da_reg = da_reg self.toRemove = [hbyDoer] + obl.doers @@ -68,39 +68,47 @@ def generate(self, tymth, tock=0.0, **opts): domain, port, path, aid = didding.parseDIDWebs(self.did) msgs = bytearray() - if self.oobi is not None or self.oobi == "": - print(f"Using oobi {self.oobi} to get CESR event stream") - obr = basing.OobiRecord(date=helping.nowIso8601()) - obr.cid = aid - self.hby.db.oobis.pin(keys=(self.oobi,), val=obr) - - while self.hby.db.roobi.get(keys=(self.oobi,)) is None: - _ = yield tock + # if self.oobi is not None or self.oobi == "": + # print(f"Using oobi {self.oobi} to get CESR event stream") + # obr = basing.OobiRecord(date=helping.nowIso8601()) + # obr.cid = aid + # self.hby.db.oobis.pin(keys=(self.oobi,), val=obr) + + # print(f"Resolving OOBI {self.oobi}") + # roobi = self.hby.db.roobi.get(keys=(self.oobi,)) + # while roobi is None or roobi.state != oobiing.Result.resolved: + # roobi = self.hby.db.roobi.get(keys=(self.oobi,)) + # _ = yield tock + # print(f"OOBI {self.oobi} resolved {roobi}") - oobiHab = self.hby.habs[aid] - msgs = oobiHab.replyToOobi(aid=aid, role="controller", eids=None) - else: - print(f"Generating CESR event stream from local hab") - #add KEL - self.genKelCesr(aid, msgs) - #add designated aliases TELs and ACDCs - self.genCredCesr(aid, didding.DES_ALIASES_SCHEMA, msgs) + # oobiHab = self.hby.habs[aid] + # print(f"Loading hab for OOBI {self.oobi}:\n {oobiHab}") + # msgs = oobiHab.replyToOobi(aid=aid, role="controller", eids=None) + # print(f"OOBI {self.oobi} CESR event stream {msgs.decode('utf-8')}") + + print(f"Generating CESR event stream data from hab") + #add KEL + self.genKelCesr(aid, msgs) + #add designated aliases TELs and ACDCs + self.genCredCesr(aid, didding.DES_ALIASES_SCHEMA, msgs) # Create the directory (and any intermediate directories in the given path) if it doesn't already exist - kc_dir_path = f"{webbing.KC_DEFAULT_DIR}/{aid}" + kc_dir_path = f"{aid}" if not os.path.exists(kc_dir_path): os.makedirs(kc_dir_path) # File path kc_file_path = os.path.join(kc_dir_path, f"{webbing.KERI_CESR}") kcf = open(kc_file_path, "w") - kcf.write(msgs.decode("utf-8")) + tmsg = msgs.decode("utf-8") + print(f"Writing CESR events to {kc_file_path}: \n{tmsg}") + kcf.write(tmsg) #generate did doc - diddoc = didding.generateDIDDoc(self.hby, did=self.did, aid=aid, oobi=self.oobi, reg_name=self.da_reg) + diddoc = didding.generateDIDDoc(self.hby, did=self.did, aid=aid, oobi=None, reg_name=self.da_reg) # Create the directory (and any intermediate directories in the given path) if it doesn't already exist - dd_dir_path = f"{webbing.DD_DEFAULT_DIR}/{aid}" + dd_dir_path = f"{aid}" if not os.path.exists(dd_dir_path): os.makedirs(dd_dir_path) diff --git a/src/dkr/app/cli/commands/did/webs/resolve.py b/src/dkr/app/cli/commands/did/webs/resolve.py index 470d256..5194c28 100644 --- a/src/dkr/app/cli/commands/did/webs/resolve.py +++ b/src/dkr/app/cli/commands/did/webs/resolve.py @@ -52,7 +52,7 @@ def __init__(self, hby, hbyDoer, obl, did, metadata): doers = list(self.toRemove) + [doing.doify(self.resolve)] super(WebsResolver, self).__init__(doers=doers) - def resolve(self, tymth, tock=0.0, **opts): + def resolve(self, tymth, tock=0.125, **opts): self.wind(tymth) self.tock = tock _ = (yield self.tock) @@ -71,7 +71,11 @@ def resolve(self, tymth, tock=0.0, **opts): # Load the KERI CESR kc_url = f"{base_url}/{webbing.KERI_CESR}" print(f"Loading KERI CESR from {kc_url}", file=sys.stderr) - self.hby.psr.parse(ims=bytearray(self.loadUrl(kc_url))) + kc_bytes = self.loadUrl(kc_url) + print(f"Got KERI CESR: {kc_bytes.decode('utf-8')}") + self.hby.psr.parse(ims=bytearray(kc_bytes)) + print("Waiting for KERI CESR to be processed...") + yield 3.0 didresult = didding.generateDIDDoc(self.hby, did=self.did, aid=aid, oobi=None, metadata=True) didresult['didDocumentMetadata']['didDocUrl'] = dd_url @@ -101,14 +105,6 @@ def loadUrl(self, url): response.raise_for_status() # Convert the content to a bytearray return response.content - - def loadFile(self, aid): - # File path - file_path = f"./keri_cesr/{aid}/{webbing.KERI_CESR}" - # Read the file in binary mode - with open(file_path, 'rb') as file: - msgs = file.read() - return msgs def verifyDidDocs(self, expected, actual): if expected != actual: @@ -158,16 +154,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/didding.py b/src/dkr/core/didding.py index 08caba0..36e6e77 100644 --- a/src/dkr/core/didding.py +++ b/src/dkr/core/didding.py @@ -19,7 +19,7 @@ from keri.vdr import credentialing, verifying DID_KERI_RE = re.compile(r'\Adid:keri:(?P[^:]+)\Z', re.IGNORECASE) -DID_WEBS_RE = re.compile(r'\Adid:webs:(?P[^%:]+)(?:%3a(?P\d+))?(?::(?P.+?))?(?::(?P[^:]+))\Z', re.IGNORECASE) +DID_WEBS_RE = re.compile(r'\Adid:web(s)?:(?P[^%:]+)(?:%3a(?P\d+))?(?::(?P.+?))?(?::(?P[^:]+))\Z', re.IGNORECASE) DID_TIME_FORMAT = "%Y-%m-%dT%H:%M:%SZ" DID_TIME_PATTERN = re.compile(r"\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z") DES_ALIASES_SCHEMA="EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5" @@ -41,7 +41,7 @@ def parseDIDKeri(did): def parseDIDWebs(did): match = DID_WEBS_RE.match(did) if match is None: - raise ValueError(f"{did} is not a valid did:webs DID") + raise ValueError(f"{did} is not a valid did:web(s) DID") domain, port, path, aid = match.group("domain", "port", "path", "aid") @@ -54,7 +54,9 @@ def parseDIDWebs(did): def generateDIDDoc(hby: habbing.Habery, did, aid, oobi=None, metadata=None, reg_name=None): - hab = hby.habs[aid] + hab = None + if aid in hby.habs: + hab = hby.habs[aid] if oobi is not None: obr = hby.db.roobi.get(keys=(oobi,)) @@ -63,7 +65,15 @@ def generateDIDDoc(hby: habbing.Habery, did, aid, oobi=None, metadata=None, reg_ data = json.dumps(msg) return data.encode("utf-8") - kever = hby.kevers[aid] + kever = None + if aid in hby.kevers: + kever = hby.kevers[aid] + else: + print(f"Habery does not have a kever for {did}. Did you parse the keri.cesr file?") + for kev in hby.kevers: + print("Known kevers: ", kev) + hby.kevers[aid] + vms = [] for idx, verfer in enumerate(kever.verfers): kid = verfer.qb64 @@ -183,37 +193,38 @@ def desAliases(hby: habbing.Habery, aid: str, reg_name: str=None): """ Returns the credentialer for the des-aliases schema, or None if it doesn't exist. """ - if reg_name is None: - reg_name = hby.habs[aid].name - rgy = credentialing.Regery(hby=hby, name=reg_name) - vry = verifying.Verifier(hby=hby, reger=rgy.reger) - - saids = rgy.reger.issus.get(keys=aid) - scads = rgy.reger.schms.get(keys=DES_ALIASES_SCHEMA.encode("utf-8")) - # self-attested, there is no issuee, and schmea is designated aliases - saiders = [saider for saider in saids if saider.qb64 in [saider.qb64 for saider in scads]] - da_ids = [] - # for saider in saiders: - creds = rgy.reger.cloneCreds(saiders) - - for idx, cred in enumerate(creds): - sad = cred['sad'] - status = cred["status"] - schema = sad['s'] - scraw = vry.resolver.resolve(schema) - schemer = scheming.Schemer(raw=scraw) - print(f"Credential #{idx+1}: {sad['d']}") - print(f" Type: {schemer.sed['title']}") - if status['et'] == 'iss' or status['et'] == 'bis': - print(f" Status: Issued {terming.Colors.OKGREEN}{terming.Symbols.CHECKMARK}{terming.Colors.ENDC}") - da_ids = sad['a']['ids'] - elif status['et'] == 'rev' or status['et'] == 'brv': - print(f" Status: Revoked {terming.Colors.FAIL}{terming.Symbols.FAILED}{terming.Colors.ENDC}") - else: - print(f" Status: Unknown") - print(f" Issued by {sad['i']}") - print(f" Issued on {status['dt']}") + if aid in hby.habs: + if reg_name is None: + reg_name = hby.habs[aid].name + rgy = credentialing.Regery(hby=hby, name=reg_name) + vry = verifying.Verifier(hby=hby, reger=rgy.reger) + + saids = rgy.reger.issus.get(keys=aid) + scads = rgy.reger.schms.get(keys=DES_ALIASES_SCHEMA.encode("utf-8")) + # self-attested, there is no issuee, and schmea is designated aliases + saiders = [saider for saider in saids if saider.qb64 in [saider.qb64 for saider in scads]] + + # for saider in saiders: + creds = rgy.reger.cloneCreds(saiders) + + for idx, cred in enumerate(creds): + sad = cred['sad'] + status = cred["status"] + schema = sad['s'] + scraw = vry.resolver.resolve(schema) + schemer = scheming.Schemer(raw=scraw) + print(f"Credential #{idx+1}: {sad['d']}") + print(f" Type: {schemer.sed['title']}") + if status['et'] == 'iss' or status['et'] == 'bis': + print(f" Status: Issued {terming.Colors.OKGREEN}{terming.Symbols.CHECKMARK}{terming.Colors.ENDC}") + da_ids = sad['a']['ids'] + elif status['et'] == 'rev' or status['et'] == 'brv': + print(f" Status: Revoked {terming.Colors.FAIL}{terming.Symbols.FAILED}{terming.Colors.ENDC}") + else: + print(f" Status: Unknown") + print(f" Issued by {sad['i']}") + print(f" Issued on {status['dt']}") return da_ids diff --git a/src/dkr/core/resolving.py b/src/dkr/core/resolving.py index 6287c37..d414fff 100644 --- a/src/dkr/core/resolving.py +++ b/src/dkr/core/resolving.py @@ -135,3 +135,16 @@ def __next__(self): self.finished = True return self.data.encode("utf-8") + + +def loadFile(file_path): + # Read the file in binary mode + with open(file_path, 'rb') as file: + msgs = file.read() + return msgs + +def loadJsonFile(file_path): + # Read the file in binary mode + with open(file_path, 'r', encoding="utf-8") as file: + msgs = json.load(file) + return msgs \ No newline at end of file diff --git a/src/dkr/core/webbing.py b/src/dkr/core/webbing.py index 713a39f..76eb8dc 100644 --- a/src/dkr/core/webbing.py +++ b/src/dkr/core/webbing.py @@ -8,16 +8,19 @@ import falcon from hio.core import http +from keri.app import habbing +from keri.core import coring, eventing, parsing, scheming from keri.end import ending 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 +40,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 @@ -66,7 +74,7 @@ def loadEnds(app, hby, web): else: prefix = f"/{web.lstrip('/').rstrip('/')}/" - path = f"{prefix}/{{aid}}/{DID_JSON}" + path = f"{prefix}/{DID_JSON}" print(f"Added route {path}") app.add_route(path, res) @@ -82,7 +90,7 @@ def loadFileEnds(app, res, file_end, dirPath): path=f"/{aid}/{file_end}" print(f"registering {path}") app.add_route(f"{path}", res) - res.add_lookup(path,fPath) + res.add_lookup(path,fPath,aid) else: print(f"Skipping {fPath} as it is not a file") @@ -140,7 +148,7 @@ def __init__(self): """ self.lookup = {} - def add_lookup(self, path, fPath): + def add_lookup(self, path, fPath, aid=None): self.lookup[path] = fPath def on_get(self, req, rep, aid=None): @@ -188,9 +196,16 @@ def __init__(self, hby): self.hby = hby self.lookup = {} - def add_lookup(self, path, fPath): + def add_lookup(self, path, fPath, aid=None): self.lookup[path] = fPath + if aid is None: + aid = os.path.basename(os.path.normpath(path.rstrip(f"/{KERI_CESR}"))) + # ahab = habbing..makeHab(name=aid, temp=True) + # kvy = eventing.Kevery(db=ahab.db, lax=False, local=False) + with open(fPath, 'rb') as file: + self.hby.psr.parse(ims=bytearray(file.read())) + def on_get(self, req, rep, aid=None): """ GET endpoint for acessing {KERI_CESR} stream for AID @@ -211,10 +226,10 @@ def on_get(self, req, rep, aid=None): raise falcon.HTTPNotFound(description=f"keri.cesr for KERI AID {aid} not found") # 404 if AID not recognized - if aid not in self.hby.kevers: - raise falcon.HTTPNotFound(description=f"KERI AID {aid} not found") + # if aid not in self.hby.kevers: + # raise falcon.HTTPNotFound(description=f"KERI AID {aid} not found") - print(f"Serving data for {aid}") + print(f"Serving KERI CESR data for {aid}") port = "" if req.port != 80 and req.port != 443: port = f"%3A{req.port}" diff --git a/tests/app/cli/commands/did/webs/test_resolve.py b/tests/app/cli/commands/did/webs/test_resolve.py new file mode 100644 index 0000000..a3ff873 --- /dev/null +++ b/tests/app/cli/commands/did/webs/test_resolve.py @@ -0,0 +1,137 @@ +import json + +import falcon +from falcon import testing, media, http_status +from hio.base import doing + +import keri +from dkr.app.cli.commands.did.webs import resolve +from hio.core import http +from keri.app import habbing, oobiing +from keri.core import coring +from keri.db import basing +from keri.end import ending +from keri.help import helping +from keri import help, kering + +import os +import time + +class ExampleEnd: + def on_get(self, req, rep): + """ + Handles GET requests + """ + message = "\nHello World\n\n" + rep.status = falcon.HTTP_200 # This is the default status + rep.content_type = "text/html" + rep.text = message + +class DidWebsEnd: + """ Test endpoint returning a static did document """ + def __init__(self, url): + self.url = url + + def on_get(self, req, rep): + """ Return a did document + + Args: + req (Request): Falcon request object + rep (Response): Falcon response object + + """ + a = { + "urls": [ + self.url + ] + } + + rep.status = falcon.HTTP_200 + rep.content_type = "application/json" + rep.data = "{reply: '/ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_/did.json'}" + +class KeriCesrEnd: + """ Test endpoint returning a static keri cesr file """ + def __init__(self, url): + self.url = url + + def on_get(self, req, rep): + """ Return a did document + + Args: + req (Request): Falcon request object + rep (Response): Falcon response object + + """ + a = { + "urls": [ + self.url + ] + } + + rep.status = falcon.HTTP_200 + rep.content_type = "application/json" + rep.data = "{reply: 'http://127.0.0.1:7676/ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_/keri.cesr'}" + +def test_resolver(): + with habbing.openHby(name="verifier") as hby: + hab = hby.makeHab(name="verifier") + hbyDoer = habbing.HaberyDoer(habery=hby) # setup doer + obl = oobiing.Oobiery(hby=hby) + did = "did:web:127.0.0.1%3a7676:ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_" + res = resolve.WebsResolver(hby,hbyDoer,obl,did,False) + + # Configure the did doc and keri cesr URL + ddurl = f'http://127.0.0.1:7676/ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_/did.json' + kcurl = f'http://127.0.0.1:7676/ELCUOZXs-0xn3jOihm0AJ-L8XTFVT8SnIpmEDhFF9Kz_/keri.cesr' + + app = falcon.App(middleware=falcon.CORSMiddleware( + allow_origins='*', allow_credentials='*', + expose_headers=['cesr-attachment', 'cesr-date', 'content-type', 'signature', 'signature-input', + 'signify-resource', 'signify-timestamp'])) + + print("CORS enabled") + app.add_middleware(middleware=HandleCORS()) + app.req_options.media_handlers.update(media.Handlers()) + app.resp_options.media_handlers.update(media.Handlers()) + # falcon.App instances are callable WSGI apps + example = ExampleEnd() # Resources are represented by long-lived class instances + app.add_route('/example', example) + dd = DidWebsEnd(url=ddurl) + kc = KeriCesrEnd(url=kcurl) + app.add_route(f"/did", dd) + app.add_route(f"/cesr", kc) + + server = http.Server(host="127.0.0.1",port=7676, app=app, scheme="http") + httpServerDoer = http.ServerDoer(server=server) + + client = testing.TestClient(app=app) + + rep = client.simulate_get('/example') + assert rep.status == falcon.HTTP_OK + assert rep.text == '\nHello World\n\n' + + limit = 2.0 + tock = 0.03125 + doers = [httpServerDoer] + doist = doing.Doist(limit=limit, tock=tock) + doist.do(doers=doers) + + assert doist.limit == limit + + # obr = hby.db.roobi.get(keys=(kcurl,)) + # assert obr is not None + # assert obr.state == oobiing.Result.resolved + # time.sleep(20) + # doist.exit() + + """Done Test""" + +class HandleCORS(object): + def process_request(self, req, resp): + resp.set_header('Access-Control-Allow-Origin', '*') + resp.set_header('Access-Control-Allow-Methods', '*') + resp.set_header('Access-Control-Allow-Headers', '*') + resp.set_header('Access-Control-Max-Age', 1728000) # 20 days + if req.method == 'OPTIONS': + raise http_status.HTTPStatus(falcon.HTTP_200, text='\n') \ No newline at end of file diff --git a/tests/app/core/test_didding.py b/tests/app/core/test_didding.py index 6b4157a..a2a9093 100644 --- a/tests/app/core/test_didding.py +++ b/tests/app/core/test_didding.py @@ -4,8 +4,9 @@ """ import json +import os import pytest -from dkr.core import didding +from dkr.core import didding, resolving import keri import re @@ -91,6 +92,61 @@ def test_parse_webs_did(): assert "my:path" == path assert aid, "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" +def test_parse_web_did(): + with pytest.raises(ValueError): + did = "did:web:127.0.0.1:1234567" + domain, port, path, aid = didding.parseDIDWebs(did) + + did = "did:web:127.0.0.1:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + domain, port, path, aid = didding.parseDIDWebs(did) + assert "127.0.0.1" == domain + assert None == port + assert None == path + assert aid == "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + + # port url should be url encoded with %3a according to the spec + did_port_bad = ( + "did:web:127.0.0.1:7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + ) + domain, port, path, aid = didding.parseDIDWebs(did_port_bad) + assert "127.0.0.1" == domain + assert None == port + assert "7676" == path + assert aid == "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + + did_port = "did:web:127.0.0.1%3a7676:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + domain, port, path, aid = didding.parseDIDWebs(did_port) + assert "127.0.0.1" == domain + assert "7676" == port + assert None == path + assert aid == "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + + # port should be url encoded with %3a according to the spec + did_port_path_bad = ( + "did:web:127.0.0.1:7676:my:path:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + ) + domain, port, path, aid = didding.parseDIDWebs(did_port_path_bad) + assert "127.0.0.1" == domain + assert None == port + assert "7676:my:path" == path + assert aid == "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + + # port is properly url encoded with %3a according to the spec + did_port_path = ( + "did:web:127.0.0.1%3a7676:my:path:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + ) + domain, port, path, aid = didding.parseDIDWebs(did_port_path) + assert "127.0.0.1" == domain + assert "7676" == port + assert "my:path" == path + assert aid == "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + + did_path = "did:web:127.0.0.1:my:path:BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" + domain, port, path, aid = didding.parseDIDWebs(did_path) + assert "127.0.0.1" == domain + assert None == port + assert "my:path" == path + assert aid, "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha" @pytest.fixture def setup_habs(): @@ -302,6 +358,29 @@ def test_gen_did_doc_with_metadata(setup_habs): != None ) +def test_gen_did_doc_no_hab(setup_habs): + hby, hab, wesHby, wesHab, wdid = setup_habs + aid = "ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe" + did = f"did:web:did-webs-service%3a7676:{aid}" + + try: + didDoc = didding.generateDIDDoc(hby, did, aid, oobi=None, metadata=False) + except KeyError as e: + assert str(e) == f"'{aid}'" + + msgs = resolving.loadFile(f"./volume/dkr/pages/{aid}/keri.cesr") + hby.psr.parse(ims=msgs) + + didDoc = didding.generateDIDDoc(hby, did, aid, oobi=None, metadata=False) + + expected = resolving.loadJsonFile(f"./volume/dkr/pages/{aid}/did.json") + + assert (didDoc["id"] == expected["id"]) + assert (didDoc["id"].startswith("did:web:")) + assert (didDoc["id"].endswith(f"{aid}")) + assert didDoc["verificationMethod"] == expected["verificationMethod"] + + assert len(didDoc["service"]) == 0 def da_cred(): """ diff --git a/volume/dkr/examples/README.md b/volume/dkr/examples/README.md new file mode 100644 index 0000000..aca652f --- /dev/null +++ b/volume/dkr/examples/README.md @@ -0,0 +1,41 @@ +The public.sh script generates a public attestation of the designated aliases. +It requires a server running at 127.0.0.1:7723 that can serve the schema oobi. +The output will look like: +``` +examples $ ./public.sh +KERI Keystore created at: /usr/local/var/keri/ks/controller +KERI Database created at: /usr/local/var/keri/db/controller +KERI Credential Store created at: /usr/local/var/keri/reg/controller +Prefix ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe + Public key 1: DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr + +Alias: controller +Identifier: ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe +Seq No: 0 + +Witnesses: +Count: 0 +Receipts: 0 +Threshold: 0 + +Public Keys: + 1. DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr + +Waiting for TEL event witness receipts +Sending TEL events to witnesses +Registry: dAliases(EH6gJT1OQifVBTPsavF5YfkQRODoSAyrMzP4vCeOm0Af) + created for Identifier Prefix: ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe +Hit enter after you have added the registry SAID (and maybe attrs, rules, etc) to desig-aliases-public.json +http://127.0.0.1:7723/oobi/EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5 resolved +Waiting for TEL event witness receipts +Sending TEL events to witnesses +EMIXtMnh1vgYhSBLekbK-360MDcMU10QzejX3zl35q30 has been created. +Current issued credentials for controller (ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe): + +Credential #1: EMIXtMnh1vgYhSBLekbK-360MDcMU10QzejX3zl35q30 + Type: Designated Aliases Public Attestation + Status: Issued ✔ + Issued by ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe + Issued on 2023-11-13T17:41:37.710691+00:00 +{"v":"ACDC10JSON0004d5_","d":"EMIXtMnh1vgYhSBLekbK-360MDcMU10QzejX3zl35q30","i":"ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe","ri":"EH6gJT1OQifVBTPsavF5YfkQRODoSAyrMzP4vCeOm0Af","s":"EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5","a":{"d":"ENjmfq8MtWLYncKtb1LYhOdeSvoH6l4u-IJWC6RSmhF2","dt":"2023-11-13T17:41:37.710691+00:00","ids":["did:webs:example.org:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe"]},"r":{"d":"EEVTx0jLLZDQq8a5bXrXgVP0JDP7j8iDym9Avfo8luLw","aliasDesignation":{"l":"The issuer of this ACDC designates the identifiers in the ids field as the only allowed namespaced aliases of the issuer's AID."},"usageDisclaimer":{"l":"This attestation only asserts designated aliases of the controller of the AID, that the AID controlled namespaced alias has been designated by the controller. It does not assert that the controller of this AID has control over the infrastructure or anything else related to the namespace other than the included AID."},"issuanceDisclaimer":{"l":"All information in a valid and non-revoked alias designation assertion is accurate as of the date specified."},"termsOfUse":{"l":"Designated aliases of the AID must only be used in a manner consistent with the expressed intent of the AID controller."}}} +``` \ No newline at end of file diff --git a/volume/dkr/examples/credential.json b/volume/dkr/examples/credential.json new file mode 100644 index 0000000..26cfaa5 --- /dev/null +++ b/volume/dkr/examples/credential.json @@ -0,0 +1 @@ +{"v": "ACDC10JSON000514_", "d": "EAxjBCqyqPmIeaZo2kUzdcpIUrooxaUqhal9ii7tLagG", "i": "ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "ri": "EFrgJK29VtqJYtKcfjJ-ig8yP37-Vwr84ANJJDv8YRXj", "s": "EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5", "a": {"d": "EHQgqNNSueVmVjlErrGtzjl-HJya9rMUiNadDSkZQ1kV", "dt": "2023-11-13T17:41:37.710691+00:00", "ids": ["did:webs:foo.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "did:web:example.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe"]}, "r": {"d": "EEVTx0jLLZDQq8a5bXrXgVP0JDP7j8iDym9Avfo8luLw", "aliasDesignation": {"l": "The issuer of this ACDC designates the identifiers in the ids field as the only allowed namespaced aliases of the issuer's AID."}, "usageDisclaimer": {"l": "This attestation only asserts designated aliases of the controller of the AID, that the AID controlled namespaced alias has been designated by the controller. It does not assert that the controller of this AID has control over the infrastructure or anything else related to the namespace other than the included AID."}, "issuanceDisclaimer": {"l": "All information in a valid and non-revoked alias designation assertion is accurate as of the date specified."}, "termsOfUse": {"l": "Designated aliases of the AID must only be used in a manner consistent with the expressed intent of the AID controller."}}} \ No newline at end of file diff --git a/volume/dkr/examples/desig-aliases-attr-public.json b/volume/dkr/examples/desig-aliases-attr-public.json new file mode 100644 index 0000000..acf8c55 --- /dev/null +++ b/volume/dkr/examples/desig-aliases-attr-public.json @@ -0,0 +1 @@ +{"d": "EHQgqNNSueVmVjlErrGtzjl-HJya9rMUiNadDSkZQ1kV", "dt": "2023-11-13T17:41:37.710691+00:00", "ids": ["did:webs:foo.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "did:web:example.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe"]} \ No newline at end of file diff --git a/volume/dkr/examples/desig-aliases-public.json b/volume/dkr/examples/desig-aliases-public.json new file mode 100644 index 0000000..063f2e7 --- /dev/null +++ b/volume/dkr/examples/desig-aliases-public.json @@ -0,0 +1 @@ +{"v": "ACDC10JSON000514_", "d": "EM1eYL8kmDMy9mLMAh9sSncMvlNSlHOHrAj0BpZxu3wj", "i": "ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "ri": "ELQoWO7vxvKLxAdwAi-o7lUBaYzplfKKwBt5oB3CtyB8", "s": "EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5", "a": {"d": "EHQgqNNSueVmVjlErrGtzjl-HJya9rMUiNadDSkZQ1kV", "dt": "2023-11-13T17:41:37.710691+00:00", "ids": ["did:webs:foo.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "did:web:example.com:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe"]}, "r": {"d": "EEVTx0jLLZDQq8a5bXrXgVP0JDP7j8iDym9Avfo8luLw", "aliasDesignation": {"l": "The issuer of this ACDC designates the identifiers in the ids field as the only allowed namespaced aliases of the issuer's AID."}, "usageDisclaimer": {"l": "This attestation only asserts designated aliases of the controller of the AID, that the AID controlled namespaced alias has been designated by the controller. It does not assert that the controller of this AID has control over the infrastructure or anything else related to the namespace other than the included AID."}, "issuanceDisclaimer": {"l": "All information in a valid and non-revoked alias designation assertion is accurate as of the date specified."}, "termsOfUse": {"l": "Designated aliases of the AID must only be used in a manner consistent with the expressed intent of the AID controller."}}} \ No newline at end of file diff --git a/volume/dkr/examples/desig-aliases-rules-public.json b/volume/dkr/examples/desig-aliases-rules-public.json new file mode 100644 index 0000000..7322b6b --- /dev/null +++ b/volume/dkr/examples/desig-aliases-rules-public.json @@ -0,0 +1 @@ +{"d": "EEVTx0jLLZDQq8a5bXrXgVP0JDP7j8iDym9Avfo8luLw", "aliasDesignation": {"l": "The issuer of this ACDC designates the identifiers in the ids field as the only allowed namespaced aliases of the issuer's AID."}, "usageDisclaimer": {"l": "This attestation only asserts designated aliases of the controller of the AID, that the AID controlled namespaced alias has been designated by the controller. It does not assert that the controller of this AID has control over the infrastructure or anything else related to the namespace other than the included AID."}, "issuanceDisclaimer": {"l": "All information in a valid and non-revoked alias designation assertion is accurate as of the date specified."}, "termsOfUse": {"l": "Designated aliases of the AID must only be used in a manner consistent with the expressed intent of the AID controller."}} \ No newline at end of file diff --git a/volume/dkr/examples/gen.sh b/volume/dkr/examples/gen.sh new file mode 100755 index 0000000..d06bce4 --- /dev/null +++ b/volume/dkr/examples/gen.sh @@ -0,0 +1 @@ +dkr did webs generate --name controller --did did:webs:labs.hyperledger.org:did-webs-resolver:pages:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe \ No newline at end of file diff --git a/volume/dkr/examples/get_started_create_id.sh b/volume/dkr/examples/get_started_create_id.sh new file mode 100755 index 0000000..c6a4260 --- /dev/null +++ b/volume/dkr/examples/get_started_create_id.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# set -x + +# RUN cd /usr/local/var/webs/volume/dkr/examples +# RUN ./get_started_create_id.sh "controller" "./my-scripts" "config-docker" "incept-wits.json" +# RUN ./get_started_webs_gen.sh "controller" "did-webs-service%3a7676" "EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP" + +#controller +ctrlName=$1 +#salt +ctrlSalt=$2 +#./my-scripts +configDir=$3 +#my-config +configFile=$4 +#./my-scripts/my-incept.json +inceptFile=$5 + +echo "Init KERI id config file at ${configDir}/keri/cf/${configFile} contains:" +cat "${configDir}/keri/cf/${configFile}.json" + +# init environment for controller AID +kli init --name "${ctrlName}" --salt "${ctrlSalt}" --nopasscode --config-dir "${configDir}" --config-file "${configFile}" + +echo "Incept KERI id config file at ${inceptFile} contains:" +cat "${inceptFile}" + +# inception for controller AID +kli incept --name "${ctrlName}" --alias "${ctrlName}" --file "${inceptFile}" + +# see status +kli status --name "${ctrlName}" \ No newline at end of file diff --git a/volume/dkr/examples/get_started_des_aliases.sh b/volume/dkr/examples/get_started_des_aliases.sh new file mode 100755 index 0000000..b57fbee --- /dev/null +++ b/volume/dkr/examples/get_started_des_aliases.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# # updates the SAIDs of the schemas +# ../update.sh + +alias="controller" +reg_name="dAliases" +d_alias_schema="EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5" +# da_schema_oobi="http://127.0.0.1:7723/oobi/${d_alias_schema}" +da_schema_oobi="https://weboftrust.github.io/oobi/${d_alias_schema}" + +#clear state from previous runs +echo "Clearing state from previous runs for $alias" +find /usr/local/var/keri/* -name "$alias" -type d -exec rm -rf {} + 2>/dev/null +find /usr/local/var/keri/* -name "$reg_name" -type d -exec rm -rf {} + 2>/dev/null + +echo "Initializing $alias" +kli init --name "$alias" --salt 0AAQmsjh-C7kAJZQEzdrzwB7 --nopasscode --config-dir "./my-scripts" --config-file config +echo "Incepting $alias" +kli incept --name "$alias" --alias "$alias" --file "./my-scripts/my-incept.json" +echo "Getting $alias status" +kli status --name "$alias" --alias "$alias" + +echo "Creating registry $reg_name" +kli vc registry incept --name "$alias" --alias "$alias" --registry-name "$reg_name" + +echo "Saidifying attestation rules" +kli saidify --file ./desig-aliases-rules-public.json --label "d" +echo "Saidifying attestation attributes" +kli saidify --file ./desig-aliases-attr-public.json --label "d" + +# manually add rules example SAID and attribute example SAID to the desig-aliases.json +# read -p "Hit enter after you have added the registry SAID (and maybe attrs, rules, etc) to desig-aliases-public.json" +# echo "Saidifying attestation with the registry you added" +# kli saidify --file ./desig-aliases-public.json --label "d" + +echo "Resolving schema at $da_schema_oobi" +kli oobi resolve --name "$alias" --oobi-alias myDesigAliases --oobi "$da_schema_oobi" +echo "Issuing attestation to registry $reg_name with schema $d_alias_schema from attr file desig-aliases-attr-public.json" +kli vc issue --name "$alias" --alias "$alias" --registry-name "$reg_name" --schema "${d_alias_schema}" --data @desig-aliases-attr-public.json --rules @desig-aliases-rules-public.json +# kli vc create --name "$alias" --alias "$alias" --registry-name "$reg_name" --schema "${d_alias_schema}" --credential @desig-aliases-public.json +echo "Getting SAID for attestation in registry $reg_name with schema $d_alias_schema" +SAID=$(kli vc list --name "$alias" --alias "$alias" --issued --said --schema "${d_alias_schema}") +echo "Listing attestations in registry $reg_name with schema $d_alias_schema" +kli vc list --name "$alias" --alias "$alias" --issued --schema "${d_alias_schema}" + +echo "Exporting attestation with SAID $SAID" +kli vc export --name "$alias" --alias "$alias" --said "${SAID}" --chain \ No newline at end of file diff --git a/volume/dkr/examples/get_started_docker.sh b/volume/dkr/examples/get_started_docker.sh new file mode 100755 index 0000000..90036f4 --- /dev/null +++ b/volume/dkr/examples/get_started_docker.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +#cd ./volume/dkr/examples + +kli init --name controller --salt 0AAQmsjh-C7kAJZQEzdrzwB7 --nopasscode --config-dir ./my-scripts --config-file config-docker + +kli incept --name controller --alias controller --file ./my-scripts/incept.json + +dkr did webs generate --name controller --did "did:webs:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe" \ No newline at end of file diff --git a/volume/dkr/examples/get_started_local.sh b/volume/dkr/examples/get_started_local.sh new file mode 100755 index 0000000..82c0120 --- /dev/null +++ b/volume/dkr/examples/get_started_local.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# need to run witness network +rm -Rf /usr/local/var/keri/*;rm -Rf ~/.keri/*;kli witness demo & +wpid=$! +echo "witness pid: $wpid" + +# init environment for controller AID +kli init --name controller --salt 0AAQmsjh-C7kAJZQEzdrzwB7 --nopasscode --config-dir "./my-scripts" --config-file local + +# inception for controller AID +kli incept --name controller --alias controller --file "./my-scripts/incept-local.json" + +# check witness oobi for our AID +curl http://127.0.0.1:5642/oobi/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha + +# generate controller did:webs for labs.hyperledger.org +dkr did webs generate --name controller --did did:webs:labs.hyperledger.org:did-webs-resolver:pages:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP --oobi http://127.0.0.1:5642/oobi/EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP/witness/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha +# dkr did webs generate --name controller --did did:webs:labs.hyperledger.org:did-webs-resolver:pages:EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP + +kill $wpid \ No newline at end of file diff --git a/volume/dkr/examples/get_started_webs_gen.sh b/volume/dkr/examples/get_started_webs_gen.sh new file mode 100755 index 0000000..4797910 --- /dev/null +++ b/volume/dkr/examples/get_started_webs_gen.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# controller +ctrlName=$1 +# host path +hostPath=$2 +# aid +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 diff --git a/volume/dkr/examples/get_started_webs_resolve.sh b/volume/dkr/examples/get_started_webs_resolve.sh new file mode 100755 index 0000000..44706b9 --- /dev/null +++ b/volume/dkr/examples/get_started_webs_resolve.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# controller +ctrlName=$1 +# host path +hostPath=$2 +# aid +aid=$3 + +# generate controller did:webs for EKYGGh-FtAphGmSZbsuBs_t4qpsjYJ2ZqvMKluq9OxmP at labs.hyperledger.org +dkr did webs resolve --name "${ctrlName}" --did "did:webs:${hostPath}:${aid}" diff --git a/volume/dkr/examples/get_started_webs_serve.sh b/volume/dkr/examples/get_started_webs_serve.sh new file mode 100755 index 0000000..f83c200 --- /dev/null +++ b/volume/dkr/examples/get_started_webs_serve.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +#controller +ctrlName=$1 +#/keripy/my-scripts +configDir=$2 +#my-config +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}" & +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/incept-wits.json b/volume/dkr/examples/my-scripts/incept-wits.json new file mode 100644 index 0000000..850aca0 --- /dev/null +++ b/volume/dkr/examples/my-scripts/incept-wits.json @@ -0,0 +1,13 @@ +{ + "transferable": true, + "wits": [ + "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", + "BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM", + "BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX" + ], + "toad": 3, + "icount": 1, + "ncount": 1, + "isith": "1", + "nsith": "1" +} diff --git a/volume/dkr/examples/my-scripts/incept.json b/volume/dkr/examples/my-scripts/incept.json new file mode 100644 index 0000000..faec18d --- /dev/null +++ b/volume/dkr/examples/my-scripts/incept.json @@ -0,0 +1,9 @@ +{ + "transferable": true, + "wits": [], + "toad": 0, + "icount": 1, + "ncount": 1, + "isith": "1", + "nsith": "1" +} \ No newline at end of file diff --git a/volume/dkr/examples/my-scripts/keri/cf/config-docker.json b/volume/dkr/examples/my-scripts/keri/cf/config-docker.json new file mode 100755 index 0000000..c682373 --- /dev/null +++ b/volume/dkr/examples/my-scripts/keri/cf/config-docker.json @@ -0,0 +1,10 @@ +{ + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + "http://witnesshost:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller", + "http://witnesshost:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller", + "http://witnesshost:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller" + ], + "keri.cesr.dir": "/usr/local/var/webs/volume/dkr/pages/", + "did.doc.dir": "/usr/local/var/webs/volume/dkr/pages/" +} \ No newline at end of file diff --git a/volume/dkr/examples/my-scripts/keri/cf/config-local-verifier.json b/volume/dkr/examples/my-scripts/keri/cf/config-local-verifier.json new file mode 100755 index 0000000..6aa3a8c --- /dev/null +++ b/volume/dkr/examples/my-scripts/keri/cf/config-local-verifier.json @@ -0,0 +1,13 @@ +{ + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + "http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller", + "http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller", + "http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller" + ], + "durls": [ + "https://weboftrust.github.io/oobi/EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5" + ], + "keri.cesr.dir": "./volume/dkr/pages/", + "did.doc.dir": "./volume/dkr/pages/" + } \ 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 new file mode 100755 index 0000000..6aa3a8c --- /dev/null +++ b/volume/dkr/examples/my-scripts/keri/cf/config-local.json @@ -0,0 +1,13 @@ +{ + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + "http://127.0.0.1:5642/oobi/BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha/controller", + "http://127.0.0.1:5644/oobi/BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX/controller", + "http://127.0.0.1:5643/oobi/BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM/controller" + ], + "durls": [ + "https://weboftrust.github.io/oobi/EN6Oh5XSD5_q2Hgu-aqpdfbVepdpYpFlgz6zvJL5b_r5" + ], + "keri.cesr.dir": "./volume/dkr/pages/", + "did.doc.dir": "./volume/dkr/pages/" + } \ No newline at end of file diff --git a/volume/dkr/examples/my-scripts/keri/cf/my-config.json b/volume/dkr/examples/my-scripts/keri/cf/my-config.json new file mode 100755 index 0000000..96a9550 --- /dev/null +++ b/volume/dkr/examples/my-scripts/keri/cf/my-config.json @@ -0,0 +1,3 @@ +{ + "dt": "2022-01-20T12:57:59.823350+00:00" +} \ No newline at end of file diff --git a/volume/dkr/examples/my-scripts/my-incept-multi-fractions.json b/volume/dkr/examples/my-scripts/my-incept-multi-fractions.json new file mode 100644 index 0000000..dbd2a19 --- /dev/null +++ b/volume/dkr/examples/my-scripts/my-incept-multi-fractions.json @@ -0,0 +1,13 @@ +{ + "transferable": true, + "wits": [ + "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", + "BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM", + "BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX" + ], + "toad": 3, + "icount": 3, + "ncount": 3, + "isith": ["1/3", "3/5", "1/5"], + "nsith": "2" +} diff --git a/volume/dkr/examples/my-scripts/my-incept-multi.json b/volume/dkr/examples/my-scripts/my-incept-multi.json new file mode 100644 index 0000000..7bc0771 --- /dev/null +++ b/volume/dkr/examples/my-scripts/my-incept-multi.json @@ -0,0 +1,13 @@ +{ + "transferable": true, + "wits": [ + "BBilc4-L3tFUnfM_wJr4S4OJanAv_VmF_dJNN6vkf2Ha", + "BLskRTInXnMxWaGqcpSyMgo0nYbalW99cGZESrz3zapM", + "BIKKuvBwpmDVA4Ds-EpL5bt9OqPzWPja2LigFYZN2YfX" + ], + "toad": 3, + "icount": 3, + "ncount": 3, + "isith": "2", + "nsith": "2" +} diff --git a/volume/dkr/examples/my-scripts/my-rotate.json b/volume/dkr/examples/my-scripts/my-rotate.json new file mode 100644 index 0000000..a0100be --- /dev/null +++ b/volume/dkr/examples/my-scripts/my-rotate.json @@ -0,0 +1,9 @@ +{ + "isith": "1", + "nsith": "1", + "ncount": 1, + "toad": 3, + "wits": [], + "witsCut": [], + "witsAdd": [] +} diff --git a/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/did.json b/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/did.json new file mode 100644 index 0000000..622f4f4 --- /dev/null +++ b/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/did.json @@ -0,0 +1 @@ +{"id": "did:web:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "verificationMethod": [{"id": "#DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr", "type": "JsonWebKey", "controller": "did:web:did-webs-service%3a7676:ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe", "publicKeyJwk": {"kid": "DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr", "kty": "OKP", "crv": "Ed25519", "x": "evT4j6Yw3uHpwsw5NEmSR8-4x3S-BA-s6Thjd51oeOs"}}], "service": [], "alsoKnownAs": []} \ No newline at end of file diff --git a/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/keri.cesr b/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/keri.cesr new file mode 100644 index 0000000..3683a53 --- /dev/null +++ b/volume/dkr/pages/ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe/keri.cesr @@ -0,0 +1 @@ +{"v":"KERI10JSON00012b_","t":"icp","d":"ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe","i":"ENro7uf0ePmiK3jdTo2YCdXLqW7z7xoP6qhhBou6gBLe","s":"0","kt":"1","k":["DHr0-I-mMN7h6cLMOTRJkkfPuMd0vgQPrOk4Y3edaHjr"],"nt":"1","n":["ELa775aLyane1vdiJEuexP8zrueiIoG995pZPGJiBzGX"],"bt":"0","b":[],"c":[],"a":[]}-VAn-AABAADjfOjbPu9OWce59OQIc-y3Su4kvfC2BAd_e_NLHbXcOK8-3s6do5vBfrxQ1kDyvFGCPMcSl620dLMZ4QDYlvME-EAB0AAAAAAAAAAAAAAAAAAAAAAA1AAG2024-01-02T14c12c15d456835p00c00 \ No newline at end of file diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wan.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wan.json new file mode 100755 index 0000000..65cc5fb --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wan.json @@ -0,0 +1,9 @@ +{ + "dt": "2022-01-20T12:57:59.823350+00:00", + "wan": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://witnesshost:5632/", "http://witnesshost:5642/"] + }, + "iurls": [ + ] +} diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wes.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wes.json new file mode 100755 index 0000000..a5b4720 --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wes.json @@ -0,0 +1,9 @@ +{ + "wes": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://witnesshost:5634/", "http://witnesshost:5644/"] + }, + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + ] +} diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wil.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wil.json new file mode 100755 index 0000000..e2250da --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wil.json @@ -0,0 +1,9 @@ +{ + "wil": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://witnesshost:5633/", "http://witnesshost:5643/"] + }, + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + ] +} diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wit.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wit.json new file mode 100755 index 0000000..aba218b --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wit.json @@ -0,0 +1,9 @@ +{ + "wit": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://127.0.0.1:5635/", "http://127.0.0.1:5645/"] + }, + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + ] +} diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wub.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wub.json new file mode 100755 index 0000000..fe06c95 --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wub.json @@ -0,0 +1,9 @@ +{ + "wub": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://127.0.0.1:5636/", "http://127.0.0.1:5646/"] + }, + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + ] +} diff --git a/volume/witnesshost/keripy/scripts/keri/cf/main/wyz.json b/volume/witnesshost/keripy/scripts/keri/cf/main/wyz.json new file mode 100755 index 0000000..350a9e6 --- /dev/null +++ b/volume/witnesshost/keripy/scripts/keri/cf/main/wyz.json @@ -0,0 +1,9 @@ +{ + "wyz": { + "dt": "2022-01-20T12:57:59.823350+00:00", + "curls": ["tcp://127.0.0.1:5637/", "http://127.0.0.1:5647/"] + }, + "dt": "2022-01-20T12:57:59.823350+00:00", + "iurls": [ + ] +}