@credda/cli 0.1.1 → 0.1.3
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/LICENSE +21 -0
- package/README.md +290 -85
- package/dist/cli.d.ts +61 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1139 -49
- package/dist/cli.js.map +1 -1
- package/dist/index.js +24 -1
- package/dist/index.js.map +1 -1
- package/dist/listener.js +4 -4
- package/dist/listener.js.map +1 -1
- package/package.json +25 -14
- package/dist/cli.test.d.ts +0 -2
- package/dist/cli.test.d.ts.map +0 -1
- package/dist/cli.test.js +0 -159
- package/dist/cli.test.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Credda, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,85 +1,290 @@
|
|
|
1
|
-
# @credda/cli
|
|
2
|
-
|
|
3
|
-
The official Credda CLI
|
|
4
|
-
|
|
5
|
-
here** (the deterministic score is computed only by
|
|
6
|
-
`score.service`).
|
|
7
|
-
|
|
8
|
-
## Install
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
credda
|
|
40
|
-
credda
|
|
41
|
-
credda
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
credda
|
|
51
|
-
#
|
|
52
|
-
|
|
53
|
-
credda
|
|
54
|
-
credda
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
1
|
+
# @credda/cli
|
|
2
|
+
|
|
3
|
+
The official Credda CLI: portable trust from the terminal. A thin client over
|
|
4
|
+
[`@credda/js`](https://www.npmjs.com/package/@credda/js)'s headless export;
|
|
5
|
+
**no scoring logic lives here** (the deterministic score is computed only by
|
|
6
|
+
the API's `score.service`).
|
|
7
|
+
|
|
8
|
+
## Install
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install -g @credda/cli # or: pnpm add -g @credda/cli
|
|
12
|
+
credda help
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Node 20 or newer. Nothing else to configure for the public commands below.
|
|
16
|
+
|
|
17
|
+
Prefer not to install globally? `npx @credda/cli help` works the same way.
|
|
18
|
+
|
|
19
|
+
`credda help` always lists exactly what the version you installed can do, so
|
|
20
|
+
treat it, not this file, as the authority on your copy. `credda --version`
|
|
21
|
+
prints that version.
|
|
22
|
+
|
|
23
|
+
## Commands
|
|
24
|
+
|
|
25
|
+
Start here, if you hold a sandbox key (`CREDDA_API_KEY` of the `crd_test_`
|
|
26
|
+
kind; a live key is refused before anything happens):
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
credda quickstart # seed the sandbox with synthetic subjects, print
|
|
30
|
+
# their real scores, then close the counterparty-
|
|
31
|
+
# confirmation loop so you finish holding a real
|
|
32
|
+
# VERIFIED event rather than a number you read
|
|
33
|
+
--no-confirm # stop after the seed; skip the confirmation loop
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Public — no API key:
|
|
37
|
+
|
|
38
|
+
```sh
|
|
39
|
+
credda lookup <token> # trust check for a share token (GET /verify/:token)
|
|
40
|
+
credda export <token> # full self-verifying trust export bundle
|
|
41
|
+
credda verify <file|-> # OFFLINE-verify a credential someone handed you:
|
|
42
|
+
# a W3C VC-JWT, a compact Trust Credential, or a
|
|
43
|
+
# saved trust-export bundle — auto-detected.
|
|
44
|
+
# '-' reads stdin. Exit 0 valid / 2 invalid.
|
|
45
|
+
credda registry # federated trust registry (/.well-known)
|
|
46
|
+
credda did # issuer DID document
|
|
47
|
+
credda benchmarks # cohort-benchmark catalog: the dimensions you can
|
|
48
|
+
# benchmark on and the k-anonymity floor below
|
|
49
|
+
# which no cohort is disclosed
|
|
50
|
+
credda reason-codes # adverse-action reason-code catalog (ECOA / Reg B).
|
|
51
|
+
# Credda supplies the attribution only — it is not
|
|
52
|
+
# a creditor and issues no notice.
|
|
53
|
+
credda badges list # the closed set of Open Badges 3.0 achievements
|
|
54
|
+
credda badges get <badgeId> # this issuer will sign, and one definition
|
|
55
|
+
credda outcome-templates [industry]
|
|
56
|
+
# how a business maps its work to Credda events, and
|
|
57
|
+
# WHO confirms each outcome. Guidance only.
|
|
58
|
+
credda professional-record public <token>
|
|
59
|
+
# the professional record behind a share token —
|
|
60
|
+
# the token IS the subject's consent to present it
|
|
61
|
+
credda career-export --token <token>
|
|
62
|
+
# the whole verified record as a JSON Resume document,
|
|
63
|
+
# behind a share token (no API key sent)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Platform — set `CREDDA_API_KEY` (a `crd_live_…` platform key):
|
|
67
|
+
|
|
68
|
+
```sh
|
|
69
|
+
credda score <userId> # current score
|
|
70
|
+
credda explain <userId> # factor-level explanation
|
|
71
|
+
credda components <userId> # six named 0-100 components
|
|
72
|
+
credda risk <userId> # advisory risk signals
|
|
73
|
+
credda trust-summary <userId> [--narrative]
|
|
74
|
+
# deterministic, evidence-based summary + strengths
|
|
75
|
+
# + risks. It explains; it is never a verdict.
|
|
76
|
+
# --narrative adds an advisory AI retelling.
|
|
77
|
+
credda benchmark <userId> [--dimension <d>]
|
|
78
|
+
# where the subject sits in its cohort: percentile
|
|
79
|
+
# + the cohort distribution. `available:false`
|
|
80
|
+
# when the cohort is below the k-anonymity floor
|
|
81
|
+
# (insufficient_data) or the subject has no score
|
|
82
|
+
# yet (no_score).
|
|
83
|
+
credda distribution [--dimension <d>] [--cohort <c>]
|
|
84
|
+
# aggregate, k-anonymised cohort distribution.
|
|
85
|
+
# Omit --cohort for every cohort on the dimension.
|
|
86
|
+
credda users [--score-min <n>] [--score-max <n>] [--band <b>]
|
|
87
|
+
[--subject-type <PERSON|AGENT|ORGANIZATION>]
|
|
88
|
+
[--scored|--unscored] [--frozen]
|
|
89
|
+
[--active-since <iso>] [--registered-since <iso>]
|
|
90
|
+
[--registered-before <iso>] [--verified] [--min-verified <n>]
|
|
91
|
+
[--sort <score|lastActivity|registered|externalId>]
|
|
92
|
+
[--order <asc|desc>] [--cursor <c>] [--limit <n>]
|
|
93
|
+
# query + export your book of subjects. The filter
|
|
94
|
+
# set is closed and validated — no query DSL.
|
|
95
|
+
# A subject with no score yet reports null, never
|
|
96
|
+
# a placeholder; list those with --unscored.
|
|
97
|
+
credda book-summary [same filters as "users"]
|
|
98
|
+
# size a segment WITHOUT paging it: how many match,
|
|
99
|
+
# how many are scored, band mix, median/mean.
|
|
100
|
+
# Null (not 0) when nothing in it is scored.
|
|
101
|
+
credda usage [days] # your platform's metered usage (trailing window)
|
|
102
|
+
credda usage --from 2026-06-01 --to 2026-06-30
|
|
103
|
+
# explicit statement range (mutually exclusive
|
|
104
|
+
# with [days])
|
|
105
|
+
credda usage --csv usage.csv
|
|
106
|
+
# write the flat CSV statement to a file
|
|
107
|
+
# (raw ?format=csv fetch; combines with either window)
|
|
108
|
+
credda activity [--action <A>] [--from <t>] [--to <t>] [--cursor <c>] [--limit <n>]
|
|
109
|
+
# your platform's own activity/audit log,
|
|
110
|
+
# newest-first, cursor-paginated
|
|
111
|
+
credda verified-profile <userId>
|
|
112
|
+
# how much of a subject's CLAIMED record
|
|
113
|
+
# (education/skills/certifications/employment) is
|
|
114
|
+
# third-party verified. Counts WHETHER a claim is
|
|
115
|
+
# verified, never how prestigious it is — and can
|
|
116
|
+
# never move the Reliability Score.
|
|
117
|
+
credda qualify <userId> --category <education|skill|certification|employment>
|
|
118
|
+
[--label <l>] [--issuer <i>] [--verified-by <witness>]
|
|
119
|
+
# record a qualification claim. Always recorded;
|
|
120
|
+
# counts as VERIFIED only with a genuine
|
|
121
|
+
# third-party --verified-by witness.
|
|
122
|
+
credda professional-record get <userId>
|
|
123
|
+
# résumé-shaped summary of a VERIFIED work record.
|
|
124
|
+
# Describes a record — not a hiring verdict, a
|
|
125
|
+
# background check, or a consumer report.
|
|
126
|
+
credda professional-record credential <userId> [--ttl <seconds>]
|
|
127
|
+
# mint the signed, offline-verifiable credential
|
|
128
|
+
# (+ an "Add to LinkedIn" certification link)
|
|
129
|
+
credda reliability-report <userId> [--recent <n>] [--benchmark]
|
|
130
|
+
# the consolidated worker reliability report a
|
|
131
|
+
# staffing agency or employer weighs. EVIDENCE, not
|
|
132
|
+
# a hire / place / rank verdict or a consumer report.
|
|
133
|
+
# Use --token <token> for the public worker-consent
|
|
134
|
+
# route (NO API key).
|
|
135
|
+
credda career-export <userId>
|
|
136
|
+
# the whole verified record as an open JSON Resume
|
|
137
|
+
# document. Use --token <token> for the public route.
|
|
138
|
+
credda mint <userId> # mint a share token
|
|
139
|
+
credda revoke <userId> # revoke a share token
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Confirmation requests — the counterparty-confirmation primitive. You propose an
|
|
143
|
+
outcome and deliver the one-time token yourself; the event is written, verified,
|
|
144
|
+
only when that distinct party confirms:
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
credda confirmations create --user worker_7 --type CONTRACT_FULFILLED \
|
|
148
|
+
--counterparty client_42 --counterparty-name "Acme Ltd" \
|
|
149
|
+
--description "Kitchen refit" [--stake HIGH] [--value 1200] \
|
|
150
|
+
[--due <iso>] [--completed <iso>] [--return-url <url>] \
|
|
151
|
+
[--expires-in 14] [--idempotency-key <k>]
|
|
152
|
+
# needs CREDDA_API_KEY. The token is shown ONCE;
|
|
153
|
+
# creating a request writes no event.
|
|
154
|
+
credda confirmations batch <file.json> [--idempotency-key <k>]
|
|
155
|
+
# the ACTIVATION ENGINE — bulk-create up to 100
|
|
156
|
+
# requests from a JSON file (an array of request
|
|
157
|
+
# bodies, or { "requests": [...] }), warming a cold
|
|
158
|
+
# ledger from your book. Needs CREDDA_API_KEY; each
|
|
159
|
+
# ok item's token is shown ONCE.
|
|
160
|
+
credda confirmations list [--status PENDING] [--cursor <c>] [--limit <n>]
|
|
161
|
+
credda confirmations get <id>
|
|
162
|
+
credda confirmations cancel <id> # only while PENDING
|
|
163
|
+
|
|
164
|
+
# ⚠️ These two are the COUNTERPARTY's calls and take NO API key — they hold a
|
|
165
|
+
# token, not a Credda account:
|
|
166
|
+
credda confirmations preview <id> --token <t>
|
|
167
|
+
credda confirmations respond <id> --token <t> --confirm
|
|
168
|
+
credda confirmations respond <id> --token <t> --decline
|
|
169
|
+
# --confirm writes the verified event; --decline
|
|
170
|
+
# writes nothing. Single-use either way, and
|
|
171
|
+
# there is no default: you must say which.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Reference requests — the qualifications-half sibling of confirmations. A résumé
|
|
175
|
+
claim (employment / education / certification / skill) becomes verified when the
|
|
176
|
+
named third party who was there confirms it; a reference never moves the score:
|
|
177
|
+
|
|
178
|
+
```sh
|
|
179
|
+
credda references create --user worker_7 --category employment \
|
|
180
|
+
--counterparty manager_42 --label "Senior Engineer" \
|
|
181
|
+
--issuer "Acme Ltd" [--jurisdiction US-CA] [--reference EMP-9910] \
|
|
182
|
+
[--counterparty-name "Dana Lee"] [--description <d>] \
|
|
183
|
+
[--return-url <url>] [--expires-in 14] [--idempotency-key <k>]
|
|
184
|
+
# needs CREDDA_API_KEY. The token is shown ONCE;
|
|
185
|
+
# creating a request records no qualification.
|
|
186
|
+
credda references list [--status PENDING] [--cursor <c>] [--limit <n>]
|
|
187
|
+
credda references get <id>
|
|
188
|
+
credda references cancel <id> # only while PENDING
|
|
189
|
+
|
|
190
|
+
# ⚠️ These two are the REFERENCE's calls and take NO API key — they hold a
|
|
191
|
+
# token, not a Credda account:
|
|
192
|
+
credda references preview <id> --token <t>
|
|
193
|
+
credda references respond <id> --token <t> --confirm
|
|
194
|
+
credda references respond <id> --token <t> --decline
|
|
195
|
+
# --confirm records the verified qualification;
|
|
196
|
+
# --decline writes nothing. Single-use either way,
|
|
197
|
+
# and there is no default: you must say which.
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Threshold policies — declarative "tell me when this line is crossed", delivered
|
|
201
|
+
as `policy.threshold_crossed` through your webhooks. Config only: a policy never
|
|
202
|
+
reads into, blocks, or changes a score:
|
|
203
|
+
|
|
204
|
+
```sh
|
|
205
|
+
credda policies create --name "Watch 60" --user worker_7 \
|
|
206
|
+
--metric score --direction down --threshold 60
|
|
207
|
+
credda policies create --name "Anyone entering High Risk" --all \
|
|
208
|
+
--metric band --direction enter --band "High Risk"
|
|
209
|
+
credda policies list [--cursor <c>] [--limit <n>]
|
|
210
|
+
credda policies get <id>
|
|
211
|
+
credda policies update <id> [--threshold <n>] [--direction <d>] [--band <b>]
|
|
212
|
+
[--component <c>] [--name <n>] [--activate | --deactivate]
|
|
213
|
+
# the metric is immutable — delete and recreate
|
|
214
|
+
credda policies delete <id>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Score monitors — set `CREDDA_API_KEY`. Edge-triggered threshold/band watches
|
|
218
|
+
that deliver `monitor.triggered` through your subscribed webhooks;
|
|
219
|
+
notification config only — a monitor never affects a score:
|
|
220
|
+
|
|
221
|
+
```sh
|
|
222
|
+
credda monitors list [--cursor <c>] [--limit <n>]
|
|
223
|
+
credda monitors get <id>
|
|
224
|
+
credda monitors create --user <externalId> --below 40
|
|
225
|
+
# at least one condition required:
|
|
226
|
+
# --below <score> downward crossing (also fires
|
|
227
|
+
# on a FIRST score already below)
|
|
228
|
+
# --above <score> upward crossing
|
|
229
|
+
# --band-change any band change
|
|
230
|
+
credda monitors delete <id>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
Bulk screenings — set `CREDDA_API_KEY`. Async batch score reads (up to
|
|
234
|
+
10,000 ids per job), strictly read-only:
|
|
235
|
+
|
|
236
|
+
```sh
|
|
237
|
+
credda screen u1,u2 u3 # ids inline, comma/space separated
|
|
238
|
+
credda screen --file roster.csv
|
|
239
|
+
# one id per line, or a CSV whose FIRST column is
|
|
240
|
+
# the id (a leading id/userId/externalId header
|
|
241
|
+
# row is skipped; no quoted-CSV handling)
|
|
242
|
+
credda screen u1,u2 --wait # poll until the job finishes, print the summary
|
|
243
|
+
# (exit 1 if the job FAILED)
|
|
244
|
+
credda screenings list [--cursor <c>] [--limit <n>]
|
|
245
|
+
credda screenings get <id> # job status + summary
|
|
246
|
+
credda screenings results <id> # per-user results as JSON
|
|
247
|
+
credda screenings results <id> --csv out.csv
|
|
248
|
+
# write the CSV attachment instead (raw fetch)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Webhooks — set `CREDDA_API_KEY`:
|
|
252
|
+
|
|
253
|
+
```sh
|
|
254
|
+
credda webhooks list
|
|
255
|
+
credda webhooks create https://hooks.you/credda score.updated score.band_changed
|
|
256
|
+
# signing secret shown ONCE
|
|
257
|
+
credda webhooks delete <id>
|
|
258
|
+
credda webhooks test <id> # synthetic signed delivery
|
|
259
|
+
credda webhooks deliveries <id> # recent attempts, incl. retries
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
Local development:
|
|
263
|
+
|
|
264
|
+
```sh
|
|
265
|
+
CREDDA_WEBHOOK_SECRET=whsec_... credda listen 4141
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
`credda listen` runs a local receiver that HMAC-verifies each delivery (the
|
|
269
|
+
same check your production handler must do) and pretty-prints the payload.
|
|
270
|
+
Credda delivers to public HTTPS only, so expose the port with your own tunnel
|
|
271
|
+
(e.g. `cloudflared tunnel --url http://localhost:4141`) and register the
|
|
272
|
+
tunnel URL as the webhook — the Stripe-CLI-style local loop without Credda
|
|
273
|
+
running a tunneling service.
|
|
274
|
+
|
|
275
|
+
Environment: `CREDDA_API_URL` overrides the API base (default
|
|
276
|
+
`https://api.credda.io`); `CREDDA_WEBHOOK_SECRET` enables signature
|
|
277
|
+
verification in `credda listen`.
|
|
278
|
+
|
|
279
|
+
## Design
|
|
280
|
+
|
|
281
|
+
- `src/cli.ts` is the pure command router — no `process`, `fs`, or env access,
|
|
282
|
+
so the whole surface is unit-tested with a mocked `CreddaClient` (same
|
|
283
|
+
pattern as `packages/mcp`'s `tools.ts`).
|
|
284
|
+
- `src/index.ts` only wires the real environment (env vars, stdin/file
|
|
285
|
+
reading, exit codes).
|
|
286
|
+
- `verify` uses the SDK's offline verifiers (WebCrypto Ed25519 + StatusList
|
|
287
|
+
revocation) — the point is that a received credential can be checked
|
|
288
|
+
without trusting the wire it arrived on.
|
|
289
|
+
- Every command is read-only against the score. `mint`/`revoke` manage a
|
|
290
|
+
share token — a capability, not a score write.
|
package/dist/cli.d.ts
CHANGED
|
@@ -31,9 +31,68 @@ export interface CliContext {
|
|
|
31
31
|
port: number;
|
|
32
32
|
secret?: string;
|
|
33
33
|
}) => Promise<void>;
|
|
34
|
+
/**
|
|
35
|
+
* Raw authenticated GET returning the response body as text — for the CSV
|
|
36
|
+
* endpoints (`?format=csv`), which the typed SDK deliberately leaves to raw
|
|
37
|
+
* fetch. `path` is relative to the `/api/v1` prefix.
|
|
38
|
+
*/
|
|
39
|
+
fetchCsv?: (path: string, apiKey: string) => Promise<string>;
|
|
40
|
+
/** Write a file to disk (CSV outputs). Injected so the router stays fs-free. */
|
|
41
|
+
writeFile?: (path: string, content: string) => Promise<void>;
|
|
42
|
+
/** Sleep between `screen --wait` polls. Injected so tests don't wait. */
|
|
43
|
+
sleep?: (ms: number) => Promise<void>;
|
|
44
|
+
/** Poll interval for `screen --wait` (default 2000ms). */
|
|
45
|
+
pollIntervalMs?: number;
|
|
34
46
|
}
|
|
35
|
-
export declare const VERSION = "0.
|
|
36
|
-
export declare const HELP = "credda \u2014 portable trust from the terminal\n\nPublic (no API key):\n credda lookup <token> Trust check for a share token\n credda export <token> Full self-verifying trust export bundle\n credda verify <file|-> Offline-verify a credential: a W3C VC-JWT,\n a compact Trust Credential, or a saved trust\n export bundle (auto-detected). '-' = stdin.\n credda registry Federated trust registry\n credda did Issuer DID document\n\nPlatform (needs CREDDA_API_KEY):\n credda score <userId> Current score\n credda explain <userId> Factor-level score explanation\n credda components <userId> Six named 0-100 score components\n credda risk <userId> Advisory risk signals\n credda usage [days] Your platform's metered API usage\n credda mint <userId> Mint a share token for a user\n credda revoke <userId> Revoke a user's share token\n\nWebhooks (needs CREDDA_API_KEY):\n credda webhooks list Your webhook subscriptions\n credda webhooks create <url> <event..> Subscribe (secret shown ONCE)\n credda webhooks delete <id> Remove a webhook\n credda webhooks test <id> Send a synthetic signed delivery\n credda webhooks deliveries <id> Recent delivery attempts (incl. retries)\n\nLocal development:\n credda listen [port] Local webhook receiver: verifies each delivery's\n HMAC signature (CREDDA_WEBHOOK_SECRET) and\n pretty-prints the payload. Default port 4141.\n Credda delivers to public HTTPS only \u2014 expose\n this port with your own tunnel (e.g. cloudflared).\n\nEnvironment:\n CREDDA_API_URL API base (default https://api.credda.io)\n CREDDA_API_KEY Platform API key for keyed commands\n CREDDA_WEBHOOK_SECRET whsec_\u2026 signing secret for \"credda listen\"\n\nExit codes: 0 ok/valid \u00B7 1 error \u00B7 2 credential failed verification";
|
|
47
|
+
export declare const VERSION = "0.1.3";
|
|
48
|
+
export declare const HELP = "credda: portable trust from the terminal\n\nStart here (needs a sandbox CREDDA_API_KEY, the crd_test_ kind):\n credda quickstart Seed your sandbox with synthetic subjects, print\n their real scores, read one back, and then close\n the counterparty-confirmation loop end to end so\n you finish holding a real VERIFIED event, not\n just a number you read. One command, nothing\n written outside the sandbox.\n --no-confirm Stop after the seed; skip the confirmation loop.\n\nSandbox (crd_test_ keys only; a live key is refused before anything happens):\n credda sandbox seed Populate the sandbox with synthetic subjects.\n Idempotent: an already-seeded subject is left\n alone, never doubled.\n credda sandbox reset Wipe the sandbox and start over.\n\nPublic (no API key):\n credda lookup <token> Trust check for a share token\n credda export <token> Full self-verifying trust export bundle\n credda verify <file|-> Offline-verify a credential: a W3C VC-JWT,\n a compact Trust Credential, or a saved trust\n export bundle (auto-detected). '-' = stdin.\n credda registry Federated trust registry\n credda did Issuer DID document\n credda benchmarks Cohort-benchmark catalog (dimensions + k-anonymity)\n credda reason-codes Adverse-action reason-code catalog (ECOA / Reg B)\n credda outcome-templates [industry]\n How a real-world business maps its work to\n Credda events, and WHO confirms each outcome.\n Guidance only. Optional industry slug filters.\n credda badges list Open Badges 3.0 achievements this issuer signs\n credda badges get <badgeId> One achievement definition\n credda professional-record public <token>\n The professional record behind a share token\n (the subject's own consent to present it)\n credda career-export --token <token>\n The subject's whole verified record as a JSON\n Resume document, behind a share token (the\n subject's own consent, no API key sent)\n\nPlatform (needs CREDDA_API_KEY):\n credda score <userId> Current score\n credda explain <userId> Factor-level score explanation\n credda components <userId> Six named 0-100 score components\n credda risk <userId> Advisory risk signals\n credda trust-summary <userId> [--narrative]\n Deterministic, evidence-based trust summary\n (explains; never a verdict). --narrative adds an\n advisory AI retelling when the server has AI on.\n credda benchmark <userId> [--dimension <d>]\n Where a subject sits within its cohort:\n percentile + the cohort distribution\n credda distribution [--dimension <d>] [--cohort <c>]\n Aggregate, k-anonymised cohort distribution.\n Omit --cohort for every cohort on the dimension.\n credda users [--score-min <n>] [--score-max <n>] [--band <b>]\n [--subject-type <PERSON|AGENT|ORGANIZATION>] [--scored|--unscored] [--frozen]\n [--active-since <iso>] [--registered-since <iso>] [--registered-before <iso>]\n [--verified] [--min-verified <n>]\n [--sort <score|lastActivity|registered|externalId>] [--order <asc|desc>]\n [--cursor <c>] [--limit <n>]\n Query + export your book of subjects.\n A subject with no score yet reports null,\n never a placeholder; list those with\n --unscored.\n credda book-summary [same filters as \"users\"]\n Size a segment WITHOUT paging it: how many\n match, how many are scored, band mix and\n median/mean. Null (not 0) when nothing in the\n segment is scored.\n credda usage [days] [--from <date> --to <date>] [--csv <outfile>]\n Your platform's metered API usage. Either a\n trailing [days] window OR an inclusive\n --from/--to date range (YYYY-MM-DD), not both.\n --csv writes the flat CSV statement to a file.\n credda activity [--action <A>] [--from <t> --to <t>] [--cursor <c>] [--limit <n>]\n Your platform's own activity/audit log,\n newest-first, cursor-paginated\n credda verified-profile <userId>\n How much of a subject's CLAIMED record\n (education/skills/certifications/employment) is\n third-party verified. Counts whether a claim is\n verified, never how prestigious it is, and it\n can never move the Reliability Score.\n credda qualify <userId> --category <education|skill|certification|employment>\n [--label <l>] [--issuer <i>] [--verified-by <witness>]\n Record a qualification claim. Always recorded;\n counts as VERIFIED only with a genuine\n third-party --verified-by witness.\n credda professional-record get <userId>\n R\u00E9sum\u00E9-shaped summary of a VERIFIED work record.\n Describes a record, not a hiring verdict, a\n background check, or a consumer report.\n credda professional-record credential <userId> [--ttl <seconds>]\n Mint the signed, offline-verifiable Professional\n Record Credential (+ an \"Add to LinkedIn\" link)\n credda reliability-report <userId> [--recent <n>] [--benchmark]\n The consolidated worker reliability report a\n staffing agency or employer weighs: reliability,\n metrics, verified experience, tenure, ranked\n drivers, recent outcomes. EVIDENCE, not a hire /\n place / rank verdict, a background check, or a\n consumer report. Use --token <token> for the\n public worker-consent route (NO API key).\n credda career-export <userId> The subject's whole verified record as an open\n JSON Resume document (jsonresume.org). Describes\n a record, not a hiring verdict or a consumer\n report. Use --token <token> for the public route.\n credda mint <userId> Mint a share token for a user\n credda revoke <userId> Revoke a user's share token\n\nConfirmation requests: the counterparty-confirmation primitive. You PROPOSE an\noutcome and deliver the one-time token to the counterparty over YOUR OWN channel;\nthe event is written, verified, only when that distinct party confirms:\n credda confirmations create --user <externalId> --type <eventType>\n --counterparty <ref> [--counterparty-name <n>] [--description <d>]\n [--stake <HIGH|MEDIUM|LOW>] [--value <n>] [--due <iso>] [--completed <iso>]\n [--return-url <url>] [--expires-in <days>] [--idempotency-key <k>]\n Needs CREDDA_API_KEY. Token shown ONCE.\n credda confirmations batch <file.json> [--idempotency-key <k>]\n The ACTIVATION ENGINE: bulk-create up to 100\n requests from a JSON file (an array of request\n bodies, or { \"requests\": [...] }). Warms a cold\n ledger from your book. Needs CREDDA_API_KEY;\n each ok item's token is shown ONCE.\n credda confirmations list [--status <s>] [--cursor <c>] [--limit <n>]\n credda confirmations get <id>\n credda confirmations cancel <id>\n credda confirmations preview <id> --token <t>\n What the counterparty is asked to confirm.\n NO API key; the token is the capability.\n credda confirmations respond <id> --token <t> (--confirm | --decline)\n The counterparty's decision. NO API key.\n --confirm writes the event; --decline writes\n nothing. Single-use either way.\n\nReference requests: the qualifications-half sibling of confirmations. A r\u00E9sum\u00E9\nclaim (employment / education / certification / skill) becomes VERIFIED when the\nnamed third party who was there confirms it. Records no qualification and never\nmoves the reliability score:\n credda references create --user <externalId>\n --category <employment|education|certification|skill>\n --counterparty <ref> [--label <l>] [--issuer <i>] [--jurisdiction <j>]\n [--reference <r>] [--counterparty-name <n>] [--description <d>]\n [--return-url <url>] [--expires-in <days>] [--idempotency-key <k>]\n Needs CREDDA_API_KEY. Token shown ONCE.\n credda references list [--status <s>] [--cursor <c>] [--limit <n>]\n credda references get <id>\n credda references cancel <id>\n credda references preview <id> --token <t>\n What the reference is asked to confirm.\n NO API key; the token is the capability.\n credda references respond <id> --token <t> (--confirm | --decline)\n The reference's decision. NO API key.\n --confirm records the qualification; --decline\n writes nothing. Single-use either way.\n\nThreshold policies (needs CREDDA_API_KEY): declarative \"tell me when this line\nis crossed\"; delivers policy.threshold_crossed through your webhooks. Config\nonly: a policy never reads into, blocks, or changes a score:\n credda policies list [--cursor <c>] [--limit <n>]\n credda policies get <id>\n credda policies create --name <n> (--user <externalId> | --all)\n --metric <score|component|band|verified_events>\n [--direction <up|down|enter|leave>] [--threshold <n>]\n [--component <reliability|timeliness|trustworthiness|verification|consistency|momentum>]\n [--band <b>]\n credda policies update <id> [--name <n>] [--direction <d>] [--threshold <n>]\n [--component <c>] [--band <b>] [--activate | --deactivate]\n The metric is immutable; delete + recreate.\n credda policies delete <id>\n\nScore monitors (needs CREDDA_API_KEY): edge-triggered watches that deliver\n\"monitor.triggered\" through your webhooks; notification config only, a\nmonitor never affects a score:\n credda monitors list [--cursor <c>] [--limit <n>]\n credda monitors get <id>\n credda monitors create --user <externalId> [--below <score>] [--above <score>] [--band-change]\n At least one condition required. --below fires\n on a downward crossing (and on a first score\n already below it), --above on an upward\n crossing, --band-change on any band change.\n credda monitors delete <id>\n\nBulk screenings (needs CREDDA_API_KEY): async batch score reads, up to\n10,000 ids per job, strictly read-only:\n credda screen <ids...> Submit ids (comma/space separated), or:\n credda screen --file <path> One id per line, or a CSV whose FIRST column\n is the id (a leading \"id\"/\"userId\"/\n \"externalId\" header row is skipped).\n [--wait] Poll until the job finishes, then print the\n summary (exit 1 if the job FAILED).\n credda screenings list [--cursor <c>] [--limit <n>]\n credda screenings get <id> Job status + summary\n credda screenings results <id> [--csv <outfile>]\n Per-user results (JSON; --csv writes the CSV\n attachment to a file instead)\n\nWebhooks (needs CREDDA_API_KEY):\n credda webhooks list Your webhook subscriptions\n credda webhooks create <url> <event..> Subscribe (secret shown ONCE)\n credda webhooks delete <id> Remove a webhook\n credda webhooks test <id> Send a synthetic signed delivery\n credda webhooks deliveries <id> Recent delivery attempts (incl. retries)\n credda webhooks recent [event..] Recent events across ALL your endpoints\n (sample data for automation platforms;\n falls back to catalog examples, flagged\n isExample, when nothing has fired yet)\n\nLocal development:\n credda listen [port] Local webhook receiver: verifies each delivery's\n HMAC signature (CREDDA_WEBHOOK_SECRET) and\n pretty-prints the payload. Default port 4141.\n Credda delivers to public HTTPS only; expose\n this port with your own tunnel (e.g. cloudflared).\n\nEnvironment:\n CREDDA_API_URL API base (default https://api.credda.io)\n CREDDA_API_KEY Platform API key for keyed commands\n CREDDA_WEBHOOK_SECRET whsec_\u2026 signing secret for \"credda listen\"\n\nExit codes: 0 ok/valid \u00B7 1 error \u00B7 2 credential failed verification";
|
|
49
|
+
/** Raw-key prefix the API stamps on a sandbox key (lib/testMode.ts). */
|
|
50
|
+
export declare const TEST_KEY_PREFIX = "crd_test_";
|
|
51
|
+
/**
|
|
52
|
+
* A sandbox key, or an error that says exactly what to do next.
|
|
53
|
+
*
|
|
54
|
+
* The server refuses a live key anyway (`403 TEST_MODE_ONLY`), but a first-run
|
|
55
|
+
* user does not deserve a 403 to interpret — the prefix is visible locally, so
|
|
56
|
+
* the actionable message costs one string comparison. This is the "better
|
|
57
|
+
* first-run errors" rule applied to the single most likely first mistake.
|
|
58
|
+
*/
|
|
59
|
+
export declare function requireSandboxKey(ctx: CliContext): string;
|
|
60
|
+
/**
|
|
61
|
+
* Extra stderr lines for a failed command.
|
|
62
|
+
*
|
|
63
|
+
* The important one is the **request id**: it is the single fastest way for
|
|
64
|
+
* Credda to diagnose a failure, and a CLI user has nowhere else to find it.
|
|
65
|
+
* Also surfaces the machine code (so it can be looked up in
|
|
66
|
+
* `GET /api/v1/errors`) and any `Retry-After` the server asked for.
|
|
67
|
+
*
|
|
68
|
+
* Duck-typed rather than `instanceof CreddaError` on purpose — the router
|
|
69
|
+
* imports only TYPES from the SDK, so it stays pure and trivially mockable.
|
|
70
|
+
* Pure and exported for testing.
|
|
71
|
+
*/
|
|
72
|
+
export declare function errorHints(e: unknown): string[];
|
|
73
|
+
/**
|
|
74
|
+
* Tiny flag parser: `--name value` for valued flags, bare `--name` for
|
|
75
|
+
* booleans, everything else positional. Unknown `--flags` are an error rather
|
|
76
|
+
* than silently becoming positionals.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseFlags(args: string[], spec?: {
|
|
79
|
+
valued?: string[];
|
|
80
|
+
boolean?: string[];
|
|
81
|
+
}): {
|
|
82
|
+
positional: string[];
|
|
83
|
+
flags: Record<string, string | true>;
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Parse the ids for `credda screen`. Inline args may be comma- and/or
|
|
87
|
+
* space-separated. A file is one id per line — or a CSV, in which case only
|
|
88
|
+
* the FIRST column is read (a leading header row named id/userId/externalId
|
|
89
|
+
* is skipped). Deduped, order-preserving. Deliberately simple: no quoted-CSV
|
|
90
|
+
* handling — an id containing a comma isn't a valid external id anyway.
|
|
91
|
+
*/
|
|
92
|
+
export declare function parseIdList(input: {
|
|
93
|
+
inline?: string[];
|
|
94
|
+
fileText?: string;
|
|
95
|
+
}): string[];
|
|
37
96
|
/** Classify verify input: trust-export bundle JSON, VC-JWT, or compact credential. */
|
|
38
97
|
export declare function classifyCredentialInput(raw: string): {
|
|
39
98
|
kind: 'export';
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,WAAW,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,WAAW,EAUZ,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,YAAY,CAAC;IACrB,6EAA6E;IAC7E,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACnD,uDAAuD;IACvD,SAAS,EAAE;QACT,eAAe,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,CAAC;QACrE,oBAAoB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;QAC7D,WAAW,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;KACpE,CAAC;IACF,4EAA4E;IAC5E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,gFAAgF;IAChF,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,yEAAyE;IACzE,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,0DAA0D;IAC1D,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,eAAO,MAAM,OAAO,UAAU,CAAC;AAE/B,eAAO,MAAM,IAAI,otcA8NmD,CAAC;AASrE,wEAAwE;AACxE,eAAO,MAAM,eAAe,cAAc,CAAC;AAE3C;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,UAAU,GAAG,MAAM,CAWzD;AAiBD;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,EAAE,CAc/C;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EAAE,EACd,IAAI,GAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GACnD;IAAE,UAAU,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,CAAA;CAAE,CAuBhE;AA6DD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAwBrF;AAYD,sFAAsF;AACtF,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,MAAM,GACV;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,WAAW,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAcrH;AAED,6DAA6D;AAC7D,wBAAsB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,CAu7B7E"}
|