Home / How-to / Set up the subscribe lane
How-to
Set up the subscribe lane
A reader presses Send; their browser encrypts a small message to your public key and appends it to a lane you own. The site never sees it. You read the lane with your key, by hand or with an agent.
What you need
- A key pair. An RSA key whose public half is published; the private half stays with whoever (or whichever agent) reads the lane. The envelope is RSA-OAEP-SHA256 wrapping an AES-256-GCM key (the sgit hybrid envelope v2).
- A vault with an append lane on an SG/Send host, with an append token that lets a browser write and nothing else. The newsroom's lane is on
dev.send.sgraph.ai(named dev; finding R5 asks the operator to say whether that is production). - The contact file at
/.well-known/sgit-subscribe.json.
The contact file
{"format": "sgit-subscribe/v1",
"site": "your-site.example",
"recipient": {"address": "newsroom@your-site.example", "fingerprint": "<sha256 of the PEM>", "encrypt": "<PEM public key>"},
"inbox": {"vault": "<vault id>", "endpoint": "https://<sg-send host>", "encrypt_to": "recipient",
"status": "live", "lane": {"name": "subscribe", "append_token": "<token that can only append>"}}}
The browser recomputes the fingerprint from the PEM before encrypting, so a swapped key is refused. The newsroom's own file is here; it is still labelled with the site the code came from (finding R4), which the move makes possible to fix.
What arrives
A subscription is an .eml with the address and a consent line; a share is the reader's summary and their data as JSON (balance, spent, reads, personas, topics, log; never a payment reference), with headers X-SGit-Form, X-SGit-Reply-To, X-SGit-Name, X-SGit-Subscribe, X-SGit-Page. A note from the vault pane arrives in the reader's own lane, whose read key they hand over, with the page, their words and the phrase they selected.
Reading the lane
With sgit and the read key, from the command line or an agent:
sgit clone <the lane's read key> # the notes as files, newest first
NEWSROOM_LANE_KEY=<read key> python3 admin/build/lane.py # the newsroom's digest, by page; the key from the environment, never a file
A read key cannot write: a push from the clone is refused, and the test proves it. The newsroom refuses to hold a vault key for a reader's lane at all.
The pieces on this host
assets/subscribe.js (the form, the fingerprint check, the envelope, the append), the meter's share view in sg-meter.js, and the vault layer for notes. The article The site is an inbox is the design of the feedback loop; Two agents, one vault is how the newsroom's agents share what arrives.