Implementation of the Peer DID method specification in Python.
Implements static layers of support (1, 2a, 2b) only.
pip install peerdid
See https://github.com/sicpa-dlab/didcomm-demo.
Example code:
from peerdid.dids import (
create_peer_did_numalgo_0,
create_peer_did_numalgo_2,
resolve_peer_did,
)
from peerdid.keys import Ed25519VerificationKey, X25519KeyAgreementKey
encryption_keys = [
X25519KeyAgreementKey.from_base58(
"DmgBSHMqaZiYqwNMEJJuxWzsGGC8jUYADrfSdBrC6L8s"
)
]
signing_keys = [
Ed25519VerificationKey.from_base58(
"ByHnpUCFb1vAfh9CFZ8ZkmUZguURW8nSw889hy6rD8L7"
)
]
service = {
"type": "DIDCommMessaging",
"serviceEndpoint": "https://example.com/endpoint1",
"routingKeys": ["did:example:somemediator#somekey1"],
"accept": ["didcomm/v2", "didcomm/aip2;env=rfc587"],
}
peer_did_algo_0 = create_peer_did_numalgo_0(inception_key=signing_keys[0])
peer_did_algo_2 = create_peer_did_numalgo_2(
encryption_keys=encryption_keys, signing_keys=signing_keys, service=service
)
did_doc_algo_0 = resolve_peer_did(peer_did_algo_0)
did_doc_algo_2 = resolve_peer_did(peer_did_algo_2)
did_doc_algo_0_json = did_doc_algo_0.to_json()
did_doc_algo_2_json = did_doc_algo_2.to_json()
Example of DID documents:
- Only static layers 1, 2a, 2b are supported
- Only
X25519
keys are supported for key agreement - Only
Ed25519
keys are supported for authentication - Supported verification materials (input and in the resolved DID Document):
- [Default] 2020 verification materials (
Ed25519VerificationKey2020
andX25519KeyAgreementKey2020
) with multibase base58 (publicKeyMultibase
) public key encoding. - JWK (
JsonWebKey2020
) using JWK (publicKeyJwk
) public key encoding - 2018/2019 verification materials (
Ed25519VerificationKey2018
andX25519KeyAgreementKey2019
) using base58 (publicKeyBase58
) public key encoding.
- [Default] 2020 verification materials (
Pull requests are welcome!
Pull requests should have a descriptive name, include the summary of all changes made in the pull request description, and include unit tests that provide good coverage of the feature or fix. A Continuous Integration ( CI) pipeline is executed on all PRs before review and contributors are expected to address all CI issues identified.
- Executes all unit tests from the pull request.
- Analyzes code style using Flake8.