pub struct CrossRegistryResolver { /* private fields */ }Expand description
Resolver for cross-registry references.
Holds a WebResolver for DID lookups and caches a RegistryClient
- capabilities document per authority for the lifetime of the resolver.
The SsrfPolicy is consulted on every URL the resolver constructs
(RFC-ACDP-0006 §7.1, §7.2).
Implementations§
Source§impl CrossRegistryResolver
impl CrossRegistryResolver
Sourcepub fn new() -> Self
pub fn new() -> Self
Build a resolver with default settings: no allowlist, depth 10, HTTPS-only / no IP literals SSRF policy.
Sourcepub fn with_ssrf_policy(self, policy: SsrfPolicy) -> Self
pub fn with_ssrf_policy(self, policy: SsrfPolicy) -> Self
Override the SsrfPolicy applied to outbound URLs.
Useful for test environments that need to allow http:// or
IP-literal hosts. Production deployments SHOULD keep the default.
Sourcepub fn with_max_depth(self, depth: usize) -> Self
pub fn with_max_depth(self, depth: usize) -> Self
Cap the number of derived_from hops walked in a single
Self::walk_derived_from call.
Sourcepub fn with_options(self, options: ResolverOptions) -> Self
pub fn with_options(self, options: ResolverOptions) -> Self
Replace the complete options struct (overrides every individual
with_* setter that wasn’t already applied).
Sourcepub fn options(&self) -> &ResolverOptions
pub fn options(&self) -> &ResolverOptions
Borrow the active options. Useful for tests + telemetry.
Sourcepub fn with_did_resolver(self, resolver: WebResolver) -> Self
pub fn with_did_resolver(self, resolver: WebResolver) -> Self
Override the WebResolver used for DID document lookups.
Primary use is supplying a WebResolver::with_root_cert_pem
instance in tests so a self-signed mock can answer DID-document
requests for did:web:localhost%3A<port>. Production callers do
not need this — the default resolver trusts the system CA bundle.
Sourcepub fn seed_client(&self, authority: impl Into<String>, client: RegistryClient)
pub fn seed_client(&self, authority: impl Into<String>, client: RegistryClient)
Pre-populate the per-authority RegistryClient cache.
Primary use is the conformance harness: tests supply a client
whose HTTP layer trusts the in-process TLS server’s self-signed
root certificate (via RegistryClient::with_root_cert_pem), so
the resolver hits the mock instead of attempting a real network
call. The seeded client wins over the lazy
RegistryClient::new_pinned constructor that Self::resolve
would otherwise invoke on first access.
Sourcepub fn with_allowlist<I, S>(self, authorities: I) -> Self
pub fn with_allowlist<I, S>(self, authorities: I) -> Self
Restrict cross-registry resolution to a fixed set of authorities
(lowercase DNS hostnames). When set, any reference outside the
allowlist is rejected with AcdpError::CrossRegistryResolutionFailed.
Sourcepub async fn resolve(
&self,
ctx_id: &CtxId,
) -> Result<VerifiedContext, AcdpError>
pub async fn resolve( &self, ctx_id: &CtxId, ) -> Result<VerifiedContext, AcdpError>
Resolve a single cross-registry CtxId end-to-end.
Steps 1–6 of RFC-ACDP-0006 §4.1: parse, fetch capabilities,
verify the registry DID and its DID document’s web binding,
retrieve, recompute hash, verify signature. The SsrfPolicy
is checked first so a hostile authority cannot drive an
internal-network request.
Sourcepub async fn walk_derived_from(
&self,
body: &Body,
) -> Result<Vec<VerifiedContext>, AcdpError>
pub async fn walk_derived_from( &self, body: &Body, ) -> Result<Vec<VerifiedContext>, AcdpError>
Walk the derived_from graph rooted at body with cycle detection,
a per-edge depth cap of ResolverOptions::max_depth, a total-
nodes cap of max_nodes, a per-context fanout cap of max_fanout,
and a wall-clock total_timeout. Returns each verified ancestor
(excluding the root). Breadth-first; closer ancestors are returned
first.