/** * `createVerifier(...)` — factory for a configured {@link Verifier}. * * A `Verifier` owns long-lived dependencies (HTTP, cache, crypto * services, registries, registry handlers, document loader) and * exposes per-call `verifyCredential` / `verifyPresentation` methods * that share those dependencies — most importantly the cache. * * Each verifier without an explicit `cacheService` gets its own fresh * `InMemoryCacheService`; cache contents are isolated from other * verifiers in the same process. To share cache state across verifiers * (e.g. a long-running service holding several pre-built verifiers), * construct one `InMemoryCacheService` (or any `CacheService` adapter) * and pass it via `createVerifier({ cacheService })`. * * Construct a single `Verifier` for any batch or repeated verification * work; reusing the instance lets issuer DID documents, status list * credentials, and JSON-LD contexts be fetched once and reused. The * standalone wrappers in `verify-suite.ts` create a fresh verifier per * call and are intended only for one-shot use. * * ## INVARIANT: suites see the bytes the issuer signed * * `parseCredential` / `parsePresentation` are validation gates only. Their * output is discarded and the caller's original object is what flows into * `runSuites` and back out as `result.verifiableCredential`. * * Zod rewrites what it parses. `.passthrough()` does not extend into nested * object schemas, so any nested `z.object({...})` deletes the keys it does * not name, and `JsonLdField` rewrites scalars into arrays. Either change * alters the canonicalized N-Quads, which makes a valid proof fail as * `INVALID_SIGNATURE`. That failure looks like a bad credential and is * actually a bug here. It is not hypothetical: a spec-legal * `issuer.image.caption` was dropped by `IssuerObjectSchema`, which rejected * production Open Badges credentials. * * Returning the original object also matters downstream, because consumers * may re-verify `result.verifiableCredential` in a second pass. Handing them * a rewritten copy makes the second pass fail where the first passed. * * Suites must therefore tolerate raw JSON-LD shapes rather than assume * normalization: `@context` and `type` may each be a string or an array. * * @example * ```ts * const verifier = createVerifier({ registries: myRegistries }); * for (const credential of credentials) { * const result = await verifier.verifyCredential({ credential }); * } * ``` */ import type { Verifier, VerifierConfig } from './types/verifier.js'; export declare function createVerifier(config?: VerifierConfig): Verifier; //# sourceMappingURL=verifier.d.ts.map