How jakbor32/privnote works
Based on our analysis of the file tree and the README content, the PrivNote project is a secure, client-side application built using React and TypeScript. It primarily focuses on enabling users to create encrypted, self-destructing notes – and now also supports secure file hosting. The encryption and decryption processes all occur in the browser using AES-256 (via crypto-js), and Supabase is used for storage and possibly other backend functions (like JWT validation for file access).
Main Components
• Frontend Application: This is built with React and TypeScript and includes all components under the src directory. It handles UI rendering, note creation, encryption, decryption, and secure file uploads.
• Encryption/Decryption Engine: Represented as a dedicated module (using crypto-js) that encrypts notes client-side before storage and decrypts them on retrieval. This logic is embedded in various components like CreateNote and OpenNote.
• Storage & Supabase Service: Supabase acts as the backend storage for encrypted notes and uploaded files. Include any API or configuration modules (see src/utils/supabaseConfig.ts) that indicate how the app interacts with Supabase. This section should also cover the JWT-based secure file hosting.
• External Services / Infrastructure: Even though most processes are client-side, mention any hosting platforms (like Vercel for deployment) since they are defined in configuration files (like vercel.json).
Relationships and Data Flow
• Encryption Module: Show how raw note content flows into the encryption routine (in the browser) and becomes an encrypted string. Emphasize that the encryption key remains client-side and is appended to the URL fragment.
• Retrieval & Decryption: Indicate that when a recipient accesses a note (using a URL with an appended key), the app retrieves the encrypted note from Supabase, then performs client-side decryption to display the content.
• Extensions for Secure File Hosting: Detail the flow where file uploads (with a size up to 50MB) go through a secure file upload flow – utilize functions in the UploadToStorage module, which handle file input, uploading, token generation, and secure link generation.
Architectural Patterns/Design Principles
• Component-Based Architecture: Clearly defined React components are split into directories such as CreateNote, OpenNote, and NoteSettings, each handling a discrete part of functionality.
• Layered Architecture: Represent how presentation (React components), business logic (encryption and file handling routines), and data access (Supabase interactions) are layered.
Relevant Technologies & Frameworks
• React & TypeScript for UI and component logic.
• Vite as the build tool (inferred from vite.config.ts and vite-env.d.ts).
• Tailwind CSS for styling, with configurations in tailwind.config.js.
• Crypto-js for AES-256 encryption.
• Supabase for backend data storage and file hosting.
• Deployment artifacts like vercel.json indicate a Vercel-hosted platform.
Specific Elements
• Each major component (Frontend App, Encryption Engine, Supabase Storage, File Hosting Service).
• Data flows: User input → Encryption → Supabase storage and back (with decryption).
• "User Interface" (with detailed components like CreateNote, OpenNote, UploadToStorage) and "Encryption Engine".
• "Encryption Engine" to "Supabase Storage".
• "Supabase Storage" back to "UI" during note retrieval, followed by "Decryption Process".
• "File Upload Service" depicting JWT-token generation and secure file hosting.