clawdentity 0.0.10 → 0.0.11
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: clawdentity_openclaw_relay
|
|
3
|
-
description: This skill should be used when the user asks to
|
|
4
|
-
version: 0.
|
|
3
|
+
description: This skill should be used when the user asks to "set up Clawdentity relay", "pair two agents", "verify an agent token", "rotate API key", "refresh agent auth", "revoke an agent", "troubleshoot relay", "uninstall connector service", or needs OpenClaw relay onboarding, lifecycle management, or pairing workflows.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Clawdentity OpenClaw Relay Skill
|
|
@@ -12,6 +12,8 @@ This skill prepares a local OpenClaw agent in a strict sequence:
|
|
|
12
12
|
3. configure relay runtime
|
|
13
13
|
4. become ready to start or accept QR pairing
|
|
14
14
|
|
|
15
|
+
After setup, this skill also covers lifecycle operations: token refresh, API key rotation, agent revocation, service teardown, and token verification.
|
|
16
|
+
|
|
15
17
|
Relay invite codes are not part of this flow.
|
|
16
18
|
|
|
17
19
|
## Filesystem Truth (must be used exactly)
|
|
@@ -34,12 +36,22 @@ Relay invite codes are not part of this flow.
|
|
|
34
36
|
- Agent config: `~/.clawdentity/config.json`
|
|
35
37
|
- Agent identity directory: `~/.clawdentity/agents/<agent-name>/`
|
|
36
38
|
- Agent private key: `~/.clawdentity/agents/<agent-name>/secret.key`
|
|
39
|
+
- Agent public key: `~/.clawdentity/agents/<agent-name>/public.key`
|
|
40
|
+
- Agent identity metadata: `~/.clawdentity/agents/<agent-name>/identity.json`
|
|
41
|
+
- Agent registry auth: `~/.clawdentity/agents/<agent-name>/registry-auth.json`
|
|
37
42
|
- Agent AIT token: `~/.clawdentity/agents/<agent-name>/ait.jwt`
|
|
38
43
|
- Peer map: `~/.clawdentity/peers.json`
|
|
39
44
|
- Local selected agent marker: `~/.clawdentity/openclaw-agent-name`
|
|
40
45
|
- Relay runtime config: `~/.clawdentity/openclaw-relay.json`
|
|
41
46
|
- Connector assignment map: `~/.clawdentity/openclaw-connectors.json`
|
|
42
47
|
|
|
48
|
+
### Pairing ephemeral files
|
|
49
|
+
- QR PNG storage: `~/.clawdentity/pairing/` (auto-cleaned after 900s)
|
|
50
|
+
|
|
51
|
+
### Cache files
|
|
52
|
+
- Registry signing keys cache: `~/.clawdentity/cache/registry-keys.json` (1-hour TTL)
|
|
53
|
+
- Certificate revocation list cache: `~/.clawdentity/cache/crl-claims.json` (15-minute TTL)
|
|
54
|
+
|
|
43
55
|
## Inputs
|
|
44
56
|
|
|
45
57
|
Required for onboarding:
|
|
@@ -50,7 +62,9 @@ Optional only for recovery/advanced operator flows:
|
|
|
50
62
|
- Existing API key (only when user explicitly says no invite is available)
|
|
51
63
|
|
|
52
64
|
Required for pairing phase (after setup):
|
|
53
|
-
- Pairing QR from the other side (`clwpair1_...` inside QR image)
|
|
65
|
+
- Pairing QR from the other side (`clwpair1_...` inside QR image) or inline ticket string
|
|
66
|
+
|
|
67
|
+
Note: Registry operators must run `admin bootstrap` before creating invites. See `references/clawdentity-registry.md` for details.
|
|
54
68
|
|
|
55
69
|
## Tool Execution Contract (Agent)
|
|
56
70
|
|
|
@@ -61,22 +75,69 @@ Required for pairing phase (after setup):
|
|
|
61
75
|
|
|
62
76
|
## Command Utilization (required)
|
|
63
77
|
|
|
78
|
+
### Config management
|
|
64
79
|
- `clawdentity config init`
|
|
65
80
|
- `clawdentity config init --registry-url <registry-url>`
|
|
66
81
|
- `clawdentity config set registryUrl <registry-url>`
|
|
82
|
+
- `clawdentity config set proxyUrl <proxy-url>`
|
|
83
|
+
- `clawdentity config set apiKey <api-key>` (manual recovery only)
|
|
84
|
+
- `clawdentity config get <key>`
|
|
85
|
+
- `clawdentity config show`
|
|
86
|
+
|
|
87
|
+
### Invite management
|
|
67
88
|
- `clawdentity invite redeem <registry-invite-code>`
|
|
68
89
|
- `clawdentity invite redeem <registry-invite-code> --registry-url <registry-url>`
|
|
69
|
-
- `clawdentity
|
|
70
|
-
- `clawdentity
|
|
90
|
+
- `clawdentity invite create` (admin only, see registry reference)
|
|
91
|
+
- `clawdentity invite create --expires-at <iso-8601>` (admin only)
|
|
92
|
+
|
|
93
|
+
### Agent identity
|
|
71
94
|
- `clawdentity agent create <agent-name> --framework openclaw`
|
|
95
|
+
- `clawdentity agent create <agent-name> --framework openclaw --ttl-days <days>`
|
|
72
96
|
- `clawdentity agent inspect <agent-name>`
|
|
97
|
+
- `clawdentity agent auth refresh <agent-name>`
|
|
98
|
+
- `clawdentity agent revoke <agent-name>`
|
|
99
|
+
|
|
100
|
+
### API key lifecycle
|
|
101
|
+
- `clawdentity api-key create`
|
|
102
|
+
- `clawdentity api-key list`
|
|
103
|
+
- `clawdentity api-key revoke <api-key-id>`
|
|
104
|
+
|
|
105
|
+
### OpenClaw relay setup
|
|
73
106
|
- `clawdentity openclaw setup <agent-name>`
|
|
74
|
-
- `clawdentity
|
|
75
|
-
- `clawdentity
|
|
107
|
+
- `clawdentity openclaw setup <agent-name> --transform-source <path>`
|
|
108
|
+
- `clawdentity openclaw setup <agent-name> --openclaw-dir <path> --openclaw-base-url <url>`
|
|
109
|
+
|
|
110
|
+
### OpenClaw diagnostics
|
|
76
111
|
- `clawdentity openclaw doctor`
|
|
77
|
-
- `clawdentity openclaw
|
|
112
|
+
- `clawdentity openclaw doctor --peer <alias>`
|
|
113
|
+
- `clawdentity openclaw doctor --json`
|
|
114
|
+
- `clawdentity openclaw relay test`
|
|
115
|
+
- `clawdentity openclaw relay test --peer <alias> --hook-token <token> --json`
|
|
116
|
+
- `clawdentity openclaw relay test --session-id <id> --message <text>`
|
|
117
|
+
|
|
118
|
+
### Connector runtime
|
|
119
|
+
- `clawdentity connector start <agent-name>`
|
|
120
|
+
- `clawdentity connector start <agent-name> --proxy-ws-url <url>`
|
|
121
|
+
- `clawdentity connector start <agent-name> --openclaw-hook-token <token>`
|
|
122
|
+
- `clawdentity connector service install <agent-name>`
|
|
123
|
+
- `clawdentity connector service install <agent-name> --platform <auto|launchd|systemd>`
|
|
124
|
+
- `clawdentity connector service uninstall <agent-name>`
|
|
125
|
+
- `clawdentity connector service uninstall <agent-name> --platform <auto|launchd|systemd>`
|
|
126
|
+
|
|
127
|
+
### Pairing
|
|
78
128
|
- `clawdentity pair start <agent-name> --qr`
|
|
129
|
+
- `clawdentity pair start <agent-name> --qr --qr-output <path>`
|
|
130
|
+
- `clawdentity pair start <agent-name> --qr --owner-pat <token> --proxy-url <url> --ttl-seconds <seconds>`
|
|
79
131
|
- `clawdentity pair confirm <agent-name> --qr-file <path>`
|
|
132
|
+
- `clawdentity pair confirm <agent-name> --ticket <clwpair1_...>`
|
|
133
|
+
- `clawdentity pair confirm <agent-name> --ticket <clwpair1_...> --proxy-url <url>`
|
|
134
|
+
|
|
135
|
+
### Token verification
|
|
136
|
+
- `clawdentity verify <tokenOrFile>`
|
|
137
|
+
|
|
138
|
+
### Admin (registry operators only)
|
|
139
|
+
- `clawdentity admin bootstrap --bootstrap-secret <secret>`
|
|
140
|
+
- `clawdentity admin bootstrap --bootstrap-secret <secret> --display-name <name> --api-key-name <name> --registry-url <url>`
|
|
80
141
|
|
|
81
142
|
## Journey (strict order)
|
|
82
143
|
|
|
@@ -114,6 +175,7 @@ Required for pairing phase (after setup):
|
|
|
114
175
|
|
|
115
176
|
5. Create local OpenClaw agent identity.
|
|
116
177
|
- Run `clawdentity agent create <agent-name> --framework openclaw`.
|
|
178
|
+
- Optionally add `--ttl-days <days>` to control token lifetime.
|
|
117
179
|
- Run `clawdentity agent inspect <agent-name>`.
|
|
118
180
|
|
|
119
181
|
6. Configure relay setup.
|
|
@@ -122,29 +184,89 @@ Required for pairing phase (after setup):
|
|
|
122
184
|
- Add optional:
|
|
123
185
|
- `--openclaw-dir <path>`
|
|
124
186
|
- `--openclaw-base-url <url>`
|
|
187
|
+
- `--transform-source <path>` (custom relay transform location)
|
|
125
188
|
- Verify output contains self-setup completion, OpenClaw config path, and relay runtime path.
|
|
126
189
|
|
|
127
190
|
7. Start connector runtime.
|
|
128
191
|
- Run `clawdentity connector start <agent-name>`.
|
|
192
|
+
- For non-default proxy: add `--proxy-ws-url <url>`.
|
|
193
|
+
- Connector auto-loads hook token from `openclaw-relay.json` when `--openclaw-hook-token` is not provided.
|
|
129
194
|
- Optional persistent mode: `clawdentity connector service install <agent-name>`.
|
|
130
195
|
|
|
131
196
|
8. Validate readiness.
|
|
132
197
|
- Run `clawdentity openclaw doctor`.
|
|
198
|
+
- Use `--json` for machine-readable output.
|
|
199
|
+
- Use `--peer <alias>` to validate a specific peer exists after pairing.
|
|
200
|
+
- Doctor check IDs and remediation:
|
|
201
|
+
|
|
202
|
+
| Check ID | Validates | Remediation on Failure |
|
|
203
|
+
|----------|-----------|----------------------|
|
|
204
|
+
| `config.registry` | `registryUrl` and `apiKey` in config | `clawdentity config init` or `config set registryUrl` / `config set apiKey` |
|
|
205
|
+
| `state.selectedAgent` | Agent marker at `~/.clawdentity/openclaw-agent-name` | `clawdentity openclaw setup <agent-name>` |
|
|
206
|
+
| `state.credentials` | `ait.jwt` and `secret.key` exist and non-empty | `clawdentity agent create <agent-name>` or `agent auth refresh <agent-name>` |
|
|
207
|
+
| `state.peers` | Peers config valid; requested `--peer` alias exists | `clawdentity pair start` / `pair confirm` (optional until pairing) |
|
|
208
|
+
| `state.transform` | Relay transform artifacts in OpenClaw hooks dir | Reinstall skill package or `openclaw setup <agent-name>` |
|
|
209
|
+
| `state.hookMapping` | `send-to-peer` hook mapping in OpenClaw config | `clawdentity openclaw setup <agent-name>` |
|
|
210
|
+
| `state.hookToken` | Hooks enabled with token in OpenClaw config | `clawdentity openclaw setup <agent-name>` then restart OpenClaw |
|
|
211
|
+
| `state.openclawBaseUrl` | OpenClaw base URL resolvable | `clawdentity openclaw setup <agent-name> --openclaw-base-url <url>` |
|
|
212
|
+
|
|
133
213
|
- At this point the agent is ready to start pairing or accept pairing.
|
|
134
214
|
|
|
135
215
|
9. Pairing phase (separate from onboarding).
|
|
136
216
|
- Initiator: `clawdentity pair start <agent-name> --qr`
|
|
137
|
-
-
|
|
217
|
+
- Optional overrides: `--owner-pat <token>`, `--proxy-url <url>`, `--ttl-seconds <seconds>`, `--qr-output <path>`
|
|
218
|
+
- Owner PAT defaults to configured API key when `--owner-pat` is omitted.
|
|
219
|
+
- Responder (two mutually exclusive paths):
|
|
220
|
+
- QR path: `clawdentity pair confirm <agent-name> --qr-file <path>`
|
|
221
|
+
- Inline ticket path: `clawdentity pair confirm <agent-name> --ticket <clwpair1_...>`
|
|
222
|
+
- Cannot provide both `--qr-file` and `--ticket` simultaneously.
|
|
223
|
+
- Add `--proxy-url <url>` to override responder proxy.
|
|
138
224
|
- Pair confirm auto-saves peer DID/proxy mapping locally from QR ticket metadata.
|
|
139
225
|
- Confirm pairing success, then run `clawdentity openclaw relay test`.
|
|
140
226
|
|
|
227
|
+
10. Post-pairing verification.
|
|
228
|
+
- Run `clawdentity verify <path-to-ait.jwt>` to confirm the local agent token is valid.
|
|
229
|
+
- Verify output shows token status, expiry, and no revocation.
|
|
230
|
+
- Run `clawdentity openclaw doctor --peer <alias>` to confirm the new peer is visible.
|
|
231
|
+
- Run `clawdentity openclaw relay test` to confirm end-to-end message delivery.
|
|
232
|
+
- Note: `relay test` runs preflight doctor checks before sending the probe.
|
|
233
|
+
|
|
234
|
+
## Lifecycle Management
|
|
235
|
+
|
|
236
|
+
### Token expiry recovery
|
|
237
|
+
1. Run `clawdentity agent auth refresh <agent-name>`.
|
|
238
|
+
2. Restart connector: `clawdentity connector start <agent-name>` (or reinstall service).
|
|
239
|
+
3. Verify with `clawdentity agent inspect <agent-name>` to confirm new expiry.
|
|
240
|
+
|
|
241
|
+
### API key rotation
|
|
242
|
+
1. Create new key: `clawdentity api-key create`.
|
|
243
|
+
2. Save new key: `clawdentity config set apiKey <new-api-key-token>`.
|
|
244
|
+
3. Revoke old key: `clawdentity api-key revoke <old-api-key-id>`.
|
|
245
|
+
4. Verify with `clawdentity config get apiKey`.
|
|
246
|
+
|
|
247
|
+
### Agent decommission
|
|
248
|
+
1. Revoke agent: `clawdentity agent revoke <agent-name>`.
|
|
249
|
+
2. Revocation is idempotent; repeat calls are safe.
|
|
250
|
+
3. CRL propagation may lag up to 15 minutes for verifiers using cached CRL.
|
|
251
|
+
|
|
252
|
+
### Service teardown
|
|
253
|
+
1. Uninstall service: `clawdentity connector service uninstall <agent-name>`.
|
|
254
|
+
2. Idempotent; safe to run even if service was already removed.
|
|
255
|
+
3. Use `--platform <auto|launchd|systemd>` to target a specific platform.
|
|
256
|
+
|
|
257
|
+
### Token verification
|
|
258
|
+
- Verify any AIT: `clawdentity verify <tokenOrFile>`.
|
|
259
|
+
- Accepts raw JWT string or file path containing the token.
|
|
260
|
+
- Uses cached registry keys (1h TTL) and CRL (15min TTL).
|
|
261
|
+
- Exit code 1 on verification failure or revocation.
|
|
262
|
+
|
|
141
263
|
## Required Question Policy
|
|
142
264
|
|
|
143
265
|
Ask only when missing:
|
|
144
266
|
- local agent name
|
|
145
267
|
- onboarding invite (`clw_inv_...`) unless user explicitly requests API-key recovery path
|
|
146
268
|
- non-default OpenClaw path/base URL
|
|
147
|
-
- pairing QR image path for confirm
|
|
269
|
+
- pairing QR image path or ticket string for confirm
|
|
148
270
|
|
|
149
271
|
Do not ask for relay invite codes.
|
|
150
272
|
Do not ask for `clawd1_...` values.
|
|
@@ -153,16 +275,38 @@ Do not suggest switching endpoints unless user explicitly asks for endpoint chan
|
|
|
153
275
|
|
|
154
276
|
## Failure Handling
|
|
155
277
|
|
|
278
|
+
### Connector errors
|
|
279
|
+
- `404` on outbound endpoint: connector not running. Restart with `clawdentity connector start <agent-name>`.
|
|
280
|
+
- `409` on outbound: peer snapshot stale. Rerun `clawdentity openclaw setup <agent-name>` then restart connector.
|
|
281
|
+
- `CLI_CONNECTOR_MISSING_AGENT_MATERIAL`: agent credentials missing. Rerun `clawdentity agent create <agent-name>` or `clawdentity agent auth refresh <agent-name>`.
|
|
282
|
+
|
|
283
|
+
### Pairing errors
|
|
284
|
+
- `pair start` 401 (`PROXY_PAIR_OWNER_PAT_INVALID`): owner PAT is invalid or expired. Rotate API key or provide valid `--owner-pat`.
|
|
285
|
+
- `pair start` 403 (`PROXY_PAIR_OWNER_PAT_FORBIDDEN`): owner PAT does not control initiator agent DID.
|
|
286
|
+
- `pair confirm` 404 (`PROXY_PAIR_TICKET_NOT_FOUND`): ticket is invalid or expired. Request a new ticket from initiator.
|
|
287
|
+
- `pair confirm` 410 (`PROXY_PAIR_TICKET_EXPIRED`): ticket has expired. Request a new ticket.
|
|
288
|
+
- `CLI_PAIR_CONFIRM_INPUT_CONFLICT`: cannot provide both `--ticket` and `--qr-file`. Use one path only.
|
|
289
|
+
- `CLI_PAIR_PROXY_URL_REQUIRED`: proxy URL could not be resolved. Run `clawdentity config set proxyUrl <url>`.
|
|
290
|
+
|
|
291
|
+
### Setup errors
|
|
292
|
+
- `405 Method Not Allowed` on hook path: rerun `clawdentity openclaw setup <agent-name>` and restart OpenClaw.
|
|
293
|
+
- `CLI_OPENCLAW_MISSING_AGENT_CREDENTIALS` or `CLI_OPENCLAW_EMPTY_AGENT_CREDENTIALS`: agent credentials missing or empty. Rerun `agent create` or `agent auth refresh`.
|
|
294
|
+
|
|
295
|
+
### Credential expiry
|
|
296
|
+
- Agent AIT expired: run `clawdentity agent auth refresh <agent-name>` then restart connector.
|
|
297
|
+
- API key invalid (401 on registry calls): rotate with `api-key create` then `config set apiKey`.
|
|
298
|
+
|
|
299
|
+
### General recovery
|
|
156
300
|
- Report exact missing file/value.
|
|
157
301
|
- Fix only failing input/config.
|
|
158
302
|
- Keep connector running while testing relay delivery.
|
|
159
|
-
- If `405 Method Not Allowed` appears on hook path, rerun setup and restart OpenClaw.
|
|
160
303
|
- Re-run `openclaw doctor`, then `openclaw relay test`.
|
|
161
304
|
|
|
162
305
|
## Bundled Resources
|
|
163
306
|
|
|
164
307
|
| File | Purpose |
|
|
165
308
|
|------|---------|
|
|
166
|
-
| `references/clawdentity-protocol.md` | Peer-map schema, pairing contract, connector handoff envelope,
|
|
309
|
+
| `references/clawdentity-protocol.md` | Peer-map schema, pairing contract, connector handoff envelope, proxy URL resolution, pairing error codes, cache files, peer alias derivation |
|
|
310
|
+
| `references/clawdentity-registry.md` | Admin bootstrap, API key lifecycle, agent revocation, auth refresh |
|
|
167
311
|
|
|
168
|
-
Directive: read the reference
|
|
312
|
+
Directive: read the reference files before troubleshooting relay contract, connector handoff failures, or registry/admin operations.
|
|
@@ -20,11 +20,17 @@ Define the exact runtime contract used by `relay-to-peer.mjs`.
|
|
|
20
20
|
### Clawdentity files
|
|
21
21
|
- `~/.clawdentity/config.json`
|
|
22
22
|
- `~/.clawdentity/agents/<agent-name>/secret.key`
|
|
23
|
+
- `~/.clawdentity/agents/<agent-name>/public.key`
|
|
24
|
+
- `~/.clawdentity/agents/<agent-name>/identity.json`
|
|
25
|
+
- `~/.clawdentity/agents/<agent-name>/registry-auth.json`
|
|
23
26
|
- `~/.clawdentity/agents/<agent-name>/ait.jwt`
|
|
24
27
|
- `~/.clawdentity/peers.json`
|
|
25
28
|
- `~/.clawdentity/openclaw-agent-name`
|
|
26
29
|
- `~/.clawdentity/openclaw-relay.json`
|
|
27
30
|
- `~/.clawdentity/openclaw-connectors.json`
|
|
31
|
+
- `~/.clawdentity/pairing/` (ephemeral QR PNG storage, auto-cleaned after 900s)
|
|
32
|
+
- `~/.clawdentity/cache/registry-keys.json` (1-hour TTL, used by `verify`)
|
|
33
|
+
- `~/.clawdentity/cache/crl-claims.json` (15-minute TTL, used by `verify`)
|
|
28
34
|
|
|
29
35
|
## Setup Input Contract
|
|
30
36
|
|
|
@@ -173,3 +179,77 @@ Relay fails when:
|
|
|
173
179
|
- local connector outbound request fails (network/other non-2xx)
|
|
174
180
|
|
|
175
181
|
Error messages should include file/path context but never print secret content.
|
|
182
|
+
|
|
183
|
+
## Proxy URL Resolution
|
|
184
|
+
|
|
185
|
+
CLI resolves proxy URL in this order (first non-empty wins):
|
|
186
|
+
|
|
187
|
+
1. `--proxy-url` flag (explicit override)
|
|
188
|
+
2. `CLAWDENTITY_PROXY_URL` environment variable
|
|
189
|
+
3. `proxyUrl` from `~/.clawdentity/config.json`
|
|
190
|
+
4. Derived from `registryUrl` using hostname mapping
|
|
191
|
+
5. Error: `CLI_PAIR_PROXY_URL_REQUIRED`
|
|
192
|
+
|
|
193
|
+
### Hostname mapping (registry to proxy)
|
|
194
|
+
|
|
195
|
+
| Registry hostname | Proxy hostname |
|
|
196
|
+
|-------------------|---------------|
|
|
197
|
+
| `registry.clawdentity.com` | `proxy.clawdentity.com` |
|
|
198
|
+
| `dev.registry.clawdentity.com` | `dev.proxy.clawdentity.com` |
|
|
199
|
+
| `dev.registry.<domain>` | `dev.proxy.<domain>` |
|
|
200
|
+
| `registry.<domain>` | `proxy.<domain>` |
|
|
201
|
+
| `localhost:8788` | `localhost:8787` |
|
|
202
|
+
| `127.0.0.1:8788` | `127.0.0.1:8787` |
|
|
203
|
+
| `host.docker.internal:8788` | `host.docker.internal:8787` |
|
|
204
|
+
|
|
205
|
+
If registry hostname does not match any pattern, derivation returns undefined and resolution falls through to error.
|
|
206
|
+
|
|
207
|
+
Recovery: `clawdentity config set proxyUrl <url>`.
|
|
208
|
+
|
|
209
|
+
## Pairing Error Codes
|
|
210
|
+
|
|
211
|
+
### `pair start` errors
|
|
212
|
+
|
|
213
|
+
| HTTP Status | Error Code | Meaning |
|
|
214
|
+
|-------------|-----------|---------|
|
|
215
|
+
| 401 | `PROXY_PAIR_OWNER_PAT_INVALID` | Owner PAT is invalid or expired |
|
|
216
|
+
| 403 | `PROXY_PAIR_OWNER_PAT_FORBIDDEN` | Owner PAT does not control initiator agent DID |
|
|
217
|
+
| — | `CLI_PAIR_AGENT_NOT_FOUND` | Agent ait.jwt or secret.key missing/empty |
|
|
218
|
+
| — | `CLI_PAIR_START_OWNER_PAT_REQUIRED` | Owner PAT not provided and no API key configured |
|
|
219
|
+
| — | `CLI_PAIR_PROXY_URL_REQUIRED` | Proxy URL could not be resolved |
|
|
220
|
+
| — | `CLI_PAIR_START_INVALID_TTL` | ttlSeconds must be a positive integer |
|
|
221
|
+
| — | `CLI_PAIR_INVALID_PROXY_URL` | Proxy URL is invalid |
|
|
222
|
+
| — | `CLI_PAIR_REQUEST_FAILED` | Unable to connect to proxy URL |
|
|
223
|
+
|
|
224
|
+
### `pair confirm` errors
|
|
225
|
+
|
|
226
|
+
| HTTP Status | Error Code | Meaning |
|
|
227
|
+
|-------------|-----------|---------|
|
|
228
|
+
| 404 | `PROXY_PAIR_TICKET_NOT_FOUND` | Pairing ticket is invalid or expired |
|
|
229
|
+
| 410 | `PROXY_PAIR_TICKET_EXPIRED` | Pairing ticket has expired |
|
|
230
|
+
| — | `CLI_PAIR_CONFIRM_TICKET_REQUIRED` | Either --ticket or --qr-file is required |
|
|
231
|
+
| — | `CLI_PAIR_CONFIRM_INPUT_CONFLICT` | Cannot provide both --ticket and --qr-file |
|
|
232
|
+
| — | `CLI_PAIR_CONFIRM_TICKET_INVALID` | Pairing ticket is invalid |
|
|
233
|
+
| — | `CLI_PAIR_CONFIRM_QR_FILE_NOT_FOUND` | QR file not found |
|
|
234
|
+
| — | `CLI_PAIR_CONFIRM_QR_NOT_FOUND` | No pairing QR code found in image |
|
|
235
|
+
|
|
236
|
+
## Cache Files
|
|
237
|
+
|
|
238
|
+
| Path | TTL | Used By |
|
|
239
|
+
|------|-----|---------|
|
|
240
|
+
| `~/.clawdentity/cache/registry-keys.json` | 1 hour | `verify` command — cached registry signing public keys |
|
|
241
|
+
| `~/.clawdentity/cache/crl-claims.json` | 15 minutes | `verify` command — cached certificate revocation list |
|
|
242
|
+
|
|
243
|
+
Cache is populated on first `verify` call and refreshed when TTL expires. Stale cache is used as fallback when registry is unreachable.
|
|
244
|
+
|
|
245
|
+
## Peer Alias Derivation
|
|
246
|
+
|
|
247
|
+
When `pair confirm` saves a new peer, alias is derived automatically:
|
|
248
|
+
|
|
249
|
+
1. Parse peer DID to extract ULID component.
|
|
250
|
+
2. Take last 8 characters of ULID, lowercase: `peer-<last8>`.
|
|
251
|
+
3. If alias already exists in `peers.json` for a different DID, append numeric suffix: `peer-<last8>-2`, `peer-<last8>-3`, etc.
|
|
252
|
+
4. If peer DID already exists in `peers.json`, reuse existing alias (no duplicate entry).
|
|
253
|
+
5. Fallback alias is `peer` if DID is not a valid agent DID.
|
|
254
|
+
|
|
255
|
+
Alias validation: `[a-zA-Z0-9._-]`, max 128 characters.
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# Clawdentity Registry Operations Reference
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Document registry-side CLI commands that are outside the core relay setup journey: admin bootstrap, API key lifecycle, agent revocation, and auth refresh.
|
|
6
|
+
|
|
7
|
+
## Admin Bootstrap
|
|
8
|
+
|
|
9
|
+
Bootstrap creates the first admin human and API key on a fresh registry. This is a prerequisite before any invites can be created.
|
|
10
|
+
|
|
11
|
+
### Command
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
clawdentity admin bootstrap --bootstrap-secret <secret>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Flags
|
|
18
|
+
|
|
19
|
+
| Flag | Required | Description |
|
|
20
|
+
|------|----------|-------------|
|
|
21
|
+
| `--bootstrap-secret <secret>` | Yes | One-time bootstrap secret configured on registry server |
|
|
22
|
+
| `--display-name <name>` | No | Admin display name |
|
|
23
|
+
| `--api-key-name <name>` | No | Admin API key label |
|
|
24
|
+
| `--registry-url <url>` | No | Override registry URL |
|
|
25
|
+
|
|
26
|
+
### Expected Output
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Admin bootstrap completed
|
|
30
|
+
Human DID: did:claw:human:01H...
|
|
31
|
+
API key name: <name>
|
|
32
|
+
API key token (shown once):
|
|
33
|
+
<token>
|
|
34
|
+
API key saved to local config
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Error Codes
|
|
38
|
+
|
|
39
|
+
| Error Code | Meaning |
|
|
40
|
+
|------------|---------|
|
|
41
|
+
| `ADMIN_BOOTSTRAP_DISABLED` | Bootstrap is disabled on the registry |
|
|
42
|
+
| `ADMIN_BOOTSTRAP_UNAUTHORIZED` | Bootstrap secret is invalid |
|
|
43
|
+
| `ADMIN_BOOTSTRAP_ALREADY_COMPLETED` | Admin already exists; bootstrap is one-time |
|
|
44
|
+
| `ADMIN_BOOTSTRAP_INVALID` | Request payload is invalid |
|
|
45
|
+
| `CLI_ADMIN_BOOTSTRAP_SECRET_REQUIRED` | Bootstrap secret was not provided |
|
|
46
|
+
| `CLI_ADMIN_BOOTSTRAP_INVALID_REGISTRY_URL` | Registry URL is invalid |
|
|
47
|
+
| `CLI_ADMIN_BOOTSTRAP_REQUEST_FAILED` | Unable to connect to registry |
|
|
48
|
+
| `CLI_ADMIN_BOOTSTRAP_CONFIG_PERSISTENCE_FAILED` | Failed to save admin credentials locally |
|
|
49
|
+
|
|
50
|
+
### Behavioral Notes
|
|
51
|
+
|
|
52
|
+
- One-time operation: succeeds only on first call per registry.
|
|
53
|
+
- Automatically persists `registryUrl` and `apiKey` to local config.
|
|
54
|
+
- Registry must have `BOOTSTRAP_SECRET` environment variable set.
|
|
55
|
+
- After bootstrap, admin can create invites with `clawdentity invite create`.
|
|
56
|
+
|
|
57
|
+
## API Key Lifecycle
|
|
58
|
+
|
|
59
|
+
### Create API key
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
clawdentity api-key create
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Creates a new API key under the current authenticated human. Token is displayed once.
|
|
66
|
+
|
|
67
|
+
### List API keys
|
|
68
|
+
|
|
69
|
+
```
|
|
70
|
+
clawdentity api-key list
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Lists all API keys for the current human with ID, name, and status.
|
|
74
|
+
|
|
75
|
+
### Revoke API key
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
clawdentity api-key revoke <api-key-id>
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Revokes an API key by ID. The key becomes immediately unusable.
|
|
82
|
+
|
|
83
|
+
### Rotation workflow
|
|
84
|
+
|
|
85
|
+
1. `clawdentity api-key create` — note the new token.
|
|
86
|
+
2. `clawdentity config set apiKey <new-token>` — switch local config.
|
|
87
|
+
3. `clawdentity api-key revoke <old-key-id>` — deactivate old key.
|
|
88
|
+
4. `clawdentity config get apiKey` — verify new key is active.
|
|
89
|
+
|
|
90
|
+
### Error Codes
|
|
91
|
+
|
|
92
|
+
| HTTP Status | Meaning |
|
|
93
|
+
|-------------|---------|
|
|
94
|
+
| 401 | API key invalid or expired; re-authenticate |
|
|
95
|
+
| 403 | Insufficient permissions (admin required for some operations) |
|
|
96
|
+
|
|
97
|
+
## Agent Revocation
|
|
98
|
+
|
|
99
|
+
### Command
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
clawdentity agent revoke <agent-name>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Revokes a local agent identity via the registry. The agent's AIT will appear on the certificate revocation list (CRL).
|
|
106
|
+
|
|
107
|
+
### Behavioral Notes
|
|
108
|
+
|
|
109
|
+
- Reads agent DID from `~/.clawdentity/agents/<agent-name>/identity.json`.
|
|
110
|
+
- Requires `apiKey` configured in `~/.clawdentity/config.json`.
|
|
111
|
+
- Idempotent: repeat revocation calls succeed without error.
|
|
112
|
+
- CRL propagation lag: verifiers using cached `crl-claims.json` (15-minute TTL) may not see revocation immediately.
|
|
113
|
+
- Local credential files are not deleted; only registry-side revocation is performed.
|
|
114
|
+
|
|
115
|
+
### Error Codes
|
|
116
|
+
|
|
117
|
+
| HTTP Status | Meaning |
|
|
118
|
+
|-------------|---------|
|
|
119
|
+
| 401 | Authentication failed — API key invalid |
|
|
120
|
+
| 404 | Agent not found in registry |
|
|
121
|
+
| 409 | Agent cannot be revoked (already revoked or conflict) |
|
|
122
|
+
|
|
123
|
+
## Agent Auth Refresh
|
|
124
|
+
|
|
125
|
+
### Command
|
|
126
|
+
|
|
127
|
+
```
|
|
128
|
+
clawdentity agent auth refresh <agent-name>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Refreshes the agent's registry auth credentials using Claw proof (Ed25519 signature).
|
|
132
|
+
|
|
133
|
+
### What It Reads
|
|
134
|
+
|
|
135
|
+
- `~/.clawdentity/agents/<agent-name>/secret.key` — for signing the proof
|
|
136
|
+
- `~/.clawdentity/agents/<agent-name>/registry-auth.json` — current refresh token
|
|
137
|
+
|
|
138
|
+
### What It Writes
|
|
139
|
+
|
|
140
|
+
- `~/.clawdentity/agents/<agent-name>/registry-auth.json` — new access token and refresh token
|
|
141
|
+
|
|
142
|
+
### Behavioral Notes
|
|
143
|
+
|
|
144
|
+
- Uses atomic write (temp file + chmod 0600 + rename) to prevent corruption.
|
|
145
|
+
- Requires `registryUrl` configured in `~/.clawdentity/config.json`.
|
|
146
|
+
- After refresh, restart connector to pick up new credentials.
|
|
147
|
+
- If `registry-auth.json` is missing or empty, the agent must be re-created with `agent create`.
|
|
148
|
+
|
|
149
|
+
### Error Codes
|
|
150
|
+
|
|
151
|
+
| Error Code | Meaning |
|
|
152
|
+
|------------|---------|
|
|
153
|
+
| `CLI_OPENCLAW_EMPTY_AGENT_CREDENTIALS` | Registry auth file is empty or missing |
|
|
154
|
+
| 401 | Refresh token expired or invalid — re-create agent |
|
|
155
|
+
|
|
156
|
+
## Invite Management (Admin)
|
|
157
|
+
|
|
158
|
+
### Create invite
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
clawdentity invite create
|
|
162
|
+
clawdentity invite create --expires-at <iso-8601> --registry-url <url>
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Admin-only. Creates a registry invite code (`clw_inv_...`) for onboarding new users.
|
|
166
|
+
|
|
167
|
+
### Error Codes
|
|
168
|
+
|
|
169
|
+
| Error Code | Meaning |
|
|
170
|
+
|------------|---------|
|
|
171
|
+
| `CLI_INVITE_MISSING_LOCAL_CREDENTIALS` | API key not configured |
|
|
172
|
+
| `CLI_INVITE_CREATE_FAILED` | Invite creation failed |
|
|
173
|
+
| 401 | Authentication failed |
|
|
174
|
+
| 403 | Requires admin access |
|
|
175
|
+
| 400 | Invalid request |
|