@open-agent-trust/cli
Advanced tools
| "use strict"; | ||
| var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| var desc = Object.getOwnPropertyDescriptor(m, k); | ||
| if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
| desc = { enumerable: true, get: function() { return m[k]; } }; | ||
| } | ||
| Object.defineProperty(o, k2, desc); | ||
| }) : (function(o, m, k, k2) { | ||
| if (k2 === undefined) k2 = k; | ||
| o[k2] = m[k]; | ||
| })); | ||
| var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { | ||
| Object.defineProperty(o, "default", { enumerable: true, value: v }); | ||
| }) : function(o, v) { | ||
| o["default"] = v; | ||
| }); | ||
| var __importStar = (this && this.__importStar) || (function () { | ||
| var ownKeys = function(o) { | ||
| ownKeys = Object.getOwnPropertyNames || function (o) { | ||
| var ar = []; | ||
| for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; | ||
| return ar; | ||
| }; | ||
| return ownKeys(o); | ||
| }; | ||
| return function (mod) { | ||
| if (mod && mod.__esModule) return mod; | ||
| var result = {}; | ||
| if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); | ||
| __setModuleDefault(result, mod); | ||
| return result; | ||
| }; | ||
| })(); | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.compile = compile; | ||
| const promises_1 = require("fs/promises"); | ||
| const path_1 = require("path"); | ||
| const ed = __importStar(require("@noble/ed25519")); | ||
| async function compile(options) { | ||
| try { | ||
| console.log('Compiling registry manifest...'); | ||
| const registryDir = (0, path_1.join)(process.cwd(), '../registry'); | ||
| const issuersDir = (0, path_1.join)(registryDir, 'issuers'); | ||
| const files = await (0, promises_1.readdir)(issuersDir); | ||
| const issuers = {}; | ||
| for (const file of files) { | ||
| if (file.endsWith('.json')) { | ||
| const content = await (0, promises_1.readFile)((0, path_1.join)(issuersDir, file), 'utf8'); | ||
| const parsed = JSON.parse(content); | ||
| issuers[parsed.issuer_id] = parsed; | ||
| } | ||
| } | ||
| const timestamp = new Date().toISOString(); | ||
| const expires = new Date(Date.now() + 60 * 60 * 1000).toISOString(); // +1 hour | ||
| const manifest = { | ||
| version: "1.0", | ||
| generated_at: timestamp, | ||
| expires_at: expires, | ||
| total_issuers: Object.keys(issuers).length, | ||
| issuers: issuers, | ||
| signature: "" | ||
| }; | ||
| const payloadToSign = JSON.stringify({ | ||
| version: manifest.version, | ||
| generated_at: manifest.generated_at, | ||
| expires_at: manifest.expires_at, | ||
| total_issuers: manifest.total_issuers, | ||
| issuers: manifest.issuers | ||
| }); | ||
| const privateKeyBuffer = Buffer.from(options.privateKey, 'base64url'); | ||
| if (privateKeyBuffer.length !== 32) { | ||
| throw new Error("Invalid private key length. Must be 32 bytes (base64url encoded)."); | ||
| } | ||
| // Use async signing to avoid needing the sync sha512 configuration | ||
| const signatureBytes = await ed.signAsync(Buffer.from(payloadToSign, 'utf8'), privateKeyBuffer); | ||
| const signatureStr = Buffer.from(signatureBytes).toString('base64url'); | ||
| manifest.signature = `ed25519:${signatureStr}`; | ||
| const outputPath = (0, path_1.join)(registryDir, 'manifest.json'); | ||
| await (0, promises_1.writeFile)(outputPath, JSON.stringify(manifest, null, 2)); | ||
| console.log('✅ Success!'); | ||
| console.log(`Signed Manifest saved to: ${outputPath}`); | ||
| console.log(`Total Issuers: ${manifest.total_issuers}`); | ||
| } | ||
| catch (error) { | ||
| console.error('❌ Failed to compile registry:', error.message); | ||
| process.exit(1); | ||
| } | ||
| } |
@@ -68,3 +68,4 @@ "use strict"; | ||
| "attestation_format": "jwt", | ||
| "max_attestation_ttl_seconds": 3600 | ||
| "max_attestation_ttl_seconds": 3600, | ||
| "capabilities_verified": false | ||
| } | ||
@@ -71,0 +72,0 @@ }; |
+7
-1
@@ -9,6 +9,7 @@ #!/usr/bin/env node | ||
| const issue_1 = require("./commands/issue"); | ||
| const compile_1 = require("./commands/compile"); | ||
| const program = new commander_1.Command(); | ||
| program | ||
| .name('agent-trust') | ||
| .description('Open Trust Registry CLI Utilities') | ||
| .description('Open Agent Trust Registry CLI Utilities') | ||
| .version('1.0.0'); | ||
@@ -48,2 +49,7 @@ program | ||
| .action(issue_1.issue); | ||
| program | ||
| .command('compile') | ||
| .description('Compiles and signs the final manifest.json from the registry folder') | ||
| .requiredOption('-p, --private-key <key>', 'Ed25519 private key to sign the manifest') | ||
| .action(compile_1.compile); | ||
| program.parse(process.argv); |
+2
-2
| { | ||
| "name": "@open-agent-trust/cli", | ||
| "version": "1.0.0", | ||
| "version": "1.0.1", | ||
| "description": "CLI utilities for the Open Agent Trust Registry", | ||
@@ -21,3 +21,3 @@ "license": "MIT", | ||
| "@noble/ed25519": "^3.0.0", | ||
| "@open-agent-trust/registry": "file:../sdk/typescript", | ||
| "@open-agent-trust/registry": "^1.0.0", | ||
| "commander": "^12.1.0", | ||
@@ -24,0 +24,0 @@ "jose": "^6.2.1" |
@@ -44,3 +44,4 @@ import * as fs from 'fs'; | ||
| "attestation_format": "jwt", | ||
| "max_attestation_ttl_seconds": 3600 | ||
| "max_attestation_ttl_seconds": 3600, | ||
| "capabilities_verified": false | ||
| } | ||
@@ -47,0 +48,0 @@ }; |
32155
15.4%15
7.14%682
16.58%8
14.29%+ Added
+ Added