Skip to content

πŸ’¬ AlgoChat web app - Encrypted messaging on Algorand with Angular and NES.css

License

Notifications You must be signed in to change notification settings

CorvidLabs/algochat-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

69 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

algochat-web

Deploy License

End-to-end encrypted messaging on Algorand. Built with Angular and NES.css.

Live App: corvidlabs.github.io/algochat-web

Features

  • 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

Tech Stack

  • Framework: Angular 21 (standalone components, signals)
  • Styling: NES.css + SCSS
  • Crypto: @noble/curves, @noble/ciphers, @noble/hashes
  • Blockchain: algosdk v3
  • Runtime: Bun

Development

# Install dependencies
bun install

# Start dev server
bun run start

# Build for production
bun run build

# Build for GitHub Pages
bun run build:gh-pages

Architecture

src/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

Protocol

Implements the AlgoChat Protocol v1 and PSK v1.1 extension.

Cryptographic Primitives

Function Algorithm
Key Agreement X25519 ECDH
Encryption ChaCha20-Poly1305
Key Derivation HKDF-SHA256

PSK v1.1 Protocol

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

Security Notes

  • 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

Related Projects

License

MIT License - See LICENSE for details.