All sensitive user data (check-in content) is encrypted before being stored in the database using the following approach:
IMPORTANT: The current implementation uses base64 encoding as a placeholder. This provides obfuscation but NOT true encryption. For production use with sensitive data, you MUST implement proper AES-GCM encryption using the Web Crypto API (see implementation example below).
Development:
# Generate a secure key
openssl rand -base64 32
# Add to wrangler.toml
[vars]
ENCRYPTION_KEY = "your-generated-key"
Production:
# Use Wrangler secrets (recommended)
wrangler secret put ENCRYPTION_KEY
# Paste your key when prompted
Data Storage:
Authentication:
Network Security:
Client-Side User ID: User IDs are stored in browser localStorage. Clearing browser data will create a new user. This is by design for simplicity.
Basic Encryption: The current encryption implementation uses base64 encoding with an IV. For production use with sensitive data, implement proper AES-GCM using the Web Crypto API.
No User Authentication: There’s no password or SSO. This is intentional for a simple check-in tool, but may not be suitable for all use cases.
For enhanced security in production:
from js import crypto
async def encrypt_with_webcrypto(data, key): # Convert key to CryptoKey key_buffer = TextEncoder().encode(key) crypto_key = await crypto.subtle.importKey( “raw”, key_buffer, {“name”: “AES-GCM”}, False, [“encrypt”] )
# Generate IV
iv = crypto.getRandomValues(bytearray(12))
# Encrypt
encrypted = await crypto.subtle.encrypt(
{"name": "AES-GCM", "iv": iv},
crypto_key,
TextEncoder().encode(data)
)
return base64.b64encode(iv + encrypted) ```
# In wrangler.toml
[limits]
requests_per_minute = 60
# Log all data access
await log_access(user_id, action, timestamp)
# Auto-delete old check-ins
DELETE FROM checkins WHERE created_at < date('now', '-90 days')
If operating in the EU or handling EU user data:
Add these endpoints:
# Export user data
GET /api/user/export?userId={id}
# Delete user data
DELETE /api/user/delete?userId={id}
If you discover a security issue:
Monitor:
Update regularly:
npm update
wrangler update
Weekly:
Monthly:
Quarterly:
Security is a continuous process. Stay vigilant and keep your Worker updated!