/** * did:web Resolver * * Resolves did:web DIDs to DID Documents by fetching the well-known document * over HTTPS, per the did:web method spec. * * URL mapping (did:web method spec §3.2): * did:web:example.com → https://example.com/.well-known/did.json * did:web:example.com:a:b → https://example.com/a/b/did.json * did:web:example.com%3A3000 → https://example.com:3000/.well-known/did.json * * Percent-encoded characters in each colon-separated segment are decoded * (notably `%3A` for a host:port colon). * * The fetch implementation is pluggable so callers — and tests — can supply * their own transport; it defaults to the global `fetch`. The resolver never * throws: a non-did:web input, non-OK response, malformed document, or * transport error all resolve to `null`. * * Mirrors the shape of {@link createDidKeyResolver}. * * @see https://w3c-ccg.github.io/did-method-web/ */ import type { DIDResolver } from './vc-verifier'; /** Minimal subset of a fetch `Response` consumed by the resolver. */ export interface DidWebFetchResponse { ok: boolean; json(): Promise; } /** * Pluggable fetch signature. The global `fetch` satisfies this structurally, * so it is the default. */ export type DidWebFetch = (url: string) => Promise; /** Options for {@link createDidWebResolver}. */ export interface DidWebResolverOptions { /** Transport used to retrieve the DID document. Defaults to global `fetch`. */ fetch?: DidWebFetch; /** * Max time (ms) to wait for the DID document before failing closed (returning * `null`). Guards against a stalled issuer endpoint hanging verification. * Defaults to {@link DEFAULT_TIMEOUT_MS}. */ timeoutMs?: number; } /** * Convert a did:web DID into the HTTPS URL of its DID document. * * @param did - The did:web DID to map. * @returns The document URL, or `null` if the DID is not a well-formed did:web. */ export declare function didWebToUrl(did: string): string | null; /** * Create a did:web resolver. * * @param options - Optional pluggable fetch transport. * @returns A {@link DIDResolver} for did:web DIDs. */ export declare function createDidWebResolver(options?: DidWebResolverOptions): DIDResolver; //# sourceMappingURL=did-web-resolver.d.ts.map