import { type VerificationResult, type VerificationState } from './manifest.ts'; import { type Attester, type StrongRef, type Verdict } from './attestation.ts'; import type { NetworkOptions } from './atproto.ts'; import type { Policy, Signer } from './policy.ts'; /** One thing that vouches for — or warns against — an archive. */ export type Evidence = { type: 'signature'; identity: string; issuer: string; signedAt?: Date | undefined; } | { type: 'certificate'; subject: string; anchor: string; anchored: boolean; } | { type: 'attestation'; did: string; handle?: string | undefined; kind?: string | undefined; verdict: Verdict; createdAt?: string | undefined; /** Not of the archive itself but of a suite it is in, which carries over: `suite devtools`. */ via?: string | undefined; /** The attester's own words about it, and a post they link for context: shown, never decisive. */ note?: string | undefined; post?: StrongRef | undefined; }; /** * Another hash whose attestations count as the archive's own: a suite's, for * its members — so that whoever attests a suite (an IT department marking it * `permitted`) need not attest each member. The suite's hash covers what it * requires of each member, and a member that does not carry that is refused, * so what was attested is what holds. */ export interface Inherited { hashAlg: string; hash: string; /** What it is, as the review says: `suite devtools`. */ via: string; } /** Who has been accepted for an install, across all its versions so far. */ export interface Accepted { signers: Signer[]; /** Certificate-chain root fingerprints. */ certificates: string[]; /** Attester DIDs. */ attesters: string[]; } /** What was found for an archive. */ export interface Gathered { hashAlg: string; hash: string; result: VerificationResult; evidence: Evidence[]; /** What could not be checked, and why — shown, never decisive. */ notes: string[]; } export interface GatherOptions { /** Extra trusted roots, as PEM text or paths to PEM files. */ roots?: string[] | undefined; /** DIDs to ask about this archive, whatever discovery finds. */ candidates?: string[] | undefined; /** The backlink index to discover attesters through, or false. */ discovery?: string | false | undefined; /** DIDs whose attestations are not looked at. */ ignore?: string[] | undefined; /** Other hashes whose attestations count as this archive's: its suites'. */ inherit?: Inherited[] | undefined; /** How stale a cached proof may be (for the offline `gatherSync`). */ maxAge?: number | undefined; /** * Also look at every attester the cache holds a proof from for this hash — * whoever was found when it was installed, or by a refresh since — so a * warning seen once is not forgotten offline. */ everyCached?: boolean | undefined; network?: NetworkOptions | undefined; } /** One line of a review: a piece of evidence, and what is known about it. */ export interface ReviewItem { evidence: Evidence; /** Why it is accepted without asking, if it is. */ known?: string | undefined; /** Why it cannot count at all, if it cannot. */ excluded?: string | undefined; } /** What a caller decides on. */ export interface Review { hashAlg: string; hash: string; signed: boolean; items: ReviewItem[]; /** Requirements that do not hold. Any of these refuses the archive. */ unmet: string[]; /** Bad verdicts from blocking attesters. Any of these refuses the archive. */ blocked: string[]; /** Bad verdicts from attesters already trusted or accepted. These force a question. */ alarms: string[]; notes: string[]; decision: 'proceed' | 'ask' | 'refuse'; reason: string; /** The verification state a refusal corresponds to. */ state: VerificationState; } /** What the command line demanded, on top of the policy. */ export interface Demands { identity?: string | undefined; issuer?: string | undefined; attesters?: Attester[] | undefined; quorum?: number | undefined; block?: Attester[] | undefined; } /** * A floor someone else set — a suite, for its members: what must hold for the * archive to be installed at all. Unlike a demand, meeting it vouches for * nothing: the evidence it names is not thereby accepted, and whoever installs * still decides whom to believe. */ export interface Minimum { identity?: string | undefined; issuer?: string | undefined; attesters?: Attester[] | undefined; /** How many of `attesters` must have attested (default: all of them). */ quorum?: number | undefined; /** Who set it, as the refusal says: `suite devtools`. */ source: string; } /** * Find everything that vouches for `bytes`: verify the archive, ask the index * who has attested its hash, and fetch every candidate's attestation into the * cache. Throws on an archive that does not verify. */ export declare function gather(bytes: Buffer, options?: GatherOptions): Promise; /** The offline half of `gather`: the archive, and what the cache holds for the candidates. */ export declare function gatherSync(bytes: Buffer, options?: GatherOptions, notes?: string[]): Gathered; /** Weigh what was gathered against the policy, the flags, and what was accepted before. */ export declare function judge(gathered: Gathered, { policy, demands, minimum, accepted, trust, previousIssuer }: { policy: Policy; demands?: Demands | undefined; /** Floors that must hold, and vouch for nothing — a suite's, for its members. */ minimum?: Minimum[] | undefined; accepted?: Accepted | undefined; /** Signers trusted for this install on top of the policy — this package's own, for itself. */ trust?: Signer[] | undefined; /** The issuer the version being replaced was signed through, for `sameIssuer`. */ previousIssuer?: string | undefined; }): Review; /** What a review's selectable items are: everything that counts. */ export declare function selectable(review: Review): ReviewItem[]; /** Add what was accepted now to what was accepted before. */ export declare function accept(previous: Accepted, chosen: ReviewItem[]): Accepted; export declare function noneAccepted(): Accepted; /** One line for a piece of evidence. */ export declare function describe(evidence: Evidence): string; /** An install refused, with the state it corresponds to. */ export declare function refusal(state: VerificationState, reason: string, review?: Review): Error; //# sourceMappingURL=review.d.ts.map