@agenticprimitives/key-custody 1.0.0-alpha.11 → 1.0.0-alpha.13

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.
@@ -1,16 +1,26 @@
1
1
  #!/usr/bin/env node
2
- // ap-provision-gcp — provision GCP Cloud KMS secp256k1 signing keys for a set of
3
- // signing identities, grant the runtime service account roles/cloudkms.signer
4
- // per key, and print the identity → key-version map + derived EVM addresses
5
- // (spec 276 KCS-D3). Thin Node wrapper over @agenticprimitives/key-custody/provision-gcp.
2
+ // ap-provision-gcp — provision GCP Cloud KMS keys for a set of identities, grant the
3
+ // runtime service account a per-key IAM role, and print the identity → key map (+
4
+ // derived EVM addresses for signing keys) (spec 276 KCS-D3). Thin Node wrapper over
5
+ // @agenticprimitives/key-custody/provision-gcp.
6
6
  //
7
+ // # secp256k1 signing keys (default):
7
8
  // ap-provision-gcp \
8
9
  // --project my-proj --location us-east1 --keyring my-ring \
9
10
  // --service-account runtime@my-proj.iam.gserviceaccount.com \
10
11
  // --identities signer-a,signer-b [--protection HSM] [--dry-run]
11
12
  //
12
- // --dry-run prints the gcloud steps without executing. Requires `gcloud` on PATH
13
- // (authenticated) for a real run.
13
+ // # symmetric per-person vault KEKs (spec 278) — identities are person SA addresses:
14
+ // ap-provision-gcp --purpose encrypt-decrypt \
15
+ // --project my-proj --location us-east1 --keyring vault-keks \
16
+ // --service-account demo-mcp-runtime@my-proj.iam.gserviceaccount.com \
17
+ // --identities 0xPersonSA1,0xPersonSA2
18
+ //
19
+ // --purpose encrypt-decrypt mints GOOGLE_SYMMETRIC_ENCRYPTION KEKs + grants the runtime SA
20
+ // roles/cloudkms.cryptoKeyEncrypterDecrypter per key; the printed keyMap entry (the version-less
21
+ // cryptoKey resource) is the `kmsKeyRef` the spec-278 VaultKeyBinding carries. --iam-role
22
+ // overrides the granted role. --dry-run prints the gcloud steps without executing. Requires
23
+ // `gcloud` on PATH (authenticated) for a real run.
14
24
  import { execFileSync } from 'node:child_process';
15
25
  import { planGcpProvision, executeGcpProvision } from '../dist/kms/provision-gcp.js';
16
26
 
@@ -35,7 +45,13 @@ const required = ['project', 'location', 'keyring', 'service-account', 'identiti
35
45
  const missing = required.filter((k) => !args[k]);
36
46
  if (missing.length) {
37
47
  console.error(`ap-provision-gcp: missing required flag(s): ${missing.map((m) => '--' + m).join(', ')}`);
38
- console.error('Usage: ap-provision-gcp --project <p> --location <l> --keyring <r> --service-account <email> --identities a,b[,c] [--protection HSM|SOFTWARE] [--dry-run]');
48
+ console.error('Usage: ap-provision-gcp --project <p> --location <l> --keyring <r> --service-account <email> --identities a,b[,c] [--purpose asymmetric-signing|encrypt-decrypt] [--iam-role <role>] [--protection HSM|SOFTWARE] [--dry-run]');
49
+ process.exit(2);
50
+ }
51
+
52
+ const purpose = args.purpose ?? 'asymmetric-signing';
53
+ if (!['asymmetric-signing', 'encrypt-decrypt'].includes(purpose)) {
54
+ console.error(`ap-provision-gcp: --purpose must be 'asymmetric-signing' or 'encrypt-decrypt' (got '${purpose}')`);
39
55
  process.exit(2);
40
56
  }
41
57
 
@@ -46,6 +62,8 @@ const plan = {
46
62
  identities: String(args.identities).split(',').map((s) => s.trim()).filter(Boolean),
47
63
  runtimeServiceAccount: args['service-account'],
48
64
  protectionLevel: args.protection ?? 'HSM',
65
+ purpose,
66
+ ...(args['iam-role'] ? { iamRole: args['iam-role'] } : {}),
49
67
  };
50
68
 
51
69
  if (args['dry-run']) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticprimitives/key-custody",
3
- "version": "1.0.0-alpha.11",
3
+ "version": "1.0.0-alpha.13",
4
4
  "description": "Pluggable envelope encryption + signers + HMAC providers (local-AES / AWS KMS / GCP KMS). Pure crypto primitives; no session lifecycle (that's in delegation).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -76,9 +76,9 @@
76
76
  },
77
77
  "peerDependencies": {
78
78
  "viem": "^2.52.2",
79
- "@agenticprimitives/audit": "1.0.0-alpha.11",
80
- "@agenticprimitives/connect-auth": "1.0.0-alpha.11",
81
- "@agenticprimitives/types": "1.0.0-alpha.11"
79
+ "@agenticprimitives/audit": "1.0.0-alpha.13",
80
+ "@agenticprimitives/connect-auth": "1.0.0-alpha.13",
81
+ "@agenticprimitives/types": "1.0.0-alpha.13"
82
82
  },
83
83
  "peerDependenciesMeta": {
84
84
  "@agenticprimitives/audit": {