Fundamental architecture of browser-contained encrypted text engine
In order to maintain both confidentiality and persistence of text data on the client side, this secure text editor uses a zero trust architecture that does not involve any server-side database.
All keystroke events originating from the text input area are captured by a lightweight event listener running on the browser's main thread and immediately buffered in local volatile memory space.
A standalone design that is fully functional even when network communications are disconnected, fundamentally eliminating the risk of man-in-the-middle attacks and server-side data leaks.
Additionally, by separating document object model updates and data persistence processing, we minimize the occurrence of reflows and repaints when processing large amounts of text, resulting in a smooth typing experience that does not interfere with the browser's rendering pipeline.
Even when the number of input characters reaches tens of thousands of characters, it has a unique garbage collection strategy that maintains memory consumption below a certain level by omitting complex parsing processes such as abstract syntax trees and using a buffer management method that handles plain text at high speed.
**AES-GCM** **256bit** Encryption flow using **Web Crypto API**
Sensitive text entered by the user is strongly encrypted through the Satoru Crypto interface, a subsystem function of the Web Crypto API, immediately before being saved to non-volatile storage.
The master password set by the user is stretched tens of thousands of times using the PBKDF2 algorithm and SHA-256 hash function, converting it into a strong 256-bit encryption key.
This key derivation process dramatically improves resistance to dictionary attacks and brute force attacks using rainbow tables. The generated encryption key is combined with a secure initialization vector obtained from the operating system's random number generator to perform encryption using AES-GCM mode.
By adopting the Galo Account Mode, not only the confidentiality but also the integrity of the data is guaranteed. Even if the encrypted data on the storage is illegally tampered with by a third party, it will be detected as an authentication tag verification error during the decryption process and the reading of the forged data will be prevented.
The encryption key itself is only held temporarily in the browser's memory, and the reference is destroyed the moment the window is closed or the session times out, so your data cannot be recovered even if your device is physically stolen.
. **IndexedDB** and localStorage hybrid storage strategy
A tiered browser-local storage architecture is implemented to enable textual data persistence and instant state restoration. Small configuration data, active tab status, UI display settings, etc.
are stored in synchronous localStorage with extremely low access latency and are loaded immediately after the browser starts.
Meanwhile, encrypted memo data and historical backup data, which can amount to several megabytes, are stored in the IndexedDB object store, an asynchronous API.
By leveraging IndexedDB's transaction mechanism, we prevent conflicts caused by simultaneous writes from multiple tabs and prevent data inconsistency and corruption.
This dual structure balances the contradictory requirements of fast application startup and secure storage of large amounts of data.
When you approach storage quota limits, background workers silently perform garbage collection, similar to an LRU cache algorithm that automatically purges old historical data, enabling intelligent storage management to free up space without disrupting users.
500ms automatic save and history backup mechanism using debounce control
A highly accurate autosave engine has been implemented to prevent data loss due to unexpected browser crashes while typing or power loss.
A debounce circuit using a timer API monitors input events because performing a save operation on every consecutive keystroke saturates the storage IO.
When the user's keyboard input is interrupted for 500 milliseconds, it evaluates the difference between the latest buffer in memory and the previous commit state, and then issues an asynchronous write transaction to IndexedDB.
At this time, instead of simply overwriting the existing record, we use a write-once architecture that stores it as a snapshot with a timestamp added to the history object store.
This allows users to go back to any previous snapshot and restore the content, even if the autosave runs immediately after a user accidentally deletes a large portion of text.
The number of saved history items is dynamically adjusted according to the storage capacity, and an interval adjustment algorithm that saves the latest data at higher density and thins out the older data is used to optimize the usability of backups and storage efficiency.
Session life cycle and cryptographic lock mechanism when switching tabs
In environments with sensitive text data, mechanisms to prevent over-the-shoulder hacking and eavesdropping when users are away are essential.
A dedicated listener that monitors the Page Visibility API detects in real time when a browser tab is inactive or minimized.
When a transition from the active state to the inactive state is confirmed, it immediately clears the plain text buffer in memory and transitions to the cryptographic lock state, which covers the on-screen text area with an opaque masking layer.
In order to view or edit the text again, you will be required to regenerate the decryption key by re-entering the master password.
In addition, if no user input is detected for a certain period of time, an idle timer is activated that monitors mouse movement and scrolling events, and when a preset timeout threshold is exceeded, the session is automatically discarded and transitioned to the lock screen.
A lock synchronization signal is sent and received between multiple tabs within the same origin through the broadcast channel API, creating a robust session protection network in which when one tab is locked, all other tabs are immediately locked.
. Export Processing and Local Rendering of Plain Text
A secure data extraction pipeline is provided to make the accumulated ciphertext available to external tools. When a user instructs to export, the corresponding encrypted record is read from IndexedDB, decrypted in memory, and then instantiated as a Blob object.
This Blob data is converted by the URL Create Object URL function into a universal resource locator for temporary local access and saved directly to the user's local file system through the download attribute of the HTML anchor element.
During this entire process, the data never leaves the external network and is exported as a plain text file in TXT or Markdown format.
When outputting in Markdown format, line breaks are optimized according to the environment while maintaining syntax highlighting and list structure, allowing seamless integration with other Markdown editors and version control systems.
By completing file generation and download within the browser's sandbox environment, we ensure portability while preserving confidential information and achieve the ultimate local-first document management.