Skip to main content

Module did

Module did 

Source

Functions§

create_did_document
Create a DID document for a did:web or did:key identity with an Ed25519 verification key.
did_jwk_from_ed25519
Build a did:jwk URI from an Ed25519 public key (32 bytes), the inverse of ed25519_from_did_jwk. The JWK JSON is compact with SORTED keys ({"crv":"Ed25519","kty":"OKP","x":"<base64url-nopad pubkey>"}); the method id is that JSON base64url-encoded WITH canonical ‘=’ padding, matching cogmem’s agent_did_jwk so the two emit byte-identical issuer DIDs.
did_key_from_ed25519
Generate a did:key URI from an Ed25519 public key (32 bytes).
did_web_from_domain
Create a did:web URI from a domain and optional path segments. did:web encodes : as domain separators and path segments after the domain. Example: did:web:example.com or did:web:example.com:users:alice
did_web_to_url
Convert a did:web URI to the HTTPS URL where its DID document should be hosted. Per the did:web spec: did:web:example.com → https://example.com/.well-known/did.json did:web:example.com:path:to → https://example.com/path/to/did.json
ed25519_from_did_document
Extract the Ed25519 public key from a DID (supports both did:key and did:web documents). For did:key, extracts directly from the URI. For did:web, requires the DID document JSON to be passed in.
ed25519_from_did_jwk
Extract the Ed25519 public key bytes from a did:jwk URI. The method id is a base64url-encoded JWK; decoding tolerates the canonical padding c2pa-rs emits.
ed25519_from_did_key
Extract the Ed25519 public key bytes from a did:key URI.