BREAKING CHANGE: Repository restructured from flat layout to tiered: FOLDER REORGANIZATION: - core/ - L0-L3 layers (Commonwealth LCL-1.0) - l0-transport/ - Transport with MIMIC, Noise, PNG - l1-identity/ - Identity, QVL, Crypto - l2_session/ - Session management - l2-federation/ - Cross-chain bridging - l2-membrane/ - Policy enforcement - sdk/ - L4+ and bindings (Sovereign LSL-1.0) - janus-sdk/ - l4-feed/ - apps/ - Examples (Unbound LUL-1.0) - examples/ - legal/ - All license texts - LICENSE_COMMONWEALTH.md - LICENSE_SOVEREIGN.md - LICENSE_UNBOUND.md IMPORT FIXES (All Layers): - L0: 13 files fixed - all relative imports corrected - L1: 14 files fixed - module imports for cross-layer dependencies - L2: 6 files fixed - session, membrane, federation - Capsule: 9 files fixed - TUI, node, main, control - Examples: 2 files fixed - lwf, crypto LICENSES ADDED: - LCL-1.0: Viral reciprocity for Core (SaaS-proof) - LSL-1.0: Business-friendly for SDK - LUL-1.0: Maximum freedom for docs/apps NO CLA REQUIRED - contributors keep copyright README.md REWRITTEN: - Documents new folder structure - Explains tiered licensing strategy - Clear SPDX identifiers per component TODO: - Fix remaining test module configuration issues - Full green build in follow-up Refs: 4 sub-agents parallel execution |
||
|---|---|---|
| .. | ||
| README.md | ||
| SPEC.md | ||
| config.zig | ||
| error.zig | ||
| handshake.zig | ||
| heartbeat.zig | ||
| mod.zig | ||
| rotation.zig | ||
| session.zig | ||
| state.zig | ||
| test_session.zig | ||
| test_state.zig | ||
| transport.zig | ||
README.md
L2 Session Manager
Sovereign peer-to-peer session management for Libertaria.
Overview
The L2 Session Manager establishes and maintains cryptographically verified sessions between Libertaria nodes. It provides:
- Post-quantum security (X25519Kyber768 hybrid)
- Resilient state machines (graceful degradation, automatic recovery)
- Seamless key rotation (no message loss during rotation)
- Multi-transport support (QUIC primary, μTCP fallback)
Why No WebSockets
This module explicitly excludes WebSockets (see ADR-001). We use:
| Transport | Use Case | Advantages |
|---|---|---|
| QUIC | Primary transport | 0-RTT, built-in TLS, multiplexing |
| μTCP | Fallback, legacy | Micro-optimized, minimal overhead |
| UDP | Discovery, broadcast | Stateless, fast probing |
WebSockets add HTTP overhead, proxy complexity, and fragility. Libertaria is built for the 2030s, not the 2010s.
Quick Start
// Establish session
let session = try l2_session.establish(
peer_did: "did:morpheus:abc123",
config: .{ ttl: 24h, heartbeat: 30s },
ctx: ctx
);
// Use session
try session.send(message);
let response = try session.receive(timeout: 5s);
State Machine
idle → handshake_initiated → established → degraded → suspended
↓ ↓ ↓
failed rotating → established
See SPEC.md for full details.
Module Structure
| File | Purpose |
|---|---|
session.zig |
Core Session struct and API |
state.zig |
State machine definitions and transitions |
handshake.zig |
PQxdh handshake implementation |
heartbeat.zig |
Keepalive and TTL management |
rotation.zig |
Key rotation without interruption |
transport.zig |
QUIC/μTCP abstraction layer |
error.zig |
Session-specific error types |
config.zig |
Configuration structures |
Testing
Tests are colocated in test_*.zig files. Run with:
zig build test-l2-session
Specification
Full specification in SPEC.md.