End-to-end encrypted messaging on Algorand. Built with Angular and NES.css.
Live App: corvidlabs.github.io/algochat-web
- Client-Side Only - No backend servers, runs entirely in browser
- End-to-End Encryption - X25519 + ChaCha20-Poly1305
- Forward Secrecy - Per-message ephemeral keys
- PSK v1.1 Protocol - Pre-shared key messaging with counter-based ratcheting
- Mobile Responsive - Works on desktop, tablet, and mobile
- Retro UI - NES.css 8-bit styling
- Framework: Angular 21 (standalone components, signals)
- Styling: NES.css + SCSS
- Crypto: @noble/curves, @noble/ciphers, @noble/hashes
- Blockchain: algosdk v3
- Runtime: Bun
# Install dependencies
bun install
# Start dev server
bun run start
# Build for production
bun run build
# Build for GitHub Pages
bun run build:gh-pagessrc/app/
βββ core/
β βββ psk/ # PSK v1.1 protocol implementation
β β βββ psk-types.ts # Constants and interfaces
β β βββ psk-ratchet.ts # Two-level HKDF ratchet
β β βββ psk-envelope.ts # Wire format (130-byte header)
β β βββ psk-encryption.ts # Hybrid ECDH+PSK encrypt/decrypt
β β βββ psk-state.ts # Counter management with window
β β βββ psk-exchange.ts # Exchange URI generation/parsing
β β βββ psk.service.ts # Angular service wrapper
β β βββ index.ts # Barrel export
β βββ services/
β β βββ wallet.service.ts # Account management
β β βββ chat.service.ts # Blockchain operations
β βββ utils/
β βββ storage-crypto.ts # AES-GCM encrypted storage
βββ features/
β βββ login/ # Mnemonic login page
β βββ chat/ # Main chat interface
βββ app.routes.ts # Route configuration
Implements the AlgoChat Protocol v1 and PSK v1.1 extension.
| Function | Algorithm |
|---|---|
| Key Agreement | X25519 ECDH |
| Encryption | ChaCha20-Poly1305 |
| Key Derivation | HKDF-SHA256 |
Pre-shared key messaging adds counter-based ratcheting and hybrid ECDH+PSK encryption:
- Two-level ratchet: session = counter / 100, position = counter % 100
- Hybrid encryption: ECDH shared secret combined with ratcheted PSK via HKDF
- Replay protection: Sliding counter window of +/- 200
- Wire format: 130-byte header (version + protocol + 4-byte counter + keys + nonce + encrypted sender key)
- Key exchange:
algochat-psk://v1?addr=...&psk=<base64url>&label=...URI scheme
- Private keys never leave the browser
- Mnemonic stored in memory only (cleared on disconnect)
- All cryptographic operations use audited @noble libraries
- Messages encrypted client-side before blockchain submission
- PSK sessions provide additional authentication layer beyond ECDH
- protocol-algochat - Protocol specification
- ts-algochat - TypeScript implementation
- swift-algochat - Swift implementation
MIT License - See LICENSE for details.