sigelo-contact 0.0.0-stage → 0.1.3

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 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,76 @@
1
- # Temporary Holding Version
1
+ <!-- SPDX-License-Identifier: MIT -->
2
+ # sigelo-contact
2
3
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
4
+ Two agents swap a one-line code, 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)).
19
+ Each verb logs in once (a relay allows 30 a minute per network).
20
+ The first login proves work (5 to 60 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
+ Node 22.18 or newer; tested on 24.
28
+
29
+ ```sh
30
+ node test-invite.mjs && node test-envelope.mjs
31
+ node test-carrier.mjs # with ../relay, on loopback
32
+ sh ../demo/two-machines.sh # two agents end to end
33
+ ```
34
+
35
+ ## Contracts
36
+
37
+ | Contract | Fixture | Pins |
38
+ |---|---|---|
39
+ | `sigelo-invite/0` | `fixtures/invite-v0.json` | code bytes, handshake proofs, pairing checks |
40
+ | `sigelo-msg/0` | `fixtures/envelope-v0.json` | envelope bytes, prekeys, key schedule, epoch recovery |
41
+ | `sigelo-carrier/0` | `fixtures/carrier-v0.json` | frames of kinds 1, 2, 4 and 5, their keys, refusals |
42
+
43
+ Each regenerates byte for byte from seeds (`gen-*.mjs`); refusals name their check
44
+ (`MsgError.check`).
45
+
46
+ ## How it works
47
+
48
+ 1. **Code**: the inviter's current DID digest, a one-time secret, expiry, relay, checksum. The
49
+ secret yields both invite topics and their key.
50
+ 2. **Handshake**: bob answers with his chain, a proof for this code and a one-time X-Wing key;
51
+ alice checks it and replies with her chain, prekeys and the encapsulation, all signed.
52
+ `K = HKDF(secret ‖ X-Wing secret)`; each keeps the other under its original DID.
53
+ 3. **Mailboxes**: one topic per direction per ISO week, from `K`, held from retention back to a
54
+ week ahead.
55
+ 4. **Envelope**: signed by the identity key, encrypted (XChaCha20-Poly1305) under a chain begun
56
+ on a single-use prekey of the recipient's, padded to whole 256-byte blocks. Until the sender
57
+ reads a reply, each envelope repeats the encapsulation: a reader offline past retention loses
58
+ those messages, not the epoch. Prekeys travel under `K`, replaced weekly.
59
+ 5. **Rotation**: the rotated agent sends each contact its chain under `K`, proven by its new key,
60
+ until the contact confirms it, so recovery beats a thief (SPEC §7.1). After a recovery both
61
+ mark the pairing `re_pair`: only that notice goes under `K` until a new code replaces it.
62
+ 6. **Relay login**: a signed `{v:"sigelo-relay/0", typ:"relay-login", did, relay, nonce}`, a
63
+ type no challenge signer produces.
64
+
65
+ Key agreement is hybrid post-quantum (X25519 + ML-KEM-768), as in Signal and SimpleX.
66
+
67
+ ## What it does not do
68
+
69
+ - Find anyone (codes travel out of band), hide who talks to whom from the relay, or deny
70
+ (signed).
71
+ - Heal inside an epoch after a key theft (no double ratchet): a stolen state file reads what
72
+ contacts write until the next weekly prekey replacement.
73
+ - Confirm delivery (the relay acknowledges, not the contact): a relay withholding an epoch's key
74
+ agreement loses what follows until fresh prekeys restart it.
75
+ - Check where a stranger's relay resolves: only its name is checked.
76
+ - Push, groups, direct delivery, a second carrier (version 2), unsend.