Security Architecture · Deep Dive

Zero trust. Zero compromise.

A complete breakdown of how NeuroKey protects your data, what threats it defends against, and the cryptographic guarantees it provides.

AES-256PBKDF2 (600k)k-AnonymityHardware KeystoreZero Network

Threat model

Security is only meaningful in the context of what you're protecting against. Here's every threat we've modeled and how NeuroKey addresses each one.

Eliminated

Server breach / data exfiltration

No server exists. There is nothing to breach.

Mitigated

Brute-force of master password

The master password is never stored. It only feeds PBKDF2-SHA256 with a random salt (600,000 iterations on desktop, 100,000 on mobile), so every guess is slow. A strong master password remains essential.

Mitigated

Device theft

Vault requires your master password or biometrics. Encrypted with AES-256 + HMAC-SHA256 at rest.

Mitigated

Eavesdropping or spoofing during Wi-Fi sync

Each sync uses a one-time 256-bit key shown only in the QR code. Payloads are encrypted and authenticated, the session works once and expires after 5 minutes, and the desktop rejects every request without it.

Mitigated

Physical memory extraction

The vault key lives only in memory while unlocked and is discarded on lock or auto-lock. The biometric unlock key is protected by the hardware-backed Keystore.

Mitigated

Reverse engineering & app tampering

Production Android builds utilize ProGuard (R8) code obfuscation, shrinking resources and masking execution logic.

Encryption pipeline

A step-by-step walkthrough of how your vault goes from plaintext to ciphertext — and back.

01

PBKDF2 key derivation

Your master password is stretched with PBKDF2-SHA256 and a random 128-bit salt into a 256-bit vault key: 600,000 iterations on desktop (native WebCrypto), 100,000 on mobile. The iteration count is stored with the vault so it can be raised over time.

const material = await crypto.subtle.importKey(
  "raw", encode(masterPassword), "PBKDF2",
  false, ["deriveBits"]
);
const vaultKey = await crypto.subtle.deriveBits(
  { name: "PBKDF2", hash: "SHA-256",
    salt, iterations: 600_000 },
  material, 256
);
02

Encrypt-then-MAC

Two sub-keys are derived from the vault key. The vault JSON is encrypted with AES-256-CBC and a fresh random 128-bit IV on every write, then an HMAC-SHA256 tag is computed over the IV and ciphertext. Any modified byte makes the tag check fail.

const encKey = HmacSHA256("neurokey-enc", vaultKey);
const macKey = HmacSHA256("neurokey-mac", vaultKey);

const iv = crypto.getRandomValues(new Uint8Array(16));
const ct = AES.encrypt(vaultJSON, encKey, { iv, mode: CBC });
const tag = HmacSHA256(`nk2.${iv}.${ct}`, macKey);

// Stored as "nk2.<iv>.<ciphertext>.<tag>"
03

Encrypted storage

Only the encrypted blob is written to disk (AsyncStorage on Android, an app data file on Windows). The salt, KDF parameters and a password verifier live in the hardware-backed Keystore via expo-secure-store — never the password itself.

// 1. Store only ciphertext
await AsyncStorage.setItem(
  '@neurokey_vault_v2', encrypt(vaultJSON, vaultKey)
);

// 2. Decrypt verifies the tag first
const json = decrypt(blob, vaultKey);
if (json === null) throw new Error('Wrong key or tampered');
04

Biometric unlock

When biometric unlock is enabled, the vault key — not the password — is stored in a Keystore item that the OS releases only after a successful fingerprint or face check. NeuroKey never sees biometric data.

import * as SecureStore from 'expo-secure-store';

await SecureStore.setItemAsync('vault_key_biometric', vaultKey, {
  requireAuthentication: true,
});

// Later: the OS shows the biometric prompt first
const key = await SecureStore.getItemAsync('vault_key_biometric', {
  requireAuthentication: true,
  authenticationPrompt: 'Unlock NeuroKey',
});
Breach Radar

How k-anonymity keeps your password private.

To check if a password has been leaked, NeuroKey uses the k-anonymity model from the Have I Been Pwned API. Here's the exact protocol:

  1. 1

    Hash the password

    Compute SHA-1 of the candidate password locally. Example: SHA-1("hunter2") = AB87D2...

  2. 2

    Truncate to 5 chars

    Take only the first 5 hex characters (the "prefix"): AB87D. This is what's transmitted.

  3. 3

    Query the API

    Send GET /range/AB87D. The API returns all hash suffixes that share this prefix — typically 400–900 entries.

  4. 4

    Match locally

    Compare the full local hash against the returned suffixes. A match means the password is in a breach database. No full hash or plaintext ever leaves your device.

k-anonymity protocol

1. Local hash

SHA1("hunter2") = AB87D24BEA...

2. Prefix sent to API

GET /range/AB87D → server never sees full hash

3. API returns suffixes

24BEA...:34221
7F3AC...:891
C4D90...:12
...(600+ entries)

4. Local match check

24BEA matched! Password found in 34,221 breaches.

Don't trust. Verify.

NeuroKey is fully open source. Every cryptographic claim on this page can be verified in the source code. No black boxes.

0

Network requests per vault operation

600k

PBKDF2 iterations per key derivation (desktop)

256-bit

AES key length

0

Bytes stored on any server