Inspiration
What it does
How we built it
Challenges we ran into
Accomplishments that we're proud of
What it does
Veilmind is a local AI agent whose inputs are sealed before they leave your computer. Gemini only ever sees opaque references like ⟦CARD_1⟧. The reply is opened locally, so the API provider never holds your data or your master key.
How it works
- A Rust core generates a 256-bit master key and splits it with Shamir's Secret Sharing over GF(2^8): 5 shares, any 3 rebuild it.
- Sensitive values (names, cards, emails, phones, or anything in [[double brackets]]) are sealed with AES-256-GCM. Each value is bound to its token name, so sealed values cannot be swapped.
- Before sending, Veilmind scans the exact outgoing request for any plaintext value or key share. One hit aborts the request.
- The reply is opened locally. The key is rebuilt from 3 shares in memory for one operation, then zeroized.
- In the UI, switch key holders off: with fewer than 3, the vault locks.
The mathematics
Each byte s of the key is the constant term of a random degree-2 polynomial over GF(2^8). Share i is the point (x_i, f(x_i)). Lagrange interpolation at x = 0 recovers s. With only 2 shares, every possible secret is equally likely, so they reveal nothing, even to an attacker with unlimited compute. The field multiply is branch-free and table-free, avoiding the cache-timing class of bug (CVE-2023-25000, HashiCorp Vault). It is tested against the FIPS-197 vector and a reference for all 65,536 input pairs.
Honest limits
Without fully homomorphic encryption an LLM cannot compute on true ciphertext, so Veilmind keeps secrets out of the model's view and opens the answer locally. Detection is pattern-based plus [[ ]] markers. In the demo all five shares live in one local process so the quorum is visible on screen.
Run it
Instructions, MATH.md and tests are in the GitHub repo. Add your own Gemini key to .env. Without one the app runs in a clearly labelled demo mode.