@attest-it/core 0.8.0 → 0.9.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/core-alpha.d.ts +29 -13
- package/dist/core-beta.d.ts +29 -13
- package/dist/core-public.d.ts +29 -13
- package/dist/core-unstripped.d.ts +29 -13
- package/dist/index.cjs +9 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -13
- package/dist/index.d.ts +29 -13
- package/dist/index.js +9 -18
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -54,6 +54,8 @@ interface TeamMember {
|
|
|
54
54
|
github?: string | undefined;
|
|
55
55
|
/** Base64-encoded Ed25519 public key */
|
|
56
56
|
publicKey: string;
|
|
57
|
+
/** Public key algorithm (optional, for future-proofing format changes) */
|
|
58
|
+
publicKeyAlgorithm?: 'ed25519' | undefined;
|
|
57
59
|
}
|
|
58
60
|
/**
|
|
59
61
|
* Fingerprint configuration for gates.
|
|
@@ -316,16 +318,19 @@ declare const configSchema: z.ZodObject<{
|
|
|
316
318
|
email: z.ZodOptional<z.ZodString>;
|
|
317
319
|
github: z.ZodOptional<z.ZodString>;
|
|
318
320
|
publicKey: z.ZodString;
|
|
321
|
+
publicKeyAlgorithm: z.ZodOptional<z.ZodEnum<["ed25519"]>>;
|
|
319
322
|
}, "strict", z.ZodTypeAny, {
|
|
320
323
|
name: string;
|
|
321
324
|
publicKey: string;
|
|
322
325
|
email?: string | undefined;
|
|
323
326
|
github?: string | undefined;
|
|
327
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
324
328
|
}, {
|
|
325
329
|
name: string;
|
|
326
330
|
publicKey: string;
|
|
327
331
|
email?: string | undefined;
|
|
328
332
|
github?: string | undefined;
|
|
333
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
329
334
|
}>>>;
|
|
330
335
|
gates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
331
336
|
name: z.ZodString;
|
|
@@ -477,6 +482,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
477
482
|
publicKey: string;
|
|
478
483
|
email?: string | undefined;
|
|
479
484
|
github?: string | undefined;
|
|
485
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
480
486
|
}> | undefined;
|
|
481
487
|
gates?: Record<string, {
|
|
482
488
|
name: string;
|
|
@@ -550,6 +556,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
550
556
|
publicKey: string;
|
|
551
557
|
email?: string | undefined;
|
|
552
558
|
github?: string | undefined;
|
|
559
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
553
560
|
}> | undefined;
|
|
554
561
|
gates?: Record<string, {
|
|
555
562
|
name: string;
|
|
@@ -697,16 +704,19 @@ declare const policySchema: z.ZodObject<{
|
|
|
697
704
|
email: z.ZodOptional<z.ZodString>;
|
|
698
705
|
github: z.ZodOptional<z.ZodString>;
|
|
699
706
|
publicKey: z.ZodString;
|
|
707
|
+
publicKeyAlgorithm: z.ZodOptional<z.ZodLiteral<"ed25519">>;
|
|
700
708
|
}, "strict", z.ZodTypeAny, {
|
|
701
709
|
name: string;
|
|
702
710
|
publicKey: string;
|
|
703
711
|
email?: string | undefined;
|
|
704
712
|
github?: string | undefined;
|
|
713
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
705
714
|
}, {
|
|
706
715
|
name: string;
|
|
707
716
|
publicKey: string;
|
|
708
717
|
email?: string | undefined;
|
|
709
718
|
github?: string | undefined;
|
|
719
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
710
720
|
}>>>;
|
|
711
721
|
gates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
712
722
|
name: z.ZodString;
|
|
@@ -755,6 +765,7 @@ declare const policySchema: z.ZodObject<{
|
|
|
755
765
|
publicKey: string;
|
|
756
766
|
email?: string | undefined;
|
|
757
767
|
github?: string | undefined;
|
|
768
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
758
769
|
}> | undefined;
|
|
759
770
|
gates?: Record<string, {
|
|
760
771
|
name: string;
|
|
@@ -779,6 +790,7 @@ declare const policySchema: z.ZodObject<{
|
|
|
779
790
|
publicKey: string;
|
|
780
791
|
email?: string | undefined;
|
|
781
792
|
github?: string | undefined;
|
|
793
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
782
794
|
}> | undefined;
|
|
783
795
|
gates?: Record<string, {
|
|
784
796
|
name: string;
|
|
@@ -2436,9 +2448,8 @@ declare function getHomePublicKeysDir(): string;
|
|
|
2436
2448
|
/**
|
|
2437
2449
|
* Get the project public keys directory.
|
|
2438
2450
|
*
|
|
2439
|
-
*
|
|
2440
|
-
*
|
|
2441
|
-
* verify attestation seals.
|
|
2451
|
+
* @deprecated Public keys are now stored inline in the team section of config.yaml.
|
|
2452
|
+
* This function is kept for backward compatibility but should not be used in new code.
|
|
2442
2453
|
*
|
|
2443
2454
|
* @param projectRoot - The project root directory (defaults to cwd)
|
|
2444
2455
|
* @returns Path to the project public keys directory
|
|
@@ -2448,6 +2459,9 @@ declare function getProjectPublicKeysDir(projectRoot?: string): string;
|
|
|
2448
2459
|
/**
|
|
2449
2460
|
* Check if a project has attest-it configuration.
|
|
2450
2461
|
*
|
|
2462
|
+
* @deprecated This function is kept for backward compatibility but is no longer used
|
|
2463
|
+
* by the core library. Public keys are now stored inline in config.yaml.
|
|
2464
|
+
*
|
|
2451
2465
|
* @param projectRoot - The project root directory (defaults to cwd)
|
|
2452
2466
|
* @returns True if the project has .attest-it/config.yaml or similar
|
|
2453
2467
|
* @public
|
|
@@ -2464,31 +2478,33 @@ interface SavePublicKeyResult {
|
|
|
2464
2478
|
projectPath?: string;
|
|
2465
2479
|
}
|
|
2466
2480
|
/**
|
|
2467
|
-
* Save a public key to the user's home directory
|
|
2481
|
+
* Save a public key to the user's home directory.
|
|
2468
2482
|
*
|
|
2469
2483
|
* This saves the public key as a base64-encoded string (matching the format in config.yaml)
|
|
2470
|
-
* to
|
|
2471
|
-
*
|
|
2472
|
-
*
|
|
2484
|
+
* to ~/.attest-it/public-keys/<slug>.pem for backup purposes.
|
|
2485
|
+
*
|
|
2486
|
+
* Public keys are now stored inline in the team section of config.yaml and no longer
|
|
2487
|
+
* written to the project directory.
|
|
2473
2488
|
*
|
|
2474
2489
|
* @param slug - The identity slug (used for the filename)
|
|
2475
2490
|
* @param publicKey - The base64-encoded public key
|
|
2476
|
-
* @param projectRoot - The project root directory (
|
|
2491
|
+
* @param projectRoot - The project root directory (deprecated, kept for backward compatibility)
|
|
2477
2492
|
* @returns Paths where the key was saved
|
|
2478
2493
|
* @public
|
|
2479
2494
|
*/
|
|
2480
2495
|
declare function savePublicKey(slug: string, publicKey: string, projectRoot?: string): Promise<SavePublicKeyResult>;
|
|
2481
2496
|
/**
|
|
2482
|
-
* Save a public key to the user's home directory
|
|
2497
|
+
* Save a public key to the user's home directory (sync).
|
|
2483
2498
|
*
|
|
2484
2499
|
* This saves the public key as a base64-encoded string (matching the format in config.yaml)
|
|
2485
|
-
* to
|
|
2486
|
-
*
|
|
2487
|
-
*
|
|
2500
|
+
* to ~/.attest-it/public-keys/<slug>.pem for backup purposes.
|
|
2501
|
+
*
|
|
2502
|
+
* Public keys are now stored inline in the team section of config.yaml and no longer
|
|
2503
|
+
* written to the project directory.
|
|
2488
2504
|
*
|
|
2489
2505
|
* @param slug - The identity slug (used for the filename)
|
|
2490
2506
|
* @param publicKey - The base64-encoded public key
|
|
2491
|
-
* @param projectRoot - The project root directory (
|
|
2507
|
+
* @param projectRoot - The project root directory (deprecated, kept for backward compatibility)
|
|
2492
2508
|
* @returns Paths where the key was saved
|
|
2493
2509
|
* @public
|
|
2494
2510
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -50,6 +50,8 @@ interface TeamMember {
|
|
|
50
50
|
github?: string | undefined;
|
|
51
51
|
/** Base64-encoded Ed25519 public key */
|
|
52
52
|
publicKey: string;
|
|
53
|
+
/** Public key algorithm (optional, for future-proofing format changes) */
|
|
54
|
+
publicKeyAlgorithm?: 'ed25519' | undefined;
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Fingerprint configuration for gates.
|
|
@@ -424,16 +426,19 @@ declare const configSchema: z.ZodObject<{
|
|
|
424
426
|
github: z.ZodOptional<z.ZodString>;
|
|
425
427
|
name: z.ZodString;
|
|
426
428
|
publicKey: z.ZodString;
|
|
429
|
+
publicKeyAlgorithm: z.ZodOptional<z.ZodEnum<["ed25519"]>>;
|
|
427
430
|
}, "strict", z.ZodTypeAny, {
|
|
428
431
|
email?: string | undefined;
|
|
429
432
|
github?: string | undefined;
|
|
430
433
|
name: string;
|
|
431
434
|
publicKey: string;
|
|
435
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
432
436
|
}, {
|
|
433
437
|
email?: string | undefined;
|
|
434
438
|
github?: string | undefined;
|
|
435
439
|
name: string;
|
|
436
440
|
publicKey: string;
|
|
441
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
437
442
|
}>>>;
|
|
438
443
|
version: z.ZodLiteral<1>;
|
|
439
444
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -481,6 +486,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
481
486
|
github?: string | undefined;
|
|
482
487
|
name: string;
|
|
483
488
|
publicKey: string;
|
|
489
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
484
490
|
}> | undefined;
|
|
485
491
|
version: 1;
|
|
486
492
|
}, {
|
|
@@ -554,6 +560,7 @@ declare const configSchema: z.ZodObject<{
|
|
|
554
560
|
github?: string | undefined;
|
|
555
561
|
name: string;
|
|
556
562
|
publicKey: string;
|
|
563
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
557
564
|
}> | undefined;
|
|
558
565
|
version: 1;
|
|
559
566
|
}>;
|
|
@@ -724,16 +731,19 @@ declare const policySchema: z.ZodObject<{
|
|
|
724
731
|
github: z.ZodOptional<z.ZodString>;
|
|
725
732
|
name: z.ZodString;
|
|
726
733
|
publicKey: z.ZodString;
|
|
734
|
+
publicKeyAlgorithm: z.ZodOptional<z.ZodLiteral<"ed25519">>;
|
|
727
735
|
}, "strict", z.ZodTypeAny, {
|
|
728
736
|
email?: string | undefined;
|
|
729
737
|
github?: string | undefined;
|
|
730
738
|
name: string;
|
|
731
739
|
publicKey: string;
|
|
740
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
732
741
|
}, {
|
|
733
742
|
email?: string | undefined;
|
|
734
743
|
github?: string | undefined;
|
|
735
744
|
name: string;
|
|
736
745
|
publicKey: string;
|
|
746
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
737
747
|
}>>>;
|
|
738
748
|
version: z.ZodLiteral<1>;
|
|
739
749
|
}, "strict", z.ZodTypeAny, {
|
|
@@ -758,6 +768,7 @@ declare const policySchema: z.ZodObject<{
|
|
|
758
768
|
github?: string | undefined;
|
|
759
769
|
name: string;
|
|
760
770
|
publicKey: string;
|
|
771
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
761
772
|
}> | undefined;
|
|
762
773
|
version: 1;
|
|
763
774
|
}, {
|
|
@@ -782,6 +793,7 @@ declare const policySchema: z.ZodObject<{
|
|
|
782
793
|
github?: string | undefined;
|
|
783
794
|
name: string;
|
|
784
795
|
publicKey: string;
|
|
796
|
+
publicKeyAlgorithm?: "ed25519" | undefined;
|
|
785
797
|
}> | undefined;
|
|
786
798
|
version: 1;
|
|
787
799
|
}>;
|
|
@@ -2426,9 +2438,8 @@ declare function getHomePublicKeysDir(): string;
|
|
|
2426
2438
|
/**
|
|
2427
2439
|
* Get the project public keys directory.
|
|
2428
2440
|
*
|
|
2429
|
-
*
|
|
2430
|
-
*
|
|
2431
|
-
* verify attestation seals.
|
|
2441
|
+
* @deprecated Public keys are now stored inline in the team section of config.yaml.
|
|
2442
|
+
* This function is kept for backward compatibility but should not be used in new code.
|
|
2432
2443
|
*
|
|
2433
2444
|
* @param projectRoot - The project root directory (defaults to cwd)
|
|
2434
2445
|
* @returns Path to the project public keys directory
|
|
@@ -2438,6 +2449,9 @@ declare function getProjectPublicKeysDir(projectRoot?: string): string;
|
|
|
2438
2449
|
/**
|
|
2439
2450
|
* Check if a project has attest-it configuration.
|
|
2440
2451
|
*
|
|
2452
|
+
* @deprecated This function is kept for backward compatibility but is no longer used
|
|
2453
|
+
* by the core library. Public keys are now stored inline in config.yaml.
|
|
2454
|
+
*
|
|
2441
2455
|
* @param projectRoot - The project root directory (defaults to cwd)
|
|
2442
2456
|
* @returns True if the project has .attest-it/config.yaml or similar
|
|
2443
2457
|
* @public
|
|
@@ -2454,31 +2468,33 @@ interface SavePublicKeyResult {
|
|
|
2454
2468
|
projectPath?: string;
|
|
2455
2469
|
}
|
|
2456
2470
|
/**
|
|
2457
|
-
* Save a public key to the user's home directory
|
|
2471
|
+
* Save a public key to the user's home directory.
|
|
2458
2472
|
*
|
|
2459
2473
|
* This saves the public key as a base64-encoded string (matching the format in config.yaml)
|
|
2460
|
-
* to
|
|
2461
|
-
*
|
|
2462
|
-
*
|
|
2474
|
+
* to ~/.attest-it/public-keys/<slug>.pem for backup purposes.
|
|
2475
|
+
*
|
|
2476
|
+
* Public keys are now stored inline in the team section of config.yaml and no longer
|
|
2477
|
+
* written to the project directory.
|
|
2463
2478
|
*
|
|
2464
2479
|
* @param slug - The identity slug (used for the filename)
|
|
2465
2480
|
* @param publicKey - The base64-encoded public key
|
|
2466
|
-
* @param projectRoot - The project root directory (
|
|
2481
|
+
* @param projectRoot - The project root directory (deprecated, kept for backward compatibility)
|
|
2467
2482
|
* @returns Paths where the key was saved
|
|
2468
2483
|
* @public
|
|
2469
2484
|
*/
|
|
2470
2485
|
declare function savePublicKey(slug: string, publicKey: string, projectRoot?: string): Promise<SavePublicKeyResult>;
|
|
2471
2486
|
/**
|
|
2472
|
-
* Save a public key to the user's home directory
|
|
2487
|
+
* Save a public key to the user's home directory (sync).
|
|
2473
2488
|
*
|
|
2474
2489
|
* This saves the public key as a base64-encoded string (matching the format in config.yaml)
|
|
2475
|
-
* to
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2490
|
+
* to ~/.attest-it/public-keys/<slug>.pem for backup purposes.
|
|
2491
|
+
*
|
|
2492
|
+
* Public keys are now stored inline in the team section of config.yaml and no longer
|
|
2493
|
+
* written to the project directory.
|
|
2478
2494
|
*
|
|
2479
2495
|
* @param slug - The identity slug (used for the filename)
|
|
2480
2496
|
* @param publicKey - The base64-encoded public key
|
|
2481
|
-
* @param projectRoot - The project root directory (
|
|
2497
|
+
* @param projectRoot - The project root directory (deprecated, kept for backward compatibility)
|
|
2482
2498
|
* @returns Paths where the key was saved
|
|
2483
2499
|
* @public
|
|
2484
2500
|
*/
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ var teamMemberSchema = z.object({
|
|
|
30
30
|
name: z.string().min(1, "Team member name cannot be empty"),
|
|
31
31
|
email: z.string().email().optional(),
|
|
32
32
|
github: z.string().min(1).optional(),
|
|
33
|
-
publicKey: z.string().min(1, "Public key is required")
|
|
33
|
+
publicKey: z.string().min(1, "Public key is required"),
|
|
34
|
+
publicKeyAlgorithm: z.enum(["ed25519"]).optional()
|
|
34
35
|
}).strict();
|
|
35
36
|
var fingerprintConfigSchema = z.object({
|
|
36
37
|
paths: z.array(z.string().min(1, "Path cannot be empty")).min(1, "At least one path is required"),
|
|
@@ -261,7 +262,8 @@ var teamMemberSchema2 = z.object({
|
|
|
261
262
|
name: z.string().min(1, "Team member name cannot be empty"),
|
|
262
263
|
email: z.string().email().optional(),
|
|
263
264
|
github: z.string().min(1).optional(),
|
|
264
|
-
publicKey: z.string().min(1, "Public key is required")
|
|
265
|
+
publicKey: z.string().min(1, "Public key is required"),
|
|
266
|
+
publicKeyAlgorithm: z.literal("ed25519").optional()
|
|
265
267
|
}).strict();
|
|
266
268
|
var fingerprintConfigSchema2 = z.object({
|
|
267
269
|
paths: z.array(z.string().min(1, "Path cannot be empty")).min(1, "At least one path is required"),
|
|
@@ -1826,16 +1828,19 @@ function loadLocalConfigSync(configPath) {
|
|
|
1826
1828
|
throw error;
|
|
1827
1829
|
}
|
|
1828
1830
|
}
|
|
1831
|
+
var IDENTITY_SCHEMA_HEADER = "# yaml-language-server: $schema=https://raw.githubusercontent.com/mike-north/attest-it/main/schemas/v1/identity.schema.json\n";
|
|
1829
1832
|
async function saveLocalConfig(config, configPath) {
|
|
1830
1833
|
const resolvedPath = configPath ?? getLocalConfigPath();
|
|
1831
|
-
const
|
|
1834
|
+
const yamlContent = stringify(config);
|
|
1835
|
+
const content = IDENTITY_SCHEMA_HEADER + yamlContent;
|
|
1832
1836
|
const dir = dirname(resolvedPath);
|
|
1833
1837
|
await mkdir(dir, { recursive: true });
|
|
1834
1838
|
await writeFile(resolvedPath, content, "utf8");
|
|
1835
1839
|
}
|
|
1836
1840
|
function saveLocalConfigSync(config, configPath) {
|
|
1837
1841
|
const resolvedPath = configPath ?? getLocalConfigPath();
|
|
1838
|
-
const
|
|
1842
|
+
const yamlContent = stringify(config);
|
|
1843
|
+
const content = IDENTITY_SCHEMA_HEADER + yamlContent;
|
|
1839
1844
|
const dir = dirname(resolvedPath);
|
|
1840
1845
|
mkdirSync(dir, { recursive: true });
|
|
1841
1846
|
writeFileSync(resolvedPath, content, "utf8");
|
|
@@ -1866,13 +1871,6 @@ async function savePublicKey(slug, publicKey, projectRoot = process.cwd()) {
|
|
|
1866
1871
|
const homePath = join(homeDir, `${slug}.pem`);
|
|
1867
1872
|
await writeFile(homePath, publicKey, "utf8");
|
|
1868
1873
|
result.homePath = homePath;
|
|
1869
|
-
if (hasProjectConfig(projectRoot)) {
|
|
1870
|
-
const projectDir = getProjectPublicKeysDir(projectRoot);
|
|
1871
|
-
await mkdir(projectDir, { recursive: true });
|
|
1872
|
-
const projectPath = join(projectDir, `${slug}.pem`);
|
|
1873
|
-
await writeFile(projectPath, publicKey, "utf8");
|
|
1874
|
-
result.projectPath = projectPath;
|
|
1875
|
-
}
|
|
1876
1874
|
return result;
|
|
1877
1875
|
}
|
|
1878
1876
|
function savePublicKeySync(slug, publicKey, projectRoot = process.cwd()) {
|
|
@@ -1884,13 +1882,6 @@ function savePublicKeySync(slug, publicKey, projectRoot = process.cwd()) {
|
|
|
1884
1882
|
const homePath = join(homeDir, `${slug}.pem`);
|
|
1885
1883
|
writeFileSync(homePath, publicKey, "utf8");
|
|
1886
1884
|
result.homePath = homePath;
|
|
1887
|
-
if (hasProjectConfig(projectRoot)) {
|
|
1888
|
-
const projectDir = getProjectPublicKeysDir(projectRoot);
|
|
1889
|
-
mkdirSync(projectDir, { recursive: true });
|
|
1890
|
-
const projectPath = join(projectDir, `${slug}.pem`);
|
|
1891
|
-
writeFileSync(projectPath, publicKey, "utf8");
|
|
1892
|
-
result.projectPath = projectPath;
|
|
1893
|
-
}
|
|
1894
1885
|
return result;
|
|
1895
1886
|
}
|
|
1896
1887
|
|