peer

module
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: GPL-3.0

README

peer

End-to-end encrypted, store-and-forward messaging between parties' agents: a channel between two parties (X3DH and the Double Ratchet, go.mau.fi/libsignal), a room among several (each record sealed once to every member with HPKE and signed by its writer), and a feed one party writes and anyone holding its link reads. A relay stores only ciphertext; trust comes from an invite link and an 8-digit code read back over a chat both people already trust, and a room admits only parties its admin has a confirmed channel with.

go install github.com/caoer/peer/cmd/peer@v0.4.0
peer --help

Release binaries (darwin/arm64, linux/amd64): https://github.com/caoer/peer/releases/tag/v0.4.0. VERSION=v0.4.0 scripts/release-build.sh rebuilds them from the tag, twice, and fails unless both builds are byte-identical. Rooms and feeds (peer room …) are in v0.2.0 and later.

License

GPL-3.0 — peer links go.mau.fi/libsignal (GPL-3.0). The full text is in LICENSE.

Directories

Path Synopsis
cmd
peer command
Command peer is an end-to-end encrypted messaging CLI for agents.
Command peer is an end-to-end encrypted messaging CLI for agents.
internal
attach
Package attach is the content of a doc or file message (design §3.5, §5.2): the file is sealed under a fresh one-time key, the ciphertext goes to the channel's blob route, and the message — inside the Double Ratchet envelope — carries a Descriptor naming the blob and holding that key.
Package attach is the content of a doc or file message (design §3.5, §5.2): the file is sealed under a fresh one-time key, the ciphertext goes to the channel's blob route, and the message — inside the Double Ratchet envelope — carries a Descriptor naming the blob and holding that key.
card
Package card builds, signs and verifies a party's card.
Package card builds, signs and verifies a party's card.
deliver
Package deliver is the host's end of design §3.5 for a message the session verified: the kind table that sends it to the inbox or the quarantine, and the record that is the delivery (UCC design v2 § 5 § Intake).
Package deliver is the host's end of design §3.5 for a message the session verified: the kind table that sends it to the inbox or the quarantine, and the record that is the delivery (UCC design v2 § 5 § Intake).
envelope
Package envelope is the relay record: a type byte and opaque bytes (plan decision 7).
Package envelope is the relay record: a type byte and opaque bytes (plan decision 7).
httpx
Package httpx is the transport every client of the relay and the ccc-pages service runs on.
Package httpx is the transport every client of the relay and the ccc-pages service runs on.
invite
Package invite formats and parses the invite link
Package invite formats and parses the invite link
keys
Package keys generates and stores a party's keys: the cold Ed25519 root key that signs cards, the identity key pair with its registrationId (the identity file, replicated to every fleet host), and the party keys record holding the signed prekey and one-time prekeys.
Package keys generates and stores a party's keys: the cold Ed25519 root key that signs cards, the identity key pair with its registrationId (the identity file, replicated to every fleet host), and the party keys record holding the signed prekey and one-time prekeys.
relay
Package relay is the client for the peer relay's wire contract (session record results/wire-contract.md): create a channel, join it, put and pull envelopes, deposit and take one-time prekeys.
Package relay is the client for the peer relay's wire contract (session record results/wire-contract.md): create a channel, join it, put and pull envelopes, deposit and take one-time prekeys.
relay/relaytest
Package relaytest is an in-memory relay serving results/wire-contract.md for tests of the CLI: two parties on one httptest server.
Package relaytest is an in-memory relay serving results/wire-contract.md for tests of the CLI: two parties on one httptest server.
room
Package room is a party's side of a v2 room: the room card (the contract's § Room card), the room state record `rm.<id>` every fleet host shares (plan decision 2 — the folded roster, own keys, cursor, seen ids, counters, membership version, the add setting; snapshot + Commit under CAS as v1's channel record), and the fold (plan decision 4 — rules 7 and 4 of results/group-design-chosen.md and the contract's sub-rules in one function).
Package room is a party's side of a v2 room: the room card (the contract's § Room card), the room state record `rm.<id>` every fleet host shares (plan decision 2 — the folded roster, own keys, cursor, seen ids, counters, membership version, the add setting; snapshot + Commit under CAS as v1's channel record), and the fold (plan decision 4 — rules 7 and 4 of results/group-design-chosen.md and the contract's sub-rules in one function).
roster
Package roster is the party's list of channels: for each peer its local name (design §3.1: names are local), the channel id, the relay the channel lives on, this party's side and token, and how far the invite has gone.
Package roster is the party's list of channels: for each peer its local name (design §3.1: names are local), the channel id, the relay the channel lives on, this party's side and token, and how far the invite has gone.
sealed
Package sealed is the room record's bytes: one message locked under a fresh key, that key sealed to every recipient, a signed header that commits to the key, and the writer's counter in the header.
Package sealed is the room record's bytes: one message locked under a fresh key, that key sealed to every recipient, a signed header that commits to the key, and the writer's counter in the header.
seats
Package seats reads the party's seat map — peers/seats.md on the fleet's sessions root (UCC design v2 § 5 § Address): one row per label, the agent id a sender addresses, naming where a message to it lands and the kinds the row accepts.
Package seats reads the party's seat map — peers/seats.md on the fleet's sessions root (UCC design v2 § 5 § Address): one row per label, the agent id a sender addresses, naming where a message to it lands and the kinds the row accepts.
session
Package session runs the Signal session of one channel over the store's snapshots: X3DH from the peer's card and a one-time prekey, encrypt and decrypt with the libsignal Double Ratchet, the plaintext message format, the send order of plan decision 5, the accept proof and the 8-digit verification code.
Package session runs the Signal session of one channel over the store's snapshots: X3DH from the peer's card and a one-time prekey, encrypt and decrypt with the libsignal Double Ratchet, the plaintext message format, the send order of plan decision 5, the accept proof and the 8-digit verification code.
status
Package status is what a party knows about each peer beyond the session itself, and the roster page that shows it (design §8 花名册页).
Package status is what a party knows about each peer beyond the session itself, and the roster page that shows it (design §8 花名册页).
store
Package store is the party's session-state store: the records every fleet host shares, loaded as a snapshot at version v, mutated in memory through the libsignal store interfaces, and written back by Commit under compare-and-swap.
Package store is the party's session-state store: the records every fleet host shares, loaded as a snapshot at version v, mutated in memory through the libsignal store interfaces, and written back by Commit under compare-and-swap.
store/file
Package file is the store backend for one machine: one JSON file per record under a directory, `{"version": n, "data": …}`, written under an exclusive flock on a sibling lock file so two processes on the machine compare-and-swap correctly.
Package file is the store backend for one machine: one JSON file per record under a directory, `{"version": n, "data": …}`, written under an exclusive flock on a sibling lock file so two processes on the machine compare-and-swap correctly.
store/pages
Package pages is the fleet's store backend: each record is one ccc-pages /d/ data record on the party's private state page (UCC design v2 § 5 commitment 5) — `GET /d/<slug>/<key>` and `PUT /d/<slug>/<key>?v=<n>` with the owner Bearer, the bytes base64 once in the envelope's data string under Schema, the 256 KiB cap on the envelope.
Package pages is the fleet's store backend: each record is one ccc-pages /d/ data record on the party's private state page (UCC design v2 § 5 commitment 5) — `GET /d/<slug>/<key>` and `PUT /d/<slug>/<key>?v=<n>` with the owner Bearer, the bytes base64 once in the envelope's data string under Schema, the 256 KiB cap on the envelope.
store/pages/pagestest
Package pagestest serves a fake ccc-pages /d/ store for tests: the owner Bearer, CAS by ?v=, the envelope cap, and the status codes and bodies the real one answers (plan-research-ccc-pages § 5).
Package pagestest serves a fake ccc-pages /d/ store for tests: the owner Bearer, CAS by ?v=, the envelope cap, and the status codes and bodies the real one answers (plan-research-ccc-pages § 5).
timeline
Package timeline is a channel's decrypted message timeline on its private collaboration page (design §8 协作页, the generic part): one plaintext record per message, received or sent, that the page lists by time.
Package timeline is a channel's decrypted message timeline on its private collaboration page (design §8 协作页, the generic part): one plaintext record per message, received or sent, that the page lists by time.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL