wavis-fhe— local FHE engine (Rust core via PyO3). Generates keys, encrypts, evaluates gates locally. Apache 2.0.wavis— REST client forapi.wavis.xyz. Manages keys/compute/webhooks through the cloud API. Apache 2.0.
Install
wavis_fhe — local engine
keygen()
Generate a fresh TFHE keypair.
TfheKeys object holding (secret_key, public_key, eval_key).
Time: ~5 seconds first call, <1 ms for cached presets.
keygen_gpu() (BYO GPU)
pip install wavis-fhe[cuda] and an NVIDIA GPU with CUDA 11.8+.
GPU keygen is ~3× faster than CPU. Subsequent gate evaluations on the
returned TfheKeysGpu use the GPU automatically.
TfheKeys.encrypt(bit)
Ciphertext. Each ciphertext is ~2 KB. Encryption is constant-time.
TfheKeys.encrypt_batch(bits)
encrypt() in a loop because it amortizes randomness sampling.
TfheKeys.decrypt(ct)
bool — the recovered plaintext bit.
Decryption requires the secret key, which only the TfheKeys instance has.
A Ciphertext decrypted with the wrong key returns garbage (the gate model
guarantees CCA1 security; CCA2 is out of scope for FHE).
Boolean gates
All gate methods follow the same shape: take 1–3 ciphertexts, return one ciphertext. Each call performs one bootstrap (resets noise to a fixed level), so circuit depth is unlimited.| Gate | Bootstrap ops | Latency (fast_128 CPU) |
|---|---|---|
| NAND, AND, OR, NOR | 1 | 14 ms |
| XOR, XNOR | 4 | 56 ms |
| NOT | 0 | <1 µs (free, no bootstrap) |
| MUX | 3 | 42 ms |
TfheKeys.batch_nand(pairs)
TfheKeys.eval_key_bytes()
Ciphertext serialization
wavis — REST client
The REST client handles auth, retries, and JSON serialization for
api.wavis.xyz.
Setup
api_key is omitted, the client reads the WAVIS_API_KEY env variable.
client.health.check()
client.keys.* — CKKS key management
client.compute.* — CKKS compute
add, multiply, add-plain, multiply-plain, negate,
rescale, rotate, matmul, poly-eval, bootstrap. See
Compute Reference for full schemas.
client.webhooks.*
client.dashboard.usage()
Error handling
WAVISApiError with the parsed error body. The
client retries idempotent requests (GET, DELETE) up to 3 times on 5xx
responses with exponential backoff.
High-level wavis API (CKKS arithmetic)
For numerical workloads, the wavis package exposes a NumPy-like API:
| Function | Description |
|---|---|
wavis.add(a, b) | Element-wise addition |
wavis.multiply(a, b) | Element-wise multiplication |
wavis.scale(a, c) | Multiply by plaintext constant |
wavis.dot(a, b) | Dot product (scalar result) |
wavis.matmul(M, v) | Matrix-vector multiplication |
wavis.rotate(a, k) | Cyclic rotation by k slots |
wavis.poly_eval(a, coeffs) | Polynomial evaluation |
Concurrency
TheWAVISClient is thread-safe and connection-pooled (up to 32 concurrent
connections per client). For multi-process workloads, instantiate one client
per process.
Next Steps
Server Mode Example
Full FHE-blind workflow end-to-end
GPU Batch Example
Local GPU acceleration step-by-step