End-to-End Encryption Keys

Messages between your machines (a2a, notify, hub and agent traffic) are always end-to-end encrypted with a key only your machines hold, so even a relay that tried to sit in the middle could not read them. There is no unkeyed mode: a machine without a key refuses to send.


Why a key

Each end makes a fresh key pair and the two ends agree on a session key, so the relay only ever carries ciphertext. Fresh keys alone are not signed: a relay that replaced them with its own could sit in the middle. So every handshake also mixes in a random secret that only your machines hold, and an end that does not hold it cannot complete one. Your hub makes its own (nfltr orch hub, see nodes); this tutorial is for two machines without a hub. The relay never sees the file. Your API key cannot do this job: the relay sees it on every request.

Prerequisites

1. Make the key

Use random bytes, at least 32. Not a passphrase: a guessable key can be tested offline.

$ openssl rand -hex 32 > pairing.key && chmod 600 pairing.key

2. Put the same file on every machine

Copy it yourself, over a channel you trust (scp, a password manager). Never send it through nfltr.

$ scp pairing.key work-laptop:pairing.key

3. Use it on both ends

On work-laptop, listen with the key:

$ nfltr a2a listen --name inbox --e2ee-key-file pairing.key
Listening as inbox for incoming A2A calls... (Ctrl+C to stop)

On your laptop, send with the same key to work-laptop.inbox: the service inbox of your machine work-laptop (its name in your account, nfltr machines). The listener echoes the message back:

$ nfltr a2a send work-laptop.inbox "hello, paired" --e2ee-key-file pairing.key
Connected as laptop-1f2e, sending to m-5keeepem74hr5ipmm64zvsq5hy-inbox...
hello, paired

Instead of the flag you can set NFLTR_A2A_E2EE_KEY_FILE, for example in your shell profile:

$ NFLTR_A2A_E2EE_KEY_FILE=pairing.key nfltr a2a send work-laptop.inbox "hello again"
hello again

4. How to verify

A reply is the proof: an end refuses any peer that cannot prove the same key, before a message is sent. There is no fallback to unkeyed encryption. Check it once by sending with a different key; it must fail:

$ openssl rand -hex 32 > wrong.key
$ nfltr a2a send work-laptop.inbox "hi" --e2ee-key-file wrong.key
Error: rpc error: code = FailedPrecondition desc = rpcclient: peer's A2A E2EE key failed pairing-key verification (a different key, or a relay in the middle); set the same --e2ee-key-file / NFLTR_A2A_E2EE_KEY_FILE on both ends

5. Nodes and hubs

A hub needs no shared file: it makes its root key on first start, and each node gets its own machine key derived from it (nfltr node join on the hub's machine makes one itself; for another machine, once it has signed in, nfltr orch hub machines add <its name> --out <file> and copy the file there as ~/.config/nfltr/a2a-machine.key). A machine key proves which machine it is, and nfltr orch hub machines revoke shuts one out without touching the others. More in Join machines as nodes.

nfltr p2p (send, recv, chat, call) is end-to-end encrypted without a key, and takes the same file to authenticate its keys: with --e2ee-key-file pairing.key on both machines it prints keys authenticated with the A2A keys, and a relay that replaced the keys, or rerouted the session to another peer under the same key, gets it refused. One end may hold the root key and the other its machine key (nfltr machine); two different machine keys are refused. An end holding the root key that starts a session takes the peer's key id only for the machine it named, from its own machine store: <machine name>.<service> (the name you gave nfltr orch hub machines add), a ref <machine id>-<service>, or, for a bare service name, a peer under the root key; any other machine is refused, so the relay can neither steer it to a peer of the same name on another machine you added nor, with a leaked machine key, sit in the middle of a session to a machine that did not leak. The end that receives names no peer and takes any machine you added, a leaked one until you revoke it. An end holding a machine key file accepts only the root key or its own machine's. Without a key, compare the session fingerprint both machines print.

6. Clean up

Stop the listener with Ctrl+C. To rotate the key, replace the file on every machine and restart the listeners, nodes and hub.

# Ctrl+C in the nfltr a2a listen terminal on work-laptop

If it goes wrong

You seeMeaning and fix
peer's A2A E2EE key failed pairing-key verification (a different key, or a relay in the middle)Both ends have a pairing key, but not the same one, or something in between swapped keys. Copy the same file to both ends again.
no A2A E2EE key on this machine (A2A is end-to-end keyed only)This machine has no key. Give it the file (--e2ee-key-file, NFLTR_A2A_E2EE_KEY_FILE, or ~/.config/nfltr/a2a-root.key).
A2A E2EE pairing key file short.key holds 3 bytes; want at least 32 bytes of random secret (e.g. openssl rand -hex 32)The file is too short to be safe. Make a new one with openssl rand -hex 32.
Error: rpc error: code = NotFound desc = target agent not connectedNothing listens under that name. Start nfltr a2a listen --name inbox there first.

What a shared file does not do: it proves the peer is one of your machines, not which one. Anyone who has the file can take part as any of them, so treat it like a private key; a hub's machine keys tell machines apart.

Next