Skip to main content

Prerequisites

  • Python 3.9+ (or Node.js 18+ for TypeScript)
  • A terminal

Option 1 — Python SDK (Local)

1. Install

pip install wavis-fhe
Building from source? Requires Rust + maturin:
pip install maturin
cd python && maturin develop --release

2. Run your first FHE gate

import wavis_fhe as wv

# Generate keys (once, ~5 seconds)
keys = wv.keygen()

# Encrypt two bits locally — server will never see them
ct_a = keys.encrypt(True)
ct_b = keys.encrypt(False)

# Evaluate NAND gate (this is what the server would do)
ct_result = keys.nand(ct_a, ct_b)

# Decrypt locally
result = keys.decrypt(ct_result)
print(f"NAND(1, 0) = {result}")  # True

3. Try the FHE-blind server mode

In production, the server holds only the evaluation key (not the secret key):
import wavis_fhe as wv

# --- Client side ---
keys = wv.keygen()
ek_bytes = keys.eval_key_bytes()   # safe to send to server (~40 MB)
ct_a = keys.encrypt(True)
ct_b = keys.encrypt(False)

# --- Server side (cannot decrypt) ---
ek = wv.eval_key_from_bytes(ek_bytes)
ct_result = ek.nand(ct_a, ct_b)

# --- Client side ---
result = keys.decrypt(ct_result)
print(f"NAND(1, 0) = {result}")   # True

Option 2 — REST API (No install)

Get a free trial key, then call the API directly:
# Step 1: Get a trial API key (no account required)
API_KEY=$(curl -s -X POST https://api.wavis.xyz/api/v1/onboarding/temp-key | jq -r .api_key)

# Step 2: Health check
curl https://api.wavis.xyz/api/v1/health

# Step 3: Create a TFHE session (upload eval key)
curl -X POST https://api.wavis.xyz/api/v1/tfhe/eval-session \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"eval_key_b64": "<your-base64-eval-key>"}'
See Python example 06 for a complete REST API flow.

Option 3 — TypeScript SDK

npm install @wavis/fhe-client
import { WavisClient } from "@wavis/fhe-client";

const { api_key } = await WavisClient.getTempKey();
const client = new WavisClient({ apiKey: api_key });

const key = await client.keys.generate({ poly_degree: 1024 });
console.log("Key ID:", key.key_id);

Next Steps