No description
  • Rust 96.4%
  • Shell 2.1%
  • Dockerfile 0.6%
  • Java 0.5%
  • Python 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Fabian Stamm 960f8be25e
All checks were successful
ci/woodpecker/tag/android Pipeline was successful
ci/woodpecker/tag/release Pipeline was successful
ci/woodpecker/push/ci Pipeline was successful
Update ed25519-dalek and x25519-dalek to 3 and jsonwebtoken to 12: only curve25519-dalek 5.1.0 remains (RUSTSEC-2026-0620); random bytes come from getrandom 0.4; the crypto-bigint audit exception is no longer needed
2026-11-29 20:21:58 +01:00
.cargo Update ed25519-dalek and x25519-dalek to 3 and jsonwebtoken to 12: only curve25519-dalek 5.1.0 remains (RUSTSEC-2026-0620); random bytes come from getrandom 0.4; the crypto-bigint audit exception is no longer needed 2026-11-29 20:21:58 +01:00
.githooks commit-msg hook refuses Co-Authored-By trailers 2026-11-19 17:53:36 +01:00
.woodpecker CI builder image (ci/builder, built by .woodpecker/builder.yaml) with clang, libclang, fonts, sccache, trunk, cargo-audit, rustfmt, clippy and the wasm target; ci and release steps run in it without apt/rustup/downloads; ci.yaml steps sequential again 2026-11-19 22:24:34 +01:00
android Attachments open and share through deltaui 0.5.4 (open_with_default, share_file) on every platform; Android provider in the manifest; own desktop opener removed 2026-11-19 18:47:09 +01:00
ci/builder CI builder image (ci/builder, built by .woodpecker/builder.yaml) with clang, libclang, fonts, sccache, trunk, cargo-audit, rustfmt, clippy and the wasm target; ci and release steps run in it without apt/rustup/downloads; ci.yaml steps sequential again 2026-11-19 22:24:34 +01:00
crates Update ed25519-dalek and x25519-dalek to 3 and jsonwebtoken to 12: only curve25519-dalek 5.1.0 remains (RUSTSEC-2026-0620); random bytes come from getrandom 0.4; the crypto-bigint audit exception is no longer needed 2026-11-29 20:21:58 +01:00
deploy The Arch package is built in the release pipeline from the desktop binary the binaries step compiles (shared sccache and target dir), instead of a separate full build 2026-11-19 14:53:30 +01:00
scripts CI builder image (ci/builder, built by .woodpecker/builder.yaml) with clang, libclang, fonts, sccache, trunk, cargo-audit, rustfmt, clippy and the wasm target; ci and release steps run in it without apt/rustup/downloads; ci.yaml steps sequential again 2026-11-19 22:24:34 +01:00
.dockerignore CI: compile the image binaries and web app in a step with sccache, the image builds only copy them in (BINARIES=prebuilt); .dockerignore 2026-11-18 16:26:14 +01:00
.gitignore Ignore makepkg work directories 2026-11-19 14:39:27 +01:00
Cargo.lock Update ed25519-dalek and x25519-dalek to 3 and jsonwebtoken to 12: only curve25519-dalek 5.1.0 remains (RUSTSEC-2026-0620); random bytes come from getrandom 0.4; the crypto-bigint audit exception is no longer needed 2026-11-29 20:21:58 +01:00
Cargo.toml Update deltaui to 0.6.8 (closing a dialog with a focused field no longer panics) and drop the focus workaround of the model picker 2026-11-27 22:30:28 +01:00
docker-compose.yml Security review fixes: key replacement on device removal, sealed secrets (keyring, Android Keystore), pairing commit/reveal, message chain check, server hardening 2026-11-15 23:55:56 +01:00
Dockerfile CI: compile the image binaries and web app in a step with sccache, the image builds only copy them in (BINARIES=prebuilt); .dockerignore 2026-11-18 16:26:14 +01:00
Dockerfile.satellite CI: compile the image binaries and web app in a step with sccache, the image builds only copy them in (BINARIES=prebuilt); .dockerignore 2026-11-18 16:26:14 +01:00
PLAN.md Key replacement carries the other devices along: devices vouch for themselves with the account identity, the replacing device seals the new key (with the succession) for each, they adopt it on their next check 2026-11-27 17:09:01 +01:00
README.md Key replacement carries the other devices along: devices vouch for themselves with the account identity, the replacing device seals the new key (with the succession) for each, they adopt it on their next check 2026-11-27 17:09:01 +01:00
rust-toolchain.toml Add AIThingy: end-to-end encrypted chat client and server 2026-11-12 23:48:55 +01:00

AIThingy

An end-to-end encrypted chat client for OpenAI-compatible providers, in the spirit of Claude Desktop's chat. Rust, deltaui, for web, desktop and Android. See PLAN.md.

Status

Crate State
crates/core Done: keys, seed phrase, pairing, signed encrypted events, shared-chat keys, OpenAI wire types + SSE
crates/server Done: OIDC login, devices, chat log, key bundles, objects, blobs, live stream, LLM proxy
crates/client Done: API client, encrypted local store, sync + offline outbox, sharing, search, account setup/pairing, LLM streaming + tools, MCP client
crates/ui, crates/desktop, crates/web, crates/android Working, see PLAN.md for what is still open
mcp bridge Not started

Server

AITHINGY_PUBLIC_URL=http://127.0.0.1:8085 \
AITHINGY_OIDC_ISSUER=https://id.example.com \
AITHINGY_OIDC_CLIENT_ID=... AITHINGY_OIDC_CLIENT_SECRET=... \
cargo run -p aithingy-server
Variable Default
AITHINGY_PUBLIC_URL http://127.0.0.1:8085 Base URL; the OIDC redirect is <url>/auth/callback
AITHINGY_OIDC_ISSUER, _CLIENT_ID, _CLIENT_SECRET none PocketID. Without them nobody can sign in
AITHINGY_BIND 0.0.0.0:8085
AITHINGY_DATA_DIR ./data SQLite DB, blobs, generated jwt.key
AITHINGY_DATABASE_URL sqlite://<data>/aithingy.db
AITHINGY_JWT_SECRET generated
AITHINGY_WEB_DIR none Built web app, served with SPA fallback
AITHINGY_BLOB_MAX_BYTES 50 MiB
AITHINGY_USER_QUOTA_BYTES 5 GiB All files one account may store
AITHINGY_TRUST_PROXY off Set to 1 behind a reverse proxy: rate limits then use X-Forwarded-For
AITHINGY_PROXY_HOSTS none Allow-list for the optional LLM proxy. A provider used through it shows the server the prompts and the API key

Restrict who may sign in with PocketID's per-client group setting; the server accepts every user the identity provider authenticates.

Desktop

cargo build --release -p aithingy-desktop builds the app. A release build keeps its keys and chats in <data dir>/aithingy with the keyring entry aithingy; a debug build (cargo run -p aithingy-desktop) uses aithingy-dev for both, so working on the code never touches the installed app's data. AITHINGY_PROFILE=<name> picks another profile, for example to run a release build from the repository on data of its own.

Satellites

A satellite makes LLM and MCP requests for your apps from wherever it runs: a home server that reaches your local Ollama and MCP tools, a VPS with a fixed IP, a machine inside a company network. It connects out to the AIThingy server (no open port needed) and waits for work.

Add one in Settings → Satellites; the app shows a setup string. Start the satellite with it:

aithingy-satellite aisat1.…                       # or AITHINGY_SATELLITE=aisat1.…
docker run -d --restart unless-stopped -e AITHINGY_SATELLITE=aisat1.… \
  git.hibas.dev/hibas123/aithingy-satellite:latest

Then choose it as the Route of a provider, or under Runs on for an MCP server. With AITHINGY_SATELLITE_STDIO=1 the apps may also start MCP programs (stdio servers) on it, which makes local tools available to the web app and Android.

Calls and answers are encrypted between the apps and the satellite with a key the server never sees (it lives in the encrypted account objects and in the setup string). The server cannot read them, make calls of its own, or replay, reorder or cut off answers unnoticed; it sees which satellite is used when and how many bytes flow. The satellite sees the requests it carries out (prompts, API keys), not your chat history. Whoever has the setup string can stand in for the satellite, so keep it secret; deleting the satellite in the app locks it out.

cargo build --release -p aithingy-satellite builds it; Dockerfile.satellite builds the image.

MCP servers on a satellite

With AITHINGY_SATELLITE_STDIO=1, add an MCP server in the app as Local (starts a program) and choose the satellite under Runs on. The command must exist where the satellite runs. The image has Node and Python, so servers started with npx or uvx work as they are; anything else goes into an image of your own built on top of it. deploy/satellite-mcp/ is an example that adds WordCraft and DeckCraft (documents and presentations), always in their newest release when built:

cd deploy/satellite-mcp && docker compose build && docker compose up -d

Each chat gets a workspace on the satellite: a folder its MCP programs run in, kept between turns (AITHINGY_SATELLITE_WORKSPACES, by default ~/.local/share/aithingy-satellite/workspaces; removed after 30 days without use). {workspace} in a server's arguments becomes its path, for example to allow a program to write only there:

command    /usr/bin/wordcraft-cli
arguments  mcp --automation-read-root {workspace} --automation-write-root {workspace}

Files a tool saves in the workspace are attached to the answer (encrypted like any attachment) and can be saved from the chat; pictures and files in tool results are attached too. Before a turn the app puts the chat's files into the workspace, only those it lacks or has in another version. The chat's copy counts: the workspace is a cache and may be lost.

Behind a reverse proxy, answers stream only if the proxy passes request bodies on as they arrive: the satellite uploads each answer to /api/satellite/jobs/<job> while it is produced. nginx buffers uploads by default; turn that off for this path:

location /api/satellite/ {
    proxy_pass http://aithingy:8085;
    proxy_request_buffering off;
    proxy_buffering off;
    proxy_http_version 1.1;
    client_max_body_size 0;
    proxy_read_timeout 1h;
}

Login for apps

/auth/login?return_to=<url>&challenge=<c> starts the OIDC flow. <c> is base64url(sha256("aithingy/login/v1" || verifier)) for a random verifier the app keeps. return_to may be a path on the server, an aithingy:// URL or a loopback http://127.0.0.1:<port> URL. The app receives ?code=... and posts {code, device, signature, verifier} to /auth/exchange for access and refresh tokens (device is the device's public key, signature its signature over the code).

What the server can and cannot do

The server stores ciphertext and relays it. It is not trusted with content, and the clients check what it hands them:

  • Chat keys come only from the chat's owner: every key bundle is signed, and a client pins the owner the first time it sees a chat. The server cannot hand out keys of its own.
  • Messages are signed by their author and bound to chat, key epoch and author. Each one names, inside the ciphertext, the last message its author had seen; a server that leaves a message out, swaps two or shows members different histories is noticed and the chat is marked. Holding back the newest messages cannot be detected.
  • Pairing a device uses a six-digit code from a commit-and-reveal exchange, so a swapped pairing link cannot be made to show the right code.
  • Removing a device that had the account key replaces that key (new recovery phrase). Chats get a new key epoch; other members follow the signed succession from the old identity to the new one. The account's other devices keep going: every device vouches for itself with a certificate signed by the account identity, and the device that replaces the key seals the new one for each certified device, together with the succession. A device takes it only if the succession starts at the key it holds, so the server can neither add a device to the set nor hand out a key of its own. A device without a certificate (set up by an older version, or one that missed two replacements in a row) is paired again.
  • Settings and providers (account objects) are encrypted with the account key, deletions included.

Limits to know about: the first key bundle of a chat is trusted on first use; a stolen device that is still signed in can do what its owner can until it is removed; the optional LLM proxy sees what goes through it (a satellite does not have this problem, see above); metadata (who is in which chat, sizes, times) is visible to the server. On the desktop the device's keys are encrypted with a key from the system keyring (plain files with 0600 if there is none); on Android with a key wrapped by a non-exportable Android Keystore key (StrongBox or TEE); in the browser a non-extractable WebCrypto key protects them.

Tests

cargo test --workspace