/** * Evidence Collection Types * * Types for collecting and packaging audit evidence for compliance. * * @module evidence/types */ import type { ComplianceFramework } from "../compliance/types.js"; /** * Evidence artifact type */ export type EvidenceArtifactType = "scan_result" | "compliance_report" | "config_file" | "sbom" | "history_snapshot" | "verification_result" | "certification_result"; /** * Individual evidence artifact */ export interface EvidenceArtifact { /** Artifact type */ type: EvidenceArtifactType; /** Human-readable name */ name: string; /** Description of what this artifact contains */ description: string; /** SHA-256 hash of the artifact content */ contentDigest: string; /** Size in bytes */ sizeBytes: number; /** When the artifact was collected */ collectedAt: string; /** Source path (if file-based) */ sourcePath?: string; /** Inline content (for small artifacts) or path to stored file */ content?: string; /** Path to stored artifact file (for large artifacts) */ storedPath?: string; } /** * CI environment metadata */ export interface CIEnvironment { /** CI provider (github, gitlab, jenkins, etc.) */ provider: string; /** Build/workflow ID */ buildId: string; /** Git commit SHA */ commitSha: string; /** Git branch or tag */ ref?: string; /** Actor/user who triggered the build */ actor?: string; /** Run number/ID */ runId?: string; /** Repository information */ repository?: { owner: string; name: string; url: string; }; /** Pull request information if applicable */ pullRequest?: { number: number; title?: string; url?: string; }; } /** * Runtime environment metadata */ export interface RuntimeEnvironment { /** Operating system */ os: string; /** OS version */ osVersion: string; /** Node.js version */ nodeVersion: string; /** Vaspera version */ vasperaVersion: string; /** Hostname (sanitized for privacy) */ hostname?: string; /** CI environment if running in CI */ ci?: CIEnvironment; /** Timestamp when environment was captured */ capturedAt: string; } /** * Evidence bundle */ export interface EvidenceBundle { /** Unique bundle ID */ id: string; /** Associated certification ID */ certificationId?: string; /** When the bundle was created */ createdAt: string; /** Project path */ projectPath: string; /** Compliance frameworks this evidence supports */ frameworks: ComplianceFramework[]; /** Runtime environment metadata */ environment: RuntimeEnvironment; /** Collected artifacts */ artifacts: EvidenceArtifact[]; /** Overall bundle digest (SHA-256 of all artifact digests) */ bundleDigest: string; /** * Sigstore signature over the bundle digest. Shaped to mirror the agent * certificate's signature so the same verification path (verifySignedArtifact) * can be reused: it carries the full Sigstore bundle and the content digest, * not just opaque fields. */ signature?: { /** Whether signing succeeded (only set when it did). */ signed: boolean; /** sha256 of the signed content (the bundle digest). */ digest: string; /** ISO timestamp of signing. */ signedAt: string; /** Rekor transparency-log index, if the bundle was logged. */ rekorLogIndex?: string; /** Full Sigstore bundle (needed to verify; omitted when unsigned). */ bundle?: unknown; }; /** Bundle metadata */ metadata?: Record; } /** * Options for collecting evidence */ export interface CollectEvidenceOptions { /** Project path to collect evidence from */ projectPath: string; /** Certification ID to associate with */ certificationId?: string; /** Compliance frameworks to include reports for */ frameworks?: ComplianceFramework[]; /** Include SBOM */ includeSbom?: boolean; /** Include history snapshot */ includeHistory?: boolean; /** Include scan results */ includeScanResults?: boolean; /** Include config files (.vaspera/config.json, etc.) */ includeConfig?: boolean; /** Sign the bundle with Sigstore */ sign?: boolean; /** Maximum artifact size to inline (larger artifacts are stored) */ maxInlineSize?: number; } /** * Evidence collection result */ export interface CollectEvidenceResult { /** Whether collection succeeded */ success: boolean; /** The collected evidence bundle */ bundle?: EvidenceBundle; /** Error message if failed */ error?: string; /** Warnings encountered during collection */ warnings: string[]; /** Path where bundle was stored */ storedPath?: string; } /** * Evidence verification result */ export interface VerifyEvidenceResult { /** Whether verification succeeded */ verified: boolean; /** Bundle ID verified */ bundleId: string; /** Whether all artifact digests match */ artifactsIntact: boolean; /** Whether signature is valid (if present) */ signatureValid?: boolean; /** List of artifacts that failed verification */ failedArtifacts: string[]; /** Verification timestamp */ verifiedAt: string; /** Error message if verification failed */ error?: string; } //# sourceMappingURL=types.d.ts.map