Private AI inference,
among friends.

WeAI turns your Mac into a private inference node and lets you weave a small, trusted mesh with people you actually know. This page documents — precisely and honestly — the cryptography it uses, how it's built, and what is and isn't real yet.

X‑Wing PQ‑hybrid onion Ed25519 signed invites ChaCha20‑Poly1305 AEAD Apple CryptoKit
01OVERVIEW

Tailscale‑style trust, Tor‑style routing — for LLMs

Commercial decentralized‑inference networks route encrypted prompts to anonymous, hardware‑attested strangers and pay them. WeAI replaces that anonymous marketplace with a trust graph of friends: you invite people you already trust with a signed link, lend your node's compute, and borrow theirs. No money, no strangers, no account. The social graph is the trust layer.

Local‑first

Inference runs on your hardware by default. Nothing leaves the machine unless you explicitly choose to ask a friend's node.

Trust by invite

A friend is added only by accepting a cryptographically signed reai:// invite. The mutual link is the trust — no central authority vouches for anyone.

Onion‑routed

Requests can hop across the friend‑of‑friend mesh so the node that answers can't tell who asked.

·WHY WeAI

One app. Every privacy model.

Every other tool forces a single trade‑off — convenient cloud or private local, anonymous marketplace or nothing. WeAI is the layer that lets you pick the right backend per request, so it checks every box — and adds rows the others don't even have.

Capability Closed cloud
OpenAI, etc.
Local‑only
Ollama, LM Studio
TEE cloud
Tinfoil, 0G
WeAI
Provable zero data retention
Cloud convenience & scale
Low setup cost & complexity
Zero‑trust (TEE attestation)
Private observability
Borrow a friend's GPU (social trust)
Sender anonymity (onion routing)
Post‑quantum encrypted channel
No account / no token required
Choose the backend per request
WeAI earns each row by routing to the right backend: local or a friend's node for zero‑retention & no‑account, a TEE cloud (Tinfoil / 0G) for verifiable cloud, web3 networks for decentralized scale — with onion routing and a post‑quantum channel layered across all of it.
02ARCHITECTURE

Four moving parts

A node identity, a signed invite, an onion‑routing layer, and a (planned) transport. Here's how they fit — and exactly which parts execute today.

YOUR NODE Identity keypair Ed25519 · X25519 · X‑Wing Local inference engine LM Studio / Ollama · local GPU Onion sealer / peeler layered AEAD · self‑tested signed invite FRIEND'S NODE Verifies signature adds you to their circle PEER TRANSPORT — IMPLEMENTED IK-style SecureChannel (X25519 multi-DH + ephemeral X-Wing) over an outbound relay. No port-forwarding. The relay carries ciphertext only. FRIEND MESH you A C
All four parts run today. The SecureChannel handshake + encrypted borrow are verified over the relay (self-test); a hosted relay and multi-hop onion over the wire are the remaining production steps.
ComponentWhat it doesStatus
Node identityLong‑term Ed25519 + X25519 keypair, generated on‑device.implemented
Signed invitesreai:// link carrying public keys + nonce + TTL, Ed25519‑signed and verified on accept.implemented
Onion seal / peelPer‑hop layered AEAD; built & peeled with a launch self‑test.implemented
Local inferenceReal models via LM Studio / Ollama on the local GPU.implemented
Key custodyKeys generated + stored in the Keychain automatically; never shown or managed by hand.implemented
Peer transportOutbound relay + mutual-auth SecureChannel (X25519 + ML-KEM-768). Verified over the wire on loopback.implemented
Remote borrow / shareRunning your prompt on a friend's node over the encrypted channel — protocol verified. Needs a hosted relay for the open internet.implemented
Hardware attestation (TDX)The provider's Intel TDX quote is verified against the pinned Intel SGX Root CA, graded against Intel's published TCB levels, checked against Intel's PCK revocation list, and its measured OS and container images resolved. NVIDIA GPU evidence is verified too. An unknown measurement is reported, never assumed good.implemented
Send gateNothing is transmitted over a connection the app could not validate. Each answer carries the disposition it was sent under, shown in the chat.implemented
Encrypted historyOff by default. When enabled, threads are stored under a Keychain device factor combined with an optional scrypt‑stretched passphrase — both always required. No public‑key cryptography at rest anywhere, which is the post‑quantum argument.implemented
wDrive storageClient‑side encrypted vaults, content‑addressed and anchored to 0G by merkle root, with chunk dedup, version history, sharing and a third‑party verifier. Reading and verifying work against 0G mainnet today; the first payable write needs a funded wallet.write path unfunded
03CRYPTOGRAPHY

Every primitive, and why

WeAI uses only vetted, standardized primitives from Apple's CryptoKit — constant‑time, hardware‑accelerated, and widely reviewed. No custom crypto.

PrimitiveRole in WeAIWhy this choice
Ed25519
RFC 8032 · 64‑B sig
Signs and verifies invite links — authenticity & integrity of who invited you.Deterministic, misuse‑resistant, tiny signatures.
X25519
RFC 7748 · 32‑B keys
The static & ephemeral DHs of the SecureChannel handshake (es/ss/ee/se), and onion layer keys.Modern, constant‑time, ubiquitous.
X‑Wing
X25519 + ML‑KEM‑768
Ephemeral PQ‑hybrid KEM mixed into every SecureChannel session, and onion layer keys (macOS 26+). Pub 1216 B, ct 1120 B.Secure unless both ECC and the lattice KEM break. Defeats harvest‑now‑decrypt‑later.
ML‑KEM‑768
FIPS 203
The quantum‑resistant half of X‑Wing.NIST‑standardized lattice KEM, category‑3 security.
HKDF‑SHA256
RFC 5869
Derives the directional session keys (i2r / r2i) and onion keys from the mixed shared secrets, salted by the transcript hash.Standard KDF; domain‑separated per direction & purpose.
HMAC‑SHA256
RFC 2104
Key‑confirmation tag at the end of the handshake — each side proves it derived the same keys before any data flows.Detects a man‑in‑the‑middle or key mismatch up front, not mid‑stream.
ChaCha20‑Poly1305
RFC 8439 · AEAD
Encrypts & authenticates each onion layer and every SecureChannel frame (8‑byte sequence prefix for replay protection).Fast in software, no timing side‑channels, 128‑bit auth tag.
SHA‑256
FIPS 180‑4
Derives the short node ID & key fingerprint, and the handshake transcript hash that binds every message.Collision‑resistant identifier & transcript binding.
Keychain
login keychain · generic password
Stores the Ed25519 & X25519 private keys automatically — generated on first launch, never shown or hand‑managed.OS‑guarded key custody; zero manual key handling for the user.
CSPRNG
SecRandomCopyBytes
Invite nonces, ephemeral keys, and all randomness.OS‑backed cryptographic randomness.

SecureChannel — the mutual‑auth, PQ‑hybrid session

When you borrow a friend's node, the two machines first run an IK‑style handshake (the pattern Noise calls IK: the initiator already knows the responder's static key — it came in the invite). Both ends are mutually authenticated to the exact X25519 keys exchanged in the signed invite, and the session is post‑quantum hybridized with an ephemeral X‑Wing KEM. Three messages, then encrypted data:

  1. msg 1 → initiator sends its ephemeral key and its encrypted static key (identity‑hiding: the static is sealed under a key derived from the first es DH, so a passive observer never sees who is dialing), plus an X‑Wing ciphertext encapsulated to the responder.
  2. msg 2 → responder replies with its ephemeral key. Both sides now mix four DHs — es · ss · ee · seand the X‑Wing shared secret into one input keying material.
  3. DeriveHKDF‑SHA256(ikm, salt = SHA‑256(transcript), info = "reai/i2r" | "reai/r2i") yields two directional keys. The transcript hash binds every public value (context, both statics, both ephemerals, the X‑Wing pub & ciphertext) so nothing can be swapped.
  4. msg 3 → key confirmation — each side sends an HMAC‑SHA256 over the transcript under a derived "reai/confirm" key. If it doesn't verify, the channel is torn down before a single prompt byte is sent.
  5. Data — every frame is ChaCha20‑Poly1305 with an 8‑byte big‑endian sequence number prefixed and bound as associated data, so replays and reordering are rejected.

Why mix four DHs + a KEM

es/se authenticate against the static keys from the invite; ee gives forward secrecy; ss binds the long‑term identities. The ephemeral X‑Wing secret means a recording made today stays secret even against a future quantum computer — break it only if ECC and ML‑KEM both fall.

What an attacker on the relay sees

Only ciphertext and a routing node‑ID. The relay can't read prompts or responses, can't impersonate either peer (it holds no static key), and can't replay frames. A wrong or unknown initiator key is rejected at msg 1 — the responder only completes for keys it learned from a real invite.

Onion routing — how a layer is sealed and peeled

you origin prompt 3 nested AEAD layers relay A peels 1 layer exit C runs the model
seal(): for each hop (exit → … → first), encapsulate to the hop's key → ChaCha20‑Poly1305 the inner layer. Each relay decapsulates with its own key, learning only the next hop. The origin is never encoded in any layer.

Classical layer

Ephemeral X25519 → ECDH with the hop's static key → HKDF‑SHA256(salt="reai-onion-v1") → ChaCha20‑Poly1305 seal. Fresh ephemeral per message.

Post‑quantum layer (macOS 26+)

X‑Wing encapsulate() to the hop's public key yields a fresh shared secret + a ~1120‑B ciphertext, used directly as the ChaCha20‑Poly1305 key. The larger packets you see in the Mesh tab are this PQ overhead.

Invite — signing & verification flow

  1. Build payload — node ID, display name, Ed25519 + X25519 public keys, a 16‑byte random nonce, issued/expiry timestamps.
  2. Canonicalize — encode as JSON with sorted keys so the bytes are deterministic across encode/decode.
  3. Sign — Ed25519 over the canonical bytes; pack as reai://invite/<base64url>.
  4. Verify on accept — decode, check the Ed25519 signature against the embedded key, reject if tampered (.badSignature) or expired (.expired).
04SECURITY RAILS

What holds today

05THREAT MODEL & LIMITS

What is not secured yet

A documentation page that only lists strengths is marketing. Here is the honest gap analysis — these are the things to fix before WeAI is something you'd trust with sensitive prompts across machines.

06ROADMAP

The path to production‑secure

Real transport & E2E channel shipped

Outbound‑only connection to a lightweight rendezvous/relay (no port‑forwarding), then a mutual‑auth IK‑style handshake keyed by the invite‑exchanged keys, PQ‑hybridized with an ephemeral X‑Wing KEM. Verified end‑to‑end over the relay by the self‑test.

Automatic key custody shipped

Identity keys are generated on first launch and held in the macOS Keychain — zero manual key management.

P1 · Hosted relay & multi‑hop onion

Deploy a stateless, community‑runnable relay (over TLS) so friends connect across the open internet, and run the already‑implemented onion across independent relay hops so no single relay sees both ends.

P2 · Secure‑Enclave attestation

Add a Secure‑Enclave P‑256 device key so a node can attest its hardware identity, on top of the Keychain‑held identity keys.

P3 · Invite hardening

Enforce one‑time‑use nonces, confirm the out‑of‑band verify code, support expiries & revocation.

P4 · Borrowed‑compute guardrails

Per‑peer authorization, rate limits, resource caps, and prompt isolation against injection & abuse.