-
Notifications
You must be signed in to change notification settings - Fork 1
Encryption Architecture
VailNote implements a sophisticated encryption architecture designed to maximize privacy and security while maintaining usability across different client environments.
VailNote's encryption system operates on the principle of zero-knowledge architecture, where the server never has access to plaintext content. The system supports two modes of operation to accommodate different client capabilities.
The encryption flow follows this pattern:
- Client-side encryption (JavaScript mode)
- Secure transmission to backend
- Server-side hashing and storage
- Link generation with embedded keys
- Decryption on retrieval

In JavaScript mode, all encryption happens on the client side before any data leaves the user's device.
-
Key Generation
- If password provided: SHA-256 hash of password becomes encryption key
- If no password: Random 32-byte key generated locally
- Random 12-byte IV (Initialization Vector) generated
-
Client-side Encryption
- Content encrypted using AES-GCM algorithm
- Encryption key derived from password hash or random generation
- IV ensures unique encryption even with same content
-
Secure Transmission
- Only encrypted content and hashed password sent to server
- Server never sees plaintext content
- Auth key remains on client side
-
Server Processing
- Server generates random note ID
- Password hash is salted and hashed again (bcrypt)
- Encrypted content stored with salted hash
-
Link Generation
- Client generates shareable link:
vailnote.com/[noteId]?auth=[authKey] - Auth key embedded in URL fragment (never sent to server)
- Client generates shareable link:
-
Link Opening
- Auth key extracted from URL
- Note ID sent to server for retrieval
-
Server Response
- Server returns encrypted content and IV
- No decryption happens on server
-
Client Decryption
- Client uses auth key to decrypt content
- Content displayed to user
- Note destroyed from server
For compatibility with clients that don't support JavaScript, VailNote provides a fallback mode.
- Content transmitted in plaintext over SSL/TLS
- Server performs encryption using note ID as key
- Reduced security compared to JavaScript mode
- Suitable for environments where JavaScript is unavailable
// Key derivation from password
const keyBuffer = await crypto.subtle.digest(
'SHA-256',
new TextEncoder().encode(password)
);
// AES-GCM encryption with random IV
const encrypted = await crypto.subtle.encrypt(
{
name: 'AES-GCM',
iv: randomIV
},
cryptoKey,
contentBytes
);-
AES-GCM Algorithm
- Authenticated encryption with associated data
- Provides both confidentiality and authenticity
- Resistant to padding oracle attacks
-
SHA-256 Key Derivation
- Cryptographically secure hash function
- Deterministic key generation from passwords
- One-way function prevents password recovery
-
Random IV Generation
- 12-byte random initialization vector
- Ensures semantic security
- Prevents rainbow table attacks
-
Bcrypt Password Hashing
- Server-side password verification
- Salted hashing prevents rainbow table attacks
- Configurable work factor for future-proofing
- Zero-knowledge: Server never sees plaintext content
- Forward secrecy: Each note uses unique encryption parameters
- Client-side key generation: Reduces attack surface
- Secure random number generation: Uses Web Crypto API
- Encrypted storage: All content stored encrypted
- Salted password hashing: Prevents credential compromise
- Self-destructing notes: Automatic deletion after viewing
- No persistent keys: Encryption keys never stored on server
- TLS encryption: All data encrypted in transit
- Authentication: bcrypt verification prevents unauthorized access
- Rate limiting: ARC protocol prevents abuse
The encryption architecture is designed to resist:
- Server compromise: Encrypted data remains secure
- Network interception: TLS and client-side encryption
- Database breach: All content stored encrypted
- Credential stuffing: Salted password hashing
- Replay attacks: Unique IVs and self-destructing notes
- Non-JavaScript mode: Content visible to server during processing
- Link sharing: Auth keys transmitted in URLs
- Client-side vulnerabilities: Depends on browser security
- Metadata leakage: Note existence and access patterns visible
- Use JavaScript mode for maximum security
- Use strong passwords when password protection is enabled
- Share links securely via encrypted channels
- Verify HTTPS connection before creating notes
- Regular security audits of encryption implementation
- Secure random number generation for all cryptographic operations
- Constant-time comparisons for password verification
- Proper error handling to prevent information leakage
- FIPS 140-2: AES-GCM encryption algorithm
- RFC 5084: AES-GCM specification compliance
- OWASP: Following secure coding practices
- Web Crypto API: Browser-native cryptographic primitives
- Post-quantum cryptography: Preparation for quantum threats
- Hardware security modules: Enhanced key management
- Multi-factor authentication: Additional security layers
- Perfect forward secrecy: Enhanced key rotation
This documentation covers VailNote's encryption architecture as of July 2025. For the latest updates, check the GitHub repository.