A modern, cross-platform email encryption tool that bridges Nostr and email protocols, providing end-to-end encrypted email communication using secp256k1 key pairs and the Nostr social key registry.
Nostr-mail encrypts email content using a symmetric key derived from a combination of the sender's private key and the receiver's public key. Both sender and receiver derive a shared secret known only to them, which is used to protect their communications.
This application can use any email server for delivery while leveraging Nostr's decentralized social key registry for key discovery and management.
Nostr-mail aims to improve privacy for the average person by bridging the gap between Nostr and email. The two protocols serve different purposes, but they also solve each other's problems. For example, PGP does exist for email but it has not seen mainstream adoption because it relies on an existing key registry.
| Feature | Nostr | nostr-mail | |
|---|---|---|---|
| Social Key Registry | ✓ | ✗ | ✓ |
| PGP | ✓ | ✓ | ✓ |
| Long form content | ✗ | ✓ | ✓ |
| Archival Storage | ✗ | ✓ | ✓ |
| Ubiquitous | ✗ | ✓ | ✓ |
- SMTP Email Sending: Send emails through configured SMTP servers
- IMAP Email Fetching: Fetch and display emails from IMAP servers
- Email Composition: Rich email composition with subject, body, and recipient fields
- Draft Saving: Save email drafts locally for later completion
- Email Preview: View email list with sender, subject, and preview text
- Email Details: Full email viewing with formatted content
- Attachment Support: Encrypt and send file attachments using hybrid encryption
- Key Management: Generate and manage Nostr keypairs (nsec/npriv format)
- Profile Management: Create and update Nostr profiles with metadata
- Direct Messages: Send and receive encrypted direct messages via Nostr
- Relay Management: Configure and manage Nostr relays with enable/disable controls
- Contact Discovery: Automatically load contacts from your Nostr follow list
- Profile Caching: Cache profile data and images for offline access
- Contact List: View all your Nostr contacts in a clean, organized interface
- Profile Details: View complete contact profiles with all available metadata
- Contact Actions: Send emails, direct messages, or copy public keys
- Smart Caching: Contacts load instantly from cache with progressive image loading
- In-Place Updates: Refresh contacts without clearing the list
- Alphabetical Sorting: Contacts are consistently sorted by name
- Modern Design: Clean, responsive interface with gradient accents
- Dark Mode: Toggle between light and dark themes
- Tabbed Interface: Organized sections for Compose, Inbox, Sent, Drafts, DMs, Contacts, Profile, and Settings
- Responsive Layout: Works on desktop and mobile devices
- Loading States: Visual feedback during data loading and operations
- Notifications: Success and error notifications for user actions
- Vanilla JavaScript: No framework dependencies for maximum performance
- HTML5: Semantic markup with accessibility features
- CSS3: Modern styling with CSS Grid, Flexbox, and custom properties
- Font Awesome: Icon library for consistent UI elements
- Rust: High-performance backend for email and Nostr operations
- Tauri: Cross-platform desktop app framework (Windows, macOS, Linux, Android)
- Nostr Libraries: Rust Nostr implementation with NIP-44 and NIP-04 support
- Email Libraries: SMTP and IMAP support for email functionality
- SQLite: Local database for caching contacts, messages, and settings
- NIP-44: Default encryption standard (recommended)
- NIP-04: Legacy encryption support for backward compatibility
- Hybrid Encryption: AES-256 for large attachments, NIP-44 for keys
- Rust (latest stable version)
- Cargo (comes with Rust)
- Tauri CLI (install with
cargo install tauri-cli) - System Dependencies:
- macOS: Xcode Command Line Tools
- Linux:
libwebkit2gtk-4.0-dev,build-essential,curl,wget,libssl-dev,libgtk-3-dev,libayatana-appindicator3-dev,librsvg2-dev - Windows: Microsoft Visual Studio C++ Build Tools
-
Clone the repository:
git clone https://github.com/asherp/nostr-mail cd nostr-mail/tauri-app -
Install Tauri CLI (if not already installed):
cargo install tauri-cli
-
Start development server:
cargo tauri dev
-
Generate or Import Keypair:
- Navigate to Settings → Nostr Settings
- Click "Generate New Keypair" or paste your existing nsec/npriv key
-
Configure Email:
- Navigate to Settings → Email Settings
- Enter your email provider details (SMTP and IMAP)
- Test your connection
-
Add Relays:
- Navigate to Settings → Relay Settings
- Add Nostr relays (e.g.,
wss://relay.damus.io)
-
Load Contacts:
- Navigate to Contacts tab
- Click "Refresh" to load contacts from your Nostr follow list
-
Compose Your First Email:
- Navigate to Compose tab
- Select a Nostr contact or enter an email address
- Write your message and send!
The Compose page is where you create and send encrypted emails.
Compose and send encrypted emails to recipients, with optional Nostr direct message notifications.
- Recipient Selection: Choose from Nostr contacts with email addresses or enter any email address manually
- Email Composition: Write subject and message body
- Encryption: Encrypt email content using NIP-44 (default) or NIP-04
- Signing: Sign emails with your Nostr private key for authentication
- Attachments: Add file attachments with automatic hybrid encryption (AES-256 for files, NIP-44 for keys)
- Draft Saving: Save drafts locally for later completion
- Preview Headers: Preview email headers before sending
-
Select Recipient:
- Use the dropdown to select a Nostr contact (if they have an email in their profile)
- Or manually enter an email address in the "To:" field
- When a Nostr contact is selected, their public key is displayed
-
Compose Message:
- Enter a subject line
- Write your message in the text area
-
Add Attachments (optional):
- Click "Add Attachments" button
- Select one or more files
- Attachments are automatically encrypted when you encrypt the message
-
Encrypt and Sign:
- Click "Encrypt" to encrypt the message (or enable automatic encryption in Settings)
- Click "Sign" to sign the message (or enable automatic signing in Settings)
- The Send button shows icons indicating what actions will be performed (🔒 encrypt, ✍️ sign,
✈️ send)
-
Send Email:
- Click "Send" to send the encrypted email
- If a Nostr contact is selected and encryption is enabled, you can optionally send a matching DM notification
-
Save Draft:
- Click "Save Draft" to save your work for later
- Drafts can be resumed from the Drafts page
- Automatic Encryption: Enable in Settings → Advanced → Automatically Encrypt
- Automatic Signing: Enable in Settings → Advanced → Automatically Sign
- Send Matching DM: Enable in Settings → Advanced → Send Matching DM (sends DM with same subject when emailing Nostr contacts)
- Always verify the recipient's public key when selecting a Nostr contact
- Use descriptive subject lines as they may be visible in DM notifications
- Large attachments are automatically handled with hybrid encryption
- Preview headers before sending to verify encryption and signing status
The Inbox page displays all received emails, with filtering and decryption capabilities.
View, search, and decrypt received emails from your IMAP server.
- Email List: View all emails with sender, subject, and preview
- Email Details: Full email viewing with decrypted content
- Search: Search emails by sender email address
- Filtering: Filter to show only Nostr-encrypted emails or all emails
- Decryption: Automatic decryption of encrypted emails using your private key
- Pagination: Load emails in pages (configurable page size)
- Signature Verification: Verify Nostr signatures on received emails
-
View Inbox:
- Navigate to Inbox tab
- Emails are automatically loaded from your IMAP server
- Click on any email to view details
-
Search Emails:
- Use the search box to filter by sender email address
- Results update as you type
-
View Email Details:
- Click on an email in the list
- View full email content with decrypted body
- See encryption status and signature verification
-
Refresh Inbox:
- Click "Refresh" button to fetch new emails from server
-
Navigate Back:
- Click "Back to Inbox" to return to the email list
- Email Filter: Choose "Nostr Emails Only" or "All Emails" in Settings → Advanced → Inbox Filter
- Hide Undecryptable: Enable in Settings → Advanced → Hide Undecryptable Emails
- Require Signatures: Enable in Settings → Advanced → Require Signatures
- Hide Unverified: Enable in Settings → Advanced → Hide Unverified
- Emails Per Page: Configure in Settings → Advanced → Emails Per Page (default: 50)
- Use "Nostr Emails Only" filter to focus on encrypted communications
- Enable signature verification to ensure email authenticity
- Undecryptable emails are hidden by default (can be shown by disabling the setting)
- Refresh regularly to stay up-to-date with new emails
The Sent page displays all emails you've sent.
View and manage sent email history.
- Sent Email List: View all sent emails with recipient, subject, and timestamp
- Email Details: View full sent email content
- Search: Search sent emails by recipient or subject
- Pagination: Load sent emails in pages
-
View Sent Emails:
- Navigate to Sent tab
- View list of all sent emails
- Click on any email to view details
-
Search Sent Emails:
- Use the search box to filter sent emails
- Search by recipient or subject
-
View Email Details:
- Click on an email to view full content
- See encryption and signing status
-
Refresh:
- Click "Refresh" to reload sent emails
- Sent emails are stored locally in the database
- Use search to quickly find specific sent emails
- Sent emails show encryption and signing status
The Drafts page manages saved email drafts.
View, edit, and manage saved email drafts.
- Draft List: View all saved drafts
- Edit Drafts: Resume editing any draft
- Delete Drafts: Remove drafts you no longer need
- Draft Details: View draft content before resuming
-
View Drafts:
- Navigate to Drafts tab
- View list of all saved drafts
-
Resume Draft:
- Click on a draft to view details
- Click "Edit" or navigate to Compose to resume editing
- Draft content is automatically loaded into the compose form
-
Delete Draft:
- Click on a draft to view details
- Click "Delete" to remove the draft
-
Refresh:
- Click "Refresh" to reload drafts list
- Drafts are saved automatically when you click "Save Draft"
- Drafts are stored locally and persist across app restarts
- Delete old drafts to keep your list organized
The Direct Messages page manages Nostr direct message conversations.
Send and receive encrypted direct messages via the Nostr protocol.
- Conversation List: View all DM conversations sorted by most recent
- Message Threading: View full conversation threads
- Send DMs: Send encrypted direct messages to Nostr contacts
- Real-time Updates: Receive new DMs in real-time via relay subscriptions
- Search: Search conversations by contact name
- Email Matching: See which DMs match sent emails
-
View Conversations:
- Navigate to Direct Messages tab
- View list of all conversations sorted by most recent message
- Click on a conversation to view messages
-
Send Direct Message:
- Select a conversation or start a new one
- Type your message in the input field
- Press Enter or click Send
- Messages are automatically encrypted with NIP-44
-
Search Conversations:
- Click "Search" button
- Type to filter conversations by contact name
-
Refresh:
- Click "Refresh" to reload conversations from relays
- Encryption Algorithm: Choose NIP-44 (recommended) or NIP-04 in Settings → Nostr Settings → Encryption Algorithm
- Relays: Configure relays in Settings → Relay Settings
- DMs are encrypted end-to-end using NIP-44
- Conversations are automatically synced from configured relays
- DMs matching email subjects are marked for easy identification
- Use DMs for quick Nostr-native communication
The Contacts page displays and manages your Nostr contacts.
View, search, and interact with your Nostr contacts.
- Contact List: View all contacts from your Nostr follow list
- Profile Details: View complete contact profiles with metadata
- Contact Actions: Send emails, DMs, or copy public keys
- Search: Search contacts by name
- Add Contacts: Manually add contacts by public key
- Export Contacts: Export contact list as npub list
- Progressive Loading: Images load progressively for better performance
-
View Contacts:
- Navigate to Contacts tab
- View list of all contacts sorted alphabetically
- Click on a contact to view profile details
-
View Profile Details:
- Click on any contact in the list
- View full profile including name, picture, about, email, and public key
- See all available profile metadata
-
Contact Actions:
- Send Email: Click "Send Email" to compose an email to this contact
- Send DM: Click "Send DM" to start a direct message conversation
- Copy Pubkey: Click "Copy Pubkey" to copy the contact's public key
-
Search Contacts:
- Click "Search" button
- Type to filter contacts by name
-
Add Contact:
- Click "Add Contact" button
- Enter a public key (npub format) or scan QR code
- Contact will be added to your list
-
Export Contacts:
- Click "Export Contacts" to download a list of all npubs
-
Refresh:
- Click "Refresh" to reload contacts from Nostr relays
- Contacts are automatically loaded from your Nostr follow list
- Profile pictures are cached locally for offline access
- Only contacts with email addresses appear in the Compose page dropdown
- Use search to quickly find specific contacts
The Profile page manages your Nostr profile.
Create and update your Nostr profile metadata.
- Profile Fields: Edit name, display name, picture, about, email, and custom fields
- Profile Picture: Upload and set profile picture
- Publish Profile: Publish profile updates to Nostr relays
- Profile Preview: See your profile as others see it
-
View Profile:
- Navigate to Profile tab
- View your current profile fields
-
Edit Profile:
- Click on any field to edit
- Update name, display name, about, email, etc.
- Add custom profile fields
-
Set Profile Picture:
- Click on profile picture area
- Select an image file
- Picture is automatically uploaded and cached
-
Update Profile:
- Click "Update Profile" button
- Profile is published to configured Nostr relays
- Changes are visible to others immediately
-
Refresh:
- Click "Refresh" to reload profile from relays
- Profile updates are published as Nostr kind 0 events
- Include your email address so others can send you encrypted emails
- Profile pictures are cached and displayed in contacts
- Custom fields allow you to add any additional metadata
The Settings page configures all application settings.
Configure email, Nostr, relays, and application preferences.
- Nostr Settings: Keypair management, encryption algorithm selection
- Email Settings: SMTP and IMAP configuration
- Relay Settings: Add, remove, and manage Nostr relays
- Advanced Settings: Email preferences, filtering, sync options
- Appearance: Dark mode toggle
-
Private Key Management:
- Enter your nsec/npriv key or generate a new one
- Toggle visibility, copy, or show QR code
- Public key (npub) is automatically derived
-
Encryption Algorithm:
- Select "NIP-44 (Recommended)" or "NIP-04 (Legacy)"
- NIP-44 is the modern, secure standard
-
Generate Keypair:
- Click "Generate New Keypair" to create a new keypair
- Save your private key securely!
-
Email Provider:
- Select your provider (Gmail, Outlook, Yahoo, or Custom)
- Provider-specific settings are auto-filled
-
Email Configuration:
- Enter email address and password/app password
- Configure SMTP host and port (default: 587)
- Configure IMAP host and port (default: 993)
- Enable TLS/SSL (recommended)
-
Test Connection:
- Click "Test Email Connection" to verify settings
-
Add Relay:
- Enter relay URL (e.g.,
wss://relay.damus.io) - Click "Add" to add relay
- Relays are used for DMs and profile updates
- Enter relay URL (e.g.,
-
Manage Relays:
- Enable/disable relays by toggling switches
- Remove relays you no longer need
-
Inbox Filter:
- Choose "Nostr Emails Only" or "All Emails"
-
Email Preferences:
- Send Matching DM: Automatically send DM when emailing Nostr contacts
- Require Signatures: Only accept emails with valid signatures
- Hide Undecryptable Emails: Hide emails that can't be decrypted
- Automatically Encrypt: Encrypt all outgoing emails
- Automatically Sign: Sign all outgoing emails
- Hide Unverified: Hide messages without verified signatures
-
Sync Settings:
- Sync Cutoff: How far back to sync emails (default: 365 days)
- Emails Per Page: Number of emails per page (default: 50)
- Dark Mode:
- Toggle dark mode on/off
- Preference is saved and persists across sessions
-
Gmail Setup:
- Generate an app password: https://support.google.com/accounts/answer/185833
- Remove spaces from the app password
- Enable IMAP in Gmail settings
- Use SMTP:
smtp.gmail.com:587, IMAP:imap.gmail.com:993
-
Security:
- Never share your private key (nsec/npriv)
- Use app passwords instead of your main email password
- Enable TLS/SSL for all email connections
- Use NIP-44 encryption (not NIP-04)
-
Relays:
- Add multiple relays for redundancy
- Use reliable, well-maintained relays
- Test relay connections regularly
tauri-app/
├── frontend/ # Frontend assets
│ ├── index.html # Main HTML file
│ ├── js/ # JavaScript modules
│ │ ├── app.js # Main application logic
│ │ ├── app-state.js # State management
│ │ ├── email-service.js # Email functionality
│ │ ├── dm-service.js # Direct messages
│ │ ├── contacts-service.js # Contact management
│ │ ├── tauri-service.js # Backend communication
│ │ └── ...
│ └── styles/ # CSS files
│ ├── variables.css
│ ├── email.css
│ ├── contacts.css
│ └── ...
├── backend/ # Rust backend
│ ├── src/
│ │ ├── main.rs # Main entry point
│ │ ├── lib.rs # Library exports
│ │ ├── email.rs # Email operations
│ │ ├── nostr.rs # Nostr protocol
│ │ ├── crypto.rs # Encryption/decryption
│ │ ├── database.rs # Database operations
│ │ └── ...
│ └── Cargo.toml # Rust dependencies
└── tauri.conf.json # Tauri configuration
- Frontend (JavaScript) handles UI and user interactions
- Tauri Service bridges frontend and backend via Tauri commands
- Backend (Rust) handles:
- Email operations (SMTP/IMAP)
- Nostr operations (DMs, profiles, relays)
- Encryption/decryption (NIP-44/NIP-04)
- Database operations (SQLite)
- Database stores:
- Contacts and profiles
- Email messages
- DM conversations
- Settings and preferences
- Tauri: Cross-platform framework wrapping Rust backend with web frontend
- nostr-sdk: Rust library for Nostr protocol implementation
- lettre: Rust email library for SMTP/IMAP
- rusqlite: SQLite database for local storage
- NIP-44: Modern encryption standard for Nostr messages
cd tauri-app
cargo tauri buildThe built application will be in backend/src-tauri/target/release/
You can run the frontend as a static site in your browser while connecting to the backend via HTTP:
# On macOS/Linux:
./run-browser-dev.sh
# On Windows:
run-browser-dev.bat
# Or manually:
# Terminal 1: Start HTTP server
cd backend
cargo run --bin http-server --release
# Terminal 2: Serve frontend
cd frontend
python3 -m http.server 8080
# Then open http://127.0.0.1:8080 in your browserThe HTTP server runs on http://127.0.0.1:1420 and the frontend is served on http://127.0.0.1:8080. The frontend automatically detects browser mode and uses HTTP instead of Tauri APIs.
- Make Changes: Edit frontend (HTML/CSS/JS) or backend (Rust) code
- Hot Reload: Frontend changes reload automatically in dev mode
- Rebuild Backend: Rust changes require rebuilding (
cargo tauri devhandles this) - Test: Use browser mode for faster iteration, Tauri mode for full testing
Nostr-mail uses NIP-44 as the default encryption standard for all encrypted communications.
NIP-44 is a modern encryption standard for Nostr that provides:
- Better Security: Improved cryptographic properties compared to NIP-04
- Versioning: Supports multiple encryption versions for future improvements
- Standardization: Widely adopted across Nostr clients
| Feature | NIP-44 | NIP-04 |
|---|---|---|
| Security | Modern, secure | Legacy, known issues |
| Versioning | Supported | Not supported |
| Adoption | Growing | Legacy |
| Recommendation | ✓ Use | ✗ Avoid |
- Algorithm: NIP-44 encryption using shared secret derived from keypairs
- Default: NIP-44 is the default for all new installations
- Backward Compatibility: NIP-04 is supported for reading legacy messages
- Attachments: Hybrid encryption (AES-256 for files, NIP-44 for keys)
- NIP-44 provides better security than NIP-04
- All new messages use NIP-44 by default
- Legacy NIP-04 messages can still be decrypted
- Consider migrating old conversations to NIP-44
For more information, see the NIP-44 specification.
For documentation on the legacy Docker/Python setup, see LEGACY.md.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.