QryptChat implements post-quantum cryptography to ensure message security against both classical and quantum computer attacks. All encryption happens client-side before data leaves the device.
- Algorithm: CRYSTALS-Kyber-1024
- Purpose: Secure key exchange between clients
- Key Size: 1,568 bytes (public), 3,168 bytes (private)
- Security Level: NIST Level 5 (highest)
- Implementation: WebAssembly module via
pqc-kyberlibrary
- Algorithm: CRYSTALS-Dilithium-5
- Purpose: Message authentication and non-repudiation
- Key Size: 2,592 bytes (public), 4,864 bytes (private)
- Security Level: NIST Level 5 (highest)
- Implementation: WebAssembly module via
pqc-dilithiumlibrary
- Algorithm: ChaCha20-Poly1305
- Purpose: Fast message content encryption
- Key Size: 256 bits
- Nonce: 96 bits (unique per message)
- Authentication: Built-in AEAD (Authenticated Encryption with Associated Data)
graph TD
IK[Identity Key Pair - Dilithium]
SPK[Signed Pre-Key - Kyber]
OPK[One-Time Pre-Keys - Kyber]
EK[Ephemeral Key - Kyber]
SS[Shared Secret]
RK[Root Key]
CK[Chain Key]
MK[Message Key]
IK --> SPK
SPK --> SS
OPK --> SS
EK --> SS
SS --> RK
RK --> CK
CK --> MK
- Type: CRYSTALS-Dilithium key pair
- Lifetime: Permanent (until user resets)
- Purpose: User identity verification
- Storage: Encrypted in browser IndexedDB
- Backup: Encrypted backup to Supabase (optional)
- Type: CRYSTALS-Kyber key pair
- Lifetime: 30 days (rotated automatically)
- Purpose: Initial key exchange
- Signature: Signed by Identity Key
- Storage: Public key on server, private key local
- Type: CRYSTALS-Kyber key pairs
- Lifetime: Single use
- Purpose: Perfect forward secrecy
- Quantity: 100 keys generated per batch
- Storage: Public keys on server, private keys local
- Type: CRYSTALS-Kyber key pair
- Lifetime: Single message
- Purpose: Additional forward secrecy
- Storage: Not stored (generated on-demand)
sequenceDiagram
participant A as Alice
participant S as Server
participant B as Bob
A->>S: Request Bob's key bundle
S->>A: Bob's identity key, signed pre-key, one-time pre-key
A->>A: Generate ephemeral key pair
A->>A: Perform 4 Kyber key exchanges
A->>A: Derive shared secret using HKDF
A->>A: Encrypt first message
A->>S: Send encrypted message + ephemeral public key
S->>B: Forward message bundle
B->>B: Recreate shared secret
B->>B: Decrypt message
sequenceDiagram
participant A as Alice
participant B as Bob
Note over A,B: Shared root key established
A->>A: Generate new Kyber key pair
A->>A: Derive new root key and sending chain
A->>A: Derive message key from chain
A->>A: Encrypt message with ChaCha20-Poly1305
A->>B: Send encrypted message + new public key
B->>B: Derive new root key and receiving chain
B->>B: Derive message key from chain
B->>B: Decrypt message
B->>B: Generate new Kyber key pair for response
- Message Keys: Deleted immediately after use
- Chain Keys: Ratcheted forward, old keys deleted
- One-Time Pre-Keys: Used once and deleted
- Ephemeral Keys: Never stored
- Key Rotation: Regular rotation of all key types
- Healing: New key exchanges heal from compromise
- Isolation: Compromise of one conversation doesn't affect others
- NIST Standards: Uses NIST-approved PQC algorithms
- Security Levels: Level 5 provides maximum quantum resistance
- Future-Proof: Designed for 50+ year security horizon
- pqc-kyber: CRYSTALS-Kyber implementation
- pqc-dilithium: CRYSTALS-Dilithium implementation
- Performance: Native speed in browser
- Security: Constant-time implementations
- ChaCha20-Poly1305: Native browser support
- HKDF: Key derivation functions
- Random: Cryptographically secure random numbers
- Subtle Crypto: Low-level cryptographic operations
- Constant-Time: All operations use constant-time algorithms
- Memory: Secure memory clearing after use
- Timing: No timing-dependent operations
- Code Review: All cryptographic code reviewed
- Testing: Extensive unit and integration tests
- Auditing: Regular security audits planned
- Updates: Automatic security updates
- Quantum Computers: Resistant to Shor's and Grover's algorithms
- Nation-State Actors: Designed for highest threat level
- Long-Term Security: 50+ year security horizon
- Compromise Recovery: Automatic healing from key compromise