@attest-it/core 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,691 @@
1
+ import { z } from 'zod';
2
+
3
+ /**
4
+ * Core types for attest-it attestation system.
5
+ * @packageDocumentation
6
+ */
7
+ /**
8
+ * Settings from the configuration file.
9
+ * @public
10
+ */
11
+ interface AttestItSettings {
12
+ /** Maximum age in days before an attestation expires */
13
+ maxAgeDays: number;
14
+ /** Path to the public key file used for signature verification */
15
+ publicKeyPath: string;
16
+ /** Path to the attestations file */
17
+ attestationsPath: string;
18
+ /** Default command to execute for attestation (can be overridden per suite) */
19
+ defaultCommand?: string;
20
+ /** Cryptographic algorithm to use for signatures */
21
+ algorithm: 'ed25519' | 'rsa';
22
+ }
23
+ /**
24
+ * Suite definition from the configuration file.
25
+ * @public
26
+ */
27
+ interface SuiteConfig {
28
+ /** Human-readable description of what this suite tests */
29
+ description?: string;
30
+ /** Glob patterns for npm packages to include in fingerprint */
31
+ packages: string[];
32
+ /** Additional file patterns to include in fingerprint */
33
+ files?: string[];
34
+ /** Patterns to ignore when computing fingerprint */
35
+ ignore?: string[];
36
+ /** Command to execute for this suite (overrides defaultCommand) */
37
+ command?: string;
38
+ /** Other suite names that, when changed, invalidate this suite's attestation */
39
+ invalidates?: string[];
40
+ }
41
+ /**
42
+ * Full configuration file structure.
43
+ * @public
44
+ */
45
+ interface AttestItConfig {
46
+ /** Configuration schema version */
47
+ version: 1;
48
+ /** Global settings for attestation behavior */
49
+ settings: AttestItSettings;
50
+ /** Named test suites with their configurations */
51
+ suites: Record<string, SuiteConfig>;
52
+ }
53
+ /**
54
+ * A single attestation entry.
55
+ * @public
56
+ */
57
+ interface Attestation {
58
+ /** Test suite name (e.g., "unit", "integration") */
59
+ suite: string;
60
+ /** SHA-256 fingerprint of test files in format "sha256:<hex>" */
61
+ fingerprint: string;
62
+ /** ISO 8601 timestamp when attestation was created */
63
+ attestedAt: string;
64
+ /** User who created the attestation */
65
+ attestedBy: string;
66
+ /** Command that was executed */
67
+ command: string;
68
+ /** Exit code (must be 0 for valid attestation) */
69
+ exitCode: 0;
70
+ }
71
+ /**
72
+ * Attestations file structure.
73
+ * @public
74
+ */
75
+ interface AttestationsFile {
76
+ /** Schema version for forward compatibility */
77
+ schemaVersion: '1';
78
+ /** Array of attestations */
79
+ attestations: Attestation[];
80
+ /** Base64-encoded signature over canonical attestations array */
81
+ signature: string;
82
+ }
83
+ /**
84
+ * Verification status codes for suite attestations.
85
+ * @public
86
+ */
87
+ type VerificationStatus = 'VALID' | 'NEEDS_ATTESTATION' | 'FINGERPRINT_CHANGED' | 'EXPIRED' | 'INVALIDATED_BY_PARENT' | 'SIGNATURE_INVALID';
88
+ /**
89
+ * Result of verifying a single suite's attestation.
90
+ * @public
91
+ */
92
+ interface SuiteVerificationResult {
93
+ /** Name of the suite being verified */
94
+ suite: string;
95
+ /** Current verification status */
96
+ status: VerificationStatus;
97
+ /** Current computed fingerprint for the suite */
98
+ fingerprint: string;
99
+ /** The attestation record, if one exists */
100
+ attestation?: Attestation;
101
+ /** List of files that changed (if status is FINGERPRINT_CHANGED) */
102
+ changedFiles?: string[];
103
+ /** Age of the attestation in days (if expired) */
104
+ age?: number;
105
+ /** Human-readable message explaining the status */
106
+ message?: string;
107
+ }
108
+
109
+ /**
110
+ * Zod schema for the full configuration file.
111
+ */
112
+ declare const configSchema: z.ZodObject<{
113
+ version: z.ZodLiteral<1>;
114
+ settings: z.ZodDefault<z.ZodObject<{
115
+ maxAgeDays: z.ZodDefault<z.ZodNumber>;
116
+ publicKeyPath: z.ZodDefault<z.ZodString>;
117
+ attestationsPath: z.ZodDefault<z.ZodString>;
118
+ defaultCommand: z.ZodOptional<z.ZodString>;
119
+ algorithm: z.ZodDefault<z.ZodEnum<["ed25519", "rsa"]>>;
120
+ }, "strict", z.ZodTypeAny, {
121
+ maxAgeDays: number;
122
+ publicKeyPath: string;
123
+ attestationsPath: string;
124
+ algorithm: "ed25519" | "rsa";
125
+ defaultCommand?: string | undefined;
126
+ }, {
127
+ maxAgeDays?: number | undefined;
128
+ publicKeyPath?: string | undefined;
129
+ attestationsPath?: string | undefined;
130
+ defaultCommand?: string | undefined;
131
+ algorithm?: "ed25519" | "rsa" | undefined;
132
+ }>>;
133
+ suites: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
134
+ description: z.ZodOptional<z.ZodString>;
135
+ packages: z.ZodArray<z.ZodString, "many">;
136
+ files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
137
+ ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
+ command: z.ZodOptional<z.ZodString>;
139
+ invalidates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
140
+ }, "strict", z.ZodTypeAny, {
141
+ packages: string[];
142
+ description?: string | undefined;
143
+ files?: string[] | undefined;
144
+ ignore?: string[] | undefined;
145
+ command?: string | undefined;
146
+ invalidates?: string[] | undefined;
147
+ }, {
148
+ packages: string[];
149
+ description?: string | undefined;
150
+ files?: string[] | undefined;
151
+ ignore?: string[] | undefined;
152
+ command?: string | undefined;
153
+ invalidates?: string[] | undefined;
154
+ }>>, Record<string, {
155
+ packages: string[];
156
+ description?: string | undefined;
157
+ files?: string[] | undefined;
158
+ ignore?: string[] | undefined;
159
+ command?: string | undefined;
160
+ invalidates?: string[] | undefined;
161
+ }>, Record<string, {
162
+ packages: string[];
163
+ description?: string | undefined;
164
+ files?: string[] | undefined;
165
+ ignore?: string[] | undefined;
166
+ command?: string | undefined;
167
+ invalidates?: string[] | undefined;
168
+ }>>;
169
+ }, "strict", z.ZodTypeAny, {
170
+ version: 1;
171
+ settings: {
172
+ maxAgeDays: number;
173
+ publicKeyPath: string;
174
+ attestationsPath: string;
175
+ algorithm: "ed25519" | "rsa";
176
+ defaultCommand?: string | undefined;
177
+ };
178
+ suites: Record<string, {
179
+ packages: string[];
180
+ description?: string | undefined;
181
+ files?: string[] | undefined;
182
+ ignore?: string[] | undefined;
183
+ command?: string | undefined;
184
+ invalidates?: string[] | undefined;
185
+ }>;
186
+ }, {
187
+ version: 1;
188
+ suites: Record<string, {
189
+ packages: string[];
190
+ description?: string | undefined;
191
+ files?: string[] | undefined;
192
+ ignore?: string[] | undefined;
193
+ command?: string | undefined;
194
+ invalidates?: string[] | undefined;
195
+ }>;
196
+ settings?: {
197
+ maxAgeDays?: number | undefined;
198
+ publicKeyPath?: string | undefined;
199
+ attestationsPath?: string | undefined;
200
+ defaultCommand?: string | undefined;
201
+ algorithm?: "ed25519" | "rsa" | undefined;
202
+ } | undefined;
203
+ }>;
204
+ /**
205
+ * Type inference from Zod schema (should match AttestItConfig).
206
+ * This is the same as AttestItConfig but with defaults applied.
207
+ * @public
208
+ */
209
+ type Config = z.infer<typeof configSchema>;
210
+ /**
211
+ * Error thrown when configuration is invalid.
212
+ * @public
213
+ */
214
+ declare class ConfigValidationError extends Error {
215
+ readonly issues: z.ZodIssue[];
216
+ constructor(message: string, issues: z.ZodIssue[]);
217
+ }
218
+ /**
219
+ * Error thrown when configuration file cannot be found.
220
+ * @public
221
+ */
222
+ declare class ConfigNotFoundError extends Error {
223
+ constructor(message: string);
224
+ }
225
+ /**
226
+ * Find the configuration file in default locations.
227
+ *
228
+ * Searches in this order:
229
+ * 1. .attest-it/config.yaml
230
+ * 2. .attest-it/config.yml
231
+ * 3. .attest-it/config.json
232
+ *
233
+ * @param startDir - Directory to start searching from (defaults to cwd)
234
+ * @returns Absolute path to the config file, or null if not found
235
+ * @public
236
+ */
237
+ declare function findConfigPath(startDir?: string): string | null;
238
+ /**
239
+ * Load and validate configuration from a file (async).
240
+ *
241
+ * @param configPath - Optional path to config file. If not provided, searches default locations.
242
+ * @returns Validated configuration object
243
+ * @throws {@link ConfigNotFoundError} If config file cannot be found
244
+ * @throws {@link ConfigValidationError} If validation fails
245
+ * @public
246
+ */
247
+ declare function loadConfig(configPath?: string): Promise<Config>;
248
+ /**
249
+ * Load and validate configuration from a file (sync).
250
+ *
251
+ * @param configPath - Optional path to config file. If not provided, searches default locations.
252
+ * @returns Validated configuration object
253
+ * @throws {@link ConfigNotFoundError} If config file cannot be found
254
+ * @throws {@link ConfigValidationError} If validation fails
255
+ * @public
256
+ */
257
+ declare function loadConfigSync(configPath?: string): Config;
258
+ /**
259
+ * Resolve relative paths in the configuration against the repository root.
260
+ *
261
+ * This converts relative paths in settings.publicKeyPath and settings.attestationsPath
262
+ * to absolute paths relative to the repository root.
263
+ *
264
+ * @param config - The configuration object
265
+ * @param repoRoot - Absolute path to the repository root
266
+ * @returns Configuration with resolved absolute paths
267
+ * @public
268
+ */
269
+ declare function resolveConfigPaths(config: Config, repoRoot: string): Config;
270
+ /**
271
+ * Convert Zod-validated Config to AttestItConfig by removing undefined values.
272
+ *
273
+ * The Config type (from Zod) has optional fields as `T | undefined`,
274
+ * while AttestItConfig has optional fields as `T?` (can be absent, not undefined).
275
+ *
276
+ * This adapter removes any undefined values to match the AttestItConfig interface
277
+ * that the core functions expect.
278
+ *
279
+ * @param config - The Zod-validated configuration from loadConfig()
280
+ * @returns Configuration compatible with AttestItConfig
281
+ * @public
282
+ */
283
+ declare function toAttestItConfig(config: Config): AttestItConfig;
284
+
285
+ /**
286
+ * Options for computing a package fingerprint.
287
+ * @public
288
+ */
289
+ interface FingerprintOptions {
290
+ /** Package directories to include */
291
+ packages: string[];
292
+ /** Glob patterns to exclude from fingerprint */
293
+ ignore?: string[];
294
+ /** Base directory for resolving paths */
295
+ baseDir?: string;
296
+ }
297
+ /**
298
+ * Result of computing a package fingerprint.
299
+ * @public
300
+ */
301
+ interface FingerprintResult {
302
+ /** The fingerprint in "sha256:..." format */
303
+ fingerprint: string;
304
+ /** List of files included in fingerprint calculation */
305
+ files: string[];
306
+ /** Number of files processed */
307
+ fileCount: number;
308
+ }
309
+ /**
310
+ * Compute a deterministic fingerprint for a set of packages (async).
311
+ *
312
+ * Algorithm:
313
+ * 1. List all files in packages (respecting ignore globs)
314
+ * 2. Sort files lexicographically by relative path
315
+ * 3. For each file: compute SHA256(relativePath + "\0" + content)
316
+ * 4. Concatenate all file hashes in sorted order
317
+ * 5. Compute final SHA256 of concatenated hashes
318
+ * 6. Return "sha256:" + hex(fingerprint)
319
+ *
320
+ * @param options - Configuration for fingerprint computation
321
+ * @returns Result containing the fingerprint hash and list of files processed
322
+ * @throws Error if packages array is empty or if package paths don't exist
323
+ * @public
324
+ */
325
+ declare function computeFingerprint(options: FingerprintOptions): Promise<FingerprintResult>;
326
+ /**
327
+ * Compute a deterministic fingerprint for a set of packages (sync).
328
+ *
329
+ * @param options - Configuration for fingerprint computation
330
+ * @returns Result containing the fingerprint hash and list of files processed
331
+ * @throws Error if packages array is empty or if package paths don't exist
332
+ * @public
333
+ * @see {@link computeFingerprint} for the async version
334
+ */
335
+ declare function computeFingerprintSync(options: FingerprintOptions): FingerprintResult;
336
+ /**
337
+ * List files in packages, respecting ignore patterns (async).
338
+ *
339
+ * @param packages - Array of package directory paths
340
+ * @param ignore - Optional glob patterns to exclude
341
+ * @param baseDir - Base directory for resolving paths (defaults to cwd)
342
+ * @returns Array of relative file paths
343
+ * @public
344
+ */
345
+ declare function listPackageFiles(packages: string[], ignore?: string[], baseDir?: string): Promise<string[]>;
346
+
347
+ /**
348
+ * Attestation file I/O module with JSON canonicalization.
349
+ */
350
+
351
+ /**
352
+ * Read attestations file from disk (async).
353
+ *
354
+ * @param filePath - Absolute path to the attestations JSON file
355
+ * @returns Parsed attestations file, or null if the file doesn't exist
356
+ * @throws Error on parse or validation errors
357
+ * @public
358
+ */
359
+ declare function readAttestations(filePath: string): Promise<AttestationsFile | null>;
360
+ /**
361
+ * Read attestations file from disk (sync).
362
+ *
363
+ * @param filePath - Absolute path to the attestations JSON file
364
+ * @returns Parsed attestations file, or null if the file doesn't exist
365
+ * @throws Error on parse or validation errors
366
+ * @public
367
+ */
368
+ declare function readAttestationsSync(filePath: string): AttestationsFile | null;
369
+ /**
370
+ * Write attestations file to disk (async).
371
+ *
372
+ * Creates parent directories if needed. The signature should be computed
373
+ * separately and passed in.
374
+ *
375
+ * @param filePath - Absolute path to write the attestations file
376
+ * @param attestations - Array of attestation entries
377
+ * @param signature - Cryptographic signature of the attestations
378
+ * @throws Error on validation or write errors
379
+ * @public
380
+ */
381
+ declare function writeAttestations(filePath: string, attestations: Attestation[], signature: string): Promise<void>;
382
+ /**
383
+ * Write attestations file to disk (sync).
384
+ *
385
+ * Creates parent directories if needed. The signature should be computed
386
+ * separately and passed in.
387
+ *
388
+ * @param filePath - Absolute path to write the attestations file
389
+ * @param attestations - Array of attestation entries
390
+ * @param signature - Cryptographic signature of the attestations
391
+ * @throws Error on validation or write errors
392
+ * @public
393
+ */
394
+ declare function writeAttestationsSync(filePath: string, attestations: Attestation[], signature: string): void;
395
+ /**
396
+ * Find an attestation for a specific suite.
397
+ *
398
+ * @param attestations - Attestations file containing all attestations
399
+ * @param suite - Name of the suite to find
400
+ * @returns The attestation if found, undefined otherwise
401
+ * @public
402
+ */
403
+ declare function findAttestation(attestations: AttestationsFile, suite: string): Attestation | undefined;
404
+ /**
405
+ * Add or update an attestation for a suite.
406
+ *
407
+ * This is an immutable operation that returns a new array.
408
+ *
409
+ * @param attestations - Current array of attestations
410
+ * @param newAttestation - Attestation to add or update
411
+ * @returns New attestations array with the upserted attestation
412
+ * @throws Error if the new attestation fails validation
413
+ * @public
414
+ */
415
+ declare function upsertAttestation(attestations: Attestation[], newAttestation: Attestation): Attestation[];
416
+ /**
417
+ * Remove attestations for a suite.
418
+ *
419
+ * This is an immutable operation that returns a new array.
420
+ *
421
+ * @param attestations - Current array of attestations
422
+ * @param suite - Name of the suite to remove
423
+ * @returns New attestations array without the specified suite
424
+ * @public
425
+ */
426
+ declare function removeAttestation(attestations: Attestation[], suite: string): Attestation[];
427
+ /**
428
+ * Compute canonical JSON representation for signing.
429
+ *
430
+ * Implements RFC 8785 JSON Canonicalization Scheme. The canonicalize package provides:
431
+ * 1. Keys sorted lexicographically (Unicode code point order)
432
+ * 2. No whitespace between tokens
433
+ * 3. No trailing commas
434
+ * 4. Strings escaped using \uXXXX for control characters
435
+ * 5. Numbers: no leading zeros, no +, use lowercase 'e' for exponent
436
+ * 6. UTF-8 encoding
437
+ *
438
+ * @param attestations - Array of attestations to canonicalize
439
+ * @returns Canonical JSON string representation
440
+ * @throws Error if canonicalization fails
441
+ * @public
442
+ */
443
+ declare function canonicalizeAttestations(attestations: Attestation[]): string;
444
+ /**
445
+ * Create a new attestation entry.
446
+ *
447
+ * @param params - Parameters for creating the attestation
448
+ * @param params.suite - Name of the test suite
449
+ * @param params.fingerprint - Fingerprint of the packages in sha256 format
450
+ * @param params.command - Command that was executed
451
+ * @param params.attestedBy - Optional username (defaults to current OS user)
452
+ * @returns Validated attestation object
453
+ * @throws Error if attestation validation fails
454
+ * @public
455
+ */
456
+ declare function createAttestation(params: {
457
+ suite: string;
458
+ fingerprint: string;
459
+ command: string;
460
+ attestedBy?: string;
461
+ }): Attestation;
462
+ /**
463
+ * Options for writing signed attestations.
464
+ * @public
465
+ */
466
+ interface WriteSignedAttestationsOptions {
467
+ /** Path to write the attestations file */
468
+ filePath: string;
469
+ /** Array of attestations to write */
470
+ attestations: Attestation[];
471
+ /** Path to the private key for signing */
472
+ privateKeyPath: string;
473
+ }
474
+ /**
475
+ * Options for reading and verifying signed attestations.
476
+ * @public
477
+ */
478
+ interface ReadSignedAttestationsOptions {
479
+ /** Path to read the attestations file from */
480
+ filePath: string;
481
+ /** Path to the public key for verification */
482
+ publicKeyPath: string;
483
+ }
484
+ /**
485
+ * Write attestations with a cryptographic signature.
486
+ *
487
+ * This function canonicalizes the attestations, signs them with the private key,
488
+ * and writes the attestations file with the signature.
489
+ *
490
+ * @param options - Options for writing signed attestations
491
+ * @throws Error if signing or writing fails
492
+ * @public
493
+ */
494
+ declare function writeSignedAttestations(options: WriteSignedAttestationsOptions): Promise<void>;
495
+ /**
496
+ * Read attestations and verify the signature.
497
+ *
498
+ * This function reads the attestations file, canonicalizes the attestations,
499
+ * and verifies the signature using the public key. It throws an error if the
500
+ * file doesn't exist or if signature verification fails.
501
+ *
502
+ * @param options - Options for reading and verifying attestations
503
+ * @returns The attestations file if signature is valid
504
+ * @throws Error if attestations file not found
505
+ * @throws SignatureInvalidError if signature verification fails
506
+ * @public
507
+ */
508
+ declare function readAndVerifyAttestations(options: ReadSignedAttestationsOptions): Promise<AttestationsFile>;
509
+ /**
510
+ * Error thrown when signature verification fails.
511
+ * @public
512
+ */
513
+ declare class SignatureInvalidError extends Error {
514
+ /**
515
+ * Create a new SignatureInvalidError.
516
+ * @param filePath - Path to the file that failed verification
517
+ */
518
+ constructor(filePath: string);
519
+ }
520
+
521
+ /**
522
+ * Cryptographic utilities for key generation, signing, and verification.
523
+ *
524
+ * @remarks
525
+ * This module provides cryptographic operations using OpenSSL for key management
526
+ * and signature verification. It supports Ed25519 and RSA algorithms.
527
+ *
528
+ * @packageDocumentation
529
+ */
530
+ /**
531
+ * Supported signature algorithms.
532
+ * @public
533
+ */
534
+ type Algorithm = 'ed25519' | 'rsa';
535
+ /**
536
+ * Paths to a generated keypair.
537
+ * @public
538
+ */
539
+ interface KeyPaths {
540
+ /** Path to the private key file */
541
+ privatePath: string;
542
+ /** Path to the public key file */
543
+ publicPath: string;
544
+ }
545
+ /**
546
+ * Options for key generation.
547
+ * @public
548
+ */
549
+ interface KeygenOptions {
550
+ /** Algorithm to use (default: ed25519) */
551
+ algorithm?: Algorithm;
552
+ /** Path for private key (default: OS-specific config dir) */
553
+ privatePath?: string;
554
+ /** Path for public key (default: repo root) */
555
+ publicPath?: string;
556
+ /** Overwrite existing keys (default: false) */
557
+ force?: boolean;
558
+ }
559
+ /**
560
+ * Options for signing data.
561
+ * @public
562
+ */
563
+ interface SignOptions {
564
+ /** Path to the private key file */
565
+ privateKeyPath: string;
566
+ /** Data to sign (string or Buffer) */
567
+ data: string | Buffer;
568
+ }
569
+ /**
570
+ * Options for verifying signatures.
571
+ * @public
572
+ */
573
+ interface VerifyOptions$1 {
574
+ /** Path to the public key file */
575
+ publicKeyPath: string;
576
+ /** Original data that was signed */
577
+ data: string | Buffer;
578
+ /** Base64-encoded signature to verify */
579
+ signature: string;
580
+ }
581
+ /**
582
+ * Check if OpenSSL is available and get version info.
583
+ * @returns OpenSSL version string
584
+ * @throws Error if OpenSSL is not available
585
+ * @public
586
+ */
587
+ declare function checkOpenSSL(): Promise<string>;
588
+ /**
589
+ * Get the default private key path based on OS.
590
+ * - macOS/Linux: ~/.config/attest-it/private.pem
591
+ * - Windows: %APPDATA%\attest-it\private.pem
592
+ * @public
593
+ */
594
+ declare function getDefaultPrivateKeyPath(): string;
595
+ /**
596
+ * Get the default public key path (in repo).
597
+ * @public
598
+ */
599
+ declare function getDefaultPublicKeyPath(): string;
600
+ /**
601
+ * Generate a new keypair using OpenSSL.
602
+ * @param options - Generation options
603
+ * @returns Paths to generated keys
604
+ * @throws Error if OpenSSL fails or keys exist without force
605
+ * @public
606
+ */
607
+ declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPaths>;
608
+ /**
609
+ * Sign data using a private key.
610
+ * @param options - Signing options
611
+ * @returns Base64-encoded signature
612
+ * @throws Error if signing fails
613
+ * @public
614
+ */
615
+ declare function sign(options: SignOptions): Promise<string>;
616
+ /**
617
+ * Verify a signature using a public key.
618
+ * @param options - Verification options
619
+ * @returns true if signature is valid
620
+ * @throws Error if verification fails (not just invalid signature)
621
+ * @public
622
+ */
623
+ declare function verify(options: VerifyOptions$1): Promise<boolean>;
624
+ /**
625
+ * Set restrictive permissions on a private key file.
626
+ * @param keyPath - Path to the private key
627
+ * @public
628
+ */
629
+ declare function setKeyPermissions(keyPath: string): Promise<void>;
630
+
631
+ /**
632
+ * Verification logic for attestations.
633
+ * @packageDocumentation
634
+ */
635
+
636
+ /**
637
+ * Options for verifying attestations.
638
+ * @public
639
+ */
640
+ interface VerifyOptions {
641
+ /** Configuration object */
642
+ config: AttestItConfig;
643
+ /** Repository root directory (defaults to process.cwd()) */
644
+ repoRoot?: string;
645
+ }
646
+ /**
647
+ * Result of verifying all attestations.
648
+ * @public
649
+ */
650
+ interface VerifyResult {
651
+ /** Overall success - true if all attestations are valid */
652
+ success: boolean;
653
+ /** Whether the attestations file signature is valid */
654
+ signatureValid: boolean;
655
+ /** Verification results for each suite */
656
+ suites: SuiteVerificationResult[];
657
+ /** Error messages encountered during verification */
658
+ errors: string[];
659
+ }
660
+ /**
661
+ * Verify all attestations against current code state.
662
+ *
663
+ * Verification algorithm:
664
+ * 1. Load and verify attestations file signature
665
+ * 2. For each suite in config:
666
+ * a. Compute current fingerprint
667
+ * b. Find matching attestation
668
+ * c. Compare fingerprints
669
+ * d. Check age
670
+ * 3. Check invalidation chains
671
+ * 4. Return aggregated results
672
+ *
673
+ * @param options - Verification options
674
+ * @returns Verification result with status for each suite
675
+ * @public
676
+ */
677
+ declare function verifyAttestations(options: VerifyOptions): Promise<VerifyResult>;
678
+
679
+ /**
680
+ * @attest-it/core
681
+ *
682
+ * Core functionality for the attest-it testing framework.
683
+ * @packageDocumentation
684
+ */
685
+ /**
686
+ * Package version
687
+ * @public
688
+ */
689
+ declare const version = "0.0.0";
690
+
691
+ export { type Algorithm, type AttestItConfig, type AttestItSettings, type Attestation, type AttestationsFile, type Config, ConfigNotFoundError, ConfigValidationError, type VerifyOptions$1 as CryptoVerifyOptions, type FingerprintOptions, type FingerprintResult, type KeyPaths, type KeygenOptions, type ReadSignedAttestationsOptions, type SignOptions, SignatureInvalidError, type SuiteConfig, type SuiteVerificationResult, type VerificationStatus, type VerifyOptions, type VerifyResult, type WriteSignedAttestationsOptions, canonicalizeAttestations, checkOpenSSL, computeFingerprint, computeFingerprintSync, createAttestation, findAttestation, findConfigPath, generateKeyPair, getDefaultPrivateKeyPath, getDefaultPublicKeyPath, listPackageFiles, loadConfig, loadConfigSync, readAndVerifyAttestations, readAttestations, readAttestationsSync, removeAttestation, resolveConfigPaths, setKeyPermissions, sign, toAttestItConfig, upsertAttestation, verify, verifyAttestations, version, writeAttestations, writeAttestationsSync, writeSignedAttestations };