flashsh CLI β
The flashsh command is FLASH's sovereign zero-knowledge shell β optimized for private RAG, agent memory, and integrity proofs.
Keep the key β do not weaken the default
flashsh wrap-key seals the master; FLASH never holds it. Default flash-zk is strong. You can weaken it by leaking .flash-wrap or turning protection off. No independent audit in this release. Mission Β· Trust Model.
Installation β
npm install -g flash-zkOr via npx:
npx flashsh initKey format (this release only) β
FLASH 1.3.x recognizes one sealed-key format. Do not invent alternate file layouts β FlashClient will reject them.
| Artifact | Format | Example / rule |
|---|---|---|
Wrap key (.flash-wrap) | One line: flash_wrap_ + 43-char base64url | flash_wrap_xK9β¦ β generated by flashsh wrap-key only |
Master secret (inside .flash-take) | flash_master_ + base64url when CLI generates it | Or your own passphrase if you passed --key (16+ bytes, not weak) |
Sealed blob (.flash-take) | Line 1: FLASHTAKE1 Β· Line 2: AES-256-GCM payload (base64) | Magic FLASHTAKE1 only β no v2 / custom headers yet |
Encryption inside .flash-take: FlashCipher with wrap key, salt flash-key-wrap-v1, AAD flash-take:secretKey.
If you hand-edit keys or use a home-grown βencrypted key fileβ, FLASH will not load it unless it matches the table above.
How wrap-key works (step by step) β
flashsh wrap-key # in your app project directory
# or
flashsh wrap-key --dir ./config --force- Wrap key β CLI generates a random
flash_wrap_β¦string and writes one line to.flash-wrap(mode0600where supported). - Master secret β CLI generates
flash_master_β¦or seals the value you passed with--key(never printed). - Seal β Master is encrypted with the wrap key β
.flash-take(FLASHTAKE1+ ciphertext). - Done β CLI prints paths only. No secrets on stdout.
At runtime, FlashClient (or flashsh init / ask / β¦) with no --key:
- Looks for
.flash-takein--dir/ cwd (wrapKeyDir). - Loads wrap key from
.flash-wraporFLASH_WRAP_KEY. - Unseals β uses result as
secretKeyfor encryption.
flash_wrap_β¦ (.flash-wrap) βββ
ββββΊ unseal βββΊ flash_master_β¦ (secretKey)
FLASHTAKE1 + ciphertext (.flash-take) βββYour responsibilities:
- Add
.flash-wrapto your repoβs.gitignore(FLASH does not gitignore it for you). - Back up the wrap key securely β lost wrap key = sealed master unrecoverable.
- Treat
FLASH_WRAP_KEYin CI like a production secret. - Committing
.flash-takewithout the wrap key is intentional; leaking both together removes the benefit.
Commands β
Wrap master key (recommended) β
flashsh wrap-key
flashsh wrap-key --key "your_long_master_passphrase_here"| File | Purpose | Commit? |
|---|---|---|
.flash-wrap | Random wrap key (decrypts the take file) | No β add to your appβs .gitignore or use FLASH_WRAP_KEY in CI |
.flash-take | Sealed master secretKey (FLASHTAKE1) | Yes β safe without .flash-wrap |
import { FlashClient } from "flash-zk";
const client = new FlashClient({
storagePath: "./flash_data",
wrapKeyDir: "./config", // optional; default cwd
});Initialize workspace β
flashsh initCreates ./flash_data, writes a welcome sample, and ingests it into Private RAG (cli_knowledge). Uses .flash-take + .flash-wrap when present; otherwise requires --key or a default dev key is not used in production setups.
Interactive REPL β
flashsh
# flashsh> client.privateRAG('kb').ask('question')Ingest knowledge (Private RAG) β
flashsh ingest ./notes.txt
echo "FLASH encrypts client-side" | flashsh ingest -Semantic search (not a chatbot) β
flashsh ask "does the server see plaintext?"ask searches ingested documents via semantic similarity. It returns the closest matching chunks β not a conversational LLM reply.
Integrity proof β
flashsh proof usersOptions β
| Flag | Description |
|---|---|
--storage ./data | Storage directory (default: ./flash_data) |
--key secret | Master secret key (or input to wrap-key) |
--dir . | Directory for .flash-wrap / .flash-take |
--force / -f | Overwrite existing wrap/take files |
--uri flash://host:6742 | Remote FLASH server |
--quiet / -q | Suppress metadata output |
Recommended workflow β
# 1. Keys (once per environment)
flashsh wrap-key --dir .
echo ".flash-wrap" >> .gitignore # in YOUR project
# 2. Bootstrap data
flashsh init
# 3. Add documents
flashsh ingest medical-notes.txt
# 4. Search
flashsh ask "side effects"Collection used: cli_knowledge under {storagePath}/flash_db/.