swarm-citi-usp / did-chain

Store DID Documents for Swarm Method (did:sw:)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DID Chain

To run:

See the setup, then:

  • SWARM_BASE_DIR=<dir> CHAIN_COLLECTION=[chain name] python3 did_chain/api.py

  • SWARM_BASE_DIR is required

  • CHAIN_COLLECTION is optional, and its default value is chain_testnet

For example:

  • SWARM_BASE_DIR=~/.swarm_test python3 did_chain/api.py
  • SWARM_BASE_DIR=~/.swarm_test CHAIN_COLLECTION=chain_mainnet python3 did_chain/api.py

Then, issue a request get the did document associated to a known did. For example, if the did of the DID Chain is did:sw:7UJPYn6cmvNcqv2hWn3TDx, the request can be sent as follows:

  • http :7878/dids/did:sw:7UJPYn6cmvNcqv2hWn3TDx accept:application/cbor-di

To test:

  • pytest --log-cli-level=info

Setup

  1. Optional: create a virtual environment
sudo apt install python3-virtualenv
virtualenv venv
source ./venv/bin/activate
  1. Install deps and did-chain:
git clone git@github.com:swarm-citi-usp/swarm-sec.git
cd swarm-sec && git checkout develop && pip3 install -e .

git clone git@github.com:swarm-citi-usp/swarm-lib-python.git
cd swarm-lib-python && git checkout develop && pip3 install -e .

git clone git@github.com:swarm-citi-usp/did-chain.git
cd did-chain && pip3 install -e .
  1. Create the did_chain Swarm agent:
swarm_manager ~/.swarm_testnet --new_agent did_chain swarm:didChain 7878

# (requires an existing `broker` agent)
# swarm_manager ~/.swarm_testnet --new_agent broker swarm:broker 4000
# SWARM_BASE_DIR=~/.swarm_testnet iex -S mix
swarm_manager ~/.swarm_testnet --setup_trust did_chain broker
  1. Setup mongodb:
docker create -it --name DidChain -p 27017:27017 mongo
docker start DidChain
  1. Finally, export DidChain as a remote agent for inclusion in other devices:
swarm_manager ~/.swarm_testnet --export_agent did_chain
# then, use the following to import:
# swarm_manager <swarm base dir> --add_remote did_chain

About

Store DID Documents for Swarm Method (did:sw:)

License:GNU Lesser General Public License v2.1


Languages

Language:Python 100.0%