import * as ZLIB from 'node:zlib'; import * as CRYPTO from 'node:crypto'; import * as ATTEST from './attestation.ts'; import { type ArchiveSource } from './integrity.ts'; export { AUTHORITY, parseSignature, parseUnsigned, signatureOf, endsInArchive, wholeFileHash, pinOf, checkIntegrity, message, type ArchiveSource, type SignatureMarker, type IntegrityResult, } from './integrity.ts'; /** What a verification concluded, in increasing order of confidence. */ export type VerificationState = 'unsigned' | 'invalid' | 'valid-untrusted' | 'valid'; /** The archive-side surface of `AUTHORITY.PEM`. */ export interface ManifestFields { /** Format version, absent when the member was not a manifest at all. */ version?: string | undefined; /** Digest used for the whole-file hash and for member digests. */ hashAlg: string; /** Digest the signature over the whole-file hash uses; absent when unsigned. */ signAlg?: string | undefined; /** The certificate chain, leaf first; empty when unsigned. */ chain: CRYPTO.X509Certificate[]; } export interface VerificationResult { state: VerificationState; reason: string; /** Subject of the leaf certificate, when the archive named one. */ subject?: string | undefined; /** True for anything but `unsigned` — the archive claimed a signature. */ signed: boolean; /** True only for `valid`. */ trusted: boolean; hashAlg?: string | undefined; /** Member name -> recorded hex digest, from the archive that was hashed. */ digests?: Map | undefined; /** True when the archive was signed through sigstore. */ sigstore?: boolean | undefined; /** The sigstore signing identity (a SAN), once established. */ identity?: string | undefined; /** The sigstore OIDC issuer, once established. */ issuer?: string | undefined; /** When the signature was witnessed, per the transparency log. */ signedAt?: Date | undefined; /** The whole-file hash, hex, when it was computed. */ hash?: string | undefined; /** What was found for each attester the policy named. */ attestations?: ATTEST.Attestation[] | undefined; /** * SHA-256 fingerprint of the top of the certificate chain — what an X.509 * signer is recognised by, since leaves come and go and the root stays. */ anchor?: string | undefined; /** * True when something the caller explicitly demanded — an identity, an * issuer, attestations — is not there. `allowUntrusted` waives a chain * nobody has anchored; it never waives a demand. */ unmet?: boolean | undefined; } export interface VerifyOptions { /** Additional trusted PEM roots, besides system + NODE_EXTRA_CA_CERTS. */ extraRoots?: string[] | undefined; /** * Reference time for certificate validity (default: now). Ignored on the * sigstore path, which derives the signing time from the archive's own log * entry instead. */ now?: number | undefined; /** * Also recompute every member's content digest (default: true). With * `false` only the presence of the digests is checked; the whole-file hash * already covers the members' bytes, so this is the right trade for a mount * that re-checks each member as it is actually read. */ deep?: boolean | undefined; /** * An already-open archive over `source` to read entries from. When given it * is left open for the caller; otherwise one is opened and closed here. */ archive?: ZLIB.ZipFile | ZLIB.ZipBuffer | undefined; /** * Path to a sigstore trust root, for sigstore-signed archives * (default: BUNDLE_SIGSTORE_ROOT, else the TUF cache, else the seed). */ trustedRoot?: string | undefined; /** Require this sigstore signing identity (SAN). */ identity?: string | undefined; /** Require this sigstore OIDC issuer. */ issuer?: string | undefined; /** Require attestations from these attesters (see attestation.ts). */ attesters?: ATTEST.Attester[] | undefined; /** How many of `attesters` must have attested (default: all of them). */ quorum?: number | undefined; /** Milliseconds a cached attestation proof stays good for (default: seven days). */ maxAge?: number | undefined; /** Attesters whose bad verdict refuses the archive, whatever else holds. */ block?: ATTEST.Attester[] | undefined; /** The attestation cache to read (default: `BUNDLE_ATTESTATIONS`, else the state directory). */ attestationCache?: string | undefined; /** * Hash and check every member even of an unsigned archive, so an * `unsigned` answer still means the bytes hold together (default: only * when attestations are required). */ integrity?: boolean | undefined; } /** * How each state is reported, and the exit code that goes with it. * * The codes are part of the CLI's contract — a script branching on * `bundle verify` depends on them — so they live here with the states they * describe rather than in `cli.ts`. That also keeps the `bundle` launcher from * having to load the CLI to find out what exit code a refusal deserves. */ export declare const STATES: Record; export declare function buildManifest({ hashAlg, signAlg, chain }?: { hashAlg?: string | undefined; signAlg?: string | undefined; chain?: string | undefined; }): Buffer; export declare function parseManifest(content: Buffer | string): ManifestFields; /** * Verify an archive. `source` is a filesystem path (opened read-only and read * in chunks) or a Buffer of the whole file. * * `digests` on the result is the member-name -> hex-digest map read from the * entry comments of the very archive that was just hashed. A caller that goes * on to serve those members (see provider.ts) should keep this map rather than * re-reading the comments later, so what it checks content against is what the * signature covered. */ export declare function verifySync(source: ArchiveSource, options?: VerifyOptions): VerificationResult; /** * Promise-returning wrapper around `verifySync`, for callers that treat * verification as an asynchronous step. Hashing is CPU-bound either way, so the * work still runs to completion synchronously. */ export declare function verify(source: ArchiveSource, options?: VerifyOptions): Promise; /** * The inverse: render a marker for the EOCD comment. Field order is fixed by * insertion, and a field whose value is empty or absent is left out entirely. */ export declare function formatSignature({ hash, sig, fields }: { hash: string; sig: string; fields?: Record | undefined; }): string; //# sourceMappingURL=manifest.d.ts.map