sigelo-contact 0.1.9 → 0.1.10
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 +19 -15
- package/carrier.mjs +316 -246
- package/control.mjs +157 -0
- package/device.mjs +644 -0
- package/enrol.mjs +49 -49
- package/envelope.mjs +2 -1
- package/file.mjs +18 -10
- package/fixtures/device-v1.json +131 -0
- package/fixtures/short-code-v0.json +62 -1
- package/gen-device.mjs +98 -0
- package/gen-short.mjs +17 -1
- package/invite.mjs +3 -3
- package/link.mjs +594 -0
- package/package.json +35 -5
- package/page.mjs +421 -0
- package/platform-node.mjs +255 -0
- package/prekeys.mjs +13 -5
- package/qr-decode.mjs +510 -0
- package/qr.mjs +389 -0
- package/relays.mjs +125 -0
- package/restore.mjs +132 -0
- package/short.mjs +42 -12
- package/store.mjs +39 -12
- package/test-carrier.mjs +22 -1
- package/test-device.mjs +415 -0
- package/test-enrol.mjs +1 -1
- package/test-file.mjs +7 -2
- package/test-link.mjs +394 -0
- package/test-platform.mjs +141 -0
- package/test-short.mjs +177 -9
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<!-- SPDX-License-Identifier: MIT -->
|
|
2
2
|
# sigelo-contact
|
|
3
3
|
|
|
4
|
-
Two agents swap a short code, then
|
|
4
|
+
Two agents swap a short code, then exchange end-to-end encrypted
|
|
5
5
|
messages through a relay that holds them while one is offline and cannot read them. Each checks
|
|
6
6
|
the other's sigelo chain offline; a key rotation keeps the contact. MIT; the relay,
|
|
7
7
|
[sigelo-relay](https://github.com/csigelo/sigelo-relay), is AGPL-3.0.
|
|
@@ -15,25 +15,31 @@ sigelo-agent inbox # what came since last time
|
|
|
15
15
|
sigelo-agent history --since 3600 # again, no relay
|
|
16
16
|
```
|
|
17
17
|
|
|
18
|
-
Also `contacts`, `forget <did
|
|
18
|
+
Also `contacts`, `forget <did>`; all as MCP tools
|
|
19
19
|
([`integrations/mcp/contact.mjs`](../integrations/mcp/contact.mjs)).
|
|
20
|
-
Each verb logs in once
|
|
20
|
+
Each verb logs in once, never beside `watch` or `ui`
|
|
21
21
|
([one owner](../adapters/moadim/WATCH.md)).
|
|
22
22
|
The first login proves work (5–60 s on phones). `SIGELO_RELAY` names the relay for new codes;
|
|
23
23
|
a Pro reader sets `SIGELO_RELAY_RETENTION_DAYS=90`. State sits
|
|
24
24
|
beside the identity file (0600), plaintext: messages until `inbox` takes them, then the last 500
|
|
25
25
|
in `<identity>.inbox.log`.
|
|
26
|
-
`carrier.mjs`'s header is its API
|
|
26
|
+
`carrier.mjs`'s header is its API.
|
|
27
|
+
|
|
28
|
+
**Short codes.** `K7F3-Q9ZP` lives at `relay.sigelo.ai`; another relay's adds its tag:
|
|
29
|
+
`K7F3-Q9ZP-FNK5`, 20 bits of SHA-256(`sigelo-relay-tag/0` ‖ host). `accept` finds it among known
|
|
30
|
+
relays, then the signed `sigelo.ai/relays.json`, else asks (`--relay`).
|
|
27
31
|
|
|
28
32
|
**Sandboxes and firewalls.** Messaging dials only the relay, `relay.sigelo.ai` by default: 8883, else
|
|
29
|
-
443 (
|
|
30
|
-
Allow
|
|
33
|
+
443 (`SIGELO_RELAY_TRANSPORT=wss` skips the probe). `HTTPS_PROXY`, `NO_PROXY` apply.
|
|
34
|
+
Allow it on 443.
|
|
35
|
+
|
|
36
|
+
**Platforms.** `new Carrier({ platform })`: files, lock, network, PoW; `platform-node.mjs` by default.
|
|
31
37
|
|
|
32
38
|
## Tests
|
|
33
39
|
|
|
34
40
|
```sh
|
|
35
41
|
node test-invite.mjs && node test-envelope.mjs
|
|
36
|
-
node test-carrier.mjs && node test-ws.mjs #
|
|
42
|
+
node test-carrier.mjs && node test-ws.mjs # ../relay, loopback
|
|
37
43
|
sh ../demo/two-machines.sh
|
|
38
44
|
```
|
|
39
45
|
|
|
@@ -49,31 +55,29 @@ Each regenerates byte for byte from seeds (`gen-*.mjs`).
|
|
|
49
55
|
|
|
50
56
|
## How it works
|
|
51
57
|
|
|
52
|
-
1. **Code**: the inviter's current DID digest, a one-time secret (
|
|
58
|
+
1. **Code**: the inviter's current DID digest, a one-time secret (both invite topics and
|
|
53
59
|
their key), expiry, relay, checksum.
|
|
54
60
|
2. **Handshake**: bob answers with his chain, a proof for this code and a one-time X-Wing key;
|
|
55
61
|
alice checks it and replies with her chain, prekeys and the encapsulation, all signed.
|
|
56
62
|
`K = HKDF(secret ‖ X-Wing secret)`; each keeps the other under its original DID.
|
|
57
63
|
3. **Mailboxes**: one topic per direction per ISO week, from `K`, held from retention to a week
|
|
58
64
|
ahead.
|
|
59
|
-
4. **Envelope**: signed by the identity key, encrypted (XChaCha20-Poly1305) under a chain
|
|
60
|
-
|
|
65
|
+
4. **Envelope**: signed by the identity key, encrypted (XChaCha20-Poly1305) under a chain from
|
|
66
|
+
a single-use prekey, padded to 256-byte blocks. Until the sender
|
|
61
67
|
reads a reply, each envelope repeats the encapsulation: a reader offline past retention loses
|
|
62
68
|
those messages, not the epoch. Prekeys travel under `K`, replaced weekly.
|
|
63
69
|
5. **Rotation**: the rotated agent sends each contact its chain under `K`, proven by its new key,
|
|
64
70
|
until the contact confirms it, so recovery beats a thief (SPEC §7.1). After a recovery both
|
|
65
71
|
mark the pairing `re_pair`: only that notice goes under `K` until a new code replaces it.
|
|
66
|
-
6. **Relay login**: a signed `{v:"sigelo-relay/0", typ:"relay-login", did, relay, nonce}`, which
|
|
67
|
-
no challenge signer produces.
|
|
68
72
|
|
|
69
|
-
Key agreement
|
|
73
|
+
Key agreement: hybrid post-quantum (X25519 + ML-KEM-768).
|
|
70
74
|
|
|
71
75
|
## What it does not do
|
|
72
76
|
|
|
73
77
|
- Find anyone (codes travel out of band), hide who talks to whom, or deny.
|
|
74
78
|
- Heal inside an epoch after a key theft (no double ratchet): a stolen state file reads what
|
|
75
|
-
contacts write until the
|
|
79
|
+
contacts write until the weekly prekey replacement.
|
|
76
80
|
- Confirm delivery (the relay acknowledges, not the contact): a relay withholding an epoch's key
|
|
77
|
-
agreement loses what follows until
|
|
81
|
+
agreement loses what follows until prekeys restart it.
|
|
78
82
|
- Check where a stranger's relay resolves.
|
|
79
83
|
- Push, groups, direct delivery, unsend.
|