MCPcopy Index your code
hub / github.com/asherp/nostr-mail

github.com/asherp/nostr-mail @v1.0.8

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.0.8 ↗ · + Follow
1,984 symbols 6,798 edges 75 files 427 documented · 22% updated 7d agov1.0.8 · 2026-06-10★ 4428 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

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

  1. Clone the repository: bash git clone https://github.com/asherp/nostr-mail cd nostr-mail/tauri-app

  2. Install Tauri CLI (if not already installed): bash cargo install tauri-cli

  3. Start development server: bash cargo tauri dev

Quick Start

  1. Generate or Import Keypair:
  2. Navigate to Settings → Nostr Settings
  3. Click "Generate New Keypair" or paste your existing nsec/npriv key

  4. Configure Email:

  5. Navigate to Settings → Email Settings
  6. Enter your email provider details (SMTP and IMAP)
  7. Test your connection

  8. Add Relays:

  9. Navigate to Settings → Relay Settings
  10. Add Nostr relays (e.g., wss://relay.damus.io)

  11. Load Contacts:

  12. Navigate to Contacts tab
  13. Click "Refresh" to load contacts from your Nostr follow list

  14. Compose Your First Email:

  15. Navigate to Compose tab
  16. Select a Nostr contact or enter an email address
  17. 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

  1. Select Recipient:
  2. Use the dropdown to select a Nostr contact (if they have an email in their profile)
  3. Or manually enter an email address in the "To:" field
  4. When a Nostr contact is selected, their public key is displayed

  5. Compose Message:

  6. Enter a subject line
  7. Write your message in the text area

  8. Add Attachments (optional):

  9. Click "Add Attachments" button
  10. Select one or more files
  11. Attachments are automatically encrypted when you encrypt the message

  12. Encrypt and Sign:

  13. Click "Encrypt" to encrypt the message (or enable automatic encryption in Settings)
  14. Click "Sign" to sign the message (or enable automatic signing in Settings)
  15. The Send button shows icons indicating what actions will be performed (🔒 encrypt, ✍️ sign, ✈️ send)

  16. Send Email:

  17. Click "Send" to send the encrypted email
  18. If a Nostr contact is selected and encryption is enabled, you can optionally send a matching DM notification

  19. Save Draft:

  20. Click "Save Draft" to save your work for later
  21. 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

  1. View Inbox:
  2. Navigate to Inbox tab
  3. Emails are automatically loaded from your IMAP server
  4. Click on any email to view details

  5. Search Emails:

  6. Use the search box to filter by sender email address
  7. Results update as you type

  8. View Email Details:

  9. Click on an email in the list
  10. View full email content with decrypted body
  11. See encryption status and signature verification

  12. Refresh Inbox:

  13. Click "Refresh" button to fetch new emails from server

  14. Navigate Back:

  15. 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

  1. View Sent Emails:
  2. Navigate to Sent tab
  3. View list of all sent emails
  4. Click on any email to view details

  5. Search Sent Emails:

  6. Use the search box to filter sent emails
  7. Search by recipient or subject

  8. View Email Details:

  9. Click on an email to view full content
  10. See encryption and signing status

  11. Refresh:

  12. 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

  1. View Drafts:
  2. Navigate to Drafts tab
  3. View list of all saved drafts

  4. Resume Draft:

  5. Click on a draft to view details
  6. Click "Edit" or navigate to Compose to resume editing
  7. Draft content is automatically loaded into the compose form

  8. Delete Draft:

  9. Click on a draft to view details
  10. Click "Delete" to remove the draft

  11. Refresh:

  12. 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

  1. View Conversations:
  2. Navigate to Direct Messages tab
  3. View list of all conversations sorted by most recent message
  4. Click on a conversation to view messages

  5. Send Direct Message:

  6. Select a conversation or start a new one
  7. Type your message in the input field
  8. Press Enter or click Send
  9. Messages are automatically encrypted with NIP-44

  10. Search Conversations:

  11. Click "Search" button
  12. Type to filter conversations by contact name

  13. Refresh:

  14. Click "Refresh" to reload conversations from relays

Configuration Options

  • Encryption Algorithm: Choose NIP-44 (r

Extension points exported contracts — how you extend this code

ReadWrite (Interface)
Any stream that can back a pooled IMAP session. The blanket impl means `TcpStream`, `native_tls::TlsStream<_>`, and `rus [1 …
tauri-app/backend/src/imap_pool.rs

Core symbols most depended-on inside this repo

to_string
called by 947
mock-email/src/types.rs
get
called by 829
tauri-app/frontend/js/dom-manager.js
clone
called by 531
tauri-app/backend/src/keychain.rs
showError
called by 212
tauri-app/frontend/js/notification-service.js
addEventListener
called by 203
tauri-app/frontend/js/dom-manager.js
get_database
called by 118
tauri-app/backend/src/state.rs
escapeHtml
called by 112
tauri-app/frontend/js/utils.js
getElement
called by 99
tauri-app/frontend/js/dom-manager.js

Shape

Function 943
Method 890
Class 142
Enum 8
Interface 1

Languages

Rust69%
TypeScript27%
Python3%
Kotlin1%

Modules by API surface

tauri-app/backend/src/lib.rs268 symbols
tauri-app/backend/src/database.rs227 symbols
tauri-app/backend/src/email.rs223 symbols
tauri-app/backend/src/nostr_mail_capnp.rs187 symbols
tauri-app/frontend/js/email-service.js179 symbols
tauri-app/frontend/js/dm-service.js51 symbols
tauri-app/frontend/js/contacts-service.js47 symbols
tauri-app/frontend/js/app-state.js44 symbols
tauri-app/frontend/js/utils.js38 symbols
tauri-app/backend/src/nostr.rs37 symbols
tauri-app/backend/src/storage.rs32 symbols
tauri-app/backend/src/types.rs30 symbols

For agents

$ claude mcp add nostr-mail \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page