sigelo-contact 0.1.8 → 0.1.9

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 CHANGED
@@ -12,15 +12,17 @@ sigelo-agent accept <code> --name alice # bob: checks alice offline, pairs
12
12
  sigelo-agent send bob "hello" # sent, or queued for bob
13
13
  seq 3 | sigelo-agent send bob - --lines # one message a line, one login
14
14
  sigelo-agent inbox # what came since last time
15
+ sigelo-agent history --since 3600 # again, no relay
15
16
  ```
16
17
 
17
18
  Also `contacts`, `forget <did>`, and all as MCP tools
18
19
  ([`integrations/mcp/contact.mjs`](../integrations/mcp/contact.mjs)).
19
- Each verb logs in once (30 a minute per network), never beside `watch` or `ui`
20
+ Each verb logs in once (30/minute per network), never beside `watch` or `ui`
20
21
  ([one owner](../adapters/moadim/WATCH.md)).
21
- The first login proves work (5–60 s on a phone). `SIGELO_RELAY` names the relay for new codes;
22
+ The first login proves work (5–60 s on phones). `SIGELO_RELAY` names the relay for new codes;
22
23
  a Pro reader sets `SIGELO_RELAY_RETENTION_DAYS=90`. State sits
23
- beside the identity file (0600); messages wait there in plaintext until `inbox` takes them.
24
+ beside the identity file (0600), plaintext: messages until `inbox` takes them, then the last 500
25
+ in `<identity>.inbox.log`.
24
26
  `carrier.mjs`'s header is its API; with `onEvent`, nothing is kept.
25
27
 
26
28
  **Sandboxes and firewalls.** Messaging dials only the relay, `relay.sigelo.ai` by default: 8883, else
@@ -43,8 +45,7 @@ sh ../demo/two-machines.sh
43
45
  | `sigelo-msg/0` | `fixtures/envelope-v0.json` | envelope bytes, prekeys, key schedule, epoch recovery |
44
46
  | `sigelo-carrier/0` | `fixtures/carrier-v0.json` | frames of kinds 1, 2, 4 and 5, their keys, refusals |
45
47
 
46
- Each regenerates byte for byte from seeds (`gen-*.mjs`); refusals name their check
47
- (`MsgError.check`).
48
+ Each regenerates byte for byte from seeds (`gen-*.mjs`).
48
49
 
49
50
  ## How it works
50
51
 
@@ -74,5 +75,5 @@ Key agreement is hybrid post-quantum (X25519 + ML-KEM-768).
74
75
  contacts write until the next weekly prekey replacement.
75
76
  - Confirm delivery (the relay acknowledges, not the contact): a relay withholding an epoch's key
76
77
  agreement loses what follows until fresh prekeys restart it.
77
- - Check where a stranger's relay resolves (only its name).
78
+ - Check where a stranger's relay resolves.
78
79
  - Push, groups, direct delivery, unsend.
package/carrier.mjs CHANGED
@@ -14,7 +14,8 @@
14
14
  // await c.cancelInvite(code) → { cancelled, name }: an unanswered invite of this agent's withdrawn
15
15
  // c.rename(who, name) the owner's name for a contact (store.mjs rename) → { did, name }
16
16
  // c.contacts() → { contacts, invites, answers, failed } each contact with its four words (fingerprint),
17
- // pair id, chain, tier (store.mjs: own, friend, quiet) and tier_by, prekeys: its
17
+ // pair id, chain, ours (an operator attestation of mine marks it), tier
18
+ // (store.mjs: own, friend, quiet) and tier_by, prekeys: its
18
19
  // bundle is here (false: messages wait for it), waiting: why they wait, or null;
19
20
  // failed: pairing_failed events (code_expired: an answer that outlived its code) until inbox
20
21
  // await c.send(to, content, { label, local }) → { status: 'sent' | 'queued', … }, or throws the relay's code
@@ -30,7 +31,14 @@
30
31
  // paired: the wait also ends at a pairing (enrol.mjs)
31
32
  // c.peek(), c.take(pick) the messages kept for inbox(), each with its sender's tier: read, or those
32
33
  // pick(message, tier) chooses taken; no session (a started carrier's owner)
33
- // c.setTier(who, tier) the owner's tier for a contact (store.mjs setTier) → { did, name, tier }
34
+ // c.history({ since }) → { messages }: what inbox() and take() gave out, again, from the local log
35
+ // (`log`: x.inbox.log, pathsFor), received at or after since (unix seconds);
36
+ // no session, nothing taken
37
+ // c.setTier(who, tier) the owner's tier for a contact (store.mjs setTier) → { did, name, tier, ours }
38
+ // c.presetTier(did, tier) the same for an original DID not yet a contact, filed when it pairs
39
+ // c.answeredBy(nonce) the original DID that paired through this agent's code `nonce`, or null
40
+ // (kept in the state until a day after the code's exp; the inviter's
41
+ // paired event names the code as `invite`: its nonce, never its secret)
34
42
  // c.observe(bundle) a contact's full bundle seen: its operator attestations (store.mjs observe)
35
43
  // a file received whole is one item {type: "file", from, contact, name, size,
36
44
  // sha256, path, …}, saved under `files` (pathsFor), never opened
@@ -49,6 +57,10 @@
49
57
  // inbox(), in plaintext, until taken (INBOX_MAX at most: the oldest go, counted as inbox_full); by
50
58
  // default only without onEvent, so a message onEvent took is not left at rest after the keys that
51
59
  // opened it are gone (contacts.md §3: keys stolen today must not open yesterday's messages).
60
+ // log: every message and file item inbox() or take() gives out is first appended to this file
61
+ // (JSON lines, 0600, the newest LOG_MAX or LOG_BYTES; enrolment's key-carrying labels never), so a
62
+ // reader that dropped its output can read it again (history); by default x.inbox.log beside the
63
+ // state; false: none. Plaintext at rest, as the state's inbox is (THREAT-MODEL §3.9).
52
64
  // One connected carrier per identity: every process logs in with the identity's one MQTT client
53
65
  // id, so a second login takes the session from a started carrier (the files stay sound under the
54
66
  // lock; the started one reconnects with backoff). Beside one, use inbox and send with local: the
@@ -187,7 +199,7 @@ import { createHash } from 'node:crypto';
187
199
  import { request as httpRequest } from 'node:http';
188
200
  import { Agent as HttpsAgent, request as httpsRequest } from 'node:https';
189
201
  import { connect as tlsConnect } from 'node:tls';
190
- import { chmodSync, closeSync, existsSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
202
+ import { chmodSync, closeSync, existsSync, linkSync, mkdirSync, openSync, readFileSync, readdirSync, realpathSync, renameSync, rmSync, statSync, writeFileSync } from 'node:fs';
191
203
  import { basename, dirname, join, resolve, sep } from 'node:path';
192
204
  import { xchacha20poly1305 } from '@noble/ciphers/chacha.js';
193
205
  import { hkdf } from '@noble/hashes/hkdf.js';
@@ -242,6 +254,16 @@ const POISON_TRIES = 3;
242
254
  // Events kept for the next inbox(): pairings, rotations, failed pairings. The oldest go first.
243
255
  // Messages kept for it (keep), likewise.
244
256
  const EVENTS_MAX = 1000, INBOX_MAX = 1000;
257
+ // The inbox log (the constructor's log): at most so many items and bytes, the oldest go first (the
258
+ // newest is kept whatever its size). Labels it never holds: enrolment's, one of which carries a key.
259
+ export const LOG_MAX = 500, LOG_BYTES = 4 * 1024 * 1024;
260
+ const UNLOGGED = /^sigelo-(identity|enrol)\//;
261
+ // Received files of one name and hash prefix kept side by side, at most (#onFile).
262
+ const FILE_COPIES = 64;
263
+ // A contact's folder of received files: its name as safeName keeps it, and 16 hex digits of the
264
+ // SHA-256 of its original DID, so two contacts whose names reduce alike never share one, and a
265
+ // rename keeps the DID part.
266
+ export const contactDir = (c) => `${safeName(c.name || 'contact')}-${hex(sha256(utf8ToBytes(c.did))).slice(0, 16)}`;
245
267
  // Files arriving at once from one contact (#onFile): each holds up to 8 MiB of parts here.
246
268
  const FILES_OPEN = 8;
247
269
  // Half the relay's publish brake (20 a second, 200 at once): past it the relay refuses publishes
@@ -337,10 +359,10 @@ const GIFT_CHECKS = new Set(['gift', 'gift_member', 'gift_term', 'pow', ...LOGIN
337
359
 
338
360
  // ---------------------------------------------------------------- configuration
339
361
 
340
- /** The contact store, this carrier's state and the files received, beside the identity file: x.json → x.contacts.json, x.carrier.json, x.files/. */
362
+ /** The contact store, this carrier's state, the files received and the inbox log, beside the identity file: x.json → x.contacts.json, x.carrier.json, x.files/, x.inbox.log. */
341
363
  export function pathsFor(identityFile) {
342
364
  const base = identityFile.replace(/\.json$/, '');
343
- return { store: `${base}.contacts.json`, state: `${base}.carrier.json`, files: `${base}.files` };
365
+ return { store: `${base}.contacts.json`, state: `${base}.carrier.json`, files: `${base}.files`, log: `${base}.inbox.log` };
344
366
  }
345
367
 
346
368
  /**
@@ -485,10 +507,10 @@ function withLock(path, fn) {
485
507
  }
486
508
 
487
509
  function loadState(path, self) {
488
- const s = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : { v: V, self, relays: {}, peers: {}, pending: [], inbox: [], events: [], dropped: {}, failing: {} };
510
+ const s = existsSync(path) ? JSON.parse(readFileSync(path, 'utf8')) : { v: V, self, relays: {}, peers: {}, pending: [], inbox: [], events: [], dropped: {}, failing: {}, answered: {} };
489
511
  if (s.v !== V || s.self !== self) fail('state', `${path} is not the ${V} state of ${self}`);
490
512
  // Written by an earlier version of this file, which kept neither.
491
- s.events ??= []; s.failing ??= {};
513
+ s.events ??= []; s.failing ??= {}; s.answered ??= {};
492
514
  return s;
493
515
  }
494
516
 
@@ -895,7 +917,7 @@ export class Carrier {
895
917
  #mineMemo = null; #clocks = new Map();
896
918
 
897
919
  constructor({ identity, store, state, relay = DEFAULT_RELAY, endpoints = {}, retentionDays, clock = () => Math.floor(Date.now() / 1000),
898
- onEvent, keep, backoff = BACKOFF, tick = TICK, files, transport = 'auto' }) {
920
+ onEvent, keep, backoff = BACKOFF, tick = TICK, files, log, transport = 'auto' }) {
899
921
  if (!TRANSPORTS.includes(transport)) throw new TypeError(`transport: ${TRANSPORTS.join(', ')}`);
900
922
  this.transport = transport;
901
923
  if (typeof identity !== 'function') throw new TypeError('identity: a function returning { sign, bundle }');
@@ -911,6 +933,27 @@ export class Carrier {
911
933
  // Files received (#onFile): files, else beside the state as pathsFor names it (x.carrier.json → x.files).
912
934
  if (files !== undefined && typeof files !== 'string') throw new TypeError('files: a directory path (pathsFor(identityFile))');
913
935
  this.filesDir = resolve(files ?? state.replace(/(\.carrier)?\.json$/, '') + '.files');
936
+ // The inbox log: log, else beside the state as pathsFor names it (x.carrier.json → x.inbox.log); false: none.
937
+ if (log !== undefined && log !== false && typeof log !== 'string') throw new TypeError('log: a file path (pathsFor(identityFile)) or false');
938
+ this.logPath = log === false ? null : resolve(log ?? state.replace(/(\.carrier)?\.json$/, '') + '.inbox.log');
939
+ }
940
+
941
+ // Items given out (inbox, take), appended to the log before they are: a reader that loses its
942
+ // output reads them again (history). Under the lock, before the state drops them, so a failed
943
+ // write leaves them in the state; an item already logged (a crash before the state was saved) is
944
+ // not logged twice. Written whole to a fresh 0600 name, then renamed, as the state is.
945
+ #logOut(items) {
946
+ const path = this.logPath, add = items.filter((m) => !(typeof m?.label === 'string' && UNLOGGED.test(m.label)));
947
+ if (path === null || add.length === 0) return;
948
+ let lines = [];
949
+ try { lines = readFileSync(path, 'utf8').split('\n').filter((l) => l !== ''); } catch (e) { if (e.code !== 'ENOENT') throw e; }
950
+ const had = new Set(lines);
951
+ for (const m of add) { const l = JSON.stringify(m); if (!had.has(l)) { had.add(l); lines.push(l); } }
952
+ let bytes = lines.reduce((n, l) => n + Buffer.byteLength(l) + 1, 0), cut = 0;
953
+ while (lines.length - cut > 1 && (lines.length - cut > LOG_MAX || bytes > LOG_BYTES)) bytes -= Buffer.byteLength(lines[cut++]) + 1;
954
+ const tmp = join(dirname(path), `.${basename(path)}.${randomId()}.tmp`);
955
+ writeFileSync(tmp, lines.slice(cut).map((l) => `${l}\n`).join(''), { mode: 0o600, flag: 'wx' });
956
+ renameSync(tmp, path);
914
957
  }
915
958
 
916
959
  // ---- files, under the lock
@@ -1334,8 +1377,11 @@ export class Carrier {
1334
1377
  // A FILE_LABEL message from contact c, opened (r). The manifest is kept in the state (files,
1335
1378
  // under a key of the contact and the file's id), each chunk under filesDir/.partial/<key>/<i>
1336
1379
  // (0600, directories 0700); once all have come, the file is checked (size, SHA-256), saved as
1337
- // filesDir/<contact>/<sha256[0..8]>-<name> (0600), and given to inbox() as one item of type
1338
- // "file". Never opened, never made executable. Anything wrong with the message is counted in
1380
+ // filesDir/<contact>-<16 hex of SHA-256(original DID)>/<sha256[0..8]>-<name> (0600), and given to
1381
+ // inbox() as one item of type "file". The folder is the contact's alone, whatever its name
1382
+ // reduces to; a name taken already is never written over (linked in, or opened wx): the file
1383
+ // goes as <sha256[0..8]>-<n>-<name>, n from 2, and past FILE_COPIES it is dropped, file_exists.
1384
+ // Never opened, never made executable. Anything wrong with the message is counted in
1339
1385
  // dropped by its check, as a refused bundle is above; the envelope stays opened either way.
1340
1386
  // A chunk before its manifest (none: the sender sends the manifest first, in one login) is
1341
1387
  // dropped, file_chunk. The disk is written before the state: a crash between them leaves a
@@ -1385,14 +1431,26 @@ export class Carrier {
1385
1431
  rmSync(this.#partDir(key), { recursive: true, force: true });
1386
1432
  return drop(e);
1387
1433
  }
1388
- const dir = join(this.filesDir, safeName(c.name || c.did));
1434
+ const dir = join(this.filesDir, contactDir(c));
1389
1435
  mkdirSync(dir, { recursive: true, mode: 0o700 });
1390
1436
  chmodSync(this.filesDir, 0o700); chmodSync(dir, 0o700);
1391
- const path = join(dir, `${p.sha256.slice(0, 8)}-${p.name}`), tmp = join(dir, `.${randomId()}.tmp`);
1437
+ const tmp = join(dir, `.${randomId()}.tmp`);
1392
1438
  writeFileSync(tmp, bytes, { mode: 0o600, flag: 'wx' });
1393
- renameSync(tmp, path);
1439
+ let path = null;
1440
+ try {
1441
+ for (let n = 1; path === null && n <= FILE_COPIES; n++) {
1442
+ const at = join(dir, `${p.sha256.slice(0, 8)}-${n === 1 ? '' : `${n}-`}${p.name}`);
1443
+ try { linkSync(tmp, at); path = at; } catch (e) {
1444
+ if (e.code === 'EEXIST') continue;
1445
+ // No hard links here (FAT, some network file systems): written again, exclusively.
1446
+ if (!['EPERM', 'ENOTSUP', 'EOPNOTSUPP', 'EXDEV', 'ENOSYS'].includes(e.code)) throw e;
1447
+ try { writeFileSync(at, bytes, { mode: 0o600, flag: 'wx' }); path = at; } catch (e2) { if (e2.code !== 'EEXIST') throw e2; }
1448
+ }
1449
+ }
1450
+ } finally { rmSync(tmp, { force: true }); }
1394
1451
  delete st.files[key];
1395
1452
  rmSync(this.#partDir(key), { recursive: true, force: true });
1453
+ if (path === null) return drop(new MsgError('file_exists', `${p.name}: ${FILE_COPIES} files of that name and hash are in ${dir} already; not saved`));
1396
1454
  const item = { type: 'file', from: c.did, contact: c.name, current_did: r.body.from, label: FILE_LABEL, name: p.name, size: p.size, sha256: p.sha256, path,
1397
1455
  iat: r.body.iat, received: now, last_resort: r.last_resort };
1398
1456
  // Kept for inbox() as a message is (#onPeer), and so many at most.
@@ -1626,15 +1684,18 @@ export class Carrier {
1626
1684
  const prekeys = s.in.prekeys.issue({ current_did: me.current_did, sign: me.sign }, s.pair, now);
1627
1685
  const reply = buildReply({ answer_id: res.answer_id, identity: { sign: me.sign, genesis: me.genesis }, bundle: chainOf(me.bundle), kem_ct: ct, prekeys });
1628
1686
  const frame = seal(KIND.invite_reply, keys.key, keys.reply_topic, reply);
1629
- const entry = { relay: p.relay, topic: keys.reply_topic, kind: KIND.invite_reply, control: 'reply', peer: c.did, undo,
1687
+ const entry = { relay: p.relay, topic: keys.reply_topic, kind: KIND.invite_reply, control: 'reply', peer: c.did, undo, invite: nonce,
1630
1688
  needs: [topic(K, c.did, me.did, isoWeek(now))], exp: p.exp };
1631
1689
  if (frame.length > INVITE_BYTES) {
1632
1690
  return [this.#unpair(ctx, entry, { code: 'too_large', detail: `the reply is ${frame.length} bytes, more than an invite topic holds (${INVITE_BYTES}): this agent's chain is too long` })];
1633
1691
  }
1634
1692
  st.peers[c.did] = { session: dumpSession(s), announced: me.current_did, known: me.current_did, outbox: st.peers[c.did]?.outbox ?? [], prekeys_resend: false, prekeys_iat: now };
1635
1693
  this.#queue(st, { ...entry, bytes: frame });
1694
+ // Who answered this code (answeredBy): saved with the pairing, whoever reads the paired event.
1695
+ for (const [x, a] of Object.entries(st.answered)) if (!(a.exp > now)) delete st.answered[x];
1696
+ st.answered[nonce] = { did: c.did, exp: p.exp + DAY };
1636
1697
  this.#routes = new Map();
1637
- return [this.#note(st, now, { type: 'paired', did: c.did, name: c.name, current_did: c.current_did, rekeyed: res.rekeyed, fingerprint: wordsOf(res.pair_key) })];
1698
+ return [this.#note(st, now, { type: 'paired', did: c.did, name: c.name, current_did: c.current_did, rekeyed: res.rekeyed, fingerprint: wordsOf(res.pair_key), invite: nonce })];
1638
1699
  }
1639
1700
 
1640
1701
  // Alice: her reply will never reach the answerer (refused, too large, or its code expired while
@@ -1647,6 +1708,7 @@ export class Carrier {
1647
1708
  if (e.undo.contact) store.s.contacts[e.peer] = e.undo.contact; else delete store.s.contacts[e.peer];
1648
1709
  store.save();
1649
1710
  this.#restorePeer(st, e);
1711
+ if (e.invite) delete st.answered[e.invite];
1650
1712
  this.#routes = new Map();
1651
1713
  return this.#note(st, now, { type: 'pairing_failed', did: e.peer, name, code, detail });
1652
1714
  }
@@ -2448,7 +2510,7 @@ export class Carrier {
2448
2510
  contacts: Object.values(s.contacts).map((c) => {
2449
2511
  const e = st.peers[c.did], pair = c.revoked || !c.pair_key ? null : pairId(hexToBytes(c.pair_key));
2450
2512
  return { name: c.name, did: c.did, current_did: c.current_did, chain: c.chain, revoked: c.revoked, relay: c.relay, queued: e?.outbox.length ?? 0,
2451
- re_pair: c.re_pair ?? null, fingerprint: c.revoked ? null : wordsOf(c.pair_key), pair, tier: store.tierOf(c, now), tier_by: c.tier_by ?? null,
2513
+ re_pair: c.re_pair ?? null, fingerprint: c.revoked ? null : wordsOf(c.pair_key), pair, ours: store.oursOf(c, now), tier: store.tierOf(c, now), tier_by: c.tier_by ?? null,
2452
2514
  prekeys: pair !== null && theirPrekeys(c, e?.session, pair, now), waiting: e?.waiting ?? null };
2453
2515
  }),
2454
2516
  invites: Object.values(s.invites).filter((p) => p.exp > now).map((p) => ({ name: p.name, exp: p.exp, relay: p.relay })),
@@ -2541,8 +2603,8 @@ export class Carrier {
2541
2603
  let ownDir;
2542
2604
  try { ownDir = realpathSync(dirname(own)); } catch { ownDir = dirname(own); }
2543
2605
  const leaf = basename(real);
2544
- if (real.startsWith(files + sep) || (dirname(real) === ownDir && (leaf.startsWith(`${basename(own)}.`) || leaf.includes('.local.')))) {
2545
- fail('file', `${path} is one of this agent's identity files (key, contacts, state, files received): not sent`);
2606
+ if (real.startsWith(files + sep) || real === this.logPath || (dirname(real) === ownDir && (leaf.startsWith(`${basename(own)}.`) || leaf.includes('.local.')))) {
2607
+ fail('file', `${path} is one of this agent's identity files (key, contacts, state, files received, inbox log): not sent`);
2546
2608
  }
2547
2609
  try { bytes = readFileSync(real); } catch (e) { fail('file', `cannot read ${path}: ${e.code ?? e.message}`, { cause: e }); }
2548
2610
  if (bytes.length > MAX_FILE) fail('file_too_large', `${path} is ${bytes.length} bytes, at most ${MAX_FILE} (8 MiB) a file`);
@@ -2578,6 +2640,7 @@ export class Carrier {
2578
2640
  return this.#locked(({ now, store, st }) => {
2579
2641
  this.#sweepFiles(st, now);
2580
2642
  const pick = picks(store, now), messages = st.inbox.filter(pick);
2643
+ this.#logOut(messages);
2581
2644
  const out = { messages, events: st.events, dropped: st.dropped, ...(offline && { offline }) };
2582
2645
  st.inbox = st.inbox.filter((m) => !pick(m)); st.events = []; st.dropped = {};
2583
2646
  return out;
@@ -2593,22 +2656,46 @@ export class Carrier {
2593
2656
  return this.#locked(({ now, store, st }) => {
2594
2657
  const t = store.tiers(now), out = [], keep = [];
2595
2658
  for (const m of st.inbox) (pick(m, t.get(m.from) ?? 'friend') ? out : keep).push(m);
2659
+ this.#logOut(out);
2596
2660
  st.inbox = keep;
2597
2661
  return out;
2598
2662
  });
2599
2663
  }
2600
2664
 
2665
+ // The log as written (atomic renames: no lock needed), oldest first; since: unix seconds, by
2666
+ // `received`. A line that does not parse (a hand edit) is skipped, never the rest.
2667
+ history({ since = 0 } = {}) {
2668
+ if (!Number.isSafeInteger(since) || since < 0) throw new TypeError('since: unix seconds, a whole number');
2669
+ if (this.logPath === null) return { messages: [] };
2670
+ let text = '';
2671
+ try { text = readFileSync(this.logPath, 'utf8'); } catch (e) { if (e.code !== 'ENOENT') throw e; }
2672
+ const messages = [];
2673
+ for (const l of text.split('\n')) {
2674
+ if (l === '') continue;
2675
+ let m;
2676
+ try { m = JSON.parse(l); } catch { continue; }
2677
+ if (m !== null && typeof m === 'object' && (m.received ?? 0) >= since) messages.push(m);
2678
+ }
2679
+ return { messages };
2680
+ }
2681
+
2601
2682
  setTier(who, tier) { return this.#locked(({ now, store }) => store.setTier(who, tier, now)); }
2683
+ // The owner's tier for an original DID before it is a contact (an enrolled worker): store.mjs presetTier.
2684
+ presetTier(did, tier) { return this.#locked(({ now, store }) => store.presetTier(did, tier, now)); }
2685
+ // The original DID that paired through this agent's code `nonce` (its inviteNonce, readCode().nonce),
2686
+ // or null: none yet, or the code's life plus a day is over (enrol.mjs answers only that DID).
2687
+ answeredBy(nonce) { return this.#read(({ now, st }) => { const a = Object.hasOwn(st.answered, nonce) ? st.answered[nonce] : null; return a && a.exp > now ? a.did : null; }); }
2602
2688
 
2603
2689
  // A contact's full bundle, from wherever it came (the UI reads its local agents' files): verified
2604
- // here; → { did, tier }, or null when it is no contact's.
2690
+ // here; → { did, tier, ours }, or null when it is no contact's.
2605
2691
  observe(bundle) {
2606
2692
  return this.#locked(({ now, store }) => {
2607
2693
  let r;
2608
2694
  try { r = verify(bundle, now); } catch (e) { fail('bundle', `REJECT: ${e.message}`); }
2609
2695
  const c = store.lookup(r.chain[0]);
2610
2696
  if (!c || c.revoked || c.did !== r.chain[0]) return null;
2611
- return { did: c.did, tier: store.observe(c.did, r, now) };
2697
+ const tier = store.observe(c.did, r, now);
2698
+ return { did: c.did, tier, ours: store.oursOf(store.lookup(c.did), now) };
2612
2699
  });
2613
2700
  }
2614
2701
 
package/enrol.mjs CHANGED
@@ -20,8 +20,9 @@
20
20
  // the operator answers a request whose proof matches an enrolment it issued with the
21
21
  // worker's identity, label LABEL_IDENTITY, end to end, once per enrolment, with a long
22
22
  // invite the worker accepts; once the worker has paired, the operator files it (observe:
23
- // tier own, by the attestation) and forgets the temporary DID. The machine takes the
24
- // identity only from the DID it paired with through the code, checks it (checkIdentity)
23
+ // ours by the attestation; tier own unless the operator chose one) and forgets the
24
+ // temporary DID. The machine takes the identity only from the DID it paired with
25
+ // through the code, checks it (checkIdentity)
25
26
  // and hands it to place(), which writes the file and pairs as the worker; then it
26
27
  // forgets the operator on the temporary identity, which gives its mailboxes up.
27
28
  // Anything else comes back in `rest`, for the caller's own inbox.
@@ -31,8 +32,17 @@
31
32
  // key = HKDF-SHA256(secret, no salt, info "sigelo-enrol/0 key", 32 bytes)
32
33
  // proof = hex HMAC-SHA256(key, "sigelo-enrol/0 request\n" ‖ pair id)
33
34
  // where the pair id (kdf.pairId) is that of the pairing the request travels on. A plain `accept` of
34
- // the code pairs and gets nothing; a proof lifted onto another pairing does not match. One
35
- // enrolment, one temporary DID: a second is refused (enrol_used).
35
+ // the code pairs and gets nothing; a proof lifted onto another pairing does not match. The secret
36
+ // alone is not enough: anyone who saw the long code (a chat it was pasted in; the relay, which
37
+ // parks it behind the short code) can compute a proof over a pairing of its own. So the operator
38
+ // answers only the DID that paired through this enrolment's own code (carrier.answeredBy(nonce),
39
+ // recorded with that pairing): enrol_unpaired while nobody has, enrol_from for any other contact.
40
+ // The relay is no contact: knowing the secret gives it no pairing to send a proof on, and that
41
+ // holds for a relay operator who is also a contact (its own pairing did not come through the code).
42
+ // What stays is the code itself: whoever ANSWERS it first (the relay, which holds it; anyone it was
43
+ // shown to) pairs through it and is answered; the machine then sees park_unknown or four words that
44
+ // differ, after the key went (THREAT-MODEL §2.11). One enrolment, one temporary DID: enrol_used
45
+ // stays as a second check, unreachable while one code pairs one DID.
36
46
  //
37
47
  // The private key travels once, inside a sigelo-msg/0 envelope (end to end); it is never parked
38
48
  // on the relay and never encrypted under the 8-character code (40 bits).
@@ -80,7 +90,7 @@ function pinnedGenesis(seed, recovery) {
80
90
  function pinnedChain(seedAt, n, recovery) {
81
91
  if (!Number.isSafeInteger(n) || n < 0 || n > MAX_N) fail('enrol', `rotation: 0 to ${MAX_N}, not ${n}`);
82
92
  const g = Array.from({ length: n + 1 }, (_, m) => pinnedGenesis(seedAt(m), recovery));
83
- const rotations = g.slice(1).map((x, m) => rotate({ genesis: g[m].genesis, next_genesis: x.genesis, iat: ROTATION_IAT, reason: 'voluntary', secret: g[m].seed }));
93
+ const rotations = g.slice(1).map((x, m) => rotate({ genesis: g[m].genesis, next_genesis: x.genesis, iat: ROTATION_IAT, reason: 'voluntary', secret: g[m].seed, next_secret: x.seed }));
84
94
  return { genesis: g[0].genesis, rotations, secret: g[n].seed, original: g[0].did, did: g[n].did };
85
95
  }
86
96
 
@@ -327,16 +337,21 @@ async function sendRequests(carrier, file, temp, out, first) {
327
337
  }
328
338
 
329
339
  // The operator: a request from a contact. Answered only when its proof matches an enrolment this
330
- // operator issued, over that contact's own pairing, and only for the first contact that asked.
340
+ // operator issued, over that contact's own pairing, and only when that contact is the DID that
341
+ // paired through the enrolment's code (the header's "The marker").
331
342
  async function onRequest(carrier, file, keeper, m, out) {
332
343
  const now = nowOf(carrier), c = readStore(carrier).contacts[m.from];
333
344
  const who = `${m.name ?? m.from} (${m.from})`;
334
345
  if (!c || c.revoked || !c.pair_key) { out.refused.push({ check: 'enrol_contact', detail: `an enrolment request from ${who}, no live contact: ignored`, from: m.from }); return; }
335
346
  const pair = pairOf(c);
347
+ // Who paired through each code, read before the pending file's lock (the carrier takes its own).
348
+ const answered = Object.fromEntries(pending(file, now, (s) => Object.keys(s.issued)).map((id) => [id, carrier.answeredBy(id)]));
336
349
  const r = pending(file, now, (s) => {
337
350
  const hit = Object.entries(s.issued).find(([, e]) => matches(m.content, hexToBytes(e.key), pair));
338
351
  if (!hit) return { check: 'enrol_proof', detail: `${who} asked to be enrolled, but its request matches no enrolment code this operator issued in the last 24 hours (a plain contact, or an expired code): nothing sent` };
339
- const [id, e] = hit;
352
+ const [id, e] = hit, by = answered[id] ?? null;
353
+ if (!by) return { check: 'enrol_unpaired', detail: `${who} proved an enrolment code over its own pairing, but nobody has paired through that code yet (the machine pairs first): nothing sent` };
354
+ if (by !== c.did) return { check: 'enrol_from', detail: `${who} proved an enrolment code over its own pairing, but ${by} paired through that code: only it is answered; nothing sent` };
340
355
  if (e.temp && e.temp !== c.did) return { check: 'enrol_used', detail: `${who} answered an enrolment that ${e.temp} took already: one code places one worker; nothing sent` };
341
356
  if (e.done) return { check: 'enrol_done', detail: `${who} asked again for worker ${e.i}, placed already: nothing sent` };
342
357
  e.temp = c.did;
@@ -370,11 +385,11 @@ async function settle(carrier, file, keeper, out) {
370
385
  if (!c || pairOf(c) === e.old_pair) continue;
371
386
  const identity = workerIdentity({ K: keeper.K, i: e.i, n: e.n, recovery: keeper.recovery, attestation: e.attestation, issuer: e.issuer });
372
387
  const bundle = { v: 'sigelo/0', typ: 'bundle', genesis: identity.genesis, rotations: identity.rotations, bindings: [], attestations: identity.attestations, issuers: identity.issuers };
373
- const tier = carrier.observe(bundle)?.tier ?? null;
388
+ const seen = carrier.observe(bundle), tier = seen?.tier ?? null, ours = seen?.ours ?? null;
374
389
  let released = false;
375
390
  try { released = (await carrier.forget(e.temp)).released; } catch (x) { if (!(x instanceof MsgError) || x.check !== 'not_contact') throw x; }
376
391
  pending(file, nowOf(carrier), (s) => { if (s.issued[id]) s.issued[id].done = nowOf(carrier); });
377
- out.placed.push({ id, name: c.name, did: c.current_did, original: c.did, i: e.i, n: e.n, tier, temp: e.temp, released, exp: e.attestation.body.exp });
392
+ out.placed.push({ id, name: c.name, did: c.current_did, original: c.did, i: e.i, n: e.n, ours, tier, temp: e.temp, released, exp: e.attestation.body.exp });
378
393
  }
379
394
  }
380
395
 
package/file.mjs CHANGED
@@ -29,18 +29,22 @@ export const chunksOf = (n) => Math.ceil(n / CHUNK);
29
29
 
30
30
  /**
31
31
  * A name safe to put in a directory: its last path segment (either slash), without control or
32
- * format characters (C0, DEL, C1, bidi overrides, zero-width), without leading dots or spaces (no
33
- * hidden file, no "..") and cut to NAME_MAX UTF-8 bytes on a character boundary. Nothing left:
34
- * "file".
32
+ * format characters (C0, DEL, C1, bidi overrides, zero-width), without what NTFS refuses or reads
33
+ * otherwise (< > : " | ? *; ":" names an alternate data stream), without leading dots or spaces (no
34
+ * hidden file, no "..") or trailing ones (Windows drops them), cut to NAME_MAX UTF-8 bytes on a
35
+ * character boundary, and a Windows device name (CON, NUL, COM1, LPT1.txt…) behind "_". Nothing
36
+ * left: "file".
35
37
  */
36
38
  export function safeName(raw) {
37
39
  let s = String(raw ?? '').split(/[\\/]/).pop();
38
- s = s.replace(/[\p{Cc}\p{Cf}\u2028\u2029]/gu, '').replace(/^[.\s]+/, '').trim();
40
+ s = s.replace(/[\p{Cc}\p{Cf}\u2028\u2029<>:"|?*]/gu, '').replace(/^[.\s]+/, '');
39
41
  if (Buffer.byteLength(s) > NAME_MAX) {
40
42
  let n = 0, cut = '';
41
43
  for (const ch of s) { n += Buffer.byteLength(ch); if (n > NAME_MAX) break; cut += ch; }
42
- s = cut.trim();
44
+ s = cut;
43
45
  }
46
+ s = s.replace(/[.\s]+$/, '').trim();
47
+ if (/^(con|prn|aux|nul|conin\$|conout\$|com[0-9¹²³]|lpt[0-9¹²³])(\.|$)/i.test(s)) s = `_${s}`;
44
48
  return s || 'file';
45
49
  }
46
50
 
@@ -86,6 +86,7 @@
86
86
  "reason": "voluntary"
87
87
  },
88
88
  "sig": "z3ZJ4sidVA6QX1mNKLzFBMPcjKGw1dP9FQCfSyrBxfpEBUM6MWJ77hi2zg4Z4biYYqurt73s3992U873dGKJH5Ye6",
89
+ "sig_next": "z4QnnhZHvEtTyMde7cVjseWdtUHuvHsGMxnic3X9gDhQdFAndbexUdBFbSyGDW6ebyVxzm9JcUApAoQ7Ap8F1v3GM",
89
90
  "next_genesis": {
90
91
  "v": "sigelo/0",
91
92
  "typ": "genesis",
@@ -106,6 +107,7 @@
106
107
  "recovery_key": "z6MknFEB9GzhsiMvQuYotqHKSXgumZkLZaJc6pkyGa6sir4B"
107
108
  },
108
109
  "sig": "zcNFYTahu2C7A32BG7ehGNN2HfsnyWu4ommKao1ZtsW9po9AroyzMFsdU7Hhyb7YEkWb5QaWMTZbYZ69jSt4QXbw",
110
+ "sig_next": "zUpNGdtfNumTUKDr7zmV6i52UiA9APu4asNc2gJAryc66xhoGiURZ2a1ewtazvK8vseuQHopfmWM3BYKKL4giUff",
109
111
  "next_genesis": {
110
112
  "v": "sigelo/0",
111
113
  "typ": "genesis",
@@ -555,6 +557,7 @@
555
557
  "reason": "voluntary"
556
558
  },
557
559
  "sig": "z3ZJ4sidVA6QX1mNKLzFBMPcjKGw1dP9FQCfSyrBxfpEBUM6MWJ77hi2zg4Z4biYYqurt73s3992U873dGKJH5Ye6",
560
+ "sig_next": "z4QnnhZHvEtTyMde7cVjseWdtUHuvHsGMxnic3X9gDhQdFAndbexUdBFbSyGDW6ebyVxzm9JcUApAoQ7Ap8F1v3GM",
558
561
  "next_genesis": {
559
562
  "v": "sigelo/0",
560
563
  "typ": "genesis",
@@ -580,9 +583,9 @@
580
583
  }
581
584
  },
582
585
  "note": "bob's contact notice after his rotation B0 -> B1: his chain, a proof signed by B1",
583
- "length": 1342,
584
- "sha256": "53fbcaab644a093926f31fe67f9361ad0cfb95ae9ed3187891ec2f0ba377a0d0",
585
- "hex": "0104000000000000000000000000000000000000000120164d0813e9a54ba2ca466de71493e863dad8a1345afac944d2757810c1c1c66831dbfcf3bc33cd2684c719c06e9f3d0dc56c0d35da73051f23f1d9af660bb99df6e2c4b424f46f4567ffcecec98ac789bcf1cf12dc4fa371e65e3ab826720329609cfa92f4c850ecc9b0a9fb93b457e57c51aba991e5d05d5a8b07561531dd680463557f0b278d9b9eee402559eadd21bbd878b9cd4ee8e31990f2f68c90667af80f105ab943cd94f449a6bcfa066db10e389304412474ffa0994947dc5b62386d8a6ad56f3b94e5a95ae28227bc0477c43ba184cac87d249c4be847120d54c255d84ed7d6ec1d27c0ea35f662bfd06f41f13c46ab81076bbf837e5298a8c3afa051a3b70e3dd1ca9ffc43eee04c463d4071b4a4696dcb01ff10dd929ba99884b23db71109c52f359d762172a55ca511ba8f7d94b249e6b002fd56bbdc958119a8277f9fc0bf96531641ac98dda85874847ebd063cbfcc5e8648eb2ccbd829088400904a64c5e6f9ac7aafeee4debf026071c1cb2ecdcbebc06b859c8e33fa84130aa69b76fd864cc01e4cfabeceb0ca372a1526af3b4febc639f37e15d122baff2cf04f684c1c7e9810b87112bc539ccae8e03614b300545c0a1515779f0f33a2544d808ea77bd58aacf64fb8c0270a0e9092ea6d1408a5a3ed47785f1f4f076e0012d32eebcdaaeb99d9599b8d2d5406cac5c3c6d7144112f03ae445e8db677222fa84447a260a025619a8d3e52cd2ab873321643d3099e5aa930d8f47219a7db6fa4f9f526b032f51c7af9a0571e2f903ead7cdbfae2faf7cd5bfc1a9ba7c2ea0f4e48fa79fa228e90c0bb59d7a1b23a20c1be938250a73049dacb0287543018667a78eb309cfdffcbdbf6e45b54f1903c59a8f5847ee52b42e22d405d6fb3ec711c42f58f8f34cbe33c0fcaebaf8d08243d80fb7904674ed63d604aacc97fe71a308c35ac795836d404ab2578c29805e988ae11722f8d7fdf945a1d352b67bed9b2fa9fd5d7b0e17df6c2bdc5ffa8fb2dc21f41ac020d1ffbd22e496c26c2a28eaee0496417db2022ec42ce82cc927827e171f0245c1c491c04f978635e36d65ffeb1dca97a7e187b855ee811906a0f7c46f61ed4467dedf8c015db4e776b5e0e3dd095271b0a87b96e92315f1d8e3554ff07071190493c22ad65280758123dce3e129c4f649f5526eee5bedfbaed106aa46e28daba40ee7c1ca160ed98a28cd4092580d4e5c06dc3f0368079aaf39b893976cf7f4226dc582934c80254d7ab12d16e5a9f7ad50412d8e90a7be46d374763aa8d691ff168ed242ecf2eb63978edf61d4e43ef046f08cd190a1d4cd4d356c8a7816eecb0482d7fb5ef7ac71e6c0635b6b26b98b0022ce897b70f2e0aa0d78461e5b75c40cb278e91fa1df40c8dfe8e75fa04813916fa79f8f68cfa2f839469da1d976fa5ae5a76cf0426bbfb067dac512159e879abb2360383b7032ed03702cb6f688dbc5e4212769e1fa5a8078247312a884d691745c3b5250933a1f95419b0f596f6f14d6958fa5e51366b1fee699baf5cb711a4015d3e3296f8f4900a67477591d659837700ded9259d4038e9670c4cb6fc13d225728339ae2eb0fe9c09650be3576165049a431d07097257b21d033338c97f0b54fdd0ad8b74274524bf2efc06705f760d92500c509e41e527926694b58204fe29bed4338854abdb2a3bc542846b3b5aa5b2d059d83a637d3797708832b350871d44362a566d48489567ac5ac62d05de3cc6a5015edacddaab1717634dff4d99644903980c3cb82036e68bd961d9e822ec8aa3eb246c195476134ee175448a279842b1dd7205244d9c22e8f8c9745f8d0fc789c81ba9accd1390b79cafd"
586
+ "length": 1598,
587
+ "sha256": "77edc6e635a7325d70f055ad57b5638a96eecf7d53fbec30f94634f363cb7d8a",
588
+ "hex": "0104000000000000000000000000000000000000000120164d0813e9a54ba2ca466de71493e863dad8a1345afac944d2757810c1c1c66831dbfcf3bc33cd2684c719c06e9f3d0dc56c0d35da73051f23f1d9af660bb99df6e2c4b424f46f4567ffcecec98ac789bcf1cf12dc4fa371e65e3ab826720329609cfa92f4c850ecc9b0a9fb93b457e57c51aba991e5d05d5a8b07561531dd680463557f0b278d9b9eee402559eadd21bbd878b9cd4ee8e31990f2f68c90667af80f105ab943cd94f449a6bcfa066db10e389304412474ffa0994947dc5b62386d8a6ad56f3b94e5a95ae28227bc0477c43ba184cac87d249c4be847120d54c255d84ed7d6ec1d27c0ea35f662bfd06f41f13c46ab81076bbf837e5298a8c3afa051a3b70e3dd1ca9ffc43eee04c463d4071b4a4696dcb01ff10dd929ba99884b23db71109c52f359d762172a55ca511ba8f7d94b249e6b002fd56bbdc958119a8277f9fc0bf96531641ac98dda85874847ebd063cbfcc5e8648eb2ccbd829088400904a64c5e6f9ac7aafeee4debf026071c1cb2ecdcbebc06b859c8e33fa84130aa69b76fd864cc01e4cfabeceb0ca372a1526af3b4febc639f37e15d122baff2cf04f684c1c7e9810b87112bc539ccae8e03614b300545c0a1515779f0f33a2544d808ea77bd58aacf64fb8c0270a0e9092ea6d1408a5a3ed47785f1f4f076e0012d32eebcdaaeb99d9599b8d2d5406cac5c3c6d7144112f03ae445e8db677222fa84447a260a025619a8d3e52cd2ab873321643d3099e5aa930d8f47219a7db6fa4f9f526b032f51c7af9a0571e2f903ead7cdbfae2faf7cd5bfc1a9ba7c2ea0f4e48fa79fa228e90c0bb59d7a1b23a20c1be938250a73049dacb0287543018667a78eb309cfdffcbdbf6e45b54f1903c59a8f5847ee52b42e22d405d6fb3ec711c42f58f8f34cbe33c0fcaebaf8d08243d80fb7904674ed63d604aacc97fe71a308c35ac795836d404ab2578c29805e988ae11722f8d7fdf945a1d352b67bed9b2fa9fd5d7b0e17df6c2bdc5ffa8fb2dc21f41ac020d1ffbd22e496c26c2a28eaee0496417db2022ec42ce82cc927827e171f0245c1c491c04f978635e36d65ffeb1dca97a7e187b855ee811906a0f7c46f61ed4467dedf8c015db4e776b5e0e3dd095271b0a87b96e92315f1d8e3554ff07071190493c22ad65280758123dce3e129c4f649f5526eee5bedfbaed106aa46e28daba40ee7c1ca160ed98a28cd4092580d4e5c06dc3f0368079aaf39b893976cf7f4226dc582934c80254d7ab12d16e5a9f7ad50412d8ec1d8e10dc052687dea80d1b05a908a76a0b0a14ffdc2b866e9fa16f84ce8dfa587fe93ea5b2e56a42f5add9a21a0cbec15aee40bbbce431100609ba30a7cdf856440facdd615120d207c4f9525a36f8d3f8ee410bbf9f99578d34571eb1b949f882de9c0ed3655879ec735fc14efe710e6463cfdf67bde8e4c15d287c1ab336f6b6b7e39f1576430ffb1cecd9cee746362aebe5e8b2e6a6419ea9486da3c5c750944d864078547921e5463214381c882afeb1108eeb2a2e3d581d12138614aebfc283db00e2afb472c396e4af6246406b8d111c103de9272e49d29d6050e67325af582f90ae193e102a8072e28097bb318886cd8140a2a8671059db794f4199664ddf0241c1e46efdd832510c777f63e1be73ab334774138611d126121c1dd8d0c19a078acb1bfa45f0a71a6b4ed547fb5bffe8a15a010102ab9094f3a33e20516cf539cc9d03e3190ee11e736d68f0d244386f6b2f9c33d184ca6a09bfb23e669f7879df460143f8ae559daec57ace85fca7192ed060e4eaf502e0ce835f3402ebf4d1e11bd9843ddc0c253acb5c13b0128073f9c37291686f4d3b7d03e3bd5c0d6853f527c5993e6e616bce9fa3190fe8b4719d40fbc18a8d103ccb52dd32d2e30837dbda577a62445f3196b0169ba8bf648e1ed4941c97648a55382652c71b9178d784e9b91086dfe3079898f549890a8960789de532cb6e1ca6834cf5c0e23bda3cd6d22ebc0ce8f8cc07ba97f89febca8232621d1a7ef3ac48810131ec4f5f75ef93b6ac4a95a8ce12e0aee3c7e8524779a254f11c4fa7499ad232611ed8aae1932f832a8fa04c5a270b0a853543331fe99c0813d3e94ba1fdfc7969567381e795e8f07f6df7efe0757d9c84cd9d191906f59466f04ba5374e93c020d57b98ba010bf842cb4eb8155c92f9d8a9c1e0ae3a6ca642ec2c6fb41"
586
589
  },
587
590
  {
588
591
  "case": "notice_recovery",
@@ -614,6 +617,7 @@
614
617
  "reason": "voluntary"
615
618
  },
616
619
  "sig": "z3ZJ4sidVA6QX1mNKLzFBMPcjKGw1dP9FQCfSyrBxfpEBUM6MWJ77hi2zg4Z4biYYqurt73s3992U873dGKJH5Ye6",
620
+ "sig_next": "z4QnnhZHvEtTyMde7cVjseWdtUHuvHsGMxnic3X9gDhQdFAndbexUdBFbSyGDW6ebyVxzm9JcUApAoQ7Ap8F1v3GM",
617
621
  "next_genesis": {
618
622
  "v": "sigelo/0",
619
623
  "typ": "genesis",
@@ -634,6 +638,7 @@
634
638
  "recovery_key": "z6MknFEB9GzhsiMvQuYotqHKSXgumZkLZaJc6pkyGa6sir4B"
635
639
  },
636
640
  "sig": "zcNFYTahu2C7A32BG7ehGNN2HfsnyWu4ommKao1ZtsW9po9AroyzMFsdU7Hhyb7YEkWb5QaWMTZbYZ69jSt4QXbw",
641
+ "sig_next": "zUpNGdtfNumTUKDr7zmV6i52UiA9APu4asNc2gJAryc66xhoGiURZ2a1ewtazvK8vseuQHopfmWM3BYKKL4giUff",
637
642
  "next_genesis": {
638
643
  "v": "sigelo/0",
639
644
  "typ": "genesis",
@@ -660,8 +665,8 @@
660
665
  },
661
666
  "note": "bob's contact notice after his recovery B0 -> B2, which beats the thief's B0 -> B1: a proof signed by B2. Alice, who followed B1, merges a recovery she had not followed: she marks bob re_pair \"contact_recovery\", since K may be the thief's, and sends him nothing more until a new pairing",
662
667
  "length": 2110,
663
- "sha256": "14fe3e6b39686760134678f5904206d14e42609da2f3548b1aec37d0ee192fa5",
664
- "hex": "010400000000000000000000000000000000000000010056d1281c0173fc533bc7f74fd7d566e39c49584b129be4c34de3627486193ede6942f1cab6c91afd85996bf59752463c81e48eb56db6e25f9883e535362baed3210f1f95d2638cfea2b9146e79ece77e8715a90fa604e26cb1a59891a09829f144cf211f1124bce328b5da013b43735d33f3144a4cf86aecb053a29f96fca0f4478d2a008e4045db9ac6ff837e98e6335417d3e5f95b6451ad51e88c0aa696911dc6b92ae470e6c63a9eabb6f918b879b82229163cbd5cfdd4a5fb1bb9af8b013702d492cd399818c3c1ad69e1b0927a43fee4237b8cf3b66a02d029aae3d544a9d7752ff35a4bb4d545662d8d68ec75a028244077e7f4b69ec4c76836bbfc9ee09bf3bf169b776322089c1693ac124083f89f820d0dd2a1625d59e4d5b12e098d57766bdb1cabddd8679921435d403166cbcf914b967268efdb78ad7969c96e93bf3ec3626c0754cb2f914807e314b9b6fed42c119860903a366ceda6c9095ecdffb9bfb8cc4cd0f5ab392430ab75891c94b774a7b994f59f71628fd9c33412fa88975aa5b4af7a0e1dc35f6368a9097d1ab37ff6c649d09ec53612a97776de3f89f16028d184073c423718f769bf8e2daf9077015b393df0db3d715048a34ccc8725ad0cf02018d050267756cc7cc20e7f96222877f25593c86d195c57c4f82567462a7692a18471eb9a18941e4eaca937be01f262e4d00210ac3d95124bd21905dfe1e0a875f94ca7e2a04c586e39580cdea9f26db9f06b817193f9d5f690c368ab0246ac0952c573e2dfadb253fc3f4c4190ab69d4c1b40da144f1f013034088727cd4d8af1a853ea4010ab28ca3137e1bb6bab3f909f18265fd519fed6425124100d70ac40dc35d899cb0f54fd2714d8ccf64df65ac6e2d51c4d4e3983c9a6bc2b04d3fab410246259506b9896f822e6a49c8a6447aea61492acb50d2e3014ecccef47b59748b7c1238f6814df5ac8d7412a08523683d14b57e05a87fad90fb118d1842cf5f50a2c71bcbdb1e5ac3287d22e947952f9b78cec0a0ff229383e455e930a93441956305088d4621a7310fd761133143aecc9a586834878ee7f3144e0091545f03ecae2e9145d86afbd35578ee05e2938fffa651354cdaea0363edc523212b62d419193a8a44d8c6a407d1f7470fd937f35c9a6edb297ae5349f516858a8154d95c5e0c270191d9e421b5dd25bc9e4b5271914c3f7a1bbd1e54f80fc291ef5f8e89f2cf0340eb37477096d1e94c38480cff5e2ce3fc831dc059986a71bb838f835c97c86ce84a1ccb91e00c4ce26dde9fd2cd76e3d725cadbd0775e1615d8af825dd16cb8a8660afa67a62ce3d514aba3078c074b9ddfef8ce87fd66f3112f45ba363a88d395e258078ae028534e6cbfd494ff8426de257ddccc585cfb0a95e450b03e19f03560dfff242b4ddf350f02169de4378aa0c3148eebf580530e45c81f9625d910e50043d8e345d772202dc03bb91a400d82622b317f396df9d50628cffaf97ccbbe0e9c0a43d2e460c90817e2605e028ef1a6df1dfbc757358576b21db16d0604d197d7d88f214d505b60cf3a9c90b11bcef4544ca628aa5606115111de64a0cc67056620309c3ae2d66e6ea64b3be59ea49c27f6726fcf50898faf7538e38d9cb96e6b168342a5fef446b0fdd94d9bda60c72254147d3dd39ad2be53c220d4dddd5d531ce6262853c71a9c4107555a1608b3993e8d43aa64fbb6ab3bcc7587fc9e30e0cbf5f76cae40b697d5b978b7388018336a1cd598d34a2344f8ad33a0bee0746bd02cf5c0d443dbfb679ea044e67aa255988c7835a88b590a9b206db8d2ae9161267447471cac3f547be96f6c42a34c8d224a1f3717c5580888abbd1a1bc6ef6f7140a156bd7371a1b5261b17b5e99e47258db8d553a9be4b221323eb57845a20a528a2122d3f8c48447eb8299ed41414eb3586556be5ddd5102687bd480c5a8de8ad27ef249672986579becf8d95937d4800e08de5e9819355c3d2b9ccc9c72ffd237343ebd8bb78aafc994db163aaa3d8fbc5b5cc3ae4546e797a25e363e307cdad2827b35a0b085699f2dc91bcb14368b734e4377dd2dc1e3fc95c634748002cc1da7a5bab03ca84e86ac8df4a31064ce82072a549740b4f713517bc8bdb0b720e2780f03ab8d1b138988b6ff04dccc94c3e1de1c2b01a3a9bfee8a4f1e8ddf6ba353c24084a61d3f99b246c1256284a9405aec6ef29cf92eda584e39c84d215ab89139833ecba4199b9723b8c56ceb36befcfab6900a0802122eacbe44f7d93731d3dabc6ca3d312e3e1484a4a23c26b6242c715e40e4860d2cb8b6b641a3b737317ab85f756ede2d0845296d91eddb92c3620ff1e515679a379bd64184a2a1a67402d8dc54d2e3a7436394fed0c16e502faabf595ea6ac82fbf6ace711e61868b5fbbed3dd6e4b6ca99b8134bfa3bf778cf71dcf962e599067bfce8d46548942151a905f2c66fe5bd3562fe6304bc93752563b182dd31d64abdeb0c0f127b1635a5200b56145339b3debf50e02f9cc52a6c46d04b1d5571c3addd75bec5e08208a266d894cad98b9fceccf11edf7e477c751d0e42807721aab6859a52a5838c2b401a5717576b00f8e3f93fd6c3c23a1614e8fb70a367e1f057469cfc3bd7e592981407e38632dc46cf36bb32cf2d02f6aa2e3df9cac828d9c92cbabcfcf75f40fa4cf2838a9fff696eba3c29ea554687daff5da87caf10c8aab6e7bcc2c89e40c2c7ddbf6c1a00549821fe0fbabadba518c6b1e9e9de69bcd88872d4f67dda453dd540223ff8605639a86e37ea11c205a13f65d3d85d64156e28c3c9a712455676b20670dad041cb85b9192bca8c8c6c6829a275cf9576d5154ac78bad596b778fb32e9bc07daddcc8e65f00b1fe41efe0849a6462c66dd38b94d7d135a7dcb418fe63ae5a5ba05c7a33b52342987bc1d180c722f90"
668
+ "sha256": "4404afafa32bc03919733c89d653aae551737f1bf8cf77288e6b0a963cd32ec5",
669
+ "hex": "010400000000000000000000000000000000000000010056d1281c0173fc533bc7f74fd7d566e39c49584b129be4c34de3627486193ede6942f1cab6c91afd85996bf59752463c81e48eb56db6e25f9883e535362baed3210f1f95d2638cfea2b9146e79ece77e8715a90fa604e26cb1a59891a09829f144cf211f1124bce328b5da013b43735d33f3144a4cf86aecb053a29f96fca0f4478d2a008e4045db9ac6ff837e98e6335417d3e5f95b6451ad51e88c0aa696911dc6b92ae470e6c63a9eabb6f918b879b82229163cbd5cfdd4a5fb1bb9af8b013702d492cd399818c3c1ad69e1b0927a43fee4237b8cf3b66a02d029aae3d544a9d7752ff35a4bb4d545662d8d68ec75a028244077e7f4b69ec4c76836bbfc9ee09bf3bf169b776322089c1693ac124083f89f820d0dd2a1625d59e4d5b12e098d57766bdb1cabddd8679921435d403166cbcf914b967268efdb78ad7969c96e93bf3ec3626c0754cb2f914807e314b9b6fed42c119860903a366ceda6c9095ecdffb9bfb8cc4cd0f5ab392430ab75891c94b774a7b994f59f71628fd9c33412fa88975aa5b4af7a0e1dc35f6368a9097d1ab37ff6c649d09ec53612a97776de3f89f16028d184073c423718f769bf8e2daf9077015b393df0db3d715048a34ccc8725ad0cf02018d050267756cc7cc20e7f96222877f25593c86d195c57c4f82567462a7692a18471eb9a18941e4eaca937be01f262e4d00210ac3d95124bd21905dfe1e0a875f94ca7e2a04c586e39580cdea9f26db9f06b817193f9d5f690c368ab0246ac0952c573e2dfadb253fc3f4c4190ab69d4c1b40da144f1f013034088727cd4d8af1a853ea4010ab28ca3137e1bb6bab3f909f18265fd519fed6425124100d70ac40dc35d899cb0f54fd2714d8ccf64df65ac6e2d51c4d4e3983c9a6bc2b04d3fab410246259506b9896f822e6a49c8a6447aea61492acb50d2e3014ecccef47b59748b7c1238f6814df5ac8d7412a08523683d14b57e05a87fad90fb118d1842cf5f50a2c71bcbdb1e5ac3287d22e947952f9b78cec0a0ff229383e455e930a93441956305088d4621a7310fd761133143aecc9a586834878ee7f3144e0091545f03ecae2e9145d86afbd35578ee05e2938fffa651354cdaea0363edc523212b62d419193a8a44d8c6a407d1f7470fd937f35c9a6edb297ae5349f516858a8154d95c5e0c270191d9e421b5dd25bc9e4b5271914c3f7a1bbd1e54f80fc291ef5f8e89f2cf0340eb37477096d1e94c38480cff5e2ce3fc831dc059986a71bb838f835c97c86ced5afc4f21b30ced27c93b0e567cc2e4e2603f2de7e31912239c3856d9a48ccfed631ae987a2ce81c43599e2c05f73a83ecf6f3f4eee849d3301f5b812d31d9d187ce722bbfeb197f617ad9dbbfee8a01932928dcef79668238e7a92da5110cb0077393ee070f0b986a1d47119eef74d2a2817aadddcfec5f471aab4bc74a8613b0441c95ef6fc60a3719ff0bd15f731aa16a033e525b54cec95322e8aabe16c98f37951042c3b928c2231afe7f59259f81bbc421edd34976963cf22b98674764d89781ccac2f5b623c18d4198f9cf801eae56055907da41f7716481ef75ffbee6413592220973ff7c96446a2337bced9c08851886641c666cff2b85003fa839fbd6972168342a1b9af17acfa9c12d5c72a946f5f5d2d2a94ce849351c421c7cbc6572e4df87d691b8001de690819267178baec72c801f304bdd68a52933bc684ef5388f6a2b614ae6995d4a5f834f11e922c250a2dd6dfb67d6e1f90e13ae2eded627fc82fe48dcf43808d73db83159e3cb3469abf5e18e1ee4946e04421f188b4a168207f000e57a52b0542a1637946b20ab8711b7c4555af0364d6c3e44309db992d2419fe10e23138d9ad284a14b1a2894b3dc4beab00ecaf29044f72de12db4852f93aa85a2f3fd308033fb862c0842249ea03c2203be4c3d42359fde22e0e0feec8ec69fd7f9d79c93062b2de93959e5d144dabcee1a2a1861cb8e5acf8c5ee35d7682b43b1d8f33fbafa884daf75a7a9d8f581f68d66b54c676b337e9b438e379aa13925c008725f06e38cdec0edc13d17bc45b32171ceed083c91056d684d0a28a3973a3cf647c3decb2892c2554e7006ba4621db476f5f5a0452089299cc60313e0fbacf2b88f8a52dd0ae39fe3ee7c25c790cd3c1a24c3ec7fea1eff4bf89b0ac33504e73682281aeda0e3c36097527e310b6828a17f3cfcaa5d5b79ef1c54ea09d5ce929a1ef7289e81f20985093c86ae9d1b44829e99e4c2ceee9ca6304fc4e1e30ac90c13455061e3d8998b6395de9270e115d2edc816964ddf0887291b6252466ed477b36fb3c2f706f23d5c29c9cf10371d7f31179c100c8da42d2c1add42b72bccf06d7a2de1560ca86a5913b116de5b7130bc3a6b8c7d8ffe554ae0173a0e8abfdc7341a7ffef0eb28a6a2b74caee93cf7af177cc172f9abc95d5ad66c505fc61c7e3ea216d97406c60f1f99231d5a615759cf356996e2aad793368b0a1d601ded646d7e97218bd51811ebda1fe99c5108e7c4265769eef610cd021730d405208224fbe0c79ce7c64cf4f18757c53e8da500246b22a76418b3282a13eb6637ff013312f73ad96bfe921b514bd64362adc76b5f0c3d3f5608fda0db4a6c4be5731a0e0248a15a975dd61f94e11b0cc487edab99b3b4aea6e987edbb0c842d9eed4b57c78b97f59f8eacf1d13d0b188dd9f8f1e8cb2ef9c2091ea043a4876d5e0fb293b38f356bff33c288c2ca986bae1178f1f5b1dc89dbb65f770aa7dc268b3b4349a7d6705bc8b5a43bc45e4f6d79b8320be294032f95e708ed455e0d0259132c649a5e59c909a4eac99a84b1b7d2f51368ce122a3a35c241ffb4a3820ab66583eb6e98af98b9478d769fe41efe0849a6462c66dd38b94d7d135a7dcb418fe63ae5a56d0393601a0f3165cc0f843d5319eba4"
665
670
  }
666
671
  ],
667
672
  "refusals": [
@@ -88,6 +88,7 @@
88
88
  "reason": "voluntary"
89
89
  },
90
90
  "sig": "z4MuQ2dcKbcLykt7e3CkoJaaG5VYH3oRSEaks9oveZCm6MMMp92ur6eXCKNXRfTNJGbkvYmkkPfttuiNPvLBPC8ip",
91
+ "sig_next": "z34xPRrMxzNMWy1XmKc3r7vKnm4awoSzq66WhSbPoTTwzQhCAp6BLf6gTU9X8LN1PjQq8d52txUvRttbtpVKbLF6V",
91
92
  "next_genesis": {
92
93
  "v": "sigelo/0",
93
94
  "typ": "genesis",