/** * Proof Bundle Creation * * Creates cryptographically signed proof bundles from test run data. * * @see docs/rfc/proof-bundle-v1.md#3-data-model */ import { type KeyPair } from './signer.js'; /** * Proof Bundle structure (matches RFC spec) */ export interface ProofBundle { spec: 'qa360.proof.v1'; run: RunMetadata; artifacts: Artifact[]; results: TestResults; signing: SigningMetadata; signature: string; } /** * Run metadata */ export interface RunMetadata { id: string; startedAt: string; finishedAt: string; environment: Environment; packHash: string; ciContext: CIContext; } /** * Environment information */ export interface Environment { os: 'windows' | 'linux' | 'darwin'; node: string; arch: 'x64' | 'arm64'; ci: boolean; } /** * CI context */ export interface CIContext { provider: string | null; } /** * Artifact metadata */ export interface Artifact { name: string; sha256: string; size: number; path?: string; } /** * Test results */ export interface TestResults { trustScore: number; gates: Gate[]; } /** * Gate result */ export interface Gate { name: string; status: 'pass' | 'fail' | 'skip'; metrics?: Record; } /** * Signing metadata */ export interface SigningMetadata { algo: 'ed25519'; signerId: string; timestamp: TimestampInfo; identity: IdentityInfo; } /** * Timestamp information (Phase 1: none, Phase 2: rfc3161) */ export interface TimestampInfo { type: 'none' | 'rfc3161'; token: string | null; } /** * Identity information (Phase 1: none, Phase 2: did/sigstore) */ export interface IdentityInfo { type: 'none' | 'did' | 'sigstore'; evidence: string | object | null; } /** * Parameters for creating a proof bundle */ export interface ProofBundleParams { runId?: string; startedAt: Date; finishedAt: Date; packHash: string; artifacts: Artifact[]; trustScore: number; gates: Gate[]; signerId?: string; keyPair?: KeyPair; } /** * Compute SHA-256 hash of string */ export declare function computeSHA256(data: string): string; /** * Create and sign a proof bundle * * @param params - Bundle parameters * @returns Signed proof bundle * * @example * ```ts * const bundle = await createProofBundle({ * startedAt: new Date('2025-01-01T00:00:00Z'), * finishedAt: new Date('2025-01-01T00:01:00Z'), * packHash: 'sha256-abc123...', * artifacts: [], * trustScore: 87, * gates: [{ name: 'api_smoke', status: 'pass' }], * }); * ``` */ export declare function createProofBundle(params: ProofBundleParams): Promise; /** * Create proof bundle from pack file content * * @param packContent - Pack YAML/JSON content * @param params - Other bundle parameters * @returns Signed proof bundle */ export declare function createProofBundleFromPack(packContent: string, params: Omit): Promise;