Edit spreadsheets with Fortune-Sheet and Word documents with Syncfusion — all client-side. Documents are decrypted, edited, re-encrypted, and saved back to R2 without plaintext ever touching the server.
TradeDrive had read-only viewers for DOCX (docx-preview), XLSX (SheetJS), and PDF (pdf.js) inside SecureFilePreview. Users could preview documents but had to download, edit locally, and re-upload to make changes. For encrypted vault files, this broke the zero-knowledge chain — plaintext would exist on disk during the edit cycle.
Fortune-Sheet, a maintained React fork of Luckysheet, provides a full-featured spreadsheet UI with cell editing, formatting, and multi-sheet support. SheetJS parses the uploaded .xlsx into JSON cell data, which Fortune-Sheet renders as an interactive grid. On save, ExcelJS converts the Fortune-Sheet state back into a valid .xlsx ArrayBuffer. The entire pipeline runs in the browser — no server round-trips for the document content.
Syncfusion DocumentEditorContainer opens .docx files directly in a rich Word-like editor with a Ribbon toolbar. No serviceUrl is configured, making it a pure client-side editor. Documents are exported as .docx blobs via saveAsBlob('Docx'). Syncfusion styles are loaded from CDN only when the editor is opened, keeping the main bundle lean.
The EditorContainer orchestrates the full zero-knowledge flow: fetch the encrypted blob from R2, prompt for the vault passphrase, decrypt with OpenPGP.js (Argon2id-hardened key), pass the plaintext ArrayBuffer to the editor, then on save re-encrypt with the user's public key before uploading back. The server only ever sees ciphertext. Decrypted buffers are zeroed on unmount via clearBuffer().
For files larger than 5 MB, the client splits the encrypted blob into 5 MB chunks and uploads them via three new worker endpoints that wrap R2's native multipart API: upload-init (createMultipartUpload), upload-part (uploadPart), and upload-complete (complete). Files under 5 MB use a single PUT to /drive/files/:id/save. Both paths overwrite the existing R2 object at the same key, so shared links remain valid.
Performance and security measures:
An Edit button (pencil icon) now appears on .xlsx and .docx files in both list and grid view. Clicking it navigates to /email/drive/edit?fileId=X&type=xlsx|docx, a dedicated full-screen editor page. Non-editable files (PDF, images, CSV) show no Edit button. The getEditorType() utility maps content types and file extensions to the correct editor.
Was this update useful?