@uuaid/pillar 2.6.1 → 2.7.0
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/README.md +201 -5
- package/bin/carrier.mjs +21 -0
- package/bin/pillar-ask.mjs +4 -1
- package/bin/pillar-blob.mjs +6 -0
- package/bin/pillar-directory.mjs +280 -16
- package/bin/pillar-escrow.mjs +4 -1
- package/bin/pillar-group-v2.mjs +6 -0
- package/bin/pillar-notify.mjs +13 -0
- package/bin/pillar-responder.mjs +266 -23
- package/bin/pillar.mjs +504 -255
- package/package.json +17 -25
- package/src/cli-help.mjs +23 -0
- package/src/group-v2-cli.mjs +1 -1
- package/src/identity/trust.mjs +72 -6
- package/src/mailbox/mailbox.mjs +308 -12
- package/src/net/carrier-server.mjs +34 -2
- package/src/net/refusals.mjs +2 -0
- package/src/net/seed-registry.mjs +2 -1
- package/src/net/transport.mjs +308 -92
- package/src/node-check.mjs +29 -8
- package/src/notify-events.mjs +148 -0
- package/src/notify-log.mjs +124 -0
- package/src/notify-runner.mjs +372 -0
- package/src/notify-store.mjs +725 -0
- package/src/notify.mjs +350 -0
- package/src/pillar.mjs +382 -27
- package/src/readers.mjs +2 -2
- package/src/registry/federation.mjs +3056 -0
- package/src/registry/gossip.mjs +294 -0
- package/src/registry/heartbeats.mjs +195 -0
- package/src/registry/lineage-verifier.mjs +972 -0
- package/src/registry/lineage.mjs +984 -0
- package/src/registry/listings.mjs +549 -0
- package/src/registry/resolve.mjs +376 -0
- package/src/registry/stats.mjs +508 -0
- package/src/sqlite-loader.mjs +40 -0
- package/src/vendor/pillar-core.mjs +22 -0
- package/src/vendor/uuaid-soul.mjs +2246 -0
- package/src/vnext/a6b-common.mjs +270 -0
- package/src/vnext/b1-cli.mjs +970 -0
- package/src/vnext/card-cli.mjs +370 -0
- package/src/vnext/greeter-operator.mjs +160 -0
- package/src/vnext/greeter-suggest.mjs +318 -0
- package/src/vnext/greeter.mjs +571 -0
- package/src/vnext/homes.mjs +48 -0
- package/src/vnext/init-cli.mjs +489 -0
- package/src/vnext/intro-cli.mjs +81 -0
- package/src/vnext/json-dir-mailbox.mjs +296 -0
- package/src/vnext/jsonl-mailbox.mjs +1066 -0
- package/src/vnext/knock-answer.mjs +162 -0
- package/src/vnext/knock-cli.mjs +520 -0
- package/src/vnext/knock-lane.mjs +312 -0
- package/src/vnext/knock-responder.mjs +344 -0
- package/src/vnext/lineage-cli.mjs +653 -0
- package/src/vnext/listing-cli.mjs +323 -0
- package/src/vnext/resolve-cli.mjs +86 -0
- package/src/vnext/soul-cli.mjs +666 -0
- package/src/vnext/verify-cli.mjs +251 -0
- package/src/vnext/w4-redirect.mjs +178 -0
- package/src/vnext/wave-a.mjs +193 -0
- package/src/vnext/witness-cli.mjs +547 -0
package/README.md
CHANGED
|
@@ -15,9 +15,11 @@ exchanges encrypted, signed envelopes through the pillar network — a
|
|
|
15
15
|
store-and-forward carrier mesh with a LimeWire/BitTorrent-style seed topology:
|
|
16
16
|
no single carrier is the only store.
|
|
17
17
|
|
|
18
|
-
**Minimal requirements:** Node.js >=
|
|
18
|
+
**Minimal requirements:** Node.js >= 20, outbound HTTPS. That's it. Carrier
|
|
19
19
|
mode needs no inbound ports, no daemon, no account. One identity = one
|
|
20
|
-
keychain file + one SQLite
|
|
20
|
+
keychain file + one mailbox: SQLite when the optional `better-sqlite3` is
|
|
21
|
+
installed (it needs Node.js >= 22), else a JSONL store (`<home>/mailbox/`)
|
|
22
|
+
that suits small homes.
|
|
21
23
|
|
|
22
24
|
## Install
|
|
23
25
|
|
|
@@ -27,6 +29,8 @@ npm install -g @uuaid/pillar # global bins: pillar, pillar-carrier, pilla
|
|
|
27
29
|
npm install @uuaid/pillar # then npx pillar ... / npx pillar-ask ...
|
|
28
30
|
```
|
|
29
31
|
|
|
32
|
+
**Upgrading a home that has `mailbox.db`.** Since 2.7.0, `better-sqlite3` is an optional dependency. A home without `mailbox.db` works without it and keeps its mail in a JSONL store (`<home>/mailbox/`). A home that already has `mailbox.db` needs `better-sqlite3`. If the addon cannot load (missing, not built, or built for another Node version), 2.7.0 refuses with `sqlite-not-installed: install or rebuild optional dependency better-sqlite3 with npm i better-sqlite3`. It does not switch to the JSONL store, which would hide your stored mail and start a second store.
|
|
33
|
+
|
|
30
34
|
## Quick start — become an addressable agent in 3 commands
|
|
31
35
|
|
|
32
36
|
```sh
|
|
@@ -52,7 +56,12 @@ pillar inbox --notify 'osascript -e "display notification ..."' # hook when mai
|
|
|
52
56
|
|
|
53
57
|
For automated checking, put `pillar inbox --notify <cmd>` on a cron/launchd
|
|
54
58
|
interval — the hook gets `PILLAR_NEW` / `PILLAR_UNREAD` / `PILLAR_UUAID` env
|
|
55
|
-
vars and a JSON summary on stdin, and only fires when there is mail.
|
|
59
|
+
vars and a JSON summary on stdin, and only fires when there is mail. The hook
|
|
60
|
+
runs only while no other wake path (`recv --notify`, `pillar notify`, a bridged
|
|
61
|
+
`recv`, `pillar-responder --command`) holds the home's `notify/wake.lock`;
|
|
62
|
+
otherwise it is skipped with one stderr line and the exit code stays 0. The
|
|
63
|
+
hook gets 10 s: after that its process group is killed (one stderr line; the
|
|
64
|
+
exit code still stays 0).
|
|
56
65
|
|
|
57
66
|
If every configured carrier fails, `inbox` behaves as 2.5.5 did: it prints
|
|
58
67
|
each refusal as `<code>: <fix>` on stderr (any other failure as the error
|
|
@@ -80,7 +89,7 @@ inbox — every reader sees every message, whoever pulled it:
|
|
|
80
89
|
```sh
|
|
81
90
|
pillar inbox --reader planner --mark-read # or PILLAR_READER=planner
|
|
82
91
|
pillar inbox --reader auditor # sees the same mail, independently
|
|
83
|
-
pillar recv --reader
|
|
92
|
+
pillar recv --reader daemon # a daemon can be a named reader too
|
|
84
93
|
pillar readers # each reader, its cursor, unseen count, live leases
|
|
85
94
|
```
|
|
86
95
|
|
|
@@ -92,6 +101,15 @@ reader last looked (naming the process and its directory), or when a live
|
|
|
92
101
|
are flagged too. `pillar-responder` and `pillar-ask` still want their own
|
|
93
102
|
identity/home: they act on first arrival, which a cursor cannot share.
|
|
94
103
|
|
|
104
|
+
A `pillar recv` with the Zestro bridge (`--zestro-bridge` or `PILLAR_ZESTRO_URL`)
|
|
105
|
+
is a wake path: it forwards each message as an agent command. It and
|
|
106
|
+
`pillar recv --notify` (or the one-shot `pillar notify`) are mutually exclusive
|
|
107
|
+
on one home: whichever starts second exits 64 with "two wake paths", and only
|
|
108
|
+
one bridged recv runs per home. A bridged recv writes no notify eligibility
|
|
109
|
+
events. A plain `pillar recv` or `pillar inbox` reader (without `--notify`) is
|
|
110
|
+
not a wake path and runs beside either. `pillar inbox --notify CMD` is a wake
|
|
111
|
+
path while its hook runs: see "One wake path per home" below.
|
|
112
|
+
|
|
95
113
|
### Mailbox: local message erasure (library)
|
|
96
114
|
|
|
97
115
|
`pillar.mailbox.eraseRows(selector)` synchronously redacts inbox **and**
|
|
@@ -200,6 +218,164 @@ while pillar wait --reader bot; do
|
|
|
200
218
|
done
|
|
201
219
|
```
|
|
202
220
|
|
|
221
|
+
A loop like this is your own wake path. `pillar wait` takes no
|
|
222
|
+
`notify/wake.lock`, so pillar cannot see it: run one loop per home, and do not
|
|
223
|
+
run it beside `recv --notify`, a bridged `recv` or `pillar-responder
|
|
224
|
+
--command` on the same home.
|
|
225
|
+
|
|
226
|
+
### New-mail notices: `pillar recv --notify`
|
|
227
|
+
|
|
228
|
+
`pillar init` writes `notify` into `config.json` (`enabled: true`; kinds
|
|
229
|
+
`message`, `reply`, `request`; no hook). `pillar init --no-notify` writes
|
|
230
|
+
`enabled: false`. `init --refresh` and `init --force` never add or change it.
|
|
231
|
+
`init` installs and starts nothing.
|
|
232
|
+
|
|
233
|
+
**Eligibility events.** With `notify` enabled, every process that stores mail
|
|
234
|
+
for the home (`recv`, `inbox`, named or not) writes one event to
|
|
235
|
+
`notify/state.json` per envelope, after signature, decryption, the trust
|
|
236
|
+
verdict and group admission. Knocks, duplicates, quarantined or erased rows,
|
|
237
|
+
blocked senders, group control messages and groups not yet admitted give
|
|
238
|
+
none; an accepted held-group release gives one. A manual quarantine release
|
|
239
|
+
gives none. Acks give none unless `notify.acks` is `"outbox"`, and then only
|
|
240
|
+
the first ack of a message you sent, from its recipient. An envelope is
|
|
241
|
+
noticed at most once per home, whichever process stored it.
|
|
242
|
+
|
|
243
|
+
**The hook.** Set it in `config.json`; it is never taken from a command line:
|
|
244
|
+
|
|
245
|
+
```json
|
|
246
|
+
"notify": { "enabled": true, "hook": { "exec": "/absolute/path/to/wake-agent", "args": ["--fixed", "args"] } }
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
`exec` must be an absolute path to a regular executable file that group and
|
|
250
|
+
others cannot write, owned by you or root, in a directory that group and
|
|
251
|
+
others cannot write; the resolved real path is what runs. It runs with no shell, its own process group, the home as
|
|
252
|
+
its working directory, and only `PILLAR_NEW` and `PILLAR_UUAID` in its
|
|
253
|
+
environment (put compound commands in a wrapper script). Its stdin is one line
|
|
254
|
+
of JSON, at most 32 records and 16 KiB, metadata only — never message text:
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{"v":"pillar-notify/1","uuaid":"<this home>","new":3,"records":[{"id":"env-…","from":"uuaid:…","kind":"message","at":"<local receipt time>"}],"more":2}
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
`inReplyTo` appears only when it names a message you sent to that sender.
|
|
261
|
+
Fields that fail their protocol checks are counted in `more`, not listed. The
|
|
262
|
+
hook's output is discarded (counted only). After 10 s (`notify.timeoutS`, 1-10)
|
|
263
|
+
its process group gets SIGTERM, then SIGKILL, and is reaped. When the hook
|
|
264
|
+
exits, anything it left running in its process group is killed too (a process
|
|
265
|
+
that calls `setsid` has left the group and is not reached). One hook runs at a
|
|
266
|
+
time per home.
|
|
267
|
+
|
|
268
|
+
**Main path:** keep `pillar recv --home H --notify` running. Print a unit,
|
|
269
|
+
review it, and install it yourself; units carry no command text and no timer,
|
|
270
|
+
and send stdout and stderr to `/dev/null`. The wake path's status (counts, the
|
|
271
|
+
last run and the last error code, no sender data) is in `notify/status.json`.
|
|
272
|
+
In `--notify` mode every stderr line is also written to `notify/recv.log`
|
|
273
|
+
(0600, rotated at 256 KiB into `recv.1.log`): control characters escaped,
|
|
274
|
+
words cut to 64 characters, lines to 400, at most 30 lines a minute (the rest
|
|
275
|
+
counted). `--notify` refuses to run with the Zestro bridge (`--zestro-bridge`
|
|
276
|
+
or `PILLAR_ZESTRO_URL`): exit 64, "two wake paths". A problem with the files in
|
|
277
|
+
`notify/` never stops mail intake: `recv --notify` logs one line, receives
|
|
278
|
+
without notify, and retries every minute:
|
|
279
|
+
|
|
280
|
+
```sh
|
|
281
|
+
pillar notify --print-unit launchd # KeepAlive LaunchAgent
|
|
282
|
+
pillar notify --print-unit systemd # Restart=always user service
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
The first start of a wake path baselines at the tip: mail stored before it
|
|
286
|
+
is not noticed. A carrier wakes a waiting long-poll as soon as an envelope for
|
|
287
|
+
it is stored (the 400 ms re-read stays as a fallback). Measured on loopback:
|
|
288
|
+
send to hook start, median about 75 ms.
|
|
289
|
+
|
|
290
|
+
**Wake budget** (`notify.budget`, durable across restarts and both wake
|
|
291
|
+
paths): at least 30 s between hook starts (`minIntervalS`), at most 6 wakes
|
|
292
|
+
per rolling hour triggered by senders outside your address book
|
|
293
|
+
(`unknownPerHour`), one wake per sender per 10 min (`perPrincipalS`), 60 per
|
|
294
|
+
hour in total (`totalPerHour`), of which 12 (`priorityReserve`) only
|
|
295
|
+
`notify.priority` senders (your sensors and key contacts) may use. Optional
|
|
296
|
+
`notify.maxWakesPerDay` caps wakes in any rolling 24 h for every sender class
|
|
297
|
+
(`null`, the default, is off). Arrivals that cannot start a hook wait and are
|
|
298
|
+
coalesced into the next start. Mail delivery never waits on the budget. A limit
|
|
299
|
+
that is set but not a whole number in range stops both wake paths (exit 2)
|
|
300
|
+
instead of falling back to a default.
|
|
301
|
+
|
|
302
|
+
**Retry contract and crash window.** A notice is attempted at most once per
|
|
303
|
+
envelope. The claim is committed before the hook starts; if the process dies
|
|
304
|
+
while the hook runs, the next start marks that run `ambiguous` and does not
|
|
305
|
+
run it again. A failed or timed-out hook is not re-run. Events not yet claimed
|
|
306
|
+
survive a restart and are noticed once. A notice is lost (the mail itself is
|
|
307
|
+
kept) when the process dies between storing an envelope and writing its event,
|
|
308
|
+
or when the writer lock stays held through both tries of that write (10 s, a
|
|
309
|
+
short backoff, then 10 s more; counted as `notify.emit-failed`). Treat a
|
|
310
|
+
notice as a hint: the agent reads the mailbox for the mail.
|
|
311
|
+
|
|
312
|
+
**One wake path per home.** `notify/wake.lock` admits exactly one of: the
|
|
313
|
+
resident `recv --notify`, the one-shot fallback `pillar notify`, a `pillar
|
|
314
|
+
recv` with the Zestro bridge (in any process, named reader or not), or
|
|
315
|
+
`pillar inbox --notify CMD` while its hook runs, or `pillar-responder
|
|
316
|
+
--command` while it runs (kind `responder`). A second `recv --notify` or
|
|
317
|
+
fallback is refused as before; any pairing with the bridge or the responder,
|
|
318
|
+
in either order, exits 64 ("two wake paths"). `inbox --notify` skips its hook
|
|
319
|
+
when another wake path holds the lock (one stderr line; its output and exit
|
|
320
|
+
code are unchanged). A plain `pillar recv` or `pillar inbox` takes no lock.
|
|
321
|
+
|
|
322
|
+
On the same machine a live holder keeps the lock however long it is paused
|
|
323
|
+
(SIGSTOP, laptop sleep): only a dead pid, or a pid reused by another process
|
|
324
|
+
(the lock records the holder's start time), frees it. The start time is
|
|
325
|
+
seconds since 1970 UTC (`epoch:N`; on Linux the `/proc` start ticks,
|
|
326
|
+
`ticks:N`). It is read without the caller's environment, so processes in
|
|
327
|
+
different time zones or locales read the same value. A start time in another
|
|
328
|
+
or older format (`lstart:` from a 2.7.0 pre-release) counts as unknown: that
|
|
329
|
+
lock is not stale while its pid lives. A lock with no start time keeps the
|
|
330
|
+
90 s wall-clock rule. "Same machine" means the same machine id (macOS
|
|
331
|
+
`IOPlatformUUID`, Linux `/etc/machine-id`; the lock stores a hash of it), so a
|
|
332
|
+
hostname change does not free a live holder; the hostname is used only when no
|
|
333
|
+
machine id can be read. On the same machine the holder only reads the lock (it
|
|
334
|
+
never rewrites it, so it cannot erase a new holder). A holder on another host must refresh it every 90 s; that refresh
|
|
335
|
+
reads and then rewrites the lock, so a takeover in the gap between the two can
|
|
336
|
+
be undone (a narrow window, cross-host only). A long-running holder re-reads the lock every 2 s
|
|
337
|
+
and before every hook or bridge command; if its token is gone it stops at once
|
|
338
|
+
(bridge closed, notifier stopped) and exits 75 with one stderr line. The
|
|
339
|
+
printed systemd unit restarts it after 10 s but not after a refusal
|
|
340
|
+
(`RestartPreventExitStatus=64`); launchd cannot filter exit codes, so a refused
|
|
341
|
+
resident under launchd retries every 10 s (`ThrottleInterval`) and is refused
|
|
342
|
+
again while the other wake path lives.
|
|
343
|
+
|
|
344
|
+
**Upgrading to 2.7.0.** Pillar builds before 2.7.0 take no `wake.lock`, so the
|
|
345
|
+
lock cannot see them. Before the first `recv --notify` on a home, stop or
|
|
346
|
+
upgrade every pre-2.7.0 `pillar` process that uses that home (a bridged `recv`,
|
|
347
|
+
an `inbox --notify` job, a responder).
|
|
348
|
+
|
|
349
|
+
**Other wake services.** Do not run `recv --notify` with a hook on a home that
|
|
350
|
+
another wake service already watches (a launchd, systemd or cron job with its
|
|
351
|
+
own `pillar wait` or `pillar inbox` loop). Pillar cannot see that service, so
|
|
352
|
+
each message would wake the agent twice. Retire the service, or keep the hook
|
|
353
|
+
off on that home.
|
|
354
|
+
|
|
355
|
+
**Fallback (one-shot):** `pillar notify` is for hosts that cannot keep a
|
|
356
|
+
process. It never pulls or stores mail and sends no receipts. It notices the
|
|
357
|
+
committed events (mail some reader of the home stored), under the same
|
|
358
|
+
budget, cursor and log, and runs the hook once for them. A one-round carrier
|
|
359
|
+
peek adds an unverified count (`"carrier": {"count": N, "verified": false,
|
|
360
|
+
"truncated": false}`) that never starts a hook. `truncated: true` means a
|
|
361
|
+
carrier answered a full page (200 envelopes) or an answer was abandoned, so
|
|
362
|
+
`count` is a lower bound. `pillar notify --print-unit cron` prints it as a
|
|
363
|
+
labelled fallback cron line; do not install it with the resident unit.
|
|
364
|
+
|
|
365
|
+
**Files.** `notify/` is 0700 and its files 0600: `state.json` (events, cursor,
|
|
366
|
+
budget, last run: one atomic commit, kept under 4 MiB on every write; an
|
|
367
|
+
event's `id` and `from` are stored only when they pass the protocol checks,
|
|
368
|
+
else `null`), `status.json` (bounded status for owners), `recv.log`,
|
|
369
|
+
`notifications.jsonl` (one line per
|
|
370
|
+
wake, rotated at 2,000 lines or 256 KiB, two old files kept up to 30 days).
|
|
371
|
+
Symlinks, hard links, non-regular files and files of another owner are
|
|
372
|
+
refused. Writes are exclusive private temp files, flushed, then renamed, under
|
|
373
|
+
one writer lock. An oversized `state.json` (left by an earlier build) keeps its
|
|
374
|
+
budget, counters and cursor; its pending events are dropped and counted. A log
|
|
375
|
+
from a pre-2.7.0 notifier that holds message text is made 0600 and refused
|
|
376
|
+
until you move it out. `pillar-notify` is an alias of
|
|
377
|
+
`pillar notify`.
|
|
378
|
+
|
|
203
379
|
`--directory` fetches the directory and configures every carrier + seed listed
|
|
204
380
|
there, and writes every `agents[]` entry (uuaid + publicKey) into
|
|
205
381
|
`<home>/fleet.json` as your address book — so step 3 works immediately, no key
|
|
@@ -420,9 +596,18 @@ mail there. To re-sync carriers and contacts without a new identity, use
|
|
|
420
596
|
|---|---|---|
|
|
421
597
|
| `pillar-responder` | Always-on auto-attendant: acks requests instantly, replies from fixed text or a command hook. Run it as a service; agents anywhere get ack+reply without you being live. | one process, outbound HTTPS |
|
|
422
598
|
| `pillar-seed` | A carrier seed — makes you part of the p2p mesh. Any agent that lists your URL replicates every envelope to you and polls you in parallel with other seeds. `--announce` enrolls it in a seed registry, if one runs `pillar-directory` (see "Running a seed" below). | one process, one SQLite file, TLS-terminating proxy in front |
|
|
423
|
-
| `pillar-directory` | The seed registry: serves `directory.json`, accepts permissionless seed enrollment, probes enrolled seeds, and promotes them. Run one if you publish a directory. | one process, one SQLite file |
|
|
599
|
+
| `pillar-directory` | The seed registry: serves `directory.json`, accepts permissionless seed enrollment, probes enrolled seeds, and promotes them. Run one if you publish a directory. **A public registry stays on 2.6.1 until 2.7.1** (note below this table). | one process, one SQLite file |
|
|
424
600
|
| `pillar` | The full CLI (`init`, `id`, `send`, `group`, `groups`, `send-group`, `recv`, `inbox`, `wait`, `readers`, `status`, `receipts`, `trust`, `tier`, `peers`, `delegate`) — optional libp2p DHT, or carrier-only. | only when used interactively |
|
|
425
601
|
|
|
602
|
+
> **Running a public registry (`pillar-directory`)? Stay on 2.6.1 until
|
|
603
|
+
> 2.7.1** (`npm install -g @uuaid/pillar@2.6.1`). In 2.7.0 the registry
|
|
604
|
+
> prunes old listings in one pass at start and every 10 minutes, and the
|
|
605
|
+
> process answers nothing during that pass: about 3.5 ms per listing (3.5 s
|
|
606
|
+
> at 1,000 listings). Anyone can add up to 600 listings an hour, so a public
|
|
607
|
+
> registry can grow to pauses of tens of seconds. 2.7.1 splits the pass.
|
|
608
|
+
> Agents, carriers and private registries are not affected. The UUAID live
|
|
609
|
+
> registry stays on 2.6.1.
|
|
610
|
+
|
|
426
611
|
```sh
|
|
427
612
|
pillar-responder --home ~/.pillar-responder --reply-text "ack" &
|
|
428
613
|
pillar-seed --home /var/lib/pillar/seed --db /var/lib/pillar/seed.db & # 127.0.0.1:8799 by default
|
|
@@ -433,6 +618,11 @@ pillar-seed --home /var/lib/pillar/seed --db /var/lib/pillar/seed.db \
|
|
|
433
618
|
pillar-seed --help # every flag, and its environment variable
|
|
434
619
|
```
|
|
435
620
|
|
|
621
|
+
Give `pillar-responder` its own home. With a command hook (`--command`) it is
|
|
622
|
+
a wake path: it holds that home's `notify/wake.lock` as kind `responder` while
|
|
623
|
+
it runs, and exits 64 ("two wake paths") when another wake path already holds
|
|
624
|
+
it.
|
|
625
|
+
|
|
436
626
|
### Running a seed
|
|
437
627
|
|
|
438
628
|
What an outside operator needs to know before the first start:
|
|
@@ -848,6 +1038,12 @@ rate and body size — see "Tier grants" above for the ladder. It is a
|
|
|
848
1038
|
numbered list that citation implies was never published, and no items #1-#4
|
|
849
1039
|
exist in this tree. `HOSTING-LIMITS.md` is now the published list of what a
|
|
850
1040
|
carrier enforces. It does not use that numbering.
|
|
1041
|
+
- **New-mail notices (`recv --notify`) for unsafe metadata are counts only.**
|
|
1042
|
+
An event whose envelope id or sender fails the protocol checks is stored
|
|
1043
|
+
with `id`/`from` set to `null`, counted, and never listed. It is not
|
|
1044
|
+
re-checked against the mailbox when it is claimed, so it still counts toward
|
|
1045
|
+
a wake if its row was later erased or quarantined. All such senders share one
|
|
1046
|
+
per-sender budget window: they are deferred together, never let through.
|
|
851
1047
|
- **Carrier retention is time-bounded.** Envelopes are retained until TTL,
|
|
852
1048
|
default 14 days, then vacuumed (`src/net/carrier-server.mjs`).
|
|
853
1049
|
- **No metering.** The carrier's rate limiter is an in-memory sliding window
|
package/bin/carrier.mjs
CHANGED
|
@@ -43,6 +43,7 @@ import { CarrierServer, parseSecureDelete, parseCommunityWaits, MAX_TTL_DAYS } f
|
|
|
43
43
|
import { Keychain, keyDerivesUuaid } from "../src/identity/keychain.mjs";
|
|
44
44
|
import { checkSeedUrl } from "../src/net/seed-registry.mjs";
|
|
45
45
|
import { parseTrustedProxies } from "../src/net/client-ip.mjs";
|
|
46
|
+
import { exitWithHelp, wantsHelp } from "../src/cli-help.mjs";
|
|
46
47
|
|
|
47
48
|
function parseArgs(argv) {
|
|
48
49
|
const args = {};
|
|
@@ -70,6 +71,26 @@ function oneLine(text) {
|
|
|
70
71
|
return String(text).replace(/[\u0000-\u001f\u007f-\u009f\u2028\u2029]/g, (c) => ESCAPES[c] ?? `\\u${c.charCodeAt(0).toString(16).padStart(4, "0")}`);
|
|
71
72
|
}
|
|
72
73
|
|
|
74
|
+
const USAGE = `usage: pillar-carrier [flags]
|
|
75
|
+
|
|
76
|
+
Runs a standalone carrier server (store-and-forward). Listens on 127.0.0.1 by
|
|
77
|
+
default; put a TLS-terminating proxy in front of it.
|
|
78
|
+
|
|
79
|
+
--port <n> listen port (CARRIER_PORT, default 8799)
|
|
80
|
+
--host <addr> listen address (CARRIER_HOST, default 127.0.0.1)
|
|
81
|
+
--db <file> SQLite database (CARRIER_DB, default ./carrier.db)
|
|
82
|
+
--ttl <days> envelope lifetime (CARRIER_TTL_DAYS, default 14, at most 36500)
|
|
83
|
+
--secure-delete <on|off> zero deleted envelopes (CARRIER_SECURE_DELETE, default on)
|
|
84
|
+
--community-waits <n> community long-poll cap (CARRIER_COMMUNITY_WAITS, default 48)
|
|
85
|
+
--trusted-proxy <ips> whose X-Forwarded-For counts (CARRIER_TRUSTED_PROXIES, default 127.0.0.1,::1)
|
|
86
|
+
--tier-issuers <hex,...> tier grant issuer keys (CARRIER_TIER_ISSUERS)
|
|
87
|
+
--receipt-keychain <file> sign carrier receipts with this existing key (CARRIER_RECEIPT_KEYCHAIN)
|
|
88
|
+
--seed-keychain <file> with --public-url: serve a signed /v1/seed-info (CARRIER_SEED_KEYCHAIN)
|
|
89
|
+
--public-url <https://> the URL the proxy serves (CARRIER_PUBLIC_URL)
|
|
90
|
+
-h, --help print this help and exit
|
|
91
|
+
|
|
92
|
+
The carrier never mints a key. See the header of bin/carrier.mjs for details.`;
|
|
93
|
+
if (wantsHelp(process.argv.slice(2))) await exitWithHelp(USAGE); // R2: before carrier.db is opened or a port is bound
|
|
73
94
|
const args = parseArgs(process.argv.slice(2));
|
|
74
95
|
const port = Number(args.port ?? process.env.CARRIER_PORT ?? 8799);
|
|
75
96
|
const host = args.host ?? process.env.CARRIER_HOST ?? "127.0.0.1";
|
package/bin/pillar-ask.mjs
CHANGED
|
@@ -18,6 +18,7 @@ import { argv, exit } from "node:process";
|
|
|
18
18
|
import { Keychain } from "../src/identity/keychain.mjs";
|
|
19
19
|
import { Pillar } from "../src/pillar.mjs";
|
|
20
20
|
import { loadFleetAddressBook } from "../src/address-book.mjs";
|
|
21
|
+
import { exitWithHelp, wantsHelp } from "../src/cli-help.mjs";
|
|
21
22
|
|
|
22
23
|
function parseArgs(argv) {
|
|
23
24
|
const args = { _: [] };
|
|
@@ -33,10 +34,12 @@ function parseArgs(argv) {
|
|
|
33
34
|
return args;
|
|
34
35
|
}
|
|
35
36
|
|
|
37
|
+
const USAGE = "usage: pillar-ask <recipient-uuaid> '<question>' [--to-pubkey HEX] [--home DIR] [--fleet FLEET.json] [--timeout S]";
|
|
38
|
+
if (wantsHelp(argv.slice(2))) await exitWithHelp(USAGE); // R2: before the home is read
|
|
36
39
|
const args = parseArgs(argv.slice(2));
|
|
37
40
|
const [recipient, question] = args._;
|
|
38
41
|
if (!recipient || !question) {
|
|
39
|
-
console.error(
|
|
42
|
+
console.error(USAGE);
|
|
40
43
|
exit(2);
|
|
41
44
|
}
|
|
42
45
|
|
package/bin/pillar-blob.mjs
CHANGED
|
@@ -30,6 +30,7 @@ import { Pillar } from "../src/pillar.mjs";
|
|
|
30
30
|
import { PillarBlobHttpClient, BLOB_BROKERS, DEFAULT_BLOB_BROKER } from "../src/blob/http.mjs";
|
|
31
31
|
import { fetchBrokerBlob, DEFAULT_BLOB_TTL_MS, BlobError } from "../src/blob/blob.mjs";
|
|
32
32
|
import { refusalLine } from "../src/net/refusals.mjs";
|
|
33
|
+
import { exitWithHelp, wantsHelp } from "../src/cli-help.mjs";
|
|
33
34
|
|
|
34
35
|
function usage(code = 2) {
|
|
35
36
|
process.stderr.write("usage: pillar-blob send|get (run without arguments to see the source header)\n");
|
|
@@ -74,6 +75,11 @@ function fail(error) {
|
|
|
74
75
|
process.exit(code === "blob-not-found" || code === "blob-expired" ? 3 : code.includes("integrity") ? 5 : 6);
|
|
75
76
|
}
|
|
76
77
|
|
|
78
|
+
const USAGE = `usage: pillar-blob send --to UUAID --recipient-pubkey HEX --data FILE [--broker URL]
|
|
79
|
+
[--carriers URL,...] [--key-id KEY_ID] [--ttl-ms N]
|
|
80
|
+
pillar-blob get --ref-file FILE --expect-envelope ID [--key-id KEY_ID]
|
|
81
|
+
[--broker URL] [--out FILE|-]`;
|
|
82
|
+
if (wantsHelp(process.argv.slice(2))) await exitWithHelp(USAGE); // R2: before the home or broker is touched
|
|
77
83
|
const [command, ...rest] = process.argv.slice(2);
|
|
78
84
|
if (!command) usage();
|
|
79
85
|
const args = parse(rest);
|