@attest-it/core 0.6.0 → 0.7.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-VC3BBBBO.js → chunk-T3NLSO5B.js} +11 -3
- package/dist/chunk-T3NLSO5B.js.map +1 -0
- package/dist/core-alpha.d.ts +88 -1
- package/dist/core-beta.d.ts +88 -1
- package/dist/core-public.d.ts +88 -1
- package/dist/core-unstripped.d.ts +88 -1
- package/dist/crypto-VT6YNHUE.js +3 -0
- package/dist/{crypto-CE2YISRD.js.map → crypto-VT6YNHUE.js.map} +1 -1
- package/dist/index.cjs +87 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +82 -2
- package/dist/index.d.ts +82 -2
- package/dist/index.js +78 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-VC3BBBBO.js.map +0 -1
- package/dist/crypto-CE2YISRD.js +0 -3
package/dist/index.cjs
CHANGED
|
@@ -57,6 +57,7 @@ __export(crypto_exports, {
|
|
|
57
57
|
generateKeyPair: () => generateKeyPair,
|
|
58
58
|
getDefaultPrivateKeyPath: () => getDefaultPrivateKeyPath,
|
|
59
59
|
getDefaultPublicKeyPath: () => getDefaultPublicKeyPath,
|
|
60
|
+
getDefaultYubiKeyEncryptedKeyPath: () => getDefaultYubiKeyEncryptedKeyPath,
|
|
60
61
|
setKeyPermissions: () => setKeyPermissions,
|
|
61
62
|
sign: () => sign,
|
|
62
63
|
verify: () => verify
|
|
@@ -118,6 +119,14 @@ function getDefaultPrivateKeyPath() {
|
|
|
118
119
|
function getDefaultPublicKeyPath() {
|
|
119
120
|
return path2__namespace.join(process.cwd(), "attest-it-public.pem");
|
|
120
121
|
}
|
|
122
|
+
function getDefaultYubiKeyEncryptedKeyPath() {
|
|
123
|
+
const homeDir = os__namespace.homedir();
|
|
124
|
+
if (process.platform === "win32") {
|
|
125
|
+
const appData = process.env.APPDATA ?? path2__namespace.join(homeDir, "AppData", "Roaming");
|
|
126
|
+
return path2__namespace.join(appData, "attest-it", "yubikey-private.enc");
|
|
127
|
+
}
|
|
128
|
+
return path2__namespace.join(homeDir, ".config", "attest-it", "yubikey-private.enc");
|
|
129
|
+
}
|
|
121
130
|
async function ensureDir(dirPath) {
|
|
122
131
|
try {
|
|
123
132
|
await fs8__namespace.mkdir(dirPath, { recursive: true });
|
|
@@ -1519,7 +1528,7 @@ var OnePasswordKeyProvider = class _OnePasswordKeyProvider {
|
|
|
1519
1528
|
}
|
|
1520
1529
|
/**
|
|
1521
1530
|
* List all 1Password accounts.
|
|
1522
|
-
* @returns Array of account information
|
|
1531
|
+
* @returns Array of account information including human-readable names
|
|
1523
1532
|
*/
|
|
1524
1533
|
static async listAccounts() {
|
|
1525
1534
|
try {
|
|
@@ -1528,7 +1537,27 @@ var OnePasswordKeyProvider = class _OnePasswordKeyProvider {
|
|
|
1528
1537
|
if (!Array.isArray(parsed)) {
|
|
1529
1538
|
return [];
|
|
1530
1539
|
}
|
|
1531
|
-
|
|
1540
|
+
const basicAccounts = parsed;
|
|
1541
|
+
const accountsWithNames = await Promise.all(
|
|
1542
|
+
basicAccounts.map(async (account) => {
|
|
1543
|
+
try {
|
|
1544
|
+
const detailOutput = await execCommand("op", [
|
|
1545
|
+
"account",
|
|
1546
|
+
"get",
|
|
1547
|
+
"--account",
|
|
1548
|
+
account.email,
|
|
1549
|
+
"--format=json"
|
|
1550
|
+
]);
|
|
1551
|
+
const details = JSON.parse(detailOutput);
|
|
1552
|
+
if (details !== null && typeof details === "object" && "name" in details && typeof details.name === "string") {
|
|
1553
|
+
return { ...account, name: details.name };
|
|
1554
|
+
}
|
|
1555
|
+
} catch {
|
|
1556
|
+
}
|
|
1557
|
+
return account;
|
|
1558
|
+
})
|
|
1559
|
+
);
|
|
1560
|
+
return accountsWithNames;
|
|
1532
1561
|
} catch (error) {
|
|
1533
1562
|
if (process.env.NODE_ENV !== "production") {
|
|
1534
1563
|
console.error("Failed to list 1Password accounts:", error);
|
|
@@ -2093,6 +2122,56 @@ function saveLocalConfigSync(config, configPath) {
|
|
|
2093
2122
|
function getActiveIdentity(config) {
|
|
2094
2123
|
return config.identities[config.activeIdentity];
|
|
2095
2124
|
}
|
|
2125
|
+
function getHomePublicKeysDir() {
|
|
2126
|
+
if (homeDirOverride) {
|
|
2127
|
+
return path2.join(homeDirOverride, "public-keys");
|
|
2128
|
+
}
|
|
2129
|
+
return path2.join(os.homedir(), ".attest-it", "public-keys");
|
|
2130
|
+
}
|
|
2131
|
+
function getProjectPublicKeysDir(projectRoot = process.cwd()) {
|
|
2132
|
+
return path2.join(projectRoot, ".attest-it", "public-keys");
|
|
2133
|
+
}
|
|
2134
|
+
function hasProjectConfig(projectRoot = process.cwd()) {
|
|
2135
|
+
const configDir = path2.join(projectRoot, ".attest-it");
|
|
2136
|
+
const candidates = ["config.yaml", "config.yml", "config.json"];
|
|
2137
|
+
return candidates.some((candidate) => fs.existsSync(path2.join(configDir, candidate)));
|
|
2138
|
+
}
|
|
2139
|
+
async function savePublicKey(slug, publicKey, projectRoot = process.cwd()) {
|
|
2140
|
+
const result = {
|
|
2141
|
+
homePath: ""
|
|
2142
|
+
};
|
|
2143
|
+
const homeDir = getHomePublicKeysDir();
|
|
2144
|
+
await fs8.mkdir(homeDir, { recursive: true });
|
|
2145
|
+
const homePath = path2.join(homeDir, `${slug}.pem`);
|
|
2146
|
+
await fs8.writeFile(homePath, publicKey, "utf8");
|
|
2147
|
+
result.homePath = homePath;
|
|
2148
|
+
if (hasProjectConfig(projectRoot)) {
|
|
2149
|
+
const projectDir = getProjectPublicKeysDir(projectRoot);
|
|
2150
|
+
await fs8.mkdir(projectDir, { recursive: true });
|
|
2151
|
+
const projectPath = path2.join(projectDir, `${slug}.pem`);
|
|
2152
|
+
await fs8.writeFile(projectPath, publicKey, "utf8");
|
|
2153
|
+
result.projectPath = projectPath;
|
|
2154
|
+
}
|
|
2155
|
+
return result;
|
|
2156
|
+
}
|
|
2157
|
+
function savePublicKeySync(slug, publicKey, projectRoot = process.cwd()) {
|
|
2158
|
+
const result = {
|
|
2159
|
+
homePath: ""
|
|
2160
|
+
};
|
|
2161
|
+
const homeDir = getHomePublicKeysDir();
|
|
2162
|
+
fs.mkdirSync(homeDir, { recursive: true });
|
|
2163
|
+
const homePath = path2.join(homeDir, `${slug}.pem`);
|
|
2164
|
+
fs.writeFileSync(homePath, publicKey, "utf8");
|
|
2165
|
+
result.homePath = homePath;
|
|
2166
|
+
if (hasProjectConfig(projectRoot)) {
|
|
2167
|
+
const projectDir = getProjectPublicKeysDir(projectRoot);
|
|
2168
|
+
fs.mkdirSync(projectDir, { recursive: true });
|
|
2169
|
+
const projectPath = path2.join(projectDir, `${slug}.pem`);
|
|
2170
|
+
fs.writeFileSync(projectPath, publicKey, "utf8");
|
|
2171
|
+
result.projectPath = projectPath;
|
|
2172
|
+
}
|
|
2173
|
+
return result;
|
|
2174
|
+
}
|
|
2096
2175
|
|
|
2097
2176
|
// src/key-provider/yubikey-provider.ts
|
|
2098
2177
|
var EncryptedKeyFileSchema = zod.z.object({
|
|
@@ -3048,11 +3127,15 @@ exports.getAttestItHomeDir = getAttestItHomeDir;
|
|
|
3048
3127
|
exports.getAuthorizedSignersForGate = getAuthorizedSignersForGate;
|
|
3049
3128
|
exports.getDefaultPrivateKeyPath = getDefaultPrivateKeyPath;
|
|
3050
3129
|
exports.getDefaultPublicKeyPath = getDefaultPublicKeyPath;
|
|
3130
|
+
exports.getDefaultYubiKeyEncryptedKeyPath = getDefaultYubiKeyEncryptedKeyPath;
|
|
3051
3131
|
exports.getGate = getGate;
|
|
3132
|
+
exports.getHomePublicKeysDir = getHomePublicKeysDir;
|
|
3052
3133
|
exports.getLocalConfigPath = getLocalConfigPath;
|
|
3053
3134
|
exports.getPreference = getPreference;
|
|
3054
3135
|
exports.getPreferencesPath = getPreferencesPath;
|
|
3136
|
+
exports.getProjectPublicKeysDir = getProjectPublicKeysDir;
|
|
3055
3137
|
exports.getPublicKeyFromPrivate = getPublicKeyFromPrivate;
|
|
3138
|
+
exports.hasProjectConfig = hasProjectConfig;
|
|
3056
3139
|
exports.isAuthorizedSigner = isAuthorizedSigner;
|
|
3057
3140
|
exports.listPackageFiles = listPackageFiles;
|
|
3058
3141
|
exports.loadConfig = loadConfig;
|
|
@@ -3076,6 +3159,8 @@ exports.resolveConfigPaths = resolveConfigPaths;
|
|
|
3076
3159
|
exports.saveLocalConfig = saveLocalConfig;
|
|
3077
3160
|
exports.saveLocalConfigSync = saveLocalConfigSync;
|
|
3078
3161
|
exports.savePreferences = savePreferences;
|
|
3162
|
+
exports.savePublicKey = savePublicKey;
|
|
3163
|
+
exports.savePublicKeySync = savePublicKeySync;
|
|
3079
3164
|
exports.setAttestItHomeDir = setAttestItHomeDir;
|
|
3080
3165
|
exports.setKeyPermissions = setKeyPermissions;
|
|
3081
3166
|
exports.setPreference = setPreference;
|