Skip to content

zbruceli/dchat-desktop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D-Chat Desktop

Decentralized, end-to-end encrypted desktop messenger built on the NKN (New Kind of Network) relay network.

D-Chat Desktop is an Electron port of nMobile, bringing private, serverless messaging to macOS, Windows, and Linux.

D-Chat Desktop features

Downloads

Pre-built binaries for macOS, Windows, and Linux are available on the Releases page.

Note: Current releases are unsigned. macOS users need to right-click → Open (or run xattr -cr on the app). Windows users may see a SmartScreen warning — click "More info" → "Run anyway".

How It Works

D-Chat sends messages through NKN's decentralized relay network of ~100,000 nodes. No central server ever sees your messages or metadata.

  • Your identity is a cryptographic key pair. No phone number, no email, no password. A wallet is generated on first launch and the private key never leaves your device.
  • Messages are end-to-end encrypted using NKN's built-in encryption. Only the sender and recipient can read them.
  • All local data is encrypted at rest using SQLCipher (AES-256 encrypted SQLite), keyed to your wallet seed.
You ──(encrypted)──► NKN Relay Network ──(encrypted)──► Recipient
         No central server. No metadata leakage.

Features

Messaging

  • 1-to-1 encrypted messaging — Text messages over NKN relay with delivery/read receipts (gray ✓✓ / blue ✓✓)
  • Image messaging — AES-128-GCM encrypted, IPFS-stored, thumbnail preview, full-screen lightbox
  • Voice messaging — Record 0.5s–60s, WebM→AAC conversion, inline player with progress bar
  • File sharing — Any file type up to 100 MB, encrypted via IPFS, open with system default app
  • Burn-after-read — Per-contact self-destructing messages (5s to 1 week), countdown timer on bubbles, nMobile-compatible
  • Rich text — Automatic markdown and HTML rendering with styled headings, blockquotes, code blocks, links
  • P2P voice calls — Real-time calls via NKN TUNA relay, Opus codec (24 kbps), mute/unmute, call duration timer
  • Video sharing — Video media type via IPFS

Group Chat

  • Public topics — NKN blockchain-based subscriptions, subscriber panel, text/image/voice/file messaging
  • Private groups — Off-chain Ed25519 signature-based membership, owner/admin/member permissions, invite/kick/leave, full member sync
  • Public group discovery — Decentralized P2P discovery via shared NKN topic, browse/search/filter groups, subscriber counts from blockchain, one-click join
  • Create & broadcast groups — Create public groups with name, description, category, and avatar from Discover page; immediate P2P broadcast; announcement messages rendered as group cards

Identity & Contacts

  • NKN wallet — Create, import (keystore/seed), send/receive NKN tokens, balance display
  • Contact management — Add by NKN address, auto-create for unknown senders, avatar photos displayed throughout UI
  • Profile — Nickname + avatar, exchanged with nMobile contacts
  • User profile panel — View any user's profile from message avatar, subscriber list, or member list

Bot Support

  • NKN bot wallet — One-click generation of standalone NKN credentials (public key, wallet address, seed) for use in external bot code, seed encrypted at rest via OS keychain

Security

  • SQLCipher encryption — AES-256, keyed to wallet seed
  • safeStorage — Wallet seed encrypted via OS keychain, no plaintext fallback
  • Context isolation — nodeIntegration disabled, renderer has no Node.js access
  • Seed isolation — Wallet seed never crosses IPC boundary to renderer

Desktop Experience

  • Desktop notifications — Native OS notifications, click to navigate, suppressed when viewing conversation
  • Mute notifications — Per-conversation toggle + global mute in Settings
  • Connection status — Green/yellow/red indicator with avatar
  • Discover tab — Browse and create public groups with category filters, search, and subscriber counts
  • Settings — Profile editing, wallet backup, database backup/restore, NKN bot wallet, IPFS gateway config
  • nMobile interop — Full compatibility with nMobile wire formats

Getting Started

Prerequisites

Install and Run

git clone <repo-url> dchat && cd dchat
npm install
npx electron-rebuild -f -w better-sqlite3-multiple-ciphers
npx electron-rebuild -f -w sharp
npm run dev

On first launch, create a new wallet with a password to connect to the NKN network.

Build for Production

npm run build          # Full production build
npm run package        # Package as distributable (dmg/nsis/AppImage)
npm run package:mac    # macOS only
npm run package:win    # Windows only
npm run package:linux  # Linux only

Development

Command Description
npm run dev Vite hot reload + Electron
npm run build Production build (main + preload + renderer)
npm run test Unit tests (Vitest)
npm run typecheck TypeScript type checking
npm run lint ESLint check

Architecture

┌─────────────────────────────────────────────────┐
│  Renderer (React + Zustand)                     │
│  UI components, stores — no Node.js access      │
├──────────── contextBridge (IPC) ────────────────┤
│  Main Process                                   │
│  NKN client, SQLCipher DB, crypto, file I/O     │
└─────────────────────────────────────────────────┘

Tech Stack

Layer Technology
Desktop runtime Electron 33
UI React 18, TypeScript, Tailwind CSS 3
State management Zustand 4
Networking nkn-sdk (NKN JavaScript SDK)
Database better-sqlite3-multiple-ciphers (SQLCipher)
Crypto Node.js crypto (AES-128-GCM), Ed25519 (libsodium)
Media sharp, fluent-ffmpeg, react-markdown, DOMPurify
Build Vite 6, electron-builder 25, Vitest 2

Security Model

Threat Mitigation
Server compromise No server — messages relay through decentralized NKN nodes
Message interception End-to-end encryption (NKN SDK)
Local data theft SQLCipher (AES-256), key derived from wallet seed
Key extraction safeStorage (OS keychain), wallet.json permissions 0600
Renderer exploitation Context isolation, nodeIntegration disabled
Seed exposure Seed never crosses IPC boundary, zeroed on disconnect
Settings API abuse Allowlist restricts renderer to safe keys only

See SECURITY_AUDIT.md for the full audit report.

Roadmap

Phase Focus Status
1 Foundation — NKN client, 1-to-1 messaging, contacts, encrypted DB Complete
2 Rich messaging — Image, voice, file, IPFS, burn-after-read Complete
3 Group chat — Public topics, private groups Complete
4 Wallet & polish — NKN wallet, notifications, profile sync Complete
5 Security hardening — SQLCipher, safeStorage, audit Complete
6 Voice calls — P2P via NKN TUNA relay Complete
7 Video calls, multi-device sync, name service Planned

Acknowledgments

  • nMobile — The original mobile messenger this project is ported from
  • NKN — The decentralized relay network powering all messaging

License

MIT

About

D-Chat desktop app powered by NKN, compatible with nMobile, using Electron.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages