Enclosed is a minimalistic web application designed for sending private and secure notes.
All notes are end-to-end encrypted, ensuring that the server and storage have zero knowledge of the content. Users can set a password, define an expiration period (TTL), and choose to have the note self-destruct after being read.
Note Creation: A user creates a note with some content and optionally sets a password.
Key Generation: A base key is generated on the client side to ensure encryption, even if no password is set.
Master Key Derivation: A master key is derived from the base key and the optional password using PBKDF2 with SHA-256.
Note Encryption: The note is encrypted using the master key with AES-GCM encryption.
Sending to Server: The encrypted note is sent to the server along with some metadata (ttl, is the note password-protected, should it self-destruct after reading).
Storage and ID Assignment: The server stores the encrypted note and provides an ID for it.
Link Generation: A link is generated that includes the note ID and the base key (included as a URL hash fragment to maximize security since hashes are not sent to the server).
Link Sharing: The link is shared with the intended recipient.
Note Retrieval: The recipient opens the link, and the app fetches the encrypted note and metadata from the server using the note ID.
Key Extraction: The base key is extracted from the URL hash fragment.
Password Prompt (If Applicable): If the note is password-protected, the recipient is prompted to enter the password.
Master Key Derivation: The master key is derived from the base key and the entered password using PBKDF2 with SHA-256.
Note Decryption: The note is decrypted using the master key with AES-GCM and can now be read by the recipient.
This ensures that the note remains securely encrypted during transmission and storage, with decryption only possible by those with the correct link and (if applicable) password.
CLI
The Enclosed CLI allows you to create notes from the terminal. You can install it globally using npm, yarn, or pnpm.
Installation
bash
# with npm
npm install -g @enclosed/cli
# with yarn
yarn global add @enclosed/cli
# with pnpm
pnpm add -g @enclosed/cli
Create a note
bash
# Basic usage
enclosed create "Hello, World!"# Using stdincat file.txt | enclosed create
# With full options
enclosed create --deleteAfterReading --password "password" --ttl 3600 "Hello, World!"
View a note
bash
# The password will be prompted if the note is password-protected
enclosed view <note-url>
# Or you can provide the password directly
enclosed view --password "password" <note-url>
Configure the enclosed instance to use
bash
# By default, the CLI uses the public instance at enclosed.cc
enclosed config set instance-url https://enclosed.cc
Project Structure
This project is organized as a monorepo using pnpm workspaces. The structure is as follows:
packages/cli: Command-line interface for Enclosed.
Contributing
Contributions are welcome! Please refer to the CONTRIBUTING.md file for guidelines on how to get started, report issues, and submit pull requests.
You can find easy-to-pick-up tasks with the good first issue label.
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for more information.