Skip to main content

Module discovery

Module discovery 

Source
Expand description

Notary key discovery — the parsing half.

Spec §8.4 defines three ways a verifier recovers a notary’s public key with no prior trust relationship: did:key (offline), a DNS TXT record, and a did:web DID Document over HTTPS.

Only parsing lives here. Fetching — DNS queries and HTTPS requests — is deliberately excluded so this crate stays offline, dependency-light, and fully testable: every rule below is exercised against fixed strings rather than a live network. A companion adapter crate performs the I/O and feeds the results to these functions.

did:key needs no fetching at all, so it is complete in crate::crypto::did_key rather than here.

The modules divide as follows. dns_txt and did_document parse the two fetched wire forms; publish renders those same two forms, so the pair is round-trip testable without a network; ports declares the narrow one-method ports an adapter implements to do the fetching; and composer dispatches across mechanisms in the §8.4.6 preference order with no silent downgrade from a stronger mechanism to a weaker one. DiscoveryOutcome is the one word all of them use for “the mechanism answered, and published nothing” — the distinction §8.4.6 is built on.

Two members here serve a surface that is NOT key discovery: revocation status (§6.3.3) is anchored in the same did:web origin, so DidUrl::web_status_url derives its endpoint through the very same percent-decode-then-split rule as the DID Document URL, and same_origin is the one origin comparison this crate makes. They live beside DidUrl rather than in crate::credential_status because a second implementation of either rule is how two surfaces anchored in one domain quietly stop agreeing about what that domain is.

Modules§

composer
Mechanism dispatch for notary key discovery (spec §8.4.6).
did_document
did:web DID Document parsing and verification-method lookup.
dns_txt
DNS TXT key publication — tag-list parsing and key selection.
ports
The narrow fetch ports the notary-hosted surfaces need.
publish
Notary key PUBLICATION — the rendering half of §8.4 discovery.

Structs§

DidUrl
A parsed proof.verificationMethod DID URL.
NotaryPublicKey
A notary public key recovered from a discovery mechanism.

Enums§

DiscoveryOutcome
What a discovery step found, when the step itself completed.
KeyAlgorithm
Signing algorithm a discovered key is pinned to.

Functions§

https_origin
The normalized https: origin of an absolute URL: scheme://host:port with the default port made explicit.
same_origin
True when two absolute URLs share an origin — identical scheme, host and port (spec §6.3.3.2).