nostr-mail
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.
Overview
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.
Why nostr-mail?
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 |
Email |
nostr-mail |
| Social Key Registry |
✓ |
✗ |
✓ |
| PGP |
✓ |
✓ |
✓ |
| Long form content |
✗ |
✓ |
✓ |
| Archival Storage |
✗ |
✓ |
✓ |
| Ubiquitous |
✗ |
✓ |
✓ |
Features
📧 Email Functionality
- 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
🔐 Nostr Integration
- 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 Management
- 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
🎨 User Interface
- 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
Tech Stack
Frontend
- 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
Backend (Tauri)
- 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
Encryption
- 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
Installation
Prerequisites
- 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
Installation Steps
-
Clone the repository:
bash
git clone https://github.com/asherp/nostr-mail
cd nostr-mail/tauri-app
-
Install Tauri CLI (if not already installed):
bash
cargo install tauri-cli
-
Start development server:
bash
cargo tauri dev
Quick Start
- 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!
Page Documentation
Compose Page
The Compose page is where you create and send encrypted emails.
Purpose
Compose and send encrypted emails to recipients, with optional Nostr direct message notifications.
Key Features
- 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
Usage Instructions
- 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
Configuration Options
- 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)
Tips and Best Practices
- 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
Inbox Page
The Inbox page displays all received emails, with filtering and decryption capabilities.
Purpose
View, search, and decrypt received emails from your IMAP server.
Key Features
- 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
Usage Instructions
- 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
Configuration Options
- 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)
Tips and Best Practices
- 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
Sent Page
The Sent page displays all emails you've sent.
Purpose
View and manage sent email history.
Key Features
- 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
Usage Instructions
- 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
Tips and Best Practices
- Sent emails are stored locally in the database
- Use search to quickly find specific sent emails
- Sent emails show encryption and signing status
Drafts Page
The Drafts page manages saved email drafts.
Purpose
View, edit, and manage saved email drafts.
Key Features
- 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
Usage Instructions
- 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
Tips and Best Practices
- 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
Direct Messages Page
The Direct Messages page manages Nostr direct message conversations.
Purpose
Send and receive encrypted direct messages via the Nostr protocol.
Key Features
- 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
Usage Instructions
- 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
Configuration Options
- Encryption Algorithm: Choose NIP-44 (r