@attest-it/core 0.4.0 → 0.5.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.
@@ -765,6 +765,25 @@ export declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPat
765
765
  */
766
766
  export declare function getActiveIdentity(config: LocalConfig): Identity | undefined;
767
767
 
768
+ /**
769
+ * Get the attest-it configuration directory.
770
+ *
771
+ * If a home directory override is set via setAttestItHomeDir(),
772
+ * returns that directory. Otherwise returns ~/.config/attest-it.
773
+ *
774
+ * @returns Path to the configuration directory
775
+ * @public
776
+ */
777
+ export declare function getAttestItConfigDir(): string;
778
+
779
+ /**
780
+ * Get the current attest-it home directory override.
781
+ *
782
+ * @returns The override directory, or null if using default
783
+ * @public
784
+ */
785
+ export declare function getAttestItHomeDir(): null | string;
786
+
768
787
  /**
769
788
  * Get all team members authorized to sign for a gate.
770
789
  *
@@ -802,7 +821,10 @@ export declare function getGate(config: AttestItConfig, gateId: string): GateCon
802
821
  /**
803
822
  * Get the path to the local config file.
804
823
  *
805
- * @returns Path to ~/.config/attest-it/config.yaml
824
+ * If a home directory override is set via setAttestItHomeDir(),
825
+ * returns {homeDir}/config.yaml. Otherwise returns ~/.config/attest-it/config.yaml.
826
+ *
827
+ * @returns Path to the local config file
806
828
  * @public
807
829
  */
808
830
  export declare function getLocalConfigPath(): string;
@@ -1084,6 +1106,17 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1084
1106
  constructor(message: string, issues: z.ZodIssue[]);
1085
1107
  }
1086
1108
 
1109
+ /**
1110
+ * Information about a macOS keychain.
1111
+ * @public
1112
+ */
1113
+ export declare interface MacOSKeychain {
1114
+ /** Full path to the keychain file */
1115
+ path: string;
1116
+ /** Display name (filename without extension) */
1117
+ name: string;
1118
+ }
1119
+
1087
1120
  /**
1088
1121
  * Key provider that stores private keys in macOS Keychain.
1089
1122
  *
@@ -1098,6 +1131,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1098
1131
  readonly type = "macos-keychain";
1099
1132
  readonly displayName = "macOS Keychain";
1100
1133
  private readonly itemName;
1134
+ private readonly keychain?;
1101
1135
  private static readonly ACCOUNT;
1102
1136
  /**
1103
1137
  * Create a new MacOSKeychainKeyProvider.
@@ -1109,6 +1143,11 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1109
1143
  * Only available on macOS platforms.
1110
1144
  */
1111
1145
  static isAvailable(): boolean;
1146
+ /**
1147
+ * List available keychains on the system.
1148
+ * @returns Array of keychain information
1149
+ */
1150
+ static listKeychains(): Promise<MacOSKeychain[]>;
1112
1151
  /**
1113
1152
  * Check if this provider is available on the current system.
1114
1153
  */
@@ -1144,6 +1183,8 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1144
1183
  export declare interface MacOSKeychainKeyProviderOptions {
1145
1184
  /** Item name in keychain (e.g., "attest-it-private-key") */
1146
1185
  itemName: string;
1186
+ /** Path to the keychain file (optional, uses default keychain if not specified) */
1187
+ keychain?: string;
1147
1188
  }
1148
1189
 
1149
1190
  /**
@@ -1268,6 +1309,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1268
1309
  */
1269
1310
  export declare type PrivateKeyRef = {
1270
1311
  account: string;
1312
+ keychain?: string;
1271
1313
  service: string;
1272
1314
  type: 'keychain';
1273
1315
  } | {
@@ -1436,6 +1478,15 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1436
1478
  message?: string;
1437
1479
  }
1438
1480
 
1481
+ /**
1482
+ * Set a custom home directory for attest-it configuration.
1483
+ * This is useful for testing or running with isolated state.
1484
+ *
1485
+ * @param dir - The directory to use, or null to reset to default
1486
+ * @public
1487
+ */
1488
+ export declare function setAttestItHomeDir(dir: null | string): void;
1489
+
1439
1490
  /**
1440
1491
  * Set restrictive permissions on a private key file.
1441
1492
  * @param keyPath - Path to the private key
@@ -765,6 +765,25 @@ export declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPat
765
765
  */
766
766
  export declare function getActiveIdentity(config: LocalConfig): Identity | undefined;
767
767
 
768
+ /**
769
+ * Get the attest-it configuration directory.
770
+ *
771
+ * If a home directory override is set via setAttestItHomeDir(),
772
+ * returns that directory. Otherwise returns ~/.config/attest-it.
773
+ *
774
+ * @returns Path to the configuration directory
775
+ * @public
776
+ */
777
+ export declare function getAttestItConfigDir(): string;
778
+
779
+ /**
780
+ * Get the current attest-it home directory override.
781
+ *
782
+ * @returns The override directory, or null if using default
783
+ * @public
784
+ */
785
+ export declare function getAttestItHomeDir(): null | string;
786
+
768
787
  /**
769
788
  * Get all team members authorized to sign for a gate.
770
789
  *
@@ -802,7 +821,10 @@ export declare function getGate(config: AttestItConfig, gateId: string): GateCon
802
821
  /**
803
822
  * Get the path to the local config file.
804
823
  *
805
- * @returns Path to ~/.config/attest-it/config.yaml
824
+ * If a home directory override is set via setAttestItHomeDir(),
825
+ * returns {homeDir}/config.yaml. Otherwise returns ~/.config/attest-it/config.yaml.
826
+ *
827
+ * @returns Path to the local config file
806
828
  * @public
807
829
  */
808
830
  export declare function getLocalConfigPath(): string;
@@ -1084,6 +1106,17 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1084
1106
  constructor(message: string, issues: z.ZodIssue[]);
1085
1107
  }
1086
1108
 
1109
+ /**
1110
+ * Information about a macOS keychain.
1111
+ * @public
1112
+ */
1113
+ export declare interface MacOSKeychain {
1114
+ /** Full path to the keychain file */
1115
+ path: string;
1116
+ /** Display name (filename without extension) */
1117
+ name: string;
1118
+ }
1119
+
1087
1120
  /**
1088
1121
  * Key provider that stores private keys in macOS Keychain.
1089
1122
  *
@@ -1098,6 +1131,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1098
1131
  readonly type = "macos-keychain";
1099
1132
  readonly displayName = "macOS Keychain";
1100
1133
  private readonly itemName;
1134
+ private readonly keychain?;
1101
1135
  private static readonly ACCOUNT;
1102
1136
  /**
1103
1137
  * Create a new MacOSKeychainKeyProvider.
@@ -1109,6 +1143,11 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1109
1143
  * Only available on macOS platforms.
1110
1144
  */
1111
1145
  static isAvailable(): boolean;
1146
+ /**
1147
+ * List available keychains on the system.
1148
+ * @returns Array of keychain information
1149
+ */
1150
+ static listKeychains(): Promise<MacOSKeychain[]>;
1112
1151
  /**
1113
1152
  * Check if this provider is available on the current system.
1114
1153
  */
@@ -1144,6 +1183,8 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1144
1183
  export declare interface MacOSKeychainKeyProviderOptions {
1145
1184
  /** Item name in keychain (e.g., "attest-it-private-key") */
1146
1185
  itemName: string;
1186
+ /** Path to the keychain file (optional, uses default keychain if not specified) */
1187
+ keychain?: string;
1147
1188
  }
1148
1189
 
1149
1190
  /**
@@ -1268,6 +1309,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1268
1309
  */
1269
1310
  export declare type PrivateKeyRef = {
1270
1311
  account: string;
1312
+ keychain?: string;
1271
1313
  service: string;
1272
1314
  type: 'keychain';
1273
1315
  } | {
@@ -1436,6 +1478,15 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1436
1478
  message?: string;
1437
1479
  }
1438
1480
 
1481
+ /**
1482
+ * Set a custom home directory for attest-it configuration.
1483
+ * This is useful for testing or running with isolated state.
1484
+ *
1485
+ * @param dir - The directory to use, or null to reset to default
1486
+ * @public
1487
+ */
1488
+ export declare function setAttestItHomeDir(dir: null | string): void;
1489
+
1439
1490
  /**
1440
1491
  * Set restrictive permissions on a private key file.
1441
1492
  * @param keyPath - Path to the private key
@@ -765,6 +765,25 @@ export declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPat
765
765
  */
766
766
  export declare function getActiveIdentity(config: LocalConfig): Identity | undefined;
767
767
 
768
+ /**
769
+ * Get the attest-it configuration directory.
770
+ *
771
+ * If a home directory override is set via setAttestItHomeDir(),
772
+ * returns that directory. Otherwise returns ~/.config/attest-it.
773
+ *
774
+ * @returns Path to the configuration directory
775
+ * @public
776
+ */
777
+ export declare function getAttestItConfigDir(): string;
778
+
779
+ /**
780
+ * Get the current attest-it home directory override.
781
+ *
782
+ * @returns The override directory, or null if using default
783
+ * @public
784
+ */
785
+ export declare function getAttestItHomeDir(): null | string;
786
+
768
787
  /**
769
788
  * Get all team members authorized to sign for a gate.
770
789
  *
@@ -802,7 +821,10 @@ export declare function getGate(config: AttestItConfig, gateId: string): GateCon
802
821
  /**
803
822
  * Get the path to the local config file.
804
823
  *
805
- * @returns Path to ~/.config/attest-it/config.yaml
824
+ * If a home directory override is set via setAttestItHomeDir(),
825
+ * returns {homeDir}/config.yaml. Otherwise returns ~/.config/attest-it/config.yaml.
826
+ *
827
+ * @returns Path to the local config file
806
828
  * @public
807
829
  */
808
830
  export declare function getLocalConfigPath(): string;
@@ -1084,6 +1106,17 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1084
1106
  constructor(message: string, issues: z.ZodIssue[]);
1085
1107
  }
1086
1108
 
1109
+ /**
1110
+ * Information about a macOS keychain.
1111
+ * @public
1112
+ */
1113
+ export declare interface MacOSKeychain {
1114
+ /** Full path to the keychain file */
1115
+ path: string;
1116
+ /** Display name (filename without extension) */
1117
+ name: string;
1118
+ }
1119
+
1087
1120
  /**
1088
1121
  * Key provider that stores private keys in macOS Keychain.
1089
1122
  *
@@ -1098,6 +1131,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1098
1131
  readonly type = "macos-keychain";
1099
1132
  readonly displayName = "macOS Keychain";
1100
1133
  private readonly itemName;
1134
+ private readonly keychain?;
1101
1135
  private static readonly ACCOUNT;
1102
1136
  /**
1103
1137
  * Create a new MacOSKeychainKeyProvider.
@@ -1109,6 +1143,11 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1109
1143
  * Only available on macOS platforms.
1110
1144
  */
1111
1145
  static isAvailable(): boolean;
1146
+ /**
1147
+ * List available keychains on the system.
1148
+ * @returns Array of keychain information
1149
+ */
1150
+ static listKeychains(): Promise<MacOSKeychain[]>;
1112
1151
  /**
1113
1152
  * Check if this provider is available on the current system.
1114
1153
  */
@@ -1144,6 +1183,8 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1144
1183
  export declare interface MacOSKeychainKeyProviderOptions {
1145
1184
  /** Item name in keychain (e.g., "attest-it-private-key") */
1146
1185
  itemName: string;
1186
+ /** Path to the keychain file (optional, uses default keychain if not specified) */
1187
+ keychain?: string;
1147
1188
  }
1148
1189
 
1149
1190
  /**
@@ -1268,6 +1309,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1268
1309
  */
1269
1310
  export declare type PrivateKeyRef = {
1270
1311
  account: string;
1312
+ keychain?: string;
1271
1313
  service: string;
1272
1314
  type: 'keychain';
1273
1315
  } | {
@@ -1436,6 +1478,15 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1436
1478
  message?: string;
1437
1479
  }
1438
1480
 
1481
+ /**
1482
+ * Set a custom home directory for attest-it configuration.
1483
+ * This is useful for testing or running with isolated state.
1484
+ *
1485
+ * @param dir - The directory to use, or null to reset to default
1486
+ * @public
1487
+ */
1488
+ export declare function setAttestItHomeDir(dir: null | string): void;
1489
+
1439
1490
  /**
1440
1491
  * Set restrictive permissions on a private key file.
1441
1492
  * @param keyPath - Path to the private key
@@ -765,6 +765,25 @@ export declare function generateKeyPair(options?: KeygenOptions): Promise<KeyPat
765
765
  */
766
766
  export declare function getActiveIdentity(config: LocalConfig): Identity | undefined;
767
767
 
768
+ /**
769
+ * Get the attest-it configuration directory.
770
+ *
771
+ * If a home directory override is set via setAttestItHomeDir(),
772
+ * returns that directory. Otherwise returns ~/.config/attest-it.
773
+ *
774
+ * @returns Path to the configuration directory
775
+ * @public
776
+ */
777
+ export declare function getAttestItConfigDir(): string;
778
+
779
+ /**
780
+ * Get the current attest-it home directory override.
781
+ *
782
+ * @returns The override directory, or null if using default
783
+ * @public
784
+ */
785
+ export declare function getAttestItHomeDir(): null | string;
786
+
768
787
  /**
769
788
  * Get all team members authorized to sign for a gate.
770
789
  *
@@ -802,7 +821,10 @@ export declare function getGate(config: AttestItConfig, gateId: string): GateCon
802
821
  /**
803
822
  * Get the path to the local config file.
804
823
  *
805
- * @returns Path to ~/.config/attest-it/config.yaml
824
+ * If a home directory override is set via setAttestItHomeDir(),
825
+ * returns {homeDir}/config.yaml. Otherwise returns ~/.config/attest-it/config.yaml.
826
+ *
827
+ * @returns Path to the local config file
806
828
  * @public
807
829
  */
808
830
  export declare function getLocalConfigPath(): string;
@@ -1084,6 +1106,17 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1084
1106
  constructor(message: string, issues: z.ZodIssue[]);
1085
1107
  }
1086
1108
 
1109
+ /**
1110
+ * Information about a macOS keychain.
1111
+ * @public
1112
+ */
1113
+ export declare interface MacOSKeychain {
1114
+ /** Full path to the keychain file */
1115
+ path: string;
1116
+ /** Display name (filename without extension) */
1117
+ name: string;
1118
+ }
1119
+
1087
1120
  /**
1088
1121
  * Key provider that stores private keys in macOS Keychain.
1089
1122
  *
@@ -1098,6 +1131,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1098
1131
  readonly type = "macos-keychain";
1099
1132
  readonly displayName = "macOS Keychain";
1100
1133
  private readonly itemName;
1134
+ private readonly keychain?;
1101
1135
  private static readonly ACCOUNT;
1102
1136
  /**
1103
1137
  * Create a new MacOSKeychainKeyProvider.
@@ -1109,6 +1143,11 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1109
1143
  * Only available on macOS platforms.
1110
1144
  */
1111
1145
  static isAvailable(): boolean;
1146
+ /**
1147
+ * List available keychains on the system.
1148
+ * @returns Array of keychain information
1149
+ */
1150
+ static listKeychains(): Promise<MacOSKeychain[]>;
1112
1151
  /**
1113
1152
  * Check if this provider is available on the current system.
1114
1153
  */
@@ -1144,6 +1183,8 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1144
1183
  export declare interface MacOSKeychainKeyProviderOptions {
1145
1184
  /** Item name in keychain (e.g., "attest-it-private-key") */
1146
1185
  itemName: string;
1186
+ /** Path to the keychain file (optional, uses default keychain if not specified) */
1187
+ keychain?: string;
1147
1188
  }
1148
1189
 
1149
1190
  /**
@@ -1268,6 +1309,7 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1268
1309
  */
1269
1310
  export declare type PrivateKeyRef = {
1270
1311
  account: string;
1312
+ keychain?: string;
1271
1313
  service: string;
1272
1314
  type: 'keychain';
1273
1315
  } | {
@@ -1436,6 +1478,15 @@ export declare function listPackageFiles(packages: string[], ignore?: string[],
1436
1478
  message?: string;
1437
1479
  }
1438
1480
 
1481
+ /**
1482
+ * Set a custom home directory for attest-it configuration.
1483
+ * This is useful for testing or running with isolated state.
1484
+ *
1485
+ * @param dir - The directory to use, or null to reset to default
1486
+ * @public
1487
+ */
1488
+ export declare function setAttestItHomeDir(dir: null | string): void;
1489
+
1439
1490
  /**
1440
1491
  * Set restrictive permissions on a private key file.
1441
1492
  * @param keyPath - Path to the private key
package/dist/index.cjs CHANGED
@@ -1425,6 +1425,7 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1425
1425
  type = "macos-keychain";
1426
1426
  displayName = "macOS Keychain";
1427
1427
  itemName;
1428
+ keychain;
1428
1429
  static ACCOUNT = "attest-it";
1429
1430
  /**
1430
1431
  * Create a new MacOSKeychainKeyProvider.
@@ -1432,6 +1433,9 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1432
1433
  */
1433
1434
  constructor(options) {
1434
1435
  this.itemName = options.itemName;
1436
+ if (options.keychain !== void 0) {
1437
+ this.keychain = options.keychain;
1438
+ }
1435
1439
  }
1436
1440
  /**
1437
1441
  * Check if this provider is available.
@@ -1440,6 +1444,32 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1440
1444
  static isAvailable() {
1441
1445
  return process.platform === "darwin";
1442
1446
  }
1447
+ /**
1448
+ * List available keychains on the system.
1449
+ * @returns Array of keychain information
1450
+ */
1451
+ static async listKeychains() {
1452
+ if (!_MacOSKeychainKeyProvider.isAvailable()) {
1453
+ return [];
1454
+ }
1455
+ try {
1456
+ const output = await execCommand2("security", ["list-keychains"]);
1457
+ const keychains = [];
1458
+ const lines = output.split("\n");
1459
+ for (const line of lines) {
1460
+ const match = /"(.+)"/.exec(line.trim());
1461
+ if (match?.[1]) {
1462
+ const fullPath = match[1];
1463
+ const filename = fullPath.split("/").pop() ?? fullPath;
1464
+ const name = filename.replace(/\.keychain(-db)?$/, "");
1465
+ keychains.push({ path: fullPath, name });
1466
+ }
1467
+ }
1468
+ return keychains;
1469
+ } catch {
1470
+ return [];
1471
+ }
1472
+ }
1443
1473
  /**
1444
1474
  * Check if this provider is available on the current system.
1445
1475
  */
@@ -1452,13 +1482,11 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1452
1482
  */
1453
1483
  async keyExists(keyRef) {
1454
1484
  try {
1455
- await execCommand2("security", [
1456
- "find-generic-password",
1457
- "-a",
1458
- _MacOSKeychainKeyProvider.ACCOUNT,
1459
- "-s",
1460
- keyRef
1461
- ]);
1485
+ const args = ["find-generic-password", "-a", _MacOSKeychainKeyProvider.ACCOUNT, "-s", keyRef];
1486
+ if (this.keychain) {
1487
+ args.push(this.keychain);
1488
+ }
1489
+ await execCommand2("security", args);
1462
1490
  return true;
1463
1491
  } catch {
1464
1492
  return false;
@@ -1479,14 +1507,18 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1479
1507
  const tempDir = await fs2__namespace.mkdtemp(path2__namespace.join(os__namespace.tmpdir(), "attest-it-"));
1480
1508
  const tempKeyPath = path2__namespace.join(tempDir, "private.pem");
1481
1509
  try {
1482
- const base64Key = await execCommand2("security", [
1510
+ const findArgs = [
1483
1511
  "find-generic-password",
1484
1512
  "-a",
1485
1513
  _MacOSKeychainKeyProvider.ACCOUNT,
1486
1514
  "-s",
1487
1515
  keyRef,
1488
1516
  "-w"
1489
- ]);
1517
+ ];
1518
+ if (this.keychain) {
1519
+ findArgs.push(this.keychain);
1520
+ }
1521
+ const base64Key = await execCommand2("security", findArgs);
1490
1522
  const keyContent = Buffer.from(base64Key, "base64").toString("utf8");
1491
1523
  await fs2__namespace.writeFile(tempKeyPath, keyContent, { mode: 384 });
1492
1524
  await setKeyPermissions(tempKeyPath);
@@ -1531,7 +1563,7 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1531
1563
  });
1532
1564
  const privateKeyContent = await fs2__namespace.readFile(tempPrivateKeyPath, "utf8");
1533
1565
  const base64Key = Buffer.from(privateKeyContent, "utf8").toString("base64");
1534
- await execCommand2("security", [
1566
+ const addArgs = [
1535
1567
  "add-generic-password",
1536
1568
  "-a",
1537
1569
  _MacOSKeychainKeyProvider.ACCOUNT,
@@ -1542,7 +1574,11 @@ var MacOSKeychainKeyProvider = class _MacOSKeychainKeyProvider {
1542
1574
  "-T",
1543
1575
  "",
1544
1576
  "-U"
1545
- ]);
1577
+ ];
1578
+ if (this.keychain) {
1579
+ addArgs.push(this.keychain);
1580
+ }
1581
+ await execCommand2("security", addArgs);
1546
1582
  await fs2__namespace.unlink(tempPrivateKeyPath);
1547
1583
  await fs2__namespace.rmdir(tempDir);
1548
1584
  return {
@@ -1659,6 +1695,13 @@ KeyProviderRegistry.register("macos-keychain", (config) => {
1659
1695
  }
1660
1696
  return new MacOSKeychainKeyProvider({ itemName });
1661
1697
  });
1698
+ var homeDirOverride = null;
1699
+ function setAttestItHomeDir(dir) {
1700
+ homeDirOverride = dir;
1701
+ }
1702
+ function getAttestItHomeDir() {
1703
+ return homeDirOverride;
1704
+ }
1662
1705
  var privateKeyRefSchema = zod.z.discriminatedUnion("type", [
1663
1706
  zod.z.object({
1664
1707
  type: zod.z.literal("file"),
@@ -1667,7 +1710,8 @@ var privateKeyRefSchema = zod.z.discriminatedUnion("type", [
1667
1710
  zod.z.object({
1668
1711
  type: zod.z.literal("keychain"),
1669
1712
  service: zod.z.string().min(1, "Service name cannot be empty"),
1670
- account: zod.z.string().min(1, "Account name cannot be empty")
1713
+ account: zod.z.string().min(1, "Account name cannot be empty"),
1714
+ keychain: zod.z.string().optional()
1671
1715
  }),
1672
1716
  zod.z.object({
1673
1717
  type: zod.z.literal("1password"),
@@ -1698,9 +1742,18 @@ var LocalConfigValidationError = class extends Error {
1698
1742
  }
1699
1743
  };
1700
1744
  function getLocalConfigPath() {
1745
+ if (homeDirOverride) {
1746
+ return path2.join(homeDirOverride, "config.yaml");
1747
+ }
1701
1748
  const home = os.homedir();
1702
1749
  return path2.join(home, ".config", "attest-it", "config.yaml");
1703
1750
  }
1751
+ function getAttestItConfigDir() {
1752
+ if (homeDirOverride) {
1753
+ return homeDirOverride;
1754
+ }
1755
+ return path2.join(os.homedir(), ".config", "attest-it");
1756
+ }
1704
1757
  function parseLocalConfigContent(content) {
1705
1758
  let rawConfig;
1706
1759
  try {
@@ -1731,6 +1784,15 @@ function parseLocalConfigContent(content) {
1731
1784
  },
1732
1785
  ...identity.privateKey.field !== void 0 && { field: identity.privateKey.field }
1733
1786
  };
1787
+ } else if (identity.privateKey.type === "keychain") {
1788
+ privateKey = {
1789
+ type: "keychain",
1790
+ service: identity.privateKey.service,
1791
+ account: identity.privateKey.account,
1792
+ ...identity.privateKey.keychain !== void 0 && {
1793
+ keychain: identity.privateKey.keychain
1794
+ }
1795
+ };
1734
1796
  } else {
1735
1797
  privateKey = identity.privateKey;
1736
1798
  }
@@ -2134,6 +2196,8 @@ exports.findTeamMemberByPublicKey = findTeamMemberByPublicKey;
2134
2196
  exports.generateEd25519KeyPair = generateKeyPair2;
2135
2197
  exports.generateKeyPair = generateKeyPair;
2136
2198
  exports.getActiveIdentity = getActiveIdentity;
2199
+ exports.getAttestItConfigDir = getAttestItConfigDir;
2200
+ exports.getAttestItHomeDir = getAttestItHomeDir;
2137
2201
  exports.getAuthorizedSignersForGate = getAuthorizedSignersForGate;
2138
2202
  exports.getDefaultPrivateKeyPath = getDefaultPrivateKeyPath;
2139
2203
  exports.getDefaultPublicKeyPath = getDefaultPublicKeyPath;
@@ -2156,6 +2220,7 @@ exports.removeAttestation = removeAttestation;
2156
2220
  exports.resolveConfigPaths = resolveConfigPaths;
2157
2221
  exports.saveLocalConfig = saveLocalConfig;
2158
2222
  exports.saveLocalConfigSync = saveLocalConfigSync;
2223
+ exports.setAttestItHomeDir = setAttestItHomeDir;
2159
2224
  exports.setKeyPermissions = setKeyPermissions;
2160
2225
  exports.sign = sign;
2161
2226
  exports.signEd25519 = sign3;