Skip to content

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 ​

bash
npm install -g flash-zk

Or via npx:

bash
npx flashsh init

Key format (this release only) ​

FLASH 1.3.x recognizes one sealed-key format. Do not invent alternate file layouts β€” FlashClient will reject them.

ArtifactFormatExample / rule
Wrap key (.flash-wrap)One line: flash_wrap_ + 43-char base64urlflash_wrap_xK9… β€” generated by flashsh wrap-key only
Master secret (inside .flash-take)flash_master_ + base64url when CLI generates itOr 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) ​

bash
flashsh wrap-key              # in your app project directory
# or
flashsh wrap-key --dir ./config --force
  1. Wrap key β€” CLI generates a random flash_wrap_… string and writes one line to .flash-wrap (mode 0600 where supported).
  2. Master secret β€” CLI generates flash_master_… or seals the value you passed with --key (never printed).
  3. Seal β€” Master is encrypted with the wrap key β†’ .flash-take (FLASHTAKE1 + ciphertext).
  4. Done β€” CLI prints paths only. No secrets on stdout.

At runtime, FlashClient (or flashsh init / ask / …) with no --key:

  1. Looks for .flash-take in --dir / cwd (wrapKeyDir).
  2. Loads wrap key from .flash-wrap or FLASH_WRAP_KEY.
  3. Unseals β†’ uses result as secretKey for encryption.
text
  flash_wrap_…  (.flash-wrap)     ──┐
                                    β”œβ”€β”€β–Ί unseal ──► flash_master_… (secretKey)
  FLASHTAKE1 + ciphertext (.flash-take) β”€β”€β”˜

Your responsibilities:

  • Add .flash-wrap to 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_KEY in CI like a production secret.
  • Committing .flash-take without the wrap key is intentional; leaking both together removes the benefit.

Commands ​

bash
flashsh wrap-key
flashsh wrap-key --key "your_long_master_passphrase_here"
FilePurposeCommit?
.flash-wrapRandom wrap key (decrypts the take file)No β€” add to your app’s .gitignore or use FLASH_WRAP_KEY in CI
.flash-takeSealed master secretKey (FLASHTAKE1)Yes β€” safe without .flash-wrap
javascript
import { FlashClient } from "flash-zk";

const client = new FlashClient({
  storagePath: "./flash_data",
  wrapKeyDir: "./config", // optional; default cwd
});

Initialize workspace ​

bash
flashsh init

Creates ./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 ​

bash
flashsh
# flashsh> client.privateRAG('kb').ask('question')

Ingest knowledge (Private RAG) ​

bash
flashsh ingest ./notes.txt
echo "FLASH encrypts client-side" | flashsh ingest -

Semantic search (not a chatbot) ​

bash
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 ​

bash
flashsh proof users

Options ​

FlagDescription
--storage ./dataStorage directory (default: ./flash_data)
--key secretMaster secret key (or input to wrap-key)
--dir .Directory for .flash-wrap / .flash-take
--force / -fOverwrite existing wrap/take files
--uri flash://host:6742Remote FLASH server
--quiet / -qSuppress metadata output

bash
# 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/.


Zero-knowledge encrypted intelligence Β· Apache 2.0