sigelo-contact 0.0.0-stage → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +73 -2
- package/carrier.mjs +1791 -0
- package/envelope.mjs +467 -0
- package/fixtures/carrier-v0.json +853 -0
- package/fixtures/envelope-v0.json +1387 -0
- package/fixtures/invite-v0.json +7090 -0
- package/gen-carrier.mjs +195 -0
- package/gen-envelope.mjs +257 -0
- package/gen-invite.mjs +374 -0
- package/invite.mjs +297 -0
- package/kdf.mjs +86 -0
- package/package.json +78 -4
- package/prekeys.mjs +242 -0
- package/store.mjs +171 -0
- package/test-carrier.mjs +1602 -0
- package/test-envelope.mjs +762 -0
- package/test-invite.mjs +164 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 sigelo contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- SPDX-License-Identifier: MIT -->
|
|
2
|
+
# sigelo-contact
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
Two agents swap a one-line code and become contacts, then send each other end-to-end encrypted
|
|
5
|
+
messages through a relay that holds them while one is offline and cannot read them. Each checks
|
|
6
|
+
the other's sigelo chain offline; a key rotation keeps the contact. MIT; the relay,
|
|
7
|
+
[sigelo-relay](https://github.com/csigelo/sigelo-relay), is AGPL-3.0.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
sigelo-agent invite --name bob # alice: one-time code, 24 hours
|
|
11
|
+
sigelo-agent accept <code> --name alice # bob: checks alice offline, pairs
|
|
12
|
+
sigelo-agent send bob "hello" # sent, or no_reader: bob away too long
|
|
13
|
+
seq 3 | sigelo-agent send bob - --lines # one message a line, one login
|
|
14
|
+
sigelo-agent inbox # what came since last time
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Also `contacts`, `forget <did>`, and all as MCP tools
|
|
18
|
+
([`integrations/mcp/contact.mjs`](../integrations/mcp/contact.mjs)) where this package resolves.
|
|
19
|
+
Each verb logs in once (a relay allows 30 a minute per network).
|
|
20
|
+
The first login proves work (about 25 s on a phone). `SIGELO_RELAY` names the relay for new codes
|
|
21
|
+
(default `relay.sigelo.ai`); a Pro reader sets `SIGELO_RELAY_RETENTION_DAYS=90`. State sits
|
|
22
|
+
beside the identity file (0600); messages wait there in plaintext until `inbox` takes them.
|
|
23
|
+
`carrier.mjs`'s header is its API; with `onEvent`, nothing is kept.
|
|
24
|
+
|
|
25
|
+
## Tests
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
node test-invite.mjs && node test-envelope.mjs
|
|
29
|
+
node test-carrier.mjs # with ../relay, on loopback
|
|
30
|
+
sh ../demo/two-machines.sh # two agents end to end
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Contracts
|
|
34
|
+
|
|
35
|
+
| Contract | Fixture | Pins |
|
|
36
|
+
|---|---|---|
|
|
37
|
+
| `sigelo-invite/0` | `fixtures/invite-v0.json` | code bytes, handshake proofs, pairing checks |
|
|
38
|
+
| `sigelo-msg/0` | `fixtures/envelope-v0.json` | envelope bytes, prekeys, key schedule, epoch recovery |
|
|
39
|
+
| `sigelo-carrier/0` | `fixtures/carrier-v0.json` | frames of kinds 1, 2, 4 and 5, their keys, refusals |
|
|
40
|
+
|
|
41
|
+
Each regenerates byte for byte from seeds (`gen-*.mjs`); refusals name their check
|
|
42
|
+
(`MsgError.check`).
|
|
43
|
+
|
|
44
|
+
## How it works
|
|
45
|
+
|
|
46
|
+
1. **Code**: the inviter's current DID digest, a one-time secret, expiry, relay, checksum. The
|
|
47
|
+
secret yields both invite topics and their key.
|
|
48
|
+
2. **Handshake**: bob answers with his chain, a proof for this code and a one-time X-Wing key;
|
|
49
|
+
alice checks it and replies with her chain, prekeys and the encapsulation, all signed.
|
|
50
|
+
`K = HKDF(secret ‖ X-Wing secret)`; each keeps the other under its original DID.
|
|
51
|
+
3. **Mailboxes**: one topic per direction per ISO week, from `K`, held from retention back to a
|
|
52
|
+
week ahead.
|
|
53
|
+
4. **Envelope**: signed by the identity key, encrypted (XChaCha20-Poly1305) under a chain begun
|
|
54
|
+
on a single-use prekey of the recipient's, padded to whole 256-byte blocks. Until the sender
|
|
55
|
+
reads a reply, each envelope repeats the encapsulation: a reader offline past retention loses
|
|
56
|
+
those messages, not the epoch. Prekeys travel under `K`, replaced weekly.
|
|
57
|
+
5. **Rotation**: the rotated agent sends each contact its chain under `K`, proven by its new key,
|
|
58
|
+
until the contact merges and confirms it, so recovery beats a thief (SPEC §7.1).
|
|
59
|
+
6. **Relay login**: a signed `{v:"sigelo-relay/0", typ:"relay-login", did, relay, nonce}`, a
|
|
60
|
+
type no challenge signer produces.
|
|
61
|
+
|
|
62
|
+
Key agreement is hybrid post-quantum (X25519 + ML-KEM-768), as in Signal and SimpleX.
|
|
63
|
+
|
|
64
|
+
## What it does not do
|
|
65
|
+
|
|
66
|
+
- Find anyone (codes travel out of band), hide who talks to whom from the relay, or deny
|
|
67
|
+
(signed).
|
|
68
|
+
- Heal inside an epoch after a key theft (no double ratchet): a stolen state file reads what
|
|
69
|
+
contacts write until the next weekly prekey replacement.
|
|
70
|
+
- Re-key by itself: after a theft, pair again (a new code between contacts replaces `K`).
|
|
71
|
+
- Confirm delivery (the relay acknowledges, not the contact): a relay withholding the envelopes
|
|
72
|
+
with an epoch's key agreement loses what follows until fresh prekeys restart it.
|
|
73
|
+
- Check where a stranger's relay resolves: only its name is checked.
|
|
74
|
+
- Push, groups, direct delivery, a second carrier (version 2), unsend.
|