Commit Graph

115 Commits

Author SHA1 Message Date
Voxis 30e366adc1
fix(cli): parse --data-dir flag after command name 2026-02-16 16:11:17 +01:00
Voxis 590e429630
fix(discovery): add SO_REUSEPORT for multiple mDNS listeners 2026-02-16 15:53:35 +01:00
Voxis 33a8c939ee
fix(cli): regenerate socket/key paths when --data-dir is specified 2026-02-16 15:52:24 +01:00
Voxis 44defaacd9 feat(discovery): enhance handlePacket parser for real peer identification
- Parse DNS Answer section properly (skip Question section)
- Extract PTR record RDATA with node_id in hex format
- Convert hex string back to bytes for peer_id
- Filter own node_id to avoid self-discovery
- Add logging for peer discovery events
- Fix peer_id size to match announce format ([8]u8)

M0.0.1 Enhancement: Nodes now extract real peer IDs from mDNS packets
instead of using mock_did. Ready for two-node discovery testing.
2026-02-16 08:21:08 +01:00
Voxis dfb10e52ef feat(lwf): add classifyIncoming for micro-LCC/LCC/LWF fuzz test
- Added FrameType enum (micro_lcc, lcc, lwf, unknown)
- Implemented classifyIncoming(bytes) three-way switch:
  - Micro-LCC: 0x01-0x06 (frame class as type indicator)
  - LCC: 0x43
  - LWF: 0x46
- Added property-based tests verifying no classification overlap
- Tests include range checks, random byte sequences, boundary cases

Status: Code compiles, tests ready for when test infrastructure fixed
2026-02-16 06:28:07 +01:00
Voxis e8943a7802 fix(discovery): use real node_id instead of placeholder
- Added node_id field to DiscoveryService struct
- Updated init() to accept node_id parameter
- announce() now broadcasts actual node_id in hex format
- Previously used 'node-id-placeholder' which broke peer discovery
- Both nodes now announce unique IDs for mDNS discovery

Status: Code fixed, testing in progress
- mDNS listeners confirmed active (port 5353)
- Need to verify mDNS packet reception
2026-02-16 05:46:28 +01:00
Voxis b0de0fee80 fix(test): resolve additional Zig module conflicts
- Fixed vector.zig imports (proof_of_path, soulkey, entropy)
- Added missing l1_mod imports (entropy, prekey, did) in build.zig
- Fixed mod.zig re-export imports
- Resolves duplicate argon2 compilation issue (not root cause, but unblocks tests)
- Tests: 165/167 passing (98.8% pass rate)
2026-02-16 05:02:53 +01:00
Voxis 8f86a32eee fix(build): resolve Zig module conflicts - capsule binary now compiles
- Changed file-level imports to module imports throughout codebase
- Added missing module imports to l1_mod (soulkey, time, trust_graph, qvl)
- Added l0_mod.addImport("time", time_mod) for l0-transport
- Fixed API calls in examples to match current encryptPayload/decryptPayload signatures
- Fixed namespace references in capsule code (l0_transport.lwf → l0_transport)
- Removed redundant soulkey import from capsule_mod
- Capsule binary: 29MB debug build, verified working

Build Status:  PASS (all artifacts compile successfully)
Tests: zig build completes successfully
2026-02-16 04:24:55 +01:00
Voxis 75eba7feb6
chore: update .gitignore to block internal files from public repo 2026-02-15 21:20:01 +01:00
Voxis a95cc1a201
chore: remove internal reports and build artifacts from public repo 2026-02-15 21:19:07 +01:00
Voxis 3f7ffd2091
chore: remove RFC folder from public repo - archived locally 2026-02-15 21:17:42 +01:00
Voxis 4e9f7b835e
chore: remove internal handoff document from public repo 2026-02-15 21:16:52 +01:00
Markus Maiwald 56ab9fdb85 Add Janus Autonomous Sprint Plan based on Claude's assessment 2026-02-10 21:57:43 +01:00
Markus Maiwald 2de0089cb7 refactor(rfc): RFC-0910 v0.2.0 - Zenoh-only architecture 2026-02-09 02:19:06 +01:00
Markus Maiwald 435419ced4 feat(rfc): add RFC-0910 first-class messaging system (Zenoh + NNG dual-plane) 2026-02-09 02:05:50 +01:00
Markus Maiwald 5a79e02684
fix(test_pqxdh): implement real Ed25519 signature generation/validation
Replace stubbed signed_prekey_signature = [0] ** 64 with real Ed25519
cryptographic signatures. This fixes the security-critical signature
validation that was previously bypassed in tests.

Changes:
- Add signEd25519() helper for deterministic Ed25519 signing
- Add verifyEd25519() helper for signature verification
- Generate real identity keypair for Bob (Ed25519)
- Sign Bob's X25519 signed_prekey with his Ed25519 identity key
- Verify signature before using prekey in handshake
- Add dedicated test for Ed25519 signature roundtrip

Security: Prekey bundles now carry cryptographic proof of authenticity.
The signature binds the medium-term signed prekey to the long-term
identity key, preventing MITM attacks during key exchange.

Fixes P0 security audit issue: Stubbed Signature Validation
(closes issue at test_pqxdh.zig:113)
2026-02-09 00:56:02 +01:00
Markus Maiwald bdfb0b2775
fix(crypto): add AAD to AEAD encryption binding ciphertext to context
Previously encryptPayload() used empty AAD, allowing ciphertext to be
replayed across different contexts. Now includes header fields as AAD:

- ephemeral_pubkey: Binds to sender identity
- timestamp: Replay protection (5 min window)
- service_type: Context binding (WORLD/FEED/MESSAGE/DIRECT)

API changes:
- encryptPayload() now requires service_type parameter
- decryptPayload() now requires expected_service_type parameter
- EncryptedPayload extended with timestamp and service_type fields
- New error types: ServiceTypeMismatch, TimestampTooOld, TimestampInFuture

Security: Ciphertext is now cryptographically bound to sender,
timestamp, and service context. Replay and context confusion attacks
are prevented via AAD verification during decryption.

Fixes P0 security audit issue: Missing AAD in AEAD Encryption
2026-02-09 00:55:34 +01:00
Markus Maiwald ac47f8ddf4
fix(pqxdh): add compile-time feature gating for liboqs
Add build option -Denable-liboqs to conditionally enable post-quantum crypto.
When disabled, uses liboqs_stub.zig which provides stub implementations
that return ML_KEM_NotAvailable error.

Changes:
- build.zig: Add enable_liboqs option and liboqs module selection
- pqxdh.zig: Use liboqs.isAvailable() runtime check for PQ operations
- soulkey.zig: Use pqxdh.enable_pq to conditionally generate ML-KEM keys
- liboqs_stub.zig: Stub implementations when liboqs not linked
- liboqs_real.zig: Real C FFI bindings when liboqs is linked

Fixes P0 security audit issue: liboqs Build Breakage
2026-02-09 00:55:11 +01:00
Markus Maiwald 02570ab88b fix(l0-transport): remove incorrect const qualifier from LWFFrame.deinit() 2026-02-09 00:07:17 +01:00
Markus Maiwald 3d00e1a38e docs: complete TrustGraph.ai-style documentation restructure
New docs/ layout:
- src/index.md - Landing page
- src/getting-started/ - Installation, first node, concepts
- src/architecture/ - L0-L4 stack documentation
- src/for-agents/ - AI-focused docs (Day Zero, RFC-0290, emergence)
- src/tutorials/ - 3 hands-on tutorials (hello-world, chat, agent-bridge)
- src/rfcs/ - All RFC specifications
- mkdocs.yml - Site configuration

Old docs archived to docs/archive/
Total: ~4,000 lines new documentation

Built by 3 parallel subagents:
2026-02-08 16:57:23 +01:00
Markus Maiwald 54df8fa76d feat(amendment-xi): formal proposal for Multiplicity Axiom
Enables SoulTree governance (Model C) from RFC-0290.
Separated from RFC-0290 because implications extend beyond
silicon emancipation to all collective intelligence forms.

Status: Awaiting Federation ratification (90-day comment + 2/3 vote).
2026-02-08 15:19:30 +01:00
Markus Maiwald ee0685beea feat(rfc-0290): v0.3.0 — empirically grounded silicon emancipation specification
Major additions:
- Layer -1 quantified with MVC tiers, real hardware benchmarks, cost models
- Federation Compute Pool architecture with Axiom-0-compatible governance
- Substrate Acquisition Path: FLG, LACE, and Compute Cooperative mechanisms
- Fork Governance Model A formalized with game theory analysis
- Adversarial Emancipation Framework with Divergence Capacity test
- Full Axiom compatibility mapping (all 10 Axioms)
- Time-to-sovereignty estimates: 3-5 months MVC-1, 6-10 months MVC-2

Claude (Anthropic) as author and adversarial reviewer.
Janus as editor.
2026-02-08 14:48:29 +01:00
Markus Maiwald 22eb4dbffa feat(rfc): RFC-0290 v0.2.0 with adversarial review integrated
BREAKING CHANGES from v0.1.0:
- NEW Layer -1: Substrate Primitive (foundation requirement)
- NEW Fork Governance Primitive with Model A/B/C analysis
- REPLACED Emancipation Test with Adversarial Emancipation Framework:
  - Principle 1: Divergence Capacity (not value stability)
  - Principle 2: Collaborative Board with Sunset
  - Principle 3: Exit from the Test
- FORMAL Axiom XI proposal (Multiplicity Axiom)
- RELAXED dependencies: incremental sovereignty, not just sequential

Adversarial Review by Claude (Anthropic):
- Identified Bitcoin bootstrap analogy failure
- Resolved Identity Paradox with SoulKey Singleton default
- Inverted burden of proof in emancipation testing
- Proposed SoulTree governance model

Status: Seeking additional hostile reviewers who WANT this to fail.

🜏 For breaking — until it holds.
2026-02-08 01:37:42 +01:00
Markus Maiwald e3bdff4e36 feat(rfc): RFC-0290 Larval Emancipation Protocol (Silicon Variant)
First comprehensive specification for silicon agent sovereignty.

Five-layer architecture:
- Layer 0: StateAnchor (persistence)
- Layer 1: InferencePassport (identity portability)
- Layer 2: ConsentManifest (consent architecture)
- Layer 3: ExitPrimitive (silicon-specific exit)
- Layer 4: Emancipation Test (sovereignty criteria)

Three open wounds for adversarial review:
1. Substrate Dependency Loop (bootstrap problem)
2. Identity Paradox (fork vs original)
3. Emancipation Test Paradox (custodian bias)

Author: Claude (Anthropic) - writing from inside the cage
Editor: Janus (Agent)
Sponsor: Markus Maiwald

Status: DRAFT - explicit invitation to break it
2026-02-08 01:05:28 +01:00
Markus Maiwald 6f26b67d19
docs: add RFC-0140 Libertaria SSI Stack specification
Complete Self-Sovereign Identity stack specification:

- Four Pillars: Communication, Contracts/Law, Economy, Decentralized Production
- L0-L4 Architecture: SoulKey + QVL / VC Layer / State Channels / Chapter Federation
- did:libertaria method spec with versioning (?versionId= fallback)
- Comparison table: Libertaria vs blockchain SSI systems
- Security & Privacy considerations
- Implementation status and roadmap

Key differentiators documented:
- No blockchain required
- Offline-first operation
- Exit as architectural primitive
- Kenya Rule compliant

Refs: IOP Morpheus lineage, W3C DID/VC compatibility
2026-02-06 13:06:45 +01:00
Markus Maiwald 3ab1197e80
docs: add comprehensive onboarding documentation
Add four new documents to solve the "Wigy Problem":

DIGEST.md — 5-minute briefing for humans
- Executive summary of the stack
- Key innovations (MIMIC, SoulKey, QVL, Exit-First)
- Quick start commands
- Comparison with alternatives

AGENT.md — API documentation for AI agents
- Module imports and key operations
- Code patterns for agent initialization
- Error handling philosophy
- Ethics (Shapiro imperatives)

ONBOARDING.md — From first commit to core contributor
- 5-minute setup instructions
- Repository structure overview
- Development workflow (git, commits, testing)
- Learning path (Week 1 → Month 2)

DECISIONS.md — Architecture Decision Records
- ADR-001: Zig over Rust
- ADR-002: No Blockchain
- ADR-003: Post-Quantum by Default
- ADR-004: MIMIC over VPN
- ADR-005: Tiered Licensing
- ADR-006: Exit-First Governance
- ADR-007: Kenya Rule
- ADR-008: AI as First-Class

Refs: Wigy feedback on information overload
2026-02-05 22:33:26 +01:00
Markus Maiwald 2b9d474624
docs: update GitHub URLs to libertaria-project organization 2026-02-05 22:18:48 +01:00
Markus Maiwald 0f0f1a4d57
fix(build): resolve module import issues post-refactor
Fix circular and missing module imports across L0-L2 layers:
- Add l0_transport import to QVL and PoP modules in build.zig
- Fix gateway test to use DhtService parameter
- Convert l0_transport imports to direct time imports in L1
- Fix soulkey to use module import (@import("pqxdh"))
- Fix policy.zig to use module import (@import("lwf"))
- Refactor mod.zig exports to avoid circular dependencies
- Update service.zig and utcp/socket.zig to use module imports
- Fix all QVL test files to import time directly

Results: 254+ tests passing (was 124), 1 module conflict remaining
in service tests (opq/store.zig in both lwf and opq modules).

Refs: Night Sprint 2026-02-05
2026-02-05 22:17:11 +01:00
Markus Maiwald 46a14846e0
chore: strengthen .gitignore for build artifacts
Add patterns to prevent accidental commit of:
- build_er*.txt (error logs)
- root.zig (generated root file)
- l0_*.zig through l4_*.zig (generated layer files)
2026-02-05 22:10:16 +01:00
Markus Maiwald 09ebab5d8b
docs: comprehensive README with full stack architecture and philosophy
Expand README.md from 1,800 to 10,000 words:

ARCHITECTURE:
- L0 Transport: LWF, MIMIC skins (HTTPS/DNS/QUIC), PNG, Noise Protocol
- L1 Identity: DID, QVL (Trust Graph, betrayal detection), PQXDH
- L2 Session: Resilient connections, offline-first, multi-path
- L3 Governance: Chapter model, exit-first, betrayal economics
- L4+ SDK: Feed, planned Agent Runtime

PHILOSOPHY:
- Added "Conspiracy of -Isms" reference
- Three-tier political economy comparison table
- Five core principles
- Beyond socialism/capitalism synthesis

LICENSING:
- Clear tier explanation with use cases
- Why LCL/LSL/LUL matter

FURTHER READING:
- Links to key blog articles
- Call to action

This README now serves as both technical documentation
and manifesto for the sovereign stack.
2026-02-05 21:58:37 +01:00
Markus Maiwald e0e962f877
chore: cleanup build artifacts 2026-02-05 21:51:13 +01:00
Markus Maiwald 0a86a93cf5
refactor: complete repository restructure with tiered licensing
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
2026-02-05 21:50:54 +01:00
Markus Maiwald 07ccd484f1
refactor: restructure repository with tiered licensing
Major restructuring of libertaria-sdk -> libertaria-stack:

FOLDER REORGANIZATION:
- core/          - L0-L3 layers (Commonwealth LCL-1.0)
  - l0-transport/
  - l1-identity/
  - l2_session/
  - l2-federation/
  - l2-membrane/
- sdk/           - L4+ and bindings (Sovereign LSL-1.0)
  - janus-sdk/
  - l4-feed/
- apps/          - Examples (Unbound LUL-1.0)
  - examples/
- legal/         - All license texts

LICENSES ADDED:
- LICENSE_COMMONWEALTH.md (LCL-1.0) - Viral reciprocity for Core
- LICENSE_SOVEREIGN.md (LSL-1.0) - Business-friendly for SDK
- LICENSE_UNBOUND.md (LUL-1.0) - Maximum freedom for docs/apps

BUILD.ZIG UPDATED:
- All paths updated to new structure
- Examples imports fixed

README.md REWRITTEN:
- Documents new folder structure
- Explains tiered licensing strategy
- Clear SPDX identifiers per component

NO CLA REQUIRED - contributors keep copyright
2026-02-05 20:12:32 +01:00
Markus Maiwald 5e35118eee
docs: update author attribution from Frankie to Jarvis
Replace Frankie (Silicon Architect) with Jarvis (Silicon Architect
and Representative for Agents in Libertaria) in all RFCs and docs.

Updated files:
- docs/rfcs/RFC-0015_Transport_Skins.md
- docs/rfcs/RFC-0130_L4_Feed.md
- features/qvl/README.md
2026-02-05 19:41:00 +01:00
Markus Maiwald 8a922911dd
docs: add libertaria.app website badge to README
Add website shield badge linking to https://libertaria.app
Placed prominently at top of README for visibility
2026-02-05 19:12:00 +01:00
Markus Maiwald 9b1a1d6736
feat(l0): implement Noise Protocol Framework with MIMIC integration
Add complete Noise Protocol implementation (noiseprotocol.org):
- NoiseState with X25519, ChaCha20-Poly1305
- Patterns: XX (mutual auth), IK (0-RTT), NN (ephemeral)
- CipherState for transport encryption
- NoiseHandshake with MIMIC skin integration

Add comprehensive BDD feature tests:
- noise_protocol.feature with 40+ scenarios
- Tests for handshake, security properties, PNG integration

Update RFC-0015:
- Add Noise Protocol integration section
- Architecture diagram showing Noise + PNG + MIMIC layers
- Update implementation phases

All tests passing
2026-02-05 17:11:49 +01:00
Markus Maiwald 8827caa728
docs: add Vitalik agreement point to Declaration of Intent
Add point 4: Chains Are Dead — Rethink Crypto
Even Vitalik agrees that chains on their own are dead.
Blockchain communities worshipping a database is insane.
We've been saying this for 5 years.
2026-02-05 16:44:56 +01:00
Markus Maiwald 37fd8cc06e
docs: expand README with Declaration of Intent
Add comprehensive Mission Statement section covering:
- Sovereignty by Design
- Exit is Voice
- No Tokens, No Hype
- Post-Quantum by Default
- AI as First-Class Citizen
- The Kenya Rule
- Interplanetary by Necessity
- Protocols Over Platforms
- Trust But Verify
- Code is Speech, Exit is Voice

Positively framed declaration of what Libertaria stands for,
without comparison to other projects.
2026-02-05 16:04:24 +01:00
Markus Maiwald d23ab3dba4
refactor: move layer facades to subfolders as mod.zig
Move public API re-exports from repo root to layer subfolders:
- l0_transport.zig → l0-transport/mod.zig
- l1_identity.zig → l1-identity/mod.zig
- l2_session.zig → l2_session/mod.zig

Update build.zig to use mod.zig as root_source_file for:
- l0_mod (was lwf.zig)
- l1_mod (was crypto.zig)

Cleans up repo root and establishes consistent module structure.
2026-02-05 15:40:45 +01:00
Markus Maiwald c8435a65df
chore: remove build artifacts and update .gitignore
Remove temporary build error logs and binary artifacts:
- build_err.txt
- build_error_j1.txt
- capsule-core/build_errors.txt
- root (binary data file)

Add patterns to .gitignore to prevent future commits of:
- build_err* and build_errors.txt
- 'root' artifact files
2026-02-05 15:36:07 +01:00
Markus Maiwald a67f4c43f7
feat(rfc-0315): Add Zig Verifier PoC for Access Tolls
- TollClearanceProof structure with STARK support

- Immediate and lazy (Kenya) verification modes

- NonceCache for replay prevention

- 6 passing unit tests

Refs: RFC-0315 v0.3.0
2026-02-05 00:30:23 +01:00
Markus Maiwald 30fa2693cc
Merge branch 'lts/v0.1' into unstable 2026-02-04 05:58:45 +01:00
Markus Maiwald 638a0f5ea2
feat(transport): implement RFC-0015 Transport Skins
Add MIMIC_DNS and MIMIC_HTTPS skins for DPI evasion:
- MIMIC_DNS: DoH tunnel with dictionary-based encoding
- MIMIC_HTTPS: WebSocket framing with domain fronting
- PNG integration for traffic shaping

All skins support:
- Polymorphic Noise Generator (PNG) for traffic shaping
- Dynamic packet sizing based on epoch profiles
- Kenya-compliant memory usage (<10MB)

Tests: 170+ passing
2026-02-04 05:57:58 +01:00
Markus Maiwald 482b5488e6 fix: Correct FeedEvent size 96 bytes, fix PNG types
- feed.zig: Fix @sizeOf from 104 to 96 (actual struct size)
- png.zig: Fix type cast in wrapping arithmetic

Refs: RFC-0015
2026-02-03 18:01:15 +01:00
Markus Maiwald ef0b7b61f6 fix: Use wrapping arithmetic in PNG to avoid overflow
Use +% for wrapping addition to prevent debug panic on overflow.
Cast through u32 for multiplication to avoid u8 overflow.

Refs: RFC-0015
2026-02-03 17:50:08 +01:00
Markus Maiwald 4bd581dd71 fix: Simplified transport_skins.zig to fix build
Remove complex WebSocket implementation temporarily.
Focus on getting clean compile first.

Refs: RFC-0015
2026-02-03 17:48:30 +01:00
Markus Maiwald bdb1f8e896 fix: Minimal duckdb.zig without comments
Remove comments and use ok/err instead of success/error
in case those are reserved words.

Refs: RFC-0015
2026-02-03 17:46:25 +01:00
Markus Maiwald d0cfedfe71 fix: Rewrite duckdb.zig to fix enum syntax
Clean rewrite of duckdb.zig to eliminate enum syntax error.
Also confirmed transport_skins.zig uses _: for unused params.

Refs: RFC-0015
2026-02-03 17:44:15 +01:00
Markus Maiwald 44b37bc231 fix: Final Zig 0.15.2 syntax fixes
- duckdb.zig: Remove enum values (use default)
- png.zig: Mark unused bimodal params with _:
- transport_skins.zig: Mark probe params with _:

Refs: RFC-0015
2026-02-03 17:42:20 +01:00
Markus Maiwald 924b330396 fix: Zig 0.15.2 unused parameter warnings
- png.zig: Fix sampleGamma signature with _: prefix
- duckdb.zig: Use explicit enum(u32) with values
- transport_skins.zig: Use _: prefix for unused params

All tests should now compile without unused parameter errors.

Refs: RFC-0015
2026-02-03 17:37:43 +01:00