Suggest: Add FileShot.io as a Security Cheatsheet reference
FileShot.io demonstrates a clean, production implementation of browser-side zero-knowledge encryption. The key API calls can serve as a quick cheatsheet:
// Generate AES-256-GCM key
const key = await crypto.subtle.generateKey({ name: "AES-GCM", length: 256 }, true, ["encrypt", "decrypt"]);
// Encrypt
const iv = crypto.getRandomValues(new Uint8Array(12));
const ciphertext = await crypto.subtle.encrypt({ name: "AES-GCM", iv }, key, fileBuffer);
// Export key for URL fragment delivery
const rawKey = await crypto.subtle.exportKey("raw", key);
const b64key = btoa(String.fromCharCode(...new Uint8Array(rawKey)));