invaria — API
FileDescriptor
Section titled “FileDescriptor”export interface FileDescriptor { sha256: string; size: number; mode: number;}InvariaManifest
Section titled “InvariaManifest”export interface InvariaManifest { version: 1; name: string; command: string[]; cwd: string; inputs: string[]; outputs: string[]; env: Record<string, string>; inheritEnv: string[]; timeoutMs: number; sourceDateEpoch: number; cache: boolean; platform: { os: string[]; arch: string[] };}AttestationPayload
Section titled “AttestationPayload”export interface AttestationPayload { schema: 'invaria.attestation/v1'; subject: string; executionId: string; fingerprint: string; cacheHit: boolean; startedAt: string; finishedAt: string; durationMs: number; command: string[]; cwd: string; environment: { declared: Record<string, string>; inheritedDigests: Record<string, string>; }; runtime: { os: string; arch: string; node: string }; inputs: Record<string, FileDescriptor>; outputs: Record<string, FileDescriptor>; stdout: { sha256: string; bytes: number }; stderr: { sha256: string; bytes: number }; exitCode: 0;}SignedAttestation
Section titled “SignedAttestation”export interface SignedAttestation { payload: AttestationPayload; signature: { algorithm: 'Ed25519'; publicKey: string; fingerprint: string; value: string; };}RunContractOptions
Section titled “RunContractOptions”export interface RunContractOptions { manifest?: string; outputRoot?: string; stateRoot?: string; keyRoot?: string; key?: string; attestation?: string; cache?: boolean;}RunContractResult
Section titled “RunContractResult”export interface RunContractResult { manifest: InvariaManifest; fingerprint: string; cacheHit: boolean; outputs: Record<string, FileDescriptor>; attestation: SignedAttestation; attestationPath: string; stdout: string; stderr: string;}CapsuleEntry
Section titled “CapsuleEntry”export interface CapsuleEntry extends FileDescriptor { path: string; offset: number;}InvariaError
Section titled “InvariaError”export class InvariaError extends Error { code: string; details?: unknown; constructor(message: string, code?: string, details?: unknown);}runContract
Section titled “runContract”export function runContract(options?: RunContractOptions): Promise<RunContractResult>;validateManifest
Section titled “validateManifest”export function validateManifest(raw: unknown): InvariaManifest;loadManifest
Section titled “loadManifest”export function loadManifest(filename?: string): Promise<{ manifest: InvariaManifest; filename: string; root: string }>;verifyAttestation
Section titled “verifyAttestation”export function verifyAttestation( attestationOrFilename: string | SignedAttestation, options?: { root?: string; publicKey?: string; verifyFiles?: boolean }): Promise<{ ok: boolean; errors: Array<Record<string, unknown>>; payload: AttestationPayload; fingerprint?: string }>;readAttestation
Section titled “readAttestation”export function readAttestation(filename: string): Promise<SignedAttestation>;packCapsule
Section titled “packCapsule”export function packCapsule(manifestFilename: string, outputFilename: string): Promise<{ filename: string; sha256: string; size: number; entries: CapsuleEntry[];}>;readCapsule
Section titled “readCapsule”export function readCapsule(filename: string): Promise<{ filename: string; data: Buffer; dataOffset: number; index: { format: 1; entries: CapsuleEntry[] }; sha256: string;}>;extractCapsule
Section titled “extractCapsule”export function extractCapsule(filename: string, destination: string): Promise<Record<string, unknown>>;generateSigningKeyPair
Section titled “generateSigningKeyPair”export function generateSigningKeyPair(privateKeyPath: string, publicKeyPath: string): Promise<{ privateKey: string; publicKey: string; fingerprint: string;}>;publicKeyFingerprint
Section titled “publicKeyFingerprint”export function publicKeyFingerprint(publicKeyPem: string): string;clearCache
Section titled “clearCache”export function clearCache(root: string): Promise<void>;canonicalize
Section titled “canonicalize”export function canonicalize(value: unknown): string;hashCanonical
Section titled “hashCanonical”export function hashCanonical(value: unknown): string;sha256
Section titled “sha256”export function sha256(data: string | Buffer | Uint8Array): string;