Architecture
Zero-Trust Edge Computing
Waspada AI follows a strict Zero-Trust architecture where no component — not even the Gateway — is trusted with victim PII.
┌──────────────────────────────────────────────────────────┐
│ TRUST BOUNDARY │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Client Device (Browser) │ │
│ │ │ │
│ │ Evidence File ──→ OCR/PDF ──→ Regex ──→ NER │ │
│ │ │ │ │
│ │ PII Stripper │ │
│ │ │ │ │
│ │ AES-256-GCM Encrypt │ │
│ │ (local evidence store) │ │
│ │ │ │ │
│ │ Anonymized Indicators │ │
│ └────────────────────────────┬───────────────────────┘ │
│ │ │
│ │ JWT-Signed · PII-stripped │
│ ▼ │
│ ┌────────────────────────────────────────────────────┐ │
│ │ Waspada Gateway │ │
│ │ │ │
│ │ JWT Verify → PII Filter → RDAP Enrich → FMS Fmt │ │
│ └────────────────────────────┬───────────────────────┘ │
│ │ │
└───────────────────────────────┼──────────────────────────┘
│
▼
┌──────────────────────┐
│ Bank FMS Webhook │
│ (Standardized Alert)│
└──────────────────────┘Key Design Principles
1. Local-First Inference
All AI processing runs on the user's device:
| Engine | Runtime | Footprint | Verified Latency |
|---|---|---|---|
Byte, /FlateDecode PDF, DuitNow TLV & AXML | TS / Swift 6 / Kotlin | 195 KB public tries | < 2.9 ms hostile fuzz max |
CrestNet v1 Emblem Vision | Apple ANE Core ML / Web ONNX | 463 KB native (1.24 MB web) | 0.31 ms ANE p50 (18.32 ms warm cache) |
PP-OCRv5 Mobile + SpanNER v2.1 | WebGPU + WASM SIMD / ANE / LiteRT | 4.5 MB det + 14.0 MB rec + 14.6 MB native (15.3 MB web) | 3.29 ms ANE p50 (260.29 MiB single-tab browser ceiling) |
Voice-Note Triage (.opus) | Ephemeral Whisper INT8 WASM Worker | 37.2 MiB lazy (0 KB cold boot) | 8,514 ms per clip (worker heap reclaimed) |
Illustrative on-device ranges. No measurement date is recorded on this page. They are not gateway ingest figures, and /health is not a latency dashboard.
2. Non-Extractable Cryptography
typescript
// Keys are created with extractable: false
// They cannot be exported via JavaScript — browser enforced
const key = await crypto.subtle.deriveKey(
{ name: 'PBKDF2', salt, iterations: 600000, hash: 'SHA-256' },
baseKey,
{ name: 'AES-GCM', length: 256 },
false, // ← NON-EXTRACTABLE
['encrypt', 'decrypt']
);3. Defense-in-Depth PII Filtering
PII is stripped in two independent layers:
- Client SDK — Regex patterns remove NRICs, phone numbers, and names before payload construction
- Gateway — Secondary PII filter rejects any payload containing suspicious patterns
If PII is Detected at the Gateway
The payload is rejected with HTTP 422. That is an SDK stripper bug and an engineering incident. Do not read it as a promise that a bad payload cannot be submitted.
4. Gateway: verify-first request path
The diagram above is the verify-first request path. It is not a claim that the gateway process holds no state. Shared replay, rate-limit, and ticket state use Redis when configured, and the durable path also writes Postgres. /health on the live host reports topology: durable-redis. That JSON is a status check, not a latency dashboard.
Phase B moved side-effects onto a durable event log (Redis Streams transport + Postgres system of record). See Phase B0 foundations for the schema, tenancy, retention, and encryption design, and Phase B1–B4 runtime for the shipped ingest → bus → durable alert → outbox path. Ingest returns 202 ACCEPTED with event_id.
Horizontal scale still requires Redis for JTI/rate-limit (and, in B4, pub/sub for SSE).