Skip to content

A-Solo-Engineer/ShadowCrypt

Repository files navigation

πŸ” ShadowCrypt: Zero-Knowledge Messaging Platform

ShadowCrypt Logo

Local-first, end-to-end encrypted messaging with a stateless backend. No server-side storage ever.

πŸ“‹ Project Structure

ShadowCrypt/
β”œβ”€β”€ backend/                      # Go Blind Relay Server
β”‚   β”œβ”€β”€ cmd/blindrelay/
β”‚   β”‚   └── main.go              # Entry point
β”‚   β”œβ”€β”€ pkg/
β”‚   β”‚   β”œβ”€β”€ server/              # WebSocket & HTTP
β”‚   β”‚   β”œβ”€β”€ routing/             # Message router (blind relay)
β”‚   β”‚   β”œβ”€β”€ session/             # Session manager (ephemeral RAM)
β”‚   β”‚   └── crypto/              # Signature verification
β”‚   β”œβ”€β”€ go.mod
β”‚   β”œβ”€β”€ BUILD_AND_DEPLOY.md
β”‚   └── README.md
β”‚
β”œβ”€β”€ frontend/                     # Flutter Encrypted Vault
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   β”œβ”€β”€ main.dart            # Vault unlock UI
β”‚   β”‚   β”œβ”€β”€ data/
β”‚   β”‚   β”‚   β”œβ”€β”€ database/        # Drift + SQLCipher
β”‚   β”‚   β”‚   └── models/          # Data classes
β”‚   β”‚   β”œβ”€β”€ crypto/              # Cryptography
β”‚   β”‚   β”‚   β”œβ”€β”€ key_management.dart   # BIP-39, PBKDF2, AES-256
β”‚   β”‚   β”‚   └── signal_protocol.dart  # Double Ratchet
β”‚   β”‚   └── ui/                  # Screens
β”‚   β”œβ”€β”€ pubspec.yaml
β”‚   β”œβ”€β”€ BUILD_AND_TEST.md
β”‚   └── README.md
β”‚
β”œβ”€β”€ ARCHITECTURE.md              # Detailed system design
β”œβ”€β”€ CRYPTOGRAPHIC_ANALYSIS.md    # Security & threat model
β”œβ”€β”€ README.md                    # This file
└── .gitignore

πŸš€ Quick Start

Backend (Go)

cd backend

# Install dependencies
go mod download

# Run locally
go build -o blindrelay ./cmd/blindrelay
./blindrelay -addr=:8080

# Or with Docker
docker build -t shadowcrypt-blindrelay .
docker run -p 8080:8080 shadowcrypt-blindrelay

Available endpoints:

  • ws://localhost:8080/ws - WebSocket messaging
  • http://localhost:8080/health - Health check
  • http://localhost:8080/metrics - Real-time server metrics

Frontend (Flutter)

cd frontend

# Install dependencies
flutter pub get

# Generate Drift code
flutter pub run build_runner build

# Run on Windows desktop
flutter run -d windows

# Or build release
flutter build windows --release

First-time setup:

  1. Run app β†’ "Create New Vault"
  2. Save 12-word mnemonic
  3. App initializes SQLCipher database
  4. Vault ready to use

Existing vault:

  1. Run app β†’ "Unlock Vault"
  2. Enter 12-word mnemonic
  3. AES-256 key derived β†’ database unlocked
  4. All messages load from encrypted local storage

πŸ” Security Features

Feature Implementation Status
Zero-Knowledge Relay Blind routing, no message storage βœ… Complete
Forward Secrecy Signal Protocol Double Ratchet βœ… Core logic
Local Encryption AES-256-GCM with SQLCipher βœ… Complete
Post-Quantum X25519 + ML-KEM-768 hybrid ⚠️ Framework ready
Recovery Phrase BIP-39 mnemonics (12 words) βœ… Complete
Message Integrity HMAC-SHA256, Ed25519 signatures βœ… Core ready
Delta-Sync Load 20 messages at once βœ… Designed
No Persistence Server restarts = all data vanishes βœ… Verified

πŸ“– Documentation

πŸ§ͺ Testing

Backend Unit Tests

🎨 Branding & Monitoring

To use the SVG logo as a favicon for the Go backend monitoring endpoints, generate a 256x256 favicon.ico from frontend/assets/logo/double_ratchet_logo_no_text.svg and serve it from /favicon.ico.

Example Go route:

mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, r *http.Request) {
    w.Header().Set("Content-Type", "image/x-icon")
    http.ServeFile(w, r, "static/favicon.ico")
})

Then browsers visiting /health or /ready will show the logo in the tab during monitoring.

Backend Unit Tests

cd backend
go test ./... -v -cover

Coverage:

  • Session manager (registration, expiration, cleanup)
  • Message routing (blind delivery, queue management)
  • Packet validation (reject malformed messages)

Frontend Unit Tests

cd frontend
flutter test --verbose

Coverage:

  • BIP-39 mnemonic generation & validation
  • PBKDF2-SHA256 key derivation
  • Signal Protocol ratcheting (KDF_CK, KDF_RK)
  • SQLCipher encryption/decryption

πŸ› οΈ Technology Stack

Backend

  • Language: Go 1.21+
  • Transport: WebSockets (RFC 6455)
  • Crypto: Standard library (Ed25519, SHA-256) + PointyCastle (external keys)
  • Deployment: Docker on Koyeb (free tier)

Frontend

  • Framework: Flutter 3.10+
  • Language: Dart 3.0+
  • Database: Drift ORM + SQLCipher (AES-256)
  • Crypto: cryptography package (PBKDF2, AES-GCM, HMAC)
  • Key Recovery: bip39 package (BIP-39 mnemonics)
  • Storage: flutter_secure_storage (secure OS keychain)

Cryptography

  • Hashing: SHA-256, SHA-512
  • Symmetric: AES-256-GCM
  • Asymmetric: Ed25519 (identity), X25519 (ECDHE)
  • Post-Quantum: ML-KEM-768 (key encapsulation mechanism)
  • KDF: PBKDF2-SHA256 (100,000 iterations)
  • MAC: HMAC-SHA256
  • Protocol: Signal Protocol Double Ratchet

🎯 Roadmap

Phase 1 βœ… Complete

  • Go Blind Relay Server (stateless roaming)
  • WebSocket message routing
  • Ephemeral session storage (RAM only)
  • Flutter SQLCipher vault
  • BIP-39 mnemonic recovery
  • AES-256 key derivation

Phase 2 In Progress

  • Client-side Signal Protocol implementation
  • WebSocket client in Flutter
  • Message sending/receiving UI
  • Contact exchange protocol
  • End-to-end cryptographic testing

Phase 3 Planned

  • Post-quantum ML-KEM integration
  • Backup & restore mechanism
  • Multi-device support
  • Group messaging
  • Platform builds (iOS, Android, web)

βš™οΈ Configuration

Backend Environment

# Default
./blindrelay

# Custom configuration
./blindrelay \
  -addr=0.0.0.0:8080 \
  -session-timeout=60m \
  -cleanup-interval=5m

Frontend Configuration

Edit lib/main.dart:

const dbPath = "/data/local/shadowcrypt.db";
await VaultDatabase.initialize(
  mnemonic: userMnemonic,
  dbPath: dbPath,
);

πŸ” Verification Checklist

Backend: Zero Storage Guarantee

  • Run server with lsof -p $(pgrep blindrelay) - no .db files
  • Restart server - all user data erased
  • Check process memory - < 50MB with 100 connections
  • Monitor disk writes - WebSocket and sockets only, no files

Frontend: Encryption Verification

  • Inspect database file: unreadable without correct mnemonic
  • Change one character in mnemonic β†’ decryption fails
  • Messages stored as AES-256-GCM ciphertext
  • Remove SQLite CLI, can't read database file

πŸ› Known Issues

Issue Workaround Priority
ML-KEM-768 integration pending Framework supports, needs liboqs binding Medium
Delta-Sync UI not yet built Core database queries ready Medium
Signal Protocol testing incomplete Ratcheting logic present, needs end-to-end test High
iOS/Android support Desktop-first, Flutter supports all platforms Low

🀝 Contributing

This is a reference implementation for learning. To extend:

  1. Add ML-KEM-768: Integrate oqs-rs or liboqs bindings
  2. Implement Group Messaging: Extend Signal Protocol for N parties
  3. Backup System: Implement encrypted backup export/import
  4. UI Polish: Build production-grade messaging UI
  5. Security Audit: Third-party cryptographic audit

πŸ“ References

⚠️ Security Disclaimer

ShadowCrypt is a reference implementation for educational purposes.

  • Not audited by security professionals
  • Not suitable for production without extensive testing
  • Cryptographic primitives are standard (Signal, PBKDF2, AES-256)
  • Always use TLS/HTTPS in production (not included)
  • Always verify contact public keys out-of-band

Use at own risk.

πŸ“„ License

AGPLv3 - See LICENSE file

πŸ‘¨β€πŸ’» Author

Aarav (A Solo Engineer)


Last Updated: April 7, 2026
Version: 0.1.0
Status: Foundation Phase Complete

About

Local-first, end-to-end encrypted messaging with a stateless backend. No server-side storage ever.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors