This repository has been archived on 2026-11-14. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Paul HittandClaude Opus 5 7abe9c0ab2 Remove Flamenet Files, and delete accounts outright
Files was folded into the messenger, so this repository is the account
service and nothing else. The file server, its web client, its tenant
schemas and the documentation for all of it are gone.

Removed: EnclaveServer and its routes, EnclaveAccess, EnclaveCrypto, the
browser client under client/, the Files spec and vectors, the tenant SQL
under sql/, the web build and the node CI job, and the Leaf dependency
that only ever rendered the file server's pages. The Dockerfile built
EnclaveServer and shipped Public/ and Resources/; it now builds the
account service alone.

Nothing was lost. Every table in the production Files database was empty
when this was written: no nodes, no blobs, no identities, no tenants.
flamenetfiles.com, www.flamenetfiles.com and files.flamenet.io were
served by that stack and now answer 404; the compose file, the env and a
schema dump are on the box under /srv/prod/backups/, and the two docker
volumes were kept rather than pruned.

The service now issues pseudonyms for one product. `050_retire_files.sql`
deletes the `files` rows and replaces the CHECK constraint rather than
dropping it, so a container still being drained cannot write one back.
Every account had a `files` pseudonym and none had a `files` identity,
which is why there is no key material to migrate: the row was bookkeeping
for a product nobody enrolled in.

That also settles the delete endpoint added on this branch. It was built
around keeping a shared account alive while another product still held an
identity, and with one product that rule can never fire. `AccountRemoval`
and its five tests are gone, the response no longer reports which of two
outcomes happened, and a delete simply removes the account. None of it
had shipped, so there is no wire compatibility to keep.

Verified: the suites pass, the live delete script passes against a real
Postgres and a running service, and the image builds and boots to its
"DATABASE_URL is required" refusal, which is the account service and not
a file server.

`flamenet/files/auth/v1` stays as the authentication context string. It
is a wire constant baked into every stored verifier, not a product name,
and changing it would lock out every existing account. Said so in
ARCHITECTURE.md so nobody tidies it later.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-21 17:30:55 -04:00

2.9 KiB

The Flamenet account service

One handle and one passphrase, checked here, so a relay never sees either.

This repository was a file service with an account service beside it. Flamenet Files was folded into the messenger on 2026-09-21 and the file server was removed, so what is left is the account service and the security core it is built on.

Layout

Sources/EnclaveAccountsKit/  Handle rules, credential hashing, rate limiting. No server deps.
Sources/EnclaveLattice/      Label, Classification, Compartments, Clearance. No deps.
Sources/EnclaveAuth/         The signed session token, and the keys that sign and verify it.
Sources/EnclaveSQL/          A statement splitter, so schema files can be run as scripts.
Sources/EnclaveAccounts/     The service: registration, sign-in, deletion, token minting.
Sources/EnclaveAccounts/SQL/ The schema, as numbered scripts run by Fluent migrations.

The kit and the lattice are deliberately free of Vapor, Fluent, and Foundation-heavy types. The security-critical decisions should be testable without a server, which is why the rules that matter live there and not in a controller.

The boundary

EnclaveAccounts runs as its own process, under a role granted USAGE on enclave_accounts and nothing else. A relay holds no grant here in return. Neither can read the other's tables, and the signed token is the whole interface between them.

That boundary is what makes a self-hosted relay safe to run against this service: it can verify a session it did not mint, and it cannot mint one. The private half of the signing key never leaves this process.

What the passphrase produces

One passphrase produces two unrelated secrets, separated by an HKDF context after a single expensive stretch: an authentication secret under flamenet/files/auth/v1, which is sent here, and an identity key under flamenet/messenger/identity/v1, which never leaves the device.

A fully compromised account service can therefore impersonate somebody to itself and decrypt nothing of theirs.

The files in that first context string is a wire constant, not a product. It was named before the products were, it is baked into every account's stored verifier, and changing it would lock every existing account out.

What it stores

An opaque id, a login handle, the parameters a client needs to stretch a passphrase, and a verifier to compare against. There is no email column: omitting it is the privacy-maximal choice and it makes account recovery impossible, which is a trade the operator makes knowingly.

A product server sees only HMAC(service_secret, account_id || product), never the account id. The account service could correlate across products, which is precisely why it stores so little else.

What Fluent gives you for free

The schema's foreign keys are ON DELETE CASCADE from accounts, so removing an account removes its pseudonyms, clearances and devices in one statement rather than in a list somebody has to keep in step by hand.