Skip to main content

This repository includes Python libraries for working with `did:tdw` (Trust DID Web) DID documents and the underlying log format.

Project description

Trust DID Web - Python

This repository includes Python libraries for working with did:tdw (Trust DID Web) DID documents and the underlying log format. Methods are provided for provisioning and updating DID documents as well as a resolving existing did:tdw DIDs. Currently, version 0.4 of the specification is implemented.

Prerequisites

This library requires Python 3.10 or later. Dependencies are listed in pyproject.toml and can be installed via:

poetry install

Usage

A new did:tdw DID can be minted using the provision command. This will create a new Askar keystore for handling the signing key.

python3 -m did_tdw.provision --auto "domain.example"

This will output a new directory named after the new DID, containing did.jsonl (the DID log) and did.json (the current state of the document).

To automatically update the DID, edit did.json and execute the update command (use the identifier output from the provision command):

python3 -m did_tdw.update --auto "did:tdw:QmRwq46VkGuCEx4dyYxxexmig7Fwbqbm9AB73iKUAHjMZH:domain.example"

DID Resolution

The resolver script may be invoked via the command line, and supports dereferencing of fragments and paths:

python3 -m did_tdw.resolver "did:tdw:QmRwq46VkGuCEx4dyYxxexmig7Fwbqbm9AB73iKUAHjMZH:domain.example"
python3 -m did_tdw.resolver "did:tdw:QmRwq46VkGuCEx4dyYxxexmig7Fwbqbm9AB73iKUAHjMZH:domain.example#key-1"
python3 -m did_tdw.resolver "did:tdw:QmRwq46VkGuCEx4dyYxxexmig7Fwbqbm9AB73iKUAHjMZH:domain.example/whois.vc"

For testing, this script also accepts the path to the local DID history file:

python3 -m did_tdw.resolver -f did.jsonl "did:tdw:QmRwq46VkGuCEx4dyYxxexmig7Fwbqbm9AB73iKUAHjMZH:domain.example"

Demo

For demo purposes, a new DID can be minted along with a series of test updates applied using the included demo script:

python3 demo.py domain.example

Contributing

Pull requests are welcome! Please read our contributions guide and submit your PRs. We enforce developer certificate of origin (DCO) commit signing — guidance on this is available. We also welcome issues submitted about problems you encounter in using Trust DID Web - Python.

License

Apache License Version 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

did_tdw-0.2.2.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

did_tdw-0.2.2-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file did_tdw-0.2.2.tar.gz.

File metadata

  • Download URL: did_tdw-0.2.2.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for did_tdw-0.2.2.tar.gz
Algorithm Hash digest
SHA256 c96f8de599217ad6e89ffcf7128c4432f62d5465b787c49521912a0a7d60fee0
MD5 0b1644fed663434b8b32b204cf0355b5
BLAKE2b-256 03876e4bb0f67960a4d40634b7e41e96ca4b59c5da83cfa877c9b3479bd01001

See more details on using hashes here.

File details

Details for the file did_tdw-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: did_tdw-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 35.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.11

File hashes

Hashes for did_tdw-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3cccb6ddc53a51e21bb78422fa4964180c9a5a22647647d22a0b49d5b945bd78
MD5 2a4ee44d2d5696bd84b480b92cd3a7c5
BLAKE2b-256 8ce0173ea4e472d3ecda3562ce28e6191041c000b1aebad4c9fc74cfdffcc8a8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page