Attesto.Did (Attesto v1.9.0)

Copy Markdown View Source

Connection-free resolution for self-contained DID methods.

did:jwk identifiers contain an unpadded base64url-encoded public JWK. did:key identifiers contain a multibase/multicodec public key; this module supports base58btc (z) with Ed25519 (0xed) and compressed P-256 (0x1200) keys.

did:web is deliberately parser-only. Without a :resolver, resolution returns {:needs_fetch, url} so the host retains ownership of HTTP, TLS, caching, and DID-document key selection. A resolver may instead be supplied as resolver: fn url -> {:ok, public_jwk} | {:error, reason} end.

Summary

Functions

Resolve a did:jwk or did:key to a public JWK, or parse a did:web identifier into its HTTPS resolution URL.

Types

jwk()

@type jwk() :: %{required(String.t()) => term()}

result()

@type result() :: {:ok, jwk()} | {:needs_fetch, String.t()} | {:error, term()}

Functions

resolve(did, opts \\ [])

@spec resolve(term(), term()) :: result()

Resolve a did:jwk or did:key to a public JWK, or parse a did:web identifier into its HTTPS resolution URL.

This function never performs network I/O. If :resolver is supplied for a did:web, it is called with the parsed HTTPS URL and must return either a public JWK map or an error tuple.