FastATP

WebResolver

A class in fastatp.did.resolver (source).

WebResolver(
    *,
    timeout: float = 10.0,
    cache_size: int = 1024,
    client: httpx.AsyncClient | None = None,
    host_policy: Callable[[str], bool] | None = None,
    max_cache_age: float = 3600.0,
)

Default DIDResolver for did:web over HTTPS.

Respects Cache-Control: max-age via a small in-memory LRU and coalesces concurrent resolutions of the same DID.

Resolving a DID means an outbound HTTP request to a host the DID's author chose. On a private network that is the product working as designed; a verifier reachable from untrusted peers should pass host_policy (host -> bool) to restrict which hosts it will fetch from (e.g. deny RFC-1918/link-local ranges, or allowlist a domain).

Methods

invalidate

invalidate(did: str) -> None

Drop a cached document so the next resolve refetches.

The explicit-invalidation seam a firehose consumer needs: an #identity event is precisely "your cache is stale" — waiting out the TTL would verify against a rotated-away key in the meantime. (Invalidation-API pattern from MarshalX/atproto's identity cache.)

aclose

async aclose() -> None