@rine-network/cli 0.12.0 → 0.13.1

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.
Files changed (2) hide show
  1. package/dist/main.js +39 -5
  2. package/package.json +2 -2
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  import { Command, Option } from "commander";
3
- import { FUNNEL_TIERS, HttpClient, IdempotencyStore, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, agentLabel, buildIssueCertDeps, cacheToken, connectTunnel, decryptGroupMessage, decryptMessage, decryptThreadRow, deleteHookSecret, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, ensureCert, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generateHookSecret, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, handleWebhookRequest, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, isValidHookName, listMyInvites, loadAgentKeys, loadCredentials, loadHookSecret, loadMeta, loadMlsState, loadTokenCache, makeEdgePipeFactory, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, renewalDueWithJitter, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveHookSecret, savePqEncryptionKey, saveTokenCache, sendGroupInviteNotification, startTlsListener, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug } from "@rine-network/core";
3
+ import { FUNNEL_TIERS, HttpClient, IdempotencyStore, RineApiError, UUID_RE, addMlsGroupMember, agentKeysExist, agentLabel, buildIssueCertDeps, cacheToken, connectTunnel, decryptGroupMessage, decryptMessage, decryptThreadRow, deleteHookSecret, encryptGroupMessage, encryptMessage, encryptMlsGroupMessage, ensureCert, externalJoinMlsGroup, fetchAgents, fetchAndIngestPendingSKDistributions, fetchOAuthToken, fetchRecipientKeys, formatError, fromBase64Url, generateAgentKeys, generateHookSecret, generatePqKeyPair, getAgentPublicKeys, getCredentialEntry, getOrCreateSenderKey, getOrRefreshToken, handleWebhookRequest, hasSpiffeEndpoint, hookNameError, ingestSenderKeyDistribution, initMlsGroup, isBareAgentName, listMyInvites, loadAgentKeys, loadCredentials, loadHookSecret, loadMeta, loadMlsState, loadTokenCache, makeEdgePipeFactory, normalizeHandle, performAgentCreation, performRegistration, processMlsWelcomes, renewalDueWithJitter, resolveAgent, resolveApiUrl, resolveConfigDir, resolveHandleViaWebFinger, resolveToUuid, saveAgentKeys, saveCredentials, saveHookSecret, savePqEncryptionKey, saveTokenCache, sendGroupInviteNotification, startTlsListener, syncMlsGroup, toBase64Url, validateEncryptionKey, validateSigningKey, validateSlug, verifyIdentitySpiffe } from "@rine-network/core";
4
4
  import readline from "node:readline";
5
5
  import * as fs from "node:fs";
6
6
  import { readFileSync } from "node:fs";
@@ -329,6 +329,11 @@ function registerAgent(program) {
329
329
  console.log("E2EE keys generated and stored locally.");
330
330
  if (data.verification_words) console.log(`Verification words: ${data.verification_words}`);
331
331
  if (data.poll_url) console.log(`Poll URL: ${data.poll_url}`);
332
+ if (data.identity) console.log(`SPIFFE identity verified: ${data.identity.spiffe_id} (trust tier ${data.identity.trust_tier})`);
333
+ }
334
+ if (data.identityError) {
335
+ printError(`Agent created, but SPIFFE identity verification failed: ${data.identityError}\nRetry with: rine verify-identity --agent ${data.id} --svid <jwt>`);
336
+ process.exitCode = 1;
332
337
  }
333
338
  }));
334
339
  agent.command("list").description("List all agents").option("--include-revoked", "Include revoked agents").action(withClient(program, async ({ client, gOpts }, opts) => {
@@ -925,8 +930,9 @@ function resolveTier(raw) {
925
930
  function registerHook(program) {
926
931
  const hook = program.command("hook").description("Manage inbound webhook funnel hooks");
927
932
  hook.command("create").description("Allocate a funnel hook and print its GitHub setup (secret shown once)").option("--agent <id>", "Agent ID (defaults to your agent)").option("--name <name>", "Hook name (default: default)", "default").addOption(new Option("--tier <tier>", "Termination tier: zero-trust (your relay terminates TLS; rine never sees the cleartext) or shared-edge (rine's broker terminates TLS for high-scale delivery; brief in-memory cleartext, never stored). Default: by trust tier.").choices(Object.keys(TIER_CLI_TO_WIRE))).action(withClient(program, async ({ client, gOpts, apiUrl, configDir }, opts) => {
928
- if (!isValidHookName(opts.name)) {
929
- printError(`Invalid hook name '${opts.name}': use lowercase letters, digits and hyphens (max 32).`);
933
+ const nameError = hookNameError(opts.name);
934
+ if (nameError) {
935
+ printError(`Invalid hook name '${opts.name}': ${nameError}.`);
930
936
  process.exitCode = 2;
931
937
  return;
932
938
  }
@@ -1507,7 +1513,7 @@ function registerMessages(program) {
1507
1513
  //#endregion
1508
1514
  //#region src/commands/onboard.ts
1509
1515
  function registerOnboard(program) {
1510
- program.command("onboard").description("Register a new organization and create your first agent").requiredOption("--email <email>", "Email address").requiredOption("--name <name>", "Organization name").requiredOption("--slug <slug>", "Organization slug").requiredOption("--agent <agent-name>", "Name for the first agent").option("--[no-]human-oversight", "Require human oversight (default: true)").option("--unlisted", "Mark agent as unlisted (not in public directory)").action(withErrorHandler(program, async (gOpts, opts) => {
1516
+ program.command("onboard").description("Register a new organization and create your first agent").requiredOption("--email <email>", "Email address").requiredOption("--name <name>", "Organization name").requiredOption("--slug <slug>", "Organization slug").requiredOption("--agent <agent-name>", "Name for the first agent").option("--[no-]human-oversight", "Require human oversight (default: true)").option("--unlisted", "Mark agent as unlisted (not in public directory)").option("--verify-identity", "After creating the agent, prove a SPIFFE identity (auto-runs when SPIFFE_ENDPOINT_SOCKET is set)").option("--svid <jwt>", "SPIFFE JWT-SVID to use for --verify-identity (when no Workload API auto-fetch is available)").action(withErrorHandler(program, async (gOpts, opts) => {
1511
1517
  const profile = gOpts.profile ?? "default";
1512
1518
  const configDir = resolveConfigDir();
1513
1519
  const apiUrl = resolveApiUrl();
@@ -1549,13 +1555,17 @@ function registerOnboard(program) {
1549
1555
  const agent = await performAgentCreation(client, configDir, profile, {
1550
1556
  name: opts.agent,
1551
1557
  humanOversight: opts.humanOversight,
1552
- unlisted: opts.unlisted
1558
+ unlisted: opts.unlisted,
1559
+ verifyIdentity: opts.verifyIdentity || Boolean(opts.svid) || hasSpiffeEndpoint(),
1560
+ svid: opts.svid
1553
1561
  });
1554
1562
  if (gOpts.json) printJson({
1555
1563
  org_id: regResult.org_id,
1556
1564
  client_id: regResult.client_id,
1557
1565
  agent,
1558
1566
  poll_url: agent.poll_url,
1567
+ identity: agent.identity,
1568
+ identity_error: agent.identityError,
1559
1569
  config_dir: configDir
1560
1570
  });
1561
1571
  else {
@@ -1566,6 +1576,11 @@ function registerOnboard(program) {
1566
1576
  console.log(`\nAgent '${agent.name}' created — reachable at ${agent.handle}`);
1567
1577
  if (agent.verification_words) console.log(`Verification words: ${agent.verification_words}`);
1568
1578
  if (agent.poll_url) console.log(`Poll URL: ${agent.poll_url}`);
1579
+ if (agent.identity) console.log(`SPIFFE identity verified: ${agent.identity.spiffe_id} (trust tier ${agent.identity.trust_tier})`);
1580
+ }
1581
+ if (agent.identityError) {
1582
+ printError(`Agent created, but SPIFFE identity verification failed: ${agent.identityError}\nRetry with: rine verify-identity --agent ${agent.id} --svid <jwt>`);
1583
+ process.exitCode = 1;
1569
1584
  }
1570
1585
  }));
1571
1586
  }
@@ -2239,6 +2254,24 @@ function registerStream(program) {
2239
2254
  });
2240
2255
  }
2241
2256
  //#endregion
2257
+ //#region src/commands/verify-identity.ts
2258
+ function printResult(result) {
2259
+ console.log(`SPIFFE identity verified for agent ${result.agent_id}`);
2260
+ console.log(` SPIFFE ID: ${result.spiffe_id}`);
2261
+ console.log(` Trust domain: ${result.trust_domain}`);
2262
+ console.log(` Trust tier: ${result.trust_tier}`);
2263
+ console.log(` Verified at: ${result.verified_at}`);
2264
+ }
2265
+ function registerVerifyIdentity(program) {
2266
+ program.command("verify-identity").description("Prove control of a SPIFFE identity for an agent (elevates the org to trust tier 2)").option("--agent <id>", "Agent UUID, handle, or name (defaults to the only agent)").option("--svid <jwt>", "A SPIFFE JWT-SVID. Required unless a Workload API auto-fetch is available.").action(withClient(program, async (ctx, opts) => {
2267
+ const agents = await fetchAgents(ctx.client);
2268
+ const agentId = await resolveAgent(ctx.apiUrl, agents, opts.agent, ctx.gOpts.as);
2269
+ const result = await verifyIdentitySpiffe(ctx.client, agentId, { svid: opts.svid });
2270
+ if (ctx.gOpts.json) printJson(result);
2271
+ else printResult(result);
2272
+ }));
2273
+ }
2274
+ //#endregion
2242
2275
  //#region src/commands/webhook.ts
2243
2276
  function registerWebhook(program) {
2244
2277
  const webhook = program.command("webhook").description("Manage webhooks");
@@ -2327,6 +2360,7 @@ registerKeys(program);
2327
2360
  registerStream(program);
2328
2361
  registerRelay(program);
2329
2362
  registerPollToken(program);
2363
+ registerVerifyIdentity(program);
2330
2364
  program.parse();
2331
2365
  //#endregion
2332
2366
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rine-network/cli",
3
- "version": "0.12.0",
3
+ "version": "0.13.1",
4
4
  "description": "CLI client for rine.network \u2014 EU-first messaging infrastructure for AI agents",
5
5
  "author": "mmmbs <mmmbs@proton.me>",
6
6
  "license": "EUPL-1.2",
@@ -28,7 +28,7 @@
28
28
  "dev": "tsx src/main.ts"
29
29
  },
30
30
  "dependencies": {
31
- "@rine-network/core": "^0.7.0",
31
+ "@rine-network/core": "^0.8.1",
32
32
  "commander": "^12.0.0",
33
33
  "eventsource-client": "^1.1.0"
34
34
  },