@attest-it/core 0.0.0 → 0.2.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.
- package/dist/{chunk-UWYR7JNE.js → chunk-CEE7ONNG.js} +20 -25
- package/dist/chunk-CEE7ONNG.js.map +1 -0
- package/dist/core-alpha.d.ts +47 -36
- package/dist/core-beta.d.ts +47 -36
- package/dist/core-public.d.ts +47 -36
- package/dist/core-unstripped.d.ts +47 -36
- package/dist/{crypto-ITLMIMRJ.js → crypto-VAXWUGKL.js} +3 -3
- package/dist/{crypto-ITLMIMRJ.js.map → crypto-VAXWUGKL.js.map} +1 -1
- package/dist/index.cjs +29 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +51 -36
- package/dist/index.d.ts +50 -37
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/dist/chunk-UWYR7JNE.js.map +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -17,8 +17,6 @@ interface AttestItSettings {
|
|
|
17
17
|
attestationsPath: string;
|
|
18
18
|
/** Default command to execute for attestation (can be overridden per suite) */
|
|
19
19
|
defaultCommand?: string;
|
|
20
|
-
/** Cryptographic algorithm to use for signatures */
|
|
21
|
-
algorithm: 'ed25519' | 'rsa';
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
22
|
* Suite definition from the configuration file.
|
|
@@ -37,6 +35,8 @@ interface SuiteConfig {
|
|
|
37
35
|
command?: string;
|
|
38
36
|
/** Other suite names that, when changed, invalidate this suite's attestation */
|
|
39
37
|
invalidates?: string[];
|
|
38
|
+
/** Array of suite names this suite depends on */
|
|
39
|
+
depends_on?: string[];
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Full configuration file structure.
|
|
@@ -49,6 +49,8 @@ interface AttestItConfig {
|
|
|
49
49
|
settings: AttestItSettings;
|
|
50
50
|
/** Named test suites with their configurations */
|
|
51
51
|
suites: Record<string, SuiteConfig>;
|
|
52
|
+
/** Named groups of suites */
|
|
53
|
+
groups?: Record<string, string[]>;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* A single attestation entry.
|
|
@@ -116,20 +118,17 @@ declare const configSchema: z.ZodObject<{
|
|
|
116
118
|
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
117
119
|
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
118
120
|
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
defaultCommand?: string | undefined;
|
|
131
|
-
algorithm?: "ed25519" | "rsa" | undefined;
|
|
132
|
-
}>>;
|
|
121
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
122
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
123
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
124
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
125
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
126
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
127
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
128
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
129
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
130
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
133
132
|
suites: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
134
133
|
description: z.ZodOptional<z.ZodString>;
|
|
135
134
|
packages: z.ZodArray<z.ZodString, "many">;
|
|
@@ -137,6 +136,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
137
136
|
ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
138
137
|
command: z.ZodOptional<z.ZodString>;
|
|
139
138
|
invalidates: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
139
|
+
depends_on: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
140
140
|
}, "strict", z.ZodTypeAny, {
|
|
141
141
|
packages: string[];
|
|
142
142
|
description?: string | undefined;
|
|
@@ -144,6 +144,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
144
144
|
ignore?: string[] | undefined;
|
|
145
145
|
command?: string | undefined;
|
|
146
146
|
invalidates?: string[] | undefined;
|
|
147
|
+
depends_on?: string[] | undefined;
|
|
147
148
|
}, {
|
|
148
149
|
packages: string[];
|
|
149
150
|
description?: string | undefined;
|
|
@@ -151,6 +152,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
151
152
|
ignore?: string[] | undefined;
|
|
152
153
|
command?: string | undefined;
|
|
153
154
|
invalidates?: string[] | undefined;
|
|
155
|
+
depends_on?: string[] | undefined;
|
|
154
156
|
}>>, Record<string, {
|
|
155
157
|
packages: string[];
|
|
156
158
|
description?: string | undefined;
|
|
@@ -158,6 +160,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
158
160
|
ignore?: string[] | undefined;
|
|
159
161
|
command?: string | undefined;
|
|
160
162
|
invalidates?: string[] | undefined;
|
|
163
|
+
depends_on?: string[] | undefined;
|
|
161
164
|
}>, Record<string, {
|
|
162
165
|
packages: string[];
|
|
163
166
|
description?: string | undefined;
|
|
@@ -165,15 +168,18 @@ declare const configSchema: z.ZodObject<{
|
|
|
165
168
|
ignore?: string[] | undefined;
|
|
166
169
|
command?: string | undefined;
|
|
167
170
|
invalidates?: string[] | undefined;
|
|
171
|
+
depends_on?: string[] | undefined;
|
|
168
172
|
}>>;
|
|
173
|
+
groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
169
174
|
}, "strict", z.ZodTypeAny, {
|
|
170
175
|
version: 1;
|
|
171
176
|
settings: {
|
|
172
177
|
maxAgeDays: number;
|
|
173
178
|
publicKeyPath: string;
|
|
174
179
|
attestationsPath: string;
|
|
175
|
-
algorithm: "ed25519" | "rsa";
|
|
176
180
|
defaultCommand?: string | undefined;
|
|
181
|
+
} & {
|
|
182
|
+
[k: string]: unknown;
|
|
177
183
|
};
|
|
178
184
|
suites: Record<string, {
|
|
179
185
|
packages: string[];
|
|
@@ -182,7 +188,9 @@ declare const configSchema: z.ZodObject<{
|
|
|
182
188
|
ignore?: string[] | undefined;
|
|
183
189
|
command?: string | undefined;
|
|
184
190
|
invalidates?: string[] | undefined;
|
|
191
|
+
depends_on?: string[] | undefined;
|
|
185
192
|
}>;
|
|
193
|
+
groups?: Record<string, string[]> | undefined;
|
|
186
194
|
}, {
|
|
187
195
|
version: 1;
|
|
188
196
|
suites: Record<string, {
|
|
@@ -192,14 +200,15 @@ declare const configSchema: z.ZodObject<{
|
|
|
192
200
|
ignore?: string[] | undefined;
|
|
193
201
|
command?: string | undefined;
|
|
194
202
|
invalidates?: string[] | undefined;
|
|
203
|
+
depends_on?: string[] | undefined;
|
|
195
204
|
}>;
|
|
196
|
-
settings?: {
|
|
197
|
-
maxAgeDays
|
|
198
|
-
publicKeyPath
|
|
199
|
-
attestationsPath
|
|
200
|
-
defaultCommand
|
|
201
|
-
|
|
202
|
-
|
|
205
|
+
settings?: z.objectInputType<{
|
|
206
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
207
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
208
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
209
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
210
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
211
|
+
groups?: Record<string, string[]> | undefined;
|
|
203
212
|
}>;
|
|
204
213
|
/**
|
|
205
214
|
* Type inference from Zod schema (should match AttestItConfig).
|
|
@@ -523,15 +532,11 @@ declare class SignatureInvalidError extends Error {
|
|
|
523
532
|
*
|
|
524
533
|
* @remarks
|
|
525
534
|
* This module provides cryptographic operations using OpenSSL for key management
|
|
526
|
-
* and signature verification. It
|
|
535
|
+
* and signature verification. It uses RSA-2048 with SHA-256 for signatures,
|
|
536
|
+
* which is universally supported across all OpenSSL and LibreSSL versions.
|
|
527
537
|
*
|
|
528
538
|
* @packageDocumentation
|
|
529
539
|
*/
|
|
530
|
-
/**
|
|
531
|
-
* Supported signature algorithms.
|
|
532
|
-
* @public
|
|
533
|
-
*/
|
|
534
|
-
type Algorithm = 'ed25519' | 'rsa';
|
|
535
540
|
/**
|
|
536
541
|
* Paths to a generated keypair.
|
|
537
542
|
* @public
|
|
@@ -547,8 +552,6 @@ interface KeyPaths {
|
|
|
547
552
|
* @public
|
|
548
553
|
*/
|
|
549
554
|
interface KeygenOptions {
|
|
550
|
-
/** Algorithm to use (default: ed25519) */
|
|
551
|
-
algorithm?: Algorithm;
|
|
552
555
|
/** Path for private key (default: OS-specific config dir) */
|
|
553
556
|
privatePath?: string;
|
|
554
557
|
/** Path for public key (default: repo root) */
|
|
@@ -598,7 +601,11 @@ declare function getDefaultPrivateKeyPath(): string;
|
|
|
598
601
|
*/
|
|
599
602
|
declare function getDefaultPublicKeyPath(): string;
|
|
600
603
|
/**
|
|
601
|
-
* Generate a new keypair using OpenSSL.
|
|
604
|
+
* Generate a new RSA-2048 keypair using OpenSSL.
|
|
605
|
+
*
|
|
606
|
+
* RSA-2048 with SHA-256 is used because it's universally supported across
|
|
607
|
+
* all OpenSSL and LibreSSL versions, including older macOS systems.
|
|
608
|
+
*
|
|
602
609
|
* @param options - Generation options
|
|
603
610
|
* @returns Paths to generated keys
|
|
604
611
|
* @throws Error if OpenSSL fails or keys exist without force
|
|
@@ -606,7 +613,11 @@ declare function getDefaultPublicKeyPath(): string;
|
|
|
606
613
|
*/
|
|
607
614
|
declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPaths>;
|
|
608
615
|
/**
|
|
609
|
-
* Sign data using
|
|
616
|
+
* Sign data using an RSA private key with SHA-256.
|
|
617
|
+
*
|
|
618
|
+
* Uses `openssl dgst -sha256 -sign` which is universally supported across
|
|
619
|
+
* all OpenSSL and LibreSSL versions.
|
|
620
|
+
*
|
|
610
621
|
* @param options - Signing options
|
|
611
622
|
* @returns Base64-encoded signature
|
|
612
623
|
* @throws Error if signing fails
|
|
@@ -614,7 +625,11 @@ declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPaths>;
|
|
|
614
625
|
*/
|
|
615
626
|
declare function sign(options: SignOptions): Promise<string>;
|
|
616
627
|
/**
|
|
617
|
-
* Verify a signature using
|
|
628
|
+
* Verify a signature using an RSA public key with SHA-256.
|
|
629
|
+
*
|
|
630
|
+
* Uses `openssl dgst -sha256 -verify` which is universally supported across
|
|
631
|
+
* all OpenSSL and LibreSSL versions.
|
|
632
|
+
*
|
|
618
633
|
* @param options - Verification options
|
|
619
634
|
* @returns true if signature is valid
|
|
620
635
|
* @throws Error if verification fails (not just invalid signature)
|
|
@@ -688,4 +703,4 @@ declare function verifyAttestations(options: VerifyOptions): Promise<VerifyResul
|
|
|
688
703
|
*/
|
|
689
704
|
declare const version = "0.0.0";
|
|
690
705
|
|
|
691
|
-
export { type
|
|
706
|
+
export { 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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,8 +17,6 @@ interface AttestItSettings {
|
|
|
17
17
|
attestationsPath: string;
|
|
18
18
|
/** Default command to execute for attestation (can be overridden per suite) */
|
|
19
19
|
defaultCommand?: string;
|
|
20
|
-
/** Cryptographic algorithm to use for signatures */
|
|
21
|
-
algorithm: 'ed25519' | 'rsa';
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
22
|
* Suite definition from the configuration file.
|
|
@@ -37,6 +35,8 @@ interface SuiteConfig {
|
|
|
37
35
|
command?: string;
|
|
38
36
|
/** Other suite names that, when changed, invalidate this suite's attestation */
|
|
39
37
|
invalidates?: string[];
|
|
38
|
+
/** Array of suite names this suite depends on */
|
|
39
|
+
depends_on?: string[];
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Full configuration file structure.
|
|
@@ -49,6 +49,8 @@ interface AttestItConfig {
|
|
|
49
49
|
settings: AttestItSettings;
|
|
50
50
|
/** Named test suites with their configurations */
|
|
51
51
|
suites: Record<string, SuiteConfig>;
|
|
52
|
+
/** Named groups of suites */
|
|
53
|
+
groups?: Record<string, string[]>;
|
|
52
54
|
}
|
|
53
55
|
/**
|
|
54
56
|
* A single attestation entry.
|
|
@@ -110,27 +112,26 @@ interface SuiteVerificationResult {
|
|
|
110
112
|
* Zod schema for the full configuration file.
|
|
111
113
|
*/
|
|
112
114
|
declare const configSchema: z.ZodObject<{
|
|
115
|
+
groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
113
116
|
settings: z.ZodDefault<z.ZodObject<{
|
|
114
|
-
algorithm: z.ZodDefault<z.ZodEnum<["ed25519", "rsa"]>>;
|
|
115
117
|
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
116
118
|
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
117
119
|
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
118
120
|
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
119
|
-
}, "
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
publicKeyPath?: string | undefined;
|
|
131
|
-
}>>;
|
|
121
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
122
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
123
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
124
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
125
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
126
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
127
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
128
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
129
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
130
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
131
|
+
}, z.ZodTypeAny, "passthrough">>>;
|
|
132
132
|
suites: z.ZodEffects<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
133
133
|
command: z.ZodOptional<z.ZodString>;
|
|
134
|
+
depends_on: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
134
135
|
description: z.ZodOptional<z.ZodString>;
|
|
135
136
|
files: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
136
137
|
ignore: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -138,6 +139,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
138
139
|
packages: z.ZodArray<z.ZodString, "many">;
|
|
139
140
|
}, "strict", z.ZodTypeAny, {
|
|
140
141
|
command?: string | undefined;
|
|
142
|
+
depends_on?: string[] | undefined;
|
|
141
143
|
description?: string | undefined;
|
|
142
144
|
files?: string[] | undefined;
|
|
143
145
|
ignore?: string[] | undefined;
|
|
@@ -145,6 +147,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
145
147
|
packages: string[];
|
|
146
148
|
}, {
|
|
147
149
|
command?: string | undefined;
|
|
150
|
+
depends_on?: string[] | undefined;
|
|
148
151
|
description?: string | undefined;
|
|
149
152
|
files?: string[] | undefined;
|
|
150
153
|
ignore?: string[] | undefined;
|
|
@@ -152,6 +155,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
152
155
|
packages: string[];
|
|
153
156
|
}>>, Record<string, {
|
|
154
157
|
command?: string | undefined;
|
|
158
|
+
depends_on?: string[] | undefined;
|
|
155
159
|
description?: string | undefined;
|
|
156
160
|
files?: string[] | undefined;
|
|
157
161
|
ignore?: string[] | undefined;
|
|
@@ -159,6 +163,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
159
163
|
packages: string[];
|
|
160
164
|
}>, Record<string, {
|
|
161
165
|
command?: string | undefined;
|
|
166
|
+
depends_on?: string[] | undefined;
|
|
162
167
|
description?: string | undefined;
|
|
163
168
|
files?: string[] | undefined;
|
|
164
169
|
ignore?: string[] | undefined;
|
|
@@ -167,15 +172,16 @@ declare const configSchema: z.ZodObject<{
|
|
|
167
172
|
}>>;
|
|
168
173
|
version: z.ZodLiteral<1>;
|
|
169
174
|
}, "strict", z.ZodTypeAny, {
|
|
175
|
+
groups?: Record<string, string[]> | undefined;
|
|
170
176
|
settings: {
|
|
171
|
-
algorithm: "ed25519" | "rsa";
|
|
172
177
|
attestationsPath: string;
|
|
173
178
|
defaultCommand?: string | undefined;
|
|
174
179
|
maxAgeDays: number;
|
|
175
180
|
publicKeyPath: string;
|
|
176
|
-
};
|
|
181
|
+
} & { [k: string]: unknown };
|
|
177
182
|
suites: Record<string, {
|
|
178
183
|
command?: string | undefined;
|
|
184
|
+
depends_on?: string[] | undefined;
|
|
179
185
|
description?: string | undefined;
|
|
180
186
|
files?: string[] | undefined;
|
|
181
187
|
ignore?: string[] | undefined;
|
|
@@ -184,15 +190,16 @@ declare const configSchema: z.ZodObject<{
|
|
|
184
190
|
}>;
|
|
185
191
|
version: 1;
|
|
186
192
|
}, {
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
attestationsPath
|
|
190
|
-
defaultCommand
|
|
191
|
-
maxAgeDays
|
|
192
|
-
publicKeyPath
|
|
193
|
-
}
|
|
193
|
+
groups?: Record<string, string[]> | undefined;
|
|
194
|
+
settings?: undefined | z.objectInputType<{
|
|
195
|
+
attestationsPath: z.ZodDefault<z.ZodString>;
|
|
196
|
+
defaultCommand: z.ZodOptional<z.ZodString>;
|
|
197
|
+
maxAgeDays: z.ZodDefault<z.ZodNumber>;
|
|
198
|
+
publicKeyPath: z.ZodDefault<z.ZodString>;
|
|
199
|
+
}, z.ZodTypeAny, "passthrough">;
|
|
194
200
|
suites: Record<string, {
|
|
195
201
|
command?: string | undefined;
|
|
202
|
+
depends_on?: string[] | undefined;
|
|
196
203
|
description?: string | undefined;
|
|
197
204
|
files?: string[] | undefined;
|
|
198
205
|
ignore?: string[] | undefined;
|
|
@@ -523,15 +530,11 @@ declare class SignatureInvalidError extends Error {
|
|
|
523
530
|
*
|
|
524
531
|
* @remarks
|
|
525
532
|
* This module provides cryptographic operations using OpenSSL for key management
|
|
526
|
-
* and signature verification. It
|
|
533
|
+
* and signature verification. It uses RSA-2048 with SHA-256 for signatures,
|
|
534
|
+
* which is universally supported across all OpenSSL and LibreSSL versions.
|
|
527
535
|
*
|
|
528
536
|
* @packageDocumentation
|
|
529
537
|
*/
|
|
530
|
-
/**
|
|
531
|
-
* Supported signature algorithms.
|
|
532
|
-
* @public
|
|
533
|
-
*/
|
|
534
|
-
type Algorithm = 'ed25519' | 'rsa';
|
|
535
538
|
/**
|
|
536
539
|
* Paths to a generated keypair.
|
|
537
540
|
* @public
|
|
@@ -547,8 +550,6 @@ interface KeyPaths {
|
|
|
547
550
|
* @public
|
|
548
551
|
*/
|
|
549
552
|
interface KeygenOptions {
|
|
550
|
-
/** Algorithm to use (default: ed25519) */
|
|
551
|
-
algorithm?: Algorithm;
|
|
552
553
|
/** Path for private key (default: OS-specific config dir) */
|
|
553
554
|
privatePath?: string;
|
|
554
555
|
/** Path for public key (default: repo root) */
|
|
@@ -598,7 +599,11 @@ declare function getDefaultPrivateKeyPath(): string;
|
|
|
598
599
|
*/
|
|
599
600
|
declare function getDefaultPublicKeyPath(): string;
|
|
600
601
|
/**
|
|
601
|
-
* Generate a new keypair using OpenSSL.
|
|
602
|
+
* Generate a new RSA-2048 keypair using OpenSSL.
|
|
603
|
+
*
|
|
604
|
+
* RSA-2048 with SHA-256 is used because it's universally supported across
|
|
605
|
+
* all OpenSSL and LibreSSL versions, including older macOS systems.
|
|
606
|
+
*
|
|
602
607
|
* @param options - Generation options
|
|
603
608
|
* @returns Paths to generated keys
|
|
604
609
|
* @throws Error if OpenSSL fails or keys exist without force
|
|
@@ -606,7 +611,11 @@ declare function getDefaultPublicKeyPath(): string;
|
|
|
606
611
|
*/
|
|
607
612
|
declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPaths>;
|
|
608
613
|
/**
|
|
609
|
-
* Sign data using
|
|
614
|
+
* Sign data using an RSA private key with SHA-256.
|
|
615
|
+
*
|
|
616
|
+
* Uses `openssl dgst -sha256 -sign` which is universally supported across
|
|
617
|
+
* all OpenSSL and LibreSSL versions.
|
|
618
|
+
*
|
|
610
619
|
* @param options - Signing options
|
|
611
620
|
* @returns Base64-encoded signature
|
|
612
621
|
* @throws Error if signing fails
|
|
@@ -614,7 +623,11 @@ declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPaths>;
|
|
|
614
623
|
*/
|
|
615
624
|
declare function sign(options: SignOptions): Promise<string>;
|
|
616
625
|
/**
|
|
617
|
-
* Verify a signature using
|
|
626
|
+
* Verify a signature using an RSA public key with SHA-256.
|
|
627
|
+
*
|
|
628
|
+
* Uses `openssl dgst -sha256 -verify` which is universally supported across
|
|
629
|
+
* all OpenSSL and LibreSSL versions.
|
|
630
|
+
*
|
|
618
631
|
* @param options - Verification options
|
|
619
632
|
* @returns true if signature is valid
|
|
620
633
|
* @throws Error if verification fails (not just invalid signature)
|
|
@@ -688,4 +701,4 @@ declare function verifyAttestations(options: VerifyOptions): Promise<VerifyResul
|
|
|
688
701
|
*/
|
|
689
702
|
declare const version = "0.0.0";
|
|
690
703
|
|
|
691
|
-
export { type
|
|
704
|
+
export { 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 };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { checkOpenSSL, generateKeyPair, getDefaultPrivateKeyPath, getDefaultPublicKeyPath, setKeyPermissions, sign, verify } from './chunk-
|
|
1
|
+
export { checkOpenSSL, generateKeyPair, getDefaultPrivateKeyPath, getDefaultPublicKeyPath, setKeyPermissions, sign, verify } from './chunk-CEE7ONNG.js';
|
|
2
2
|
import * as fs from 'fs';
|
|
3
3
|
import { readFileSync } from 'fs';
|
|
4
4
|
import { readFile } from 'fs/promises';
|
|
@@ -15,23 +15,25 @@ var settingsSchema = z.object({
|
|
|
15
15
|
maxAgeDays: z.number().int().positive().default(30),
|
|
16
16
|
publicKeyPath: z.string().default(".attest-it/pubkey.pem"),
|
|
17
17
|
attestationsPath: z.string().default(".attest-it/attestations.json"),
|
|
18
|
-
defaultCommand: z.string().optional()
|
|
19
|
-
|
|
20
|
-
}).
|
|
18
|
+
defaultCommand: z.string().optional()
|
|
19
|
+
// Note: algorithm field was removed - RSA is the only supported algorithm
|
|
20
|
+
}).passthrough();
|
|
21
21
|
var suiteSchema = z.object({
|
|
22
22
|
description: z.string().optional(),
|
|
23
23
|
packages: z.array(z.string().min(1, "Package path cannot be empty")).min(1, "At least one package pattern is required"),
|
|
24
24
|
files: z.array(z.string().min(1, "File path cannot be empty")).optional(),
|
|
25
25
|
ignore: z.array(z.string().min(1, "Ignore pattern cannot be empty")).optional(),
|
|
26
26
|
command: z.string().optional(),
|
|
27
|
-
invalidates: z.array(z.string().min(1, "Invalidated suite name cannot be empty")).optional()
|
|
27
|
+
invalidates: z.array(z.string().min(1, "Invalidated suite name cannot be empty")).optional(),
|
|
28
|
+
depends_on: z.array(z.string().min(1, "Dependency suite name cannot be empty")).optional()
|
|
28
29
|
}).strict();
|
|
29
30
|
var configSchema = z.object({
|
|
30
31
|
version: z.literal(1),
|
|
31
32
|
settings: settingsSchema.default({}),
|
|
32
33
|
suites: z.record(z.string(), suiteSchema).refine((suites) => Object.keys(suites).length >= 1, {
|
|
33
34
|
message: "At least one suite must be defined"
|
|
34
|
-
})
|
|
35
|
+
}),
|
|
36
|
+
groups: z.record(z.string(), z.array(z.string().min(1, "Suite name in group cannot be empty"))).optional()
|
|
35
37
|
}).strict();
|
|
36
38
|
var ConfigValidationError = class extends Error {
|
|
37
39
|
constructor(message, issues) {
|
|
@@ -150,7 +152,6 @@ function toAttestItConfig(config) {
|
|
|
150
152
|
maxAgeDays: config.settings.maxAgeDays,
|
|
151
153
|
publicKeyPath: config.settings.publicKeyPath,
|
|
152
154
|
attestationsPath: config.settings.attestationsPath,
|
|
153
|
-
algorithm: config.settings.algorithm,
|
|
154
155
|
...config.settings.defaultCommand !== void 0 && {
|
|
155
156
|
defaultCommand: config.settings.defaultCommand
|
|
156
157
|
}
|
|
@@ -164,10 +165,12 @@ function toAttestItConfig(config) {
|
|
|
164
165
|
...suite.files !== void 0 && { files: suite.files },
|
|
165
166
|
...suite.ignore !== void 0 && { ignore: suite.ignore },
|
|
166
167
|
...suite.command !== void 0 && { command: suite.command },
|
|
167
|
-
...suite.invalidates !== void 0 && { invalidates: suite.invalidates }
|
|
168
|
+
...suite.invalidates !== void 0 && { invalidates: suite.invalidates },
|
|
169
|
+
...suite.depends_on !== void 0 && { depends_on: suite.depends_on }
|
|
168
170
|
}
|
|
169
171
|
])
|
|
170
|
-
)
|
|
172
|
+
),
|
|
173
|
+
...config.groups !== void 0 && { groups: config.groups }
|
|
171
174
|
};
|
|
172
175
|
}
|
|
173
176
|
var LARGE_FILE_THRESHOLD = 50 * 1024 * 1024;
|
|
@@ -467,7 +470,7 @@ function createAttestation(params) {
|
|
|
467
470
|
return attestation;
|
|
468
471
|
}
|
|
469
472
|
async function writeSignedAttestations(options) {
|
|
470
|
-
const { sign: sign2 } = await import('./crypto-
|
|
473
|
+
const { sign: sign2 } = await import('./crypto-VAXWUGKL.js');
|
|
471
474
|
const canonical = canonicalizeAttestations(options.attestations);
|
|
472
475
|
const signature = await sign2({
|
|
473
476
|
privateKeyPath: options.privateKeyPath,
|
|
@@ -476,7 +479,7 @@ async function writeSignedAttestations(options) {
|
|
|
476
479
|
await writeAttestations(options.filePath, options.attestations, signature);
|
|
477
480
|
}
|
|
478
481
|
async function readAndVerifyAttestations(options) {
|
|
479
|
-
const { verify: verify2 } = await import('./crypto-
|
|
482
|
+
const { verify: verify2 } = await import('./crypto-VAXWUGKL.js');
|
|
480
483
|
const file = await readAttestations(options.filePath);
|
|
481
484
|
if (!file) {
|
|
482
485
|
throw new Error(`Attestations file not found: ${options.filePath}`);
|