Zero-knowledge hybrid P2P messenger with end-to-end encryption.
Repository: Viktor592/messenger-secure
Status: π§ Active Development
Latest Build: β
TypeScript 2150 LOC, 13 files
Messenger Secure is a cryptographically secure messaging application that prioritizes user privacy and data protection. It uses a hybrid architecture:
- P2P Direct: When both users are online, messages are encrypted end-to-end via WebRTC
- Relay: When users are offline, messages are stored encrypted on the server (7-day TTL)
- Zero-Knowledge: Server never has access to plaintext messages or encryption keys
| Layer | Technology |
|---|---|
| Transport | TLS 1.3 |
| E2E Encryption | Noise Protocol (Curve25519, ChaCha20-Poly1305) |
| Key Exchange | X3DH + Double Ratchet |
| Signing | Ed25519 |
| Hashing | SHA256 |
| Phase | Description | Status | Files |
|---|---|---|---|
| Round 1 | Backend scaffolding | β Complete | +21 |
| Round 2 | Mobile app scaffold | β Complete | +23 |
| Round 3 | API integration | β Complete | +12 |
| Round 4 | Backend implementation | β Complete | TS fixes |
| Round 5 | Local dev setup | β Complete | +3 |
Total Backend Code: 2,150 lines of TypeScript across 13 files
- Runtime: Node.js 20+
- Framework: Express.js + TypeScript
- Database: PostgreSQL 16
- Cache: Redis 7
- Crypto: tweetnacl + Node.js crypto
- Real-time: Socket.io
- Framework: React Native + Expo
- Language: TypeScript
- State: Zustand
- Storage: SQLite + SecureStore
- Networking: Socket.io client
- Framework: React 18
- Build: Vite
- Styling: TailwindCSS
- State: Zustand
node --version # v20+git clone https://github.com/Viktor592/messenger-secure.git
cd messenger-secure
# Verify compilation
bash test-build.sh# Start databases (Docker)
docker-compose -f docker-compose.dev.yml up -d
# Initialize backend
cd backend
npm install
npm run build
npx prisma db push
# Start server
npm run dev
# Opens on http://localhost:3001See LOCAL_SETUP.md for detailed instructions.
POST /api/auth/register β SMS code sent
POST /api/auth/verify β JWT tokens
POST /api/auth/refresh β New access token
POST /api/auth/logout β Session terminated
GET /api/contacts/search β Find user
POST /api/contacts/add β Add contact
GET /api/contacts/verify/:fp β Verify fingerprint
GET /api/contacts/list β List contacts
GET /api/messages/pending β Offline messages
POST /api/messages/relay β Store encrypted message
DELETE /api/messages/:id β Delete message
POST /api/messages/batch-delete β Bulk delete
GET /api/messages/stats β Message statistics
POST /api/groups/create β Create group
GET /api/groups/list β List groups
GET /api/groups/:id β Get group details
POST /api/groups/:id/add-member β Add member
POST /api/groups/:id/leave β Leave group
DELETE /api/groups/:id β Delete group
Full API docs: API.md
User
βββ id (UUID)
βββ phoneHash (SHA256, unique)
βββ publicKey (Curve25519)
βββ identityKeyFingerprint (Ed25519)
βββ displayName
Message (7-day TTL)
βββ id
βββ fromPhoneHash
βββ toPhoneHash
βββ encryptedBlob (Noise Protocol)
Group
βββ id
βββ name
βββ creatorPhoneHash
βββ GroupMember[]
Session, SmsCode, Prekey, Device, AuditLogbash test-build.sh
# β
TypeScript compiles
# β
2150 LOC backend
# β
13 source files# Health check
curl http://localhost:3001/health
# Register phone
curl -X POST http://localhost:3001/api/auth/register \
-H "Content-Type: application/json" \
-d '{"phone": "+79991234567"}'See E2E_TESTING.md for full integration tests with two clients.
- QUICKSTART.md - 5-minute setup
- LOCAL_SETUP.md - Development environment
- ARCHITECTURE.md - Design decisions
- SECURITY.md - Threat model
- API.md - Complete API reference
- E2E_TESTING.md - Integration testing
- MOBILE_DEVELOPMENT.md - React Native guide
# Development
docker-compose -f docker-compose.dev.yml up
# Production
docker-compose -f docker-compose.prod.yml up -dSee SETUP.md for:
- Server provisioning (Ubuntu 22.04+)
- SSL/TLS certificates (Let's Encrypt)
- PostgreSQL backup strategy
- Monitoring & alerting
- Log aggregation
- Backend API with encryption
- Mobile client scaffold
- Docker compose setup
- E2E testing
- WebRTC P2P implementation
- Group messaging encryption
- File sharing
- Voice/video calls
- Performance optimization
- Offline message queue
- End-to-end search
- Device management
- Fork:
git clone https://github.com/Viktor592/messenger-secure.git - Branch:
git checkout -b feature/description - Commit:
git commit -m "feat: description" - Push:
git push origin feature/description - PR: Submit pull request
Standards:
- TypeScript strict mode
- No untyped
any - Meaningful commits
- Updated docs
Author: Viktor592
Email: viktor@motor-app.ru
GitHub: @Viktor592
[Your License Here]
Status: β
Build Successful (2026-09-25)
Next Steps: Mobile integration + local E2E testing