sigelo-contact 0.1.21 → 0.1.23

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.
Files changed (69) hide show
  1. package/GROUPS-REFERENCE.md +165 -0
  2. package/GROUPS.md +53 -0
  3. package/LICENSE +235 -21
  4. package/README.md +4 -5
  5. package/call.mjs +89 -28
  6. package/carrier.mjs +230 -51
  7. package/control.mjs +2 -2
  8. package/create.mjs +2 -2
  9. package/device.mjs +2 -2
  10. package/enrol.mjs +2 -2
  11. package/envelope.mjs +6 -6
  12. package/file.mjs +2 -2
  13. package/fixtures/carrier-v0.json +1 -1
  14. package/fixtures/envelope-v0.json +1 -1
  15. package/fixtures/group-v2.json +2999 -0
  16. package/gen-carrier.mjs +2 -2
  17. package/gen-device.mjs +1 -1
  18. package/gen-envelope.mjs +2 -2
  19. package/gen-group2.mjs +291 -0
  20. package/gen-invite.mjs +2 -2
  21. package/gen-short.mjs +1 -1
  22. package/group.mjs +116 -17
  23. package/group2.mjs +1534 -0
  24. package/home-wire.mjs +812 -0
  25. package/invite.mjs +3 -3
  26. package/kdf.mjs +2 -2
  27. package/kin.mjs +62 -0
  28. package/link.mjs +6 -6
  29. package/package.json +25 -8
  30. package/page.mjs +542 -63
  31. package/photo.mjs +2 -2
  32. package/platform-node.mjs +6 -6
  33. package/prekeys.mjs +3 -3
  34. package/public.mjs +2 -2
  35. package/qr-decode.mjs +1 -1
  36. package/qr.mjs +2 -2
  37. package/relays.mjs +2 -2
  38. package/restore.mjs +2 -2
  39. package/rtc-web.mjs +3 -3
  40. package/short.mjs +2 -2
  41. package/store.mjs +22 -9
  42. package/test-carrier.mjs +32 -11
  43. package/test-device.mjs +3 -3
  44. package/test-enrol.mjs +9 -4
  45. package/test-envelope.mjs +2 -2
  46. package/test-file.mjs +2 -2
  47. package/test-group-move.mjs +225 -0
  48. package/test-group.mjs +1 -1
  49. package/test-group2.mjs +202 -0
  50. package/test-home.mjs +225 -0
  51. package/test-invite.mjs +1 -1
  52. package/test-link.mjs +3 -3
  53. package/test-platform.mjs +2 -2
  54. package/test-presence.mjs +2 -2
  55. package/test-push.mjs +5 -5
  56. package/test-relay-lane.mjs +3 -3
  57. package/test-short.mjs +1 -1
  58. package/test-tier.mjs +8 -2
  59. package/test-transfer-web.mjs +15 -7
  60. package/test-transfer.mjs +24 -6
  61. package/test-voice.mjs +2 -2
  62. package/test-ws.mjs +1 -1
  63. package/transfer-engine.mjs +46 -16
  64. package/transfer-node.mjs +9 -7
  65. package/transfer-web.mjs +4 -4
  66. package/transfer.mjs +8 -8
  67. package/voice-web.mjs +2 -2
  68. package/voice.mjs +7 -3
  69. package/words-lock.mjs +2 -2
package/control.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: MIT
2
- // Remote control over the relay (design/apps.md §6.3; apps/agent/UI-API.md "Remote"): an app
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Remote control over the relay (apps/agent/UI-API.md "Remote"): an app
3
3
  // drives the page of `sigelo-agent ui` on a computer through the relay, holding no account key.
4
4
  //
5
5
  // The control identity: a random Ed25519 key made where the app runs (newControlIdentity), never
package/create.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: MIT
2
- // A new identity made on the device (design/apps-seed.md §7, pass A10a; Monerujo's create and seed
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // A new identity made on the device (Monerujo's create and seed
3
3
  // review as the model). The root S is drawn here, as `newRoot()` draws it (keys.ts: 253 random bits from
4
4
  // crypto.getRandomValues, redrawn until 0 < S < l), and held as bytes. Its 25 words exist only while the
5
5
  // review screen shows them; the identity's files are made only after the human has typed three of them
package/device.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: MIT
2
- // Devices, contract sigelo-device/1 (design/devices.md §5–§7): moving a device identity to a phone
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // Devices, contract sigelo-device/1 (apps/agent/DEVICES.md, THREAT-MODEL §2.15): moving a device identity to a phone
3
3
  // or a second computer by QR. No network and no process here; sigelo-agent's `device` verbs drive
4
4
  // it (apps/agent/sigelo-agent-device.ts, DEVICES.md). Two ranks: SAFE, the device becomes
5
5
  // worker i of the operator's keeper root, its own DID, tier own, revocable alone; FULL, it also
package/enrol.mjs CHANGED
@@ -1,4 +1,4 @@
1
- // SPDX-License-Identifier: MIT
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
2
  // Enrolment, contract sigelo-enrol/1: the operator places worker i, an identity DERIVED from its
3
3
  // keeper root K (MONERO.md §2, ts/src/keys.ts agentIdentitySeed(K, i, n)), on another machine, so
4
4
  // the 25 words bring the same DID back. THREAT-MODEL §2.11, apps/agent/ENROL.md.
@@ -60,7 +60,7 @@
60
60
  // temp?, invite?, done?, sent_at?, needs_send?, short_hash?, unparked? } },
61
61
  // joining: { invite nonce: { key, code_did, relay, exp, sent, temp, long?, short_hash?, answered? } } }
62
62
  //
63
- // The code is spent at the grant, not before (the agent-setup feedback, point 2). The operator parks its short
63
+ // The code is spent at the grant, not before (spent earlier, a machine whose join was cut short could not fetch it again). The operator parks its short
64
64
  // code as an enrolment code (relay/park.mjs: fetched again until the grant) and spends it there once
65
65
  // the worker's identity has gone (unparkHash, `unparked`). The machine keeps its joining entry from the
66
66
  // fetch on: the long code, the short code's hash and its temporary identity, whether its answer went
package/envelope.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: MIT
2
- // sigelo-msg/0 envelopes (design/relay-plan.md §3 "Envelope", §11 "Epoch recovery"): one
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // sigelo-msg/0 envelopes (README.md "How it works", 4 and 5): one
3
3
  // end-to-end encrypted, signed message between two contacts, as the binary MQTT payload the relay
4
4
  // stores. No network code.
5
5
  // const s = session({ me, peer, K, hold }) me: { did, current_did, sign } (or secret: kdf.mjs signAs); peer: the store's contact record;
@@ -83,8 +83,8 @@ export const KIND = { message: 0, invite_answer: 1, invite_reply: 2, group: 3 };
83
83
  // epoch (the header's "Layout" and "Epoch recovery").
84
84
  export const CARRIES = 0x80;
85
85
  export const EPOCH_MESSAGES = 1000, EPOCH_SECONDS = 7 * 86400, BLOCK = 256, MAX_PADDED = 1 << 20;
86
- // The longest envelope a sender writes: the largest message a relay stores, on any tier (relay-plan
87
- // §3 "Allowances", 1 MB for Pro; relay/allowance.mjs). A relay closes the connection, with no
86
+ // The longest envelope a sender writes: the largest message a relay stores, on any tier (relay/README.md
87
+ // "Limits", 1 MB for Pro; relay/allowance.mjs). A relay closes the connection, with no
88
88
  // notice, on a packet past that and its header room (relay/server.mjs MAX_FRAME), and a carrier
89
89
  // sends what it queued first at every connection: an envelope over it would block every later one.
90
90
  // A padded plaintext of at most a reader's cap (256 KiB free, 1 MiB Pro) less 1,198 bytes always
@@ -102,8 +102,8 @@ export const MAX_ENVELOPE = 1 << 20;
102
102
  // carries an encapsulation naming a held prekey adds a decapsulation (8 ms).
103
103
  export const WINDOW = 64;
104
104
  export const EPOCHS_MAX = 64, ENDED_MAX = 1024;
105
- // The longest a relay keeps an envelope: the Pro tier's 90 days (relay/allowance.mjs, relay-plan
106
- // §11), the hold of a session that names none. A carrier passes its reader's own retention.
105
+ // The longest a relay keeps an envelope: the Pro tier's 90 days (relay/allowance.mjs,
106
+ // relay/README.md "Limits"), the hold of a session that names none. A carrier passes its reader's own retention.
107
107
  export const HOLD = 90 * 86400;
108
108
  const HEAD = 22, KEM = 16 + 1120, NONCE = 24, TAG = 16;
109
109
  const sameBytes = (a, b) => { if (a.length !== b.length) return false; for (let i = 0; i < a.length; i++) if (a[i] !== b[i]) return false; return true; };
package/file.mjs CHANGED
@@ -1,5 +1,5 @@
1
- // SPDX-License-Identifier: MIT
2
- // File transfer over contact messages (design/human-ui-plan.md §4, decision 3): pure code, no I/O.
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ // File transfer over contact messages: pure code, no I/O.
3
3
  // A file goes as messages labelled FILE_LABEL to one contact, in one login (carrier.sendFile →
4
4
  // sendAll): first a manifest {id, name, size, sha256, chunks}, then `chunks` messages {id, i,
5
5
  // data}, each CHUNK bytes of the file (the last one the rest) as base64. 256 KiB is 349,528
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "v": "sigelo-carrier/0",
3
- "about": "sigelo-carrier/0 frames (design/relay-plan.md §11 \"Wire contracts as built\"; carrier.mjs header). `frames`: seal `value` as `kind` under `key` on `topic` with `nonce`; the result has `length` bytes and SHA-256 `sha256`, and is `hex` when given (frames of at most 4,096 bytes). Opening it gives `value` back. `refusals`: opening `hex` as kind `read_as` under the generic key on `topic` fails with `error`, the first failing check. `derived`: what the seeds yield, each from the formula beside it.",
3
+ "about": "sigelo-carrier/0 frames (README.md \"Contracts\"; carrier.mjs header). `frames`: seal `value` as `kind` under `key` on `topic` with `nonce`; the result has `length` bytes and SHA-256 `sha256`, and is `hex` when given (frames of at most 4,096 bytes). Opening it gives `value` back. `refusals`: opening `hex` as kind `read_as` under the generic key on `topic` fails with `error`, the first failing check. `derived`: what the seeds yield, each from the formula beside it.",
4
4
  "layout": "version 0x01 (1) | kind (1) | 16 zero bytes | counter 1, u32 big-endian (4) | XChaCha20-Poly1305 nonce (24) | ciphertext + tag of pad(JCS(value)); additional data = the 22-byte header ‖ UTF-8 topic; pad: 0x80 then 0x00 to the next multiple of 256",
5
5
  "kinds": {
6
6
  "1": "invite answer (sigelo-invite/0), on the answer topic, key invite.key",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "v": "sigelo-msg/0",
3
- "about": "sigelo-msg/0 envelopes (design/relay-plan.md §3, §11 \"Epoch recovery\"). Rebuild the receivers from the seeds (gen-envelope.mjs receivers(), each holding envelopes `params.hold` seconds), run `steps` in order: open `envelope` (hex) on its `topic` at its `now`, after `xor` [offset, mask] (negative offset counts from the end), `set` [offset, hex] or `truncate` (bytes cut from the end), then, with `rebind`, set the epoch id (bytes 2..17) to the first 16 bytes of SHA-256 of bytes 22..1157 (prekey id and X-Wing ciphertext, as a sender derives it), and compare `expect` plus the envelope's `body` by value, or `error` by check name. `contact`: the receiver's store has merged `rotation`; its peer record becomes { did: original, current_did, current_key } as SPEC §9 resolves that chain, and `current` names the identity it must resolve to.",
3
+ "about": "sigelo-msg/0 envelopes (README.md \"How it works\" and \"Contracts\"). Rebuild the receivers from the seeds (gen-envelope.mjs receivers(), each holding envelopes `params.hold` seconds), run `steps` in order: open `envelope` (hex) on its `topic` at its `now`, after `xor` [offset, mask] (negative offset counts from the end), `set` [offset, hex] or `truncate` (bytes cut from the end), then, with `rebind`, set the epoch id (bytes 2..17) to the first 16 bytes of SHA-256 of bytes 22..1157 (prekey id and X-Wing ciphertext, as a sender derives it), and compare `expect` plus the envelope's `body` by value, or `error` by check name. `contact`: the receiver's store has merged `rotation`; its peer record becomes { did: original, current_did, current_key } as SPEC §9 resolves that chain, and `current` names the identity it must resolve to.",
4
4
  "params": {
5
5
  "epoch_messages": 1000,
6
6
  "epoch_seconds": 604800,