Open-source SDK

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.

01

Collect

Platform-specific key event hooks feed into a lock-free SPSC ring buffer.

02

Extract

42-dimensional feature vectors from dwell, flight, digraphs, trigraphs, and velocity.

03

Score

Dual anomaly scoring: Isolation Forest and Adaptive Mahalanobis Distance.

04

Fuse

Adaptive weighted blend of both scores. Weights learn which scorer is more discriminative.

05

Decide

Hysteresis 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.0

Benchmarks

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
InferenceOn-device, < 1µs
PrivacyZero data leaves device
Dependencies0
Size~140 KB
PriceFree, open source
PlatformsWASM, Android, iOS, desktop

Ready to get started?

Try the interactive demo, explore the documentation, or integrate TrueStroke into your app today.