Authenticate users
by how they type.
TrueStroke is a C++ engine that identifies users by their unconscious keystroke rhythm. On-device inference under 1µs, ~140KB binary, zero dependencies.
< 1µs
p50 inference
~140 KB
binary size
0
dependencies
~150K/s
throughput
Capabilities
Built from first principles
C++17 with no frameworks, no cloud dependencies, no compromises.
On-device inference
All scoring runs locally. Raw keystroke data never leaves the device. Profiles encrypted with XChaCha20-Poly1305 at rest.
Sub-microsecond latency
SIMD-accelerated dual anomaly detection. Isolation Forest + Adaptive Mahalanobis Distance. 493K ops/sec on ARM.
Cross-platform
Same C++ core compiles to WASM, Android NDK, iOS, and desktop. WASM SIMD128 for near-native browser performance.
Liveness detection
Timing entropy analysis, Goertzel DFT jitter detection, WPM bounds validation, and FNV-1a replay fingerprinting.
Federated learning
Optional model improvement with differential privacy. Gradient clipping, calibrated Gaussian noise, Rényi DP composition.
Zero dependencies
No Boost, no Eigen, no TensorFlow. Custom SIMD abstraction, custom crypto, custom PRNG. 130KB static library.
Architecture
How it works
Five-stage pipeline from raw key events to authentication decision.
Collect
KeyDown / KeyUp eventsPlatform-specific key event hooks feed into a lock-free SPSC ring buffer.
Extract
Feature vectors42-dimensional feature vectors from dwell, flight, digraphs, trigraphs, and velocity.
Score
Anomaly scoresDual anomaly scoring: Isolation Forest and Adaptive Mahalanobis Distance.
Fuse
Fused confidenceAdaptive weighted blend of both scores. Weights learn which scorer is more discriminative.
Decide
Auth decisionHysteresis requires 3 consecutive anomalous windows before triggering a status change.
onAnomaly(callback) → step-up auth / lock UI / re-authenticate
Integration
Five lines to integrate
Works in any environment. Browser, mobile, or native.
import { TrueStroke } from '@truestroke/core';
const ts = await TrueStroke.init({ userId: 'user_123' });
// Attach to any element
const detach = ts.attachTo(document);
// React when an imposter is detected
ts.onAnomaly((event) => {
console.log(`confidence: ${event.confidence}`);
showReauthPrompt();
});
// Check confidence anytime
const score = ts.getConfidence(); // 0.0 to 1.0Benchmarks
Performance
Benchmarked on Apple Silicon M-series, Release build, Clang 17.
< 1 µs
P50 inference latency
on Apple Silicon
~17 µs
P99 inference latency
worst-case bound
~150K
Inferences per second
single-threaded
4M
Mahalanobis scores/sec
SIMD-accelerated
~800 MB/s
Crypto throughput
XChaCha20-Poly1305
~17 µs
Engine initialization
cold start
Comparison
How we compare
TrueStroke vs. existing keystroke biometric solutions.
| TrueStroke | TypingDNA | BioCatch | |
|---|---|---|---|
| Inference | On-device, < 1µs | Cloud, ~180ms | Cloud, ~200ms |
| Privacy | Zero data leaves device | Typing sent to cloud | Cloud processing |
| Dependencies | 0 | Cloud SDK | Enterprise SDK |
| Size | ~140 KB | N/A (SaaS) | N/A (SaaS) |
| Price | Free, open source | $3–5/user/mo | Enterprise contract |
| Platforms | WASM, Android, iOS, desktop | Web only | Web + mobile |
Ready to get started?
Try the interactive demo, explore the documentation, or integrate TrueStroke into your app today.