# TOSV Architecture - `load_db/save_db` : flat key=value + `grant=` lines, atomic tmp+rename. - `derive` : SHA256 chain per layer, hex memrand, memset wipe. - `crypt_buf` : XOR each layer at `(off+i)%32`, 64KB streaming, never whole file in RAM beyond chunk. - `ip_ok` : exact match or CIDR via inet_addr + mask compare. - `handle` : single-thread-per-conn, raw POSIX parse, Content-Length body read, Basic base64 decode, session map + mutex. - `wipe_store` : overwrite up to 1MB zeros then unlink, remove DB. - `main` : loopback listen, creates `.env.json` admin + random pass if missing. ## Security notes - Bootstrap creds plaintext by design, single use. - Per-grant random creds, UUIDv4 with RFC variant bits. - Duress path audited then wiped. - No TLS in this port, run behind stunnel or on loopback. ## Volledigheid vs alle besproken teksten - paste.txt, plan.md, legacy README, elite report source.md: bootstrap, grants, IP/CIDR, window, lagen, stream crypt, uuid4 custom, mlock/wipe, signals/wipe, audit, rate, tweeweg default append-only, WebDAV/SFTP/POST, VFS blobs. - C++ port dekt alles af binnen stdlib+POSIX: geen externe deps, single file.