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
This commit is contained in:
parent
5e35118eee
commit
07ccd484f1
194
README.md
194
README.md
|
|
@ -1,11 +1,12 @@
|
|||
# Libertaria SDK
|
||||
# Libertaria Stack
|
||||
|
||||
> Sovereign Infrastructure for Autonomous Agents
|
||||
|
||||
[](https://libertaria.app)
|
||||
[](https://github.com/MarkusMaiwald/libertaria-sdk)
|
||||
[](https://github.com/MarkusMaiwald/libertaria-stack)
|
||||
[](https://ziglang.org)
|
||||
[](LICENSE)
|
||||
[](#licensing)
|
||||
[](#licensing)
|
||||
|
||||
**Sovereign; Kinetic; Anti-Fragile.**
|
||||
|
||||
|
|
@ -52,13 +53,64 @@ Cryptographic proof, not platform promises. Reputation graphs, not follower coun
|
|||
**11. Code is Speech, Exit is Voice**
|
||||
We defend the right to build, to experiment, to fork, and to leave. Technology is a tool of liberation — never of control.
|
||||
|
||||
### This SDK
|
||||
---
|
||||
|
||||
This repository implements the **L1 Identity Layer** with:
|
||||
- Ed25519 sovereign identities with rotation/burn
|
||||
- Trust Graph (QVL) with betrayal detection
|
||||
- GQL (ISO/IEC 39075:2024 compliant) query interface
|
||||
- Persistent storage with Kenya Rule compliance
|
||||
## Repository Structure
|
||||
|
||||
```
|
||||
libertaria-stack/
|
||||
├── legal/ # License texts
|
||||
│ ├── LICENSE_COMMONWEALTH.md # LCL-1.0 (Core)
|
||||
│ ├── LICENSE_SOVEREIGN.md # LSL-1.0 (SDK)
|
||||
│ └── LICENSE_UNBOUND.md # LUL-1.0 (Docs/Apps)
|
||||
│
|
||||
├── core/ # ⬇️ LCL-1.0 Commonwealth
|
||||
│ ├── l0-transport/ # Transport layer (MIMIC, Noise, PNG)
|
||||
│ ├── l1-identity/ # Identity layer (DID, QVL, Crypto)
|
||||
│ ├── l2_session/ # Session management
|
||||
│ ├── l2-federation/ # Cross-chain bridging
|
||||
│ ├── l2-membrane/ # Policy enforcement
|
||||
│ └── LICENSE # Points to LCL-1.0
|
||||
│
|
||||
├── sdk/ # ⬇️ LSL-1.0 Sovereign
|
||||
│ ├── janus-sdk/ # Language bindings
|
||||
│ ├── l4-feed/ # Temporal event store
|
||||
│ └── LICENSE # Points to LSL-1.0
|
||||
│
|
||||
├── apps/ # ⬇️ LUL-1.0 Unbound
|
||||
│ └── examples/ # Example applications
|
||||
│ └── LICENSE # Points to LUL-1.0
|
||||
│
|
||||
├── docs/ # ⬇️ LUL-1.0 Unbound
|
||||
│ ├── rfcs/ # RFC specifications
|
||||
│ └── specs/ # Technical specifications
|
||||
│
|
||||
├── tests/ # ⬇️ LCL-1.0 (belongs to Core)
|
||||
│
|
||||
└── build.zig # Build configuration
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Licensing
|
||||
|
||||
Libertaria uses a **tiered licensing strategy** to balance community ownership with business adoption:
|
||||
|
||||
| Component | License | Description |
|
||||
|:----------|:--------|:------------|
|
||||
| **Core (L0-L3)** | [LCL-1.0 Commonwealth](legal/LICENSE_COMMONWEALTH.md) | **Viral reciprocity.** Modifications must be shared. SaaS loophole closed. Patent disarmament. |
|
||||
| **SDK (L4+)** | [LSL-1.0 Sovereign](legal/LICENSE_SOVEREIGN.md) | **Business-friendly.** File-level reciprocity. Build proprietary apps on top. Patent peace. |
|
||||
| **Docs/Examples** | [LUL-1.0 Unbound](legal/LICENSE_UNBOUND.md) | **Maximum freedom.** Attribution only. Spread the ideas. |
|
||||
|
||||
### Why Tiered Licensing?
|
||||
|
||||
- **Core remains free forever**: The protocol layers that handle identity, trust, and transport are protected from capture. No company can privatize them.
|
||||
- **SDK enables business**: Developers can build proprietary applications using our SDK without "infecting" their codebase.
|
||||
- **Docs spread widely**: Specifications and examples flow freely to maximize adoption.
|
||||
|
||||
### No CLA Required
|
||||
|
||||
We don't demand copyright assignment. Your contributions remain yours. The licenses ensure reciprocity without requiring you to "sign your soul away."
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -66,8 +118,8 @@ This repository implements the **L1 Identity Layer** with:
|
|||
|
||||
```bash
|
||||
# Clone
|
||||
git clone https://github.com/MarkusMaiwald/libertaria-sdk.git
|
||||
cd libertaria-sdk
|
||||
git clone https://github.com/MarkusMaiwald/libertaria-stack.git
|
||||
cd libertaria-stack
|
||||
|
||||
# Build
|
||||
zig build
|
||||
|
|
@ -80,70 +132,45 @@ zig build test
|
|||
|
||||
## Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────────────────┐
|
||||
│ Application Layer │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Libertaria SDK │
|
||||
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │
|
||||
│ │ Identity │ │ Trust Graph │ │ GQL │ │
|
||||
│ │ (identity) │ │ (qvl) │ │ (gql/*.zig) │ │
|
||||
│ └──────────────┘ └──────────────┘ └──────────────┘ │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Janus Standard Library │
|
||||
├─────────────────────────────────────────────────────────────┤
|
||||
│ Janus Compiler (:service) │
|
||||
└─────────────────────────────────────────────────────────────┘
|
||||
```
|
||||
### The Four Layers
|
||||
|
||||
**L0: Transport** — Stealth protocols that evade censorship
|
||||
- MIMIC skins (HTTPS, DNS, QUIC camouflage)
|
||||
- Noise Protocol Framework (Signal/WireGuard crypto)
|
||||
- Polymorphic Noise Generator (traffic shaping)
|
||||
|
||||
**L1: Identity** — Self-sovereign cryptographic identity
|
||||
- Ed25519 with rotation/burn
|
||||
- QVL Trust Graph (betrayal detection)
|
||||
- Verifiable Credentials (DID/VC)
|
||||
|
||||
**L2: Session** — Resilient peer-to-peer connections
|
||||
- Post-quantum secure handshakes
|
||||
- Cross-planetary delay tolerance
|
||||
- Exit-first governance
|
||||
|
||||
**L3: Governance** — Federated coordination
|
||||
- Chapter-based organization
|
||||
- Right to fork at any level
|
||||
- No global consensus required
|
||||
|
||||
---
|
||||
|
||||
## Modules
|
||||
## Core Components
|
||||
|
||||
### Identity (`l1-identity/`)
|
||||
- `crypto.zig` — Ed25519 signatures, key rotation
|
||||
### L0 Transport (`core/l0-transport/`)
|
||||
- `mod.zig` — Public API exports
|
||||
- `noise.zig` — Noise Protocol Framework (X25519, ChaCha20-Poly1305)
|
||||
- `png.zig` — Polymorphic Noise Generator
|
||||
- `transport_skins.zig` — MIMIC camouflage framework
|
||||
- `mimic_*.zig` — Protocol-specific skins (HTTPS, DNS, QUIC)
|
||||
|
||||
### L1 Identity (`core/l1-identity/`)
|
||||
- `mod.zig` — Public API exports
|
||||
- `crypto.zig` — Ed25519 signatures
|
||||
- `did.zig` — Decentralized identifiers
|
||||
- `soulkey.zig` — Deterministic key derivation
|
||||
- `entropy.zig` — Sovereign randomness
|
||||
|
||||
### QVL — Quasar Vector Lattice (`l1-identity/qvl/`)
|
||||
- `storage.zig` — PersistentGraph with libmdbx
|
||||
- `betrayal.zig` — Bellman-Ford negative cycle detection
|
||||
- `pathfinding.zig` — A* trust path discovery
|
||||
- `feed.zig` — L4 temporal event store (DuckDB + LanceDB)
|
||||
- `gql/` — ISO/IEC 39075:2024 Graph Query Language
|
||||
- `lexer.zig` — Tokenizer
|
||||
- `parser.zig` — Recursive descent parser
|
||||
- `ast.zig` — Abstract syntax tree
|
||||
- `codegen.zig` — GQL → Zig transpiler
|
||||
|
||||
---
|
||||
|
||||
## GQL Example
|
||||
|
||||
```zig
|
||||
const gql = @import("qvl").gql;
|
||||
|
||||
// Parse GQL query
|
||||
const query_str = "MATCH (n:Identity)-[t:TRUST]->(m) WHERE n.did = 'alice' RETURN m";
|
||||
var query = try gql.parse(allocator, query_str);
|
||||
defer query.deinit();
|
||||
|
||||
// Transpile to Zig code
|
||||
const zig_code = try gql.generateZig(allocator, query);
|
||||
defer allocator.free(zig_code);
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Kenya Compliance
|
||||
|
||||
| Metric | Target | Status |
|
||||
|--------|--------|--------|
|
||||
| Binary Size (L1) | < 200KB | ✅ 85KB |
|
||||
| Memory Usage | < 10MB | ✅ ~5MB |
|
||||
| Storage | Single-file | ✅ libmdbx |
|
||||
| Cloud Calls | None | ✅ Offline-capable |
|
||||
- `qvl.zig` — Trust Graph engine
|
||||
- `qvl/` — QVL submodules (storage, gossip, pathfinding)
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -153,20 +180,26 @@ defer allocator.free(zig_code);
|
|||
# All tests
|
||||
zig build test
|
||||
|
||||
# Specific module
|
||||
zig test l1-identity/qvl/gql/lexer.zig
|
||||
zig test l1-identity/qvl/storage.zig
|
||||
# Core tests only
|
||||
zig test core/l0-transport/noise.zig
|
||||
zig test core/l1-identity/qvl/storage.zig
|
||||
|
||||
# SDK tests
|
||||
zig test sdk/l4-feed/feed.zig
|
||||
```
|
||||
|
||||
**Current Status:** 166/166 tests passing ✅
|
||||
|
||||
---
|
||||
|
||||
## Related Projects
|
||||
## Kenya Compliance
|
||||
|
||||
- [Janus Language](https://github.com/janus-lang/janus) — The foundation
|
||||
- [libertaria.blog](https://github.com/MarkusMaiwald/libertaria-blog) — This project's blog
|
||||
- [libertaria.bot](https://github.com/MarkusMaiwald/libertaria-bot) — Agent marketplace (coming soon)
|
||||
| Metric | Target | Status |
|
||||
|:-------|:-------|:-------|
|
||||
| Binary Size (L0-L1) | < 200KB | ✅ 85KB |
|
||||
| Memory Usage | < 10MB | ✅ ~5MB |
|
||||
| Storage | Single-file | ✅ libmdbx |
|
||||
| Cloud Calls | None | ✅ Offline-capable |
|
||||
|
||||
---
|
||||
|
||||
|
|
@ -183,11 +216,10 @@ zig test l1-identity/qvl/storage.zig
|
|||
|
||||
---
|
||||
|
||||
## License
|
||||
## Related Projects
|
||||
|
||||
MIT License + Libertaria Commons Clause
|
||||
|
||||
See [LICENSE](LICENSE) for details.
|
||||
- [libertaria.app](https://libertaria.app) — Project website and blog
|
||||
- [Citadel](https://github.com/MarkusMaiwald/citadel) — Validator deployment (Dlabs)
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,4 @@
|
|||
This directory is licensed under The Libertaria Unbound License v1.0 (LUL-1.0).
|
||||
See ../legal/LICENSE_UNBOUND.md for full text.
|
||||
|
||||
SPDX-License-Identifier: LUL-1.0
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
//! This demonstrates basic usage of the L1 crypto layer.
|
||||
|
||||
const std = @import("std");
|
||||
const crypto_mod = @import("../l1-identity/crypto.zig");
|
||||
const crypto_mod = @import("../../core/l1-identity/crypto.zig");
|
||||
|
||||
pub fn main() !void {
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
//! This demonstrates basic usage of the L0 transport layer.
|
||||
|
||||
const std = @import("std");
|
||||
const lwf = @import("../l0-transport/lwf.zig");
|
||||
const lwf = @import("../../core/l0-transport/lwf.zig");
|
||||
|
||||
pub fn main() !void {
|
||||
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
|
||||
70
build.zig
70
build.zig
|
|
@ -12,7 +12,7 @@ pub fn build(b: *std.Build) void {
|
|||
// Time Module (L0)
|
||||
// ========================================================================
|
||||
const time_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/time.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/time.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -21,18 +21,18 @@ pub fn build(b: *std.Build) void {
|
|||
// L0: Transport Layer
|
||||
// ========================================================================
|
||||
const l0_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mod.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/mod.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
const ipc_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/ipc/client.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/ipc/client.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const utcp_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/utcp/socket.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/utcp/socket.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -40,14 +40,14 @@ pub fn build(b: *std.Build) void {
|
|||
utcp_mod.addImport("lwf", l0_mod);
|
||||
|
||||
const opq_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/opq.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/opq.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
opq_mod.addImport("lwf", l0_mod);
|
||||
|
||||
const l0_service_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/service.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/service.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -56,53 +56,53 @@ pub fn build(b: *std.Build) void {
|
|||
l0_service_mod.addImport("opq", opq_mod);
|
||||
|
||||
const dht_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/dht.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/dht.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const gateway_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/gateway.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/gateway.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
gateway_mod.addImport("dht", dht_mod);
|
||||
|
||||
const relay_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/relay.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/relay.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: Transport Skins (MIMIC_DNS for DPI evasion)
|
||||
const mimic_dns_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_dns.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/mimic_dns.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: MIMIC_HTTPS with Domain Fronting
|
||||
const mimic_https_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_https.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/mimic_https.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: MIMIC_QUIC (HTTP/3 over QUIC)
|
||||
const mimic_quic_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_quic.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/mimic_quic.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const bridge_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l2-federation/bridge.zig"),
|
||||
.root_source_file = b.path("core/l2-federation/bridge.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const l2_policy_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l2-membrane/policy.zig"),
|
||||
.root_source_file = b.path("core/l2-membrane/policy.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -134,7 +134,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1: Identity & Crypto Layer
|
||||
// ========================================================================
|
||||
const l1_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/mod.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/mod.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -147,7 +147,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 PQXDH Module (Phase 3) - Core Dependency
|
||||
// ========================================================================
|
||||
const l1_pqxdh_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/pqxdh.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -162,7 +162,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 Modules: SoulKey, Entropy, Prekey (Phase 2B + 2C)
|
||||
// ========================================================================
|
||||
const l1_soulkey_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/soulkey.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/soulkey.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -170,7 +170,7 @@ pub fn build(b: *std.Build) void {
|
|||
l1_soulkey_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
const l1_entropy_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/entropy.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/entropy.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -179,14 +179,14 @@ pub fn build(b: *std.Build) void {
|
|||
utcp_mod.addImport("entropy", l1_entropy_mod);
|
||||
|
||||
const l1_prekey_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/prekey.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/prekey.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_prekey_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
const l1_did_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/did.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/did.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -196,14 +196,14 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 Slash Protocol & L0 Quarantine
|
||||
// ========================================================================
|
||||
const l1_slash_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/slash.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/slash.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_mod.addImport("slash", l1_slash_mod);
|
||||
|
||||
const l0_quarantine_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/quarantine.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/quarantine.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -214,7 +214,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 Trust Graph Module (Core Dependency for QVL/PoP)
|
||||
// ========================================================================
|
||||
const l1_trust_graph_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/trust_graph.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/trust_graph.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -225,7 +225,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 Proof of Path Module (PoP)
|
||||
// ========================================================================
|
||||
const l1_pop_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/proof_of_path.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/proof_of_path.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -237,7 +237,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L1 QVL (Quasar Vector Lattice) - Advanced Graph Engine
|
||||
// ========================================================================
|
||||
const l1_qvl_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/qvl.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/qvl.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -249,7 +249,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
// QVL FFI (C ABI exports for L2 integration)
|
||||
const l1_qvl_ffi_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/qvl_ffi.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/qvl_ffi.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -271,7 +271,7 @@ pub fn build(b: *std.Build) void {
|
|||
// L4 Feed — Temporal Event Store
|
||||
// ========================================================================
|
||||
const l4_feed_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l4-feed/feed.zig"),
|
||||
.root_source_file = b.path("sdk/l4-feed/feed.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -287,13 +287,13 @@ pub fn build(b: *std.Build) void {
|
|||
// RFC-0015: Transport Skins (DPI Resistance)
|
||||
// ========================================================================
|
||||
const png_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/png.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/png.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const transport_skins_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/transport_skins.zig"),
|
||||
.root_source_file = b.path("core/l0-transport/transport_skins.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -445,7 +445,7 @@ pub fn build(b: *std.Build) void {
|
|||
// Import PQXDH into main L1 module
|
||||
// Tests (root is test_pqxdh.zig)
|
||||
const l1_pqxdh_tests_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/test_pqxdh.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/test_pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -461,7 +461,7 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
// L1 Vector tests (Phase 3C)
|
||||
const l1_vector_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/vector.zig"),
|
||||
.root_source_file = b.path("core/l1-identity/vector.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
|
@ -543,11 +543,11 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
// Example: LWF frame usage
|
||||
const lwf_example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/lwf_example.zig"),
|
||||
.root_source_file = b.path("apps/examples/lwf_example.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
lwf_example_mod.addImport("../l0-transport/lwf.zig", l0_mod);
|
||||
lwf_example_mod.addImport("l0_transport", l0_mod);
|
||||
|
||||
const lwf_example = b.addExecutable(.{
|
||||
.name = "lwf_example",
|
||||
|
|
@ -557,11 +557,11 @@ pub fn build(b: *std.Build) void {
|
|||
|
||||
// Example: Encryption usage
|
||||
const crypto_example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/crypto_example.zig"),
|
||||
.root_source_file = b.path("apps/examples/crypto_example.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
crypto_example_mod.addImport("../l1-identity/crypto.zig", l1_mod);
|
||||
crypto_example_mod.addImport("l1_identity", l1_mod);
|
||||
|
||||
const crypto_example = b.addExecutable(.{
|
||||
.name = "crypto_example",
|
||||
|
|
|
|||
|
|
@ -0,0 +1,638 @@
|
|||
const std = @import("std");
|
||||
|
||||
pub fn build(b: *std.Build) void {
|
||||
const target = b.standardTargetOptions(.{});
|
||||
const optimize = b.standardOptimizeOption(.{});
|
||||
|
||||
// Dependencies
|
||||
const vaxis_dep = b.dependency("vaxis", .{});
|
||||
const vaxis_mod = vaxis_dep.module("vaxis");
|
||||
|
||||
// ========================================================================
|
||||
// Time Module (L0)
|
||||
// ========================================================================
|
||||
const time_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/time.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// ========================================================================
|
||||
// L0: Transport Layer
|
||||
// ========================================================================
|
||||
const l0_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mod.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
const ipc_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/ipc/client.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const utcp_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/utcp/socket.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
utcp_mod.addImport("ipc", ipc_mod);
|
||||
utcp_mod.addImport("lwf", l0_mod);
|
||||
|
||||
const opq_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/opq.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
opq_mod.addImport("lwf", l0_mod);
|
||||
|
||||
const l0_service_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/service.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l0_service_mod.addImport("lwf", l0_mod);
|
||||
l0_service_mod.addImport("utcp", utcp_mod);
|
||||
l0_service_mod.addImport("opq", opq_mod);
|
||||
|
||||
const dht_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/dht.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const gateway_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/gateway.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
gateway_mod.addImport("dht", dht_mod);
|
||||
|
||||
const relay_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/relay.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: Transport Skins (MIMIC_DNS for DPI evasion)
|
||||
const mimic_dns_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_dns.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: MIMIC_HTTPS with Domain Fronting
|
||||
const mimic_https_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_https.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// RFC-0015: MIMIC_QUIC (HTTP/3 over QUIC)
|
||||
const mimic_quic_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/mimic_quic.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const bridge_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l2-federation/bridge.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const l2_policy_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l2-membrane/policy.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l2_policy_mod.addImport("lwf", l0_mod);
|
||||
|
||||
// ========================================================================
|
||||
// Crypto: SHA3/SHAKE & FIPS 202
|
||||
// ========================================================================
|
||||
const crypto_shake_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/crypto/shake.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const crypto_fips202_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/crypto/fips202_bridge.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const crypto_exports_mod = b.createModule(.{
|
||||
.root_source_file = b.path("src/crypto/exports.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
crypto_exports_mod.addImport("fips202_bridge", crypto_fips202_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1: Identity & Crypto Layer
|
||||
// ========================================================================
|
||||
const l1_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/mod.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// Add crypto modules as imports to L1
|
||||
l1_mod.addImport("shake", crypto_shake_mod);
|
||||
l1_mod.addImport("fips202_bridge", crypto_fips202_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 PQXDH Module (Phase 3) - Core Dependency
|
||||
// ========================================================================
|
||||
const l1_pqxdh_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_pqxdh_mod.addIncludePath(b.path("vendor/liboqs/install/include"));
|
||||
l1_pqxdh_mod.addLibraryPath(b.path("vendor/liboqs/install/lib"));
|
||||
l1_pqxdh_mod.linkSystemLibrary("oqs", .{ .needed = true });
|
||||
|
||||
// Ensure l1_mod uses PQXDH
|
||||
l1_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 Modules: SoulKey, Entropy, Prekey (Phase 2B + 2C)
|
||||
// ========================================================================
|
||||
const l1_soulkey_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/soulkey.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
// SoulKey needs PQXDH for deterministic generation
|
||||
l1_soulkey_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
const l1_entropy_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/entropy.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// UTCP needs entropy for fast validation
|
||||
utcp_mod.addImport("entropy", l1_entropy_mod);
|
||||
|
||||
const l1_prekey_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/prekey.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_prekey_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
const l1_did_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/did.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_did_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 Slash Protocol & L0 Quarantine
|
||||
// ========================================================================
|
||||
const l1_slash_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/slash.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_mod.addImport("slash", l1_slash_mod);
|
||||
|
||||
const l0_quarantine_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/quarantine.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
utcp_mod.addImport("quarantine", l0_quarantine_mod);
|
||||
l0_service_mod.addImport("quarantine", l0_quarantine_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 Trust Graph Module (Core Dependency for QVL/PoP)
|
||||
// ========================================================================
|
||||
const l1_trust_graph_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/trust_graph.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
// trust_graph needs crypto types
|
||||
l1_trust_graph_mod.addImport("crypto", l1_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 Proof of Path Module (PoP)
|
||||
// ========================================================================
|
||||
const l1_pop_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/proof_of_path.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_pop_mod.addImport("trust_graph", l1_trust_graph_mod);
|
||||
l1_pop_mod.addImport("time", time_mod);
|
||||
l1_pop_mod.addImport("soulkey", l1_soulkey_mod);
|
||||
|
||||
// ========================================================================
|
||||
// L1 QVL (Quasar Vector Lattice) - Advanced Graph Engine
|
||||
// ========================================================================
|
||||
const l1_qvl_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/qvl.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_qvl_mod.addImport("trust_graph", l1_trust_graph_mod);
|
||||
l1_qvl_mod.addImport("proof_of_path", l1_pop_mod);
|
||||
l1_qvl_mod.addImport("time", time_mod);
|
||||
// Note: libmdbx linking removed - using stub implementation for now
|
||||
// TODO: Add real libmdbx when available on build system
|
||||
|
||||
// QVL FFI (C ABI exports for L2 integration)
|
||||
const l1_qvl_ffi_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/qvl_ffi.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_qvl_ffi_mod.addImport("qvl", l1_qvl_mod);
|
||||
l1_qvl_ffi_mod.addImport("slash", l1_slash_mod);
|
||||
l1_qvl_ffi_mod.addImport("time", time_mod);
|
||||
l1_qvl_ffi_mod.addImport("trust_graph", l1_trust_graph_mod);
|
||||
|
||||
// QVL FFI static library (for Rust L2 Membrane Agent)
|
||||
const qvl_ffi_lib = b.addLibrary(.{
|
||||
.name = "qvl_ffi",
|
||||
.root_module = l1_qvl_ffi_mod,
|
||||
.linkage = .static,
|
||||
});
|
||||
qvl_ffi_lib.linkLibC();
|
||||
b.installArtifact(qvl_ffi_lib);
|
||||
|
||||
// ========================================================================
|
||||
// L4 Feed — Temporal Event Store
|
||||
// ========================================================================
|
||||
const l4_feed_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l4-feed/feed.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// L4 Feed tests (requires libduckdb at runtime)
|
||||
const l4_feed_tests = b.addTest(.{
|
||||
.root_module = l4_feed_mod,
|
||||
});
|
||||
l4_feed_tests.linkLibC(); // Required for DuckDB C API
|
||||
const run_l4_feed_tests = b.addRunArtifact(l4_feed_tests);
|
||||
|
||||
// ========================================================================
|
||||
// RFC-0015: Transport Skins (DPI Resistance)
|
||||
// ========================================================================
|
||||
const png_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/png.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const transport_skins_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l0-transport/transport_skins.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
transport_skins_mod.addImport("png", png_mod);
|
||||
transport_skins_mod.addImport("mimic_dns", mimic_dns_mod);
|
||||
transport_skins_mod.addImport("mimic_https", mimic_https_mod);
|
||||
transport_skins_mod.addImport("mimic_quic", mimic_quic_mod);
|
||||
|
||||
// Transport Skins tests
|
||||
const png_tests = b.addTest(.{
|
||||
.root_module = png_mod,
|
||||
});
|
||||
const run_png_tests = b.addRunArtifact(png_tests);
|
||||
|
||||
const transport_skins_tests = b.addTest(.{
|
||||
.root_module = transport_skins_mod,
|
||||
});
|
||||
const run_transport_skins_tests = b.addRunArtifact(transport_skins_tests);
|
||||
|
||||
// ========================================================================
|
||||
// Tests (with C FFI support for Argon2 + liboqs)
|
||||
// ========================================================================
|
||||
|
||||
// Crypto tests (SHA3/SHAKE)
|
||||
const crypto_tests = b.addTest(.{
|
||||
.root_module = crypto_shake_mod,
|
||||
});
|
||||
const run_crypto_tests = b.addRunArtifact(crypto_tests);
|
||||
|
||||
// Crypto FFI bridge tests
|
||||
const crypto_ffi_tests = b.addTest(.{
|
||||
.root_module = crypto_fips202_mod,
|
||||
});
|
||||
const run_crypto_ffi_tests = b.addRunArtifact(crypto_ffi_tests);
|
||||
|
||||
// L0 tests
|
||||
const l0_tests = b.addTest(.{
|
||||
.root_module = l0_mod,
|
||||
});
|
||||
const run_l0_tests = b.addRunArtifact(l0_tests);
|
||||
|
||||
// UTCP tests
|
||||
const utcp_tests = b.addTest(.{
|
||||
.root_module = utcp_mod,
|
||||
});
|
||||
const run_utcp_tests = b.addRunArtifact(utcp_tests);
|
||||
|
||||
// L2 Policy tests
|
||||
const l2_policy_tests = b.addTest(.{
|
||||
.root_module = l2_policy_mod,
|
||||
});
|
||||
const run_l2_policy_tests = b.addRunArtifact(l2_policy_tests);
|
||||
|
||||
// OPQ tests
|
||||
const opq_tests = b.addTest(.{
|
||||
.root_module = opq_mod,
|
||||
});
|
||||
const run_opq_tests = b.addRunArtifact(opq_tests);
|
||||
|
||||
// L0 Service tests
|
||||
const l0_service_tests = b.addTest(.{
|
||||
.root_module = l0_service_mod,
|
||||
});
|
||||
const run_l0_service_tests = b.addRunArtifact(l0_service_tests);
|
||||
|
||||
// DHT tests
|
||||
const dht_tests = b.addTest(.{
|
||||
.root_module = dht_mod,
|
||||
});
|
||||
const run_dht_tests = b.addRunArtifact(dht_tests);
|
||||
|
||||
// Gateway tests
|
||||
const gateway_tests = b.addTest(.{
|
||||
.root_module = gateway_mod,
|
||||
});
|
||||
const run_gateway_tests = b.addRunArtifact(gateway_tests);
|
||||
|
||||
// Relay tests
|
||||
const relay_tests = b.addTest(.{
|
||||
.root_module = relay_mod,
|
||||
});
|
||||
const run_relay_tests = b.addRunArtifact(relay_tests);
|
||||
|
||||
// Bridge tests
|
||||
const bridge_tests = b.addTest(.{
|
||||
.root_module = bridge_mod,
|
||||
});
|
||||
const run_bridge_tests = b.addRunArtifact(bridge_tests);
|
||||
|
||||
// L1 SoulKey tests (Phase 2B)
|
||||
const l1_soulkey_tests = b.addTest(.{
|
||||
.root_module = l1_soulkey_mod,
|
||||
});
|
||||
// Tests linking liboqs effectively happen via the module now, but we also link LibC
|
||||
l1_soulkey_tests.linkLibC();
|
||||
const run_l1_soulkey_tests = b.addRunArtifact(l1_soulkey_tests);
|
||||
|
||||
// L1 Entropy tests (Phase 2B)
|
||||
const l1_entropy_tests = b.addTest(.{
|
||||
.root_module = l1_entropy_mod,
|
||||
});
|
||||
l1_entropy_tests.addCSourceFiles(.{
|
||||
.files = &.{
|
||||
"vendor/argon2/src/argon2.c",
|
||||
"vendor/argon2/src/core.c",
|
||||
"vendor/argon2/src/blake2/blake2b.c",
|
||||
"vendor/argon2/src/thread.c",
|
||||
"vendor/argon2/src/encoding.c",
|
||||
"vendor/argon2/src/opt.c",
|
||||
},
|
||||
.flags = &.{
|
||||
"-std=c99",
|
||||
"-O3",
|
||||
"-fPIC",
|
||||
"-DHAVE_PTHREAD",
|
||||
},
|
||||
});
|
||||
l1_entropy_tests.addIncludePath(b.path("vendor/argon2/include"));
|
||||
l1_entropy_tests.linkLibC();
|
||||
const run_l1_entropy_tests = b.addRunArtifact(l1_entropy_tests);
|
||||
|
||||
// L1 Prekey tests (Phase 2C)
|
||||
const l1_prekey_tests = b.addTest(.{
|
||||
.root_module = l1_prekey_mod,
|
||||
});
|
||||
l1_prekey_tests.linkLibC();
|
||||
const run_l1_prekey_tests = b.addRunArtifact(l1_prekey_tests);
|
||||
|
||||
// L1 DID tests (Phase 2D)
|
||||
const l1_did_tests = b.addTest(.{
|
||||
.root_module = l1_did_mod,
|
||||
});
|
||||
l1_did_tests.linkLibC();
|
||||
const run_l1_did_tests = b.addRunArtifact(l1_did_tests);
|
||||
|
||||
// L1 Slash tests
|
||||
const l1_slash_tests = b.addTest(.{
|
||||
.root_module = l1_slash_mod,
|
||||
});
|
||||
l1_slash_tests.linkLibC();
|
||||
const run_l1_slash_tests = b.addRunArtifact(l1_slash_tests);
|
||||
|
||||
// L0 Quarantine tests
|
||||
const l0_quarantine_tests = b.addTest(.{
|
||||
.root_module = l0_quarantine_mod,
|
||||
});
|
||||
const run_l0_quarantine_tests = b.addRunArtifact(l0_quarantine_tests);
|
||||
|
||||
// Import PQXDH into main L1 module
|
||||
// Tests (root is test_pqxdh.zig)
|
||||
const l1_pqxdh_tests_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/test_pqxdh.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
const l1_pqxdh_tests = b.addTest(.{
|
||||
.root_module = l1_pqxdh_tests_mod,
|
||||
});
|
||||
l1_pqxdh_tests.linkLibC();
|
||||
l1_pqxdh_tests.addIncludePath(b.path("vendor/liboqs/install/include"));
|
||||
l1_pqxdh_tests.addLibraryPath(b.path("vendor/liboqs/install/lib"));
|
||||
l1_pqxdh_tests.linkSystemLibrary("oqs");
|
||||
const run_l1_pqxdh_tests = b.addRunArtifact(l1_pqxdh_tests);
|
||||
|
||||
// L1 Vector tests (Phase 3C)
|
||||
const l1_vector_mod = b.createModule(.{
|
||||
.root_source_file = b.path("l1-identity/vector.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
l1_vector_mod.addImport("time", time_mod);
|
||||
l1_vector_mod.addImport("pqxdh", l1_pqxdh_mod);
|
||||
l1_vector_mod.addImport("trust_graph", l1_trust_graph_mod);
|
||||
l1_vector_mod.addImport("soulkey", l1_soulkey_mod);
|
||||
|
||||
const l1_vector_tests = b.addTest(.{
|
||||
.root_module = l1_vector_mod,
|
||||
});
|
||||
// Add Argon2 support for vector tests (via entropy.zig)
|
||||
l1_vector_tests.addCSourceFiles(.{
|
||||
.files = &.{
|
||||
"vendor/argon2/src/argon2.c",
|
||||
"vendor/argon2/src/core.c",
|
||||
"vendor/argon2/src/blake2/blake2b.c",
|
||||
"vendor/argon2/src/thread.c",
|
||||
"vendor/argon2/src/encoding.c",
|
||||
"vendor/argon2/src/opt.c",
|
||||
},
|
||||
.flags = &.{
|
||||
"-std=c99",
|
||||
"-O3",
|
||||
"-fPIC",
|
||||
"-DHAVE_PTHREAD",
|
||||
},
|
||||
});
|
||||
l1_vector_tests.addIncludePath(b.path("vendor/argon2/include"));
|
||||
l1_vector_tests.linkLibC();
|
||||
const run_l1_vector_tests = b.addRunArtifact(l1_vector_tests);
|
||||
|
||||
// L1 QVL tests
|
||||
const l1_qvl_tests = b.addTest(.{
|
||||
.root_module = l1_qvl_mod,
|
||||
});
|
||||
const run_l1_qvl_tests = b.addRunArtifact(l1_qvl_tests);
|
||||
|
||||
// L1 QVL FFI tests (C ABI validation)
|
||||
const l1_qvl_ffi_tests = b.addTest(.{
|
||||
.root_module = l1_qvl_ffi_mod,
|
||||
});
|
||||
l1_qvl_ffi_tests.linkLibC(); // Required for C allocator
|
||||
const run_l1_qvl_ffi_tests = b.addRunArtifact(l1_qvl_ffi_tests);
|
||||
|
||||
// NOTE: C test harness (test_qvl_ffi.c) can be compiled manually:
|
||||
// zig cc -I. l1-identity/test_qvl_ffi.c zig-out/lib/libqvl_ffi.a -o test_qvl_ffi
|
||||
|
||||
// Test step (runs Phase 2B + 2C + 2D + 3C SDK tests)
|
||||
const test_step = b.step("test", "Run SDK tests");
|
||||
test_step.dependOn(&run_crypto_tests.step);
|
||||
test_step.dependOn(&run_crypto_ffi_tests.step);
|
||||
test_step.dependOn(&run_l0_tests.step);
|
||||
test_step.dependOn(&run_l1_soulkey_tests.step);
|
||||
test_step.dependOn(&run_l1_entropy_tests.step);
|
||||
test_step.dependOn(&run_l1_prekey_tests.step);
|
||||
test_step.dependOn(&run_l1_did_tests.step);
|
||||
test_step.dependOn(&run_l1_slash_tests.step);
|
||||
test_step.dependOn(&run_l0_quarantine_tests.step);
|
||||
test_step.dependOn(&run_l1_vector_tests.step);
|
||||
test_step.dependOn(&run_l1_pqxdh_tests.step);
|
||||
test_step.dependOn(&run_utcp_tests.step);
|
||||
test_step.dependOn(&run_opq_tests.step);
|
||||
test_step.dependOn(&run_l0_service_tests.step);
|
||||
test_step.dependOn(&run_dht_tests.step);
|
||||
test_step.dependOn(&run_gateway_tests.step);
|
||||
test_step.dependOn(&run_relay_tests.step);
|
||||
test_step.dependOn(&run_bridge_tests.step);
|
||||
test_step.dependOn(&run_l1_qvl_tests.step);
|
||||
test_step.dependOn(&run_l1_qvl_ffi_tests.step);
|
||||
test_step.dependOn(&run_l2_policy_tests.step);
|
||||
test_step.dependOn(&run_l4_feed_tests.step);
|
||||
test_step.dependOn(&run_png_tests.step);
|
||||
test_step.dependOn(&run_transport_skins_tests.step);
|
||||
|
||||
// ========================================================================
|
||||
// Examples
|
||||
// ========================================================================
|
||||
|
||||
// Example: LWF frame usage
|
||||
const lwf_example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/lwf_example.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
lwf_example_mod.addImport("../l0-transport/lwf.zig", l0_mod);
|
||||
|
||||
const lwf_example = b.addExecutable(.{
|
||||
.name = "lwf_example",
|
||||
.root_module = lwf_example_mod,
|
||||
});
|
||||
b.installArtifact(lwf_example);
|
||||
|
||||
// Example: Encryption usage
|
||||
const crypto_example_mod = b.createModule(.{
|
||||
.root_source_file = b.path("examples/crypto_example.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
crypto_example_mod.addImport("../l1-identity/crypto.zig", l1_mod);
|
||||
|
||||
const crypto_example = b.addExecutable(.{
|
||||
.name = "crypto_example",
|
||||
.root_module = crypto_example_mod,
|
||||
});
|
||||
b.installArtifact(crypto_example);
|
||||
|
||||
// Examples step
|
||||
const examples_step = b.step("examples", "Build example programs");
|
||||
examples_step.dependOn(&b.addInstallArtifact(lwf_example, .{}).step);
|
||||
examples_step.dependOn(&b.addInstallArtifact(crypto_example, .{}).step);
|
||||
|
||||
// ========================================================================
|
||||
// Convenience Commands
|
||||
// ========================================================================
|
||||
|
||||
// Run crypto example
|
||||
const run_crypto_example = b.addRunArtifact(crypto_example);
|
||||
const run_crypto_step = b.step("run-crypto", "Run encryption example");
|
||||
run_crypto_step.dependOn(&run_crypto_example.step);
|
||||
|
||||
// ========================================================================
|
||||
// Capsule Core (Phase 10) Reference Implementation
|
||||
// ========================================================================
|
||||
const capsule_control_mod = b.createModule(.{
|
||||
.root_source_file = b.path("capsule-core/src/control.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
capsule_control_mod.addImport("qvl", l1_qvl_mod);
|
||||
|
||||
const capsule_mod = b.createModule(.{
|
||||
.root_source_file = b.path("capsule-core/src/main.zig"),
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
|
||||
// Link L0 (Transport)
|
||||
capsule_mod.addImport("l0_transport", l0_mod);
|
||||
capsule_mod.addImport("utcp", utcp_mod);
|
||||
|
||||
// Link L1 (Identity)
|
||||
capsule_mod.addImport("l1_identity", l1_mod);
|
||||
capsule_mod.addImport("qvl", l1_qvl_mod);
|
||||
capsule_mod.addImport("dht", dht_mod);
|
||||
capsule_mod.addImport("gateway", gateway_mod);
|
||||
capsule_mod.addImport("relay", relay_mod);
|
||||
capsule_mod.addImport("quarantine", l0_quarantine_mod);
|
||||
capsule_mod.addImport("policy", l2_policy_mod);
|
||||
capsule_mod.addImport("soulkey", l1_soulkey_mod);
|
||||
capsule_mod.addImport("vaxis", vaxis_mod);
|
||||
capsule_mod.addImport("control", capsule_control_mod);
|
||||
|
||||
const capsule_exe = b.addExecutable(.{
|
||||
.name = "capsule",
|
||||
.root_module = capsule_mod,
|
||||
});
|
||||
// Link LibC (required for Argon2/OQS via L1)
|
||||
capsule_exe.linkLibC();
|
||||
// Link SQLite3 (required for Persistent State)
|
||||
capsule_exe.linkSystemLibrary("sqlite3");
|
||||
// Link DuckDB (required for Analytical QVL)
|
||||
capsule_exe.linkSystemLibrary("duckdb");
|
||||
|
||||
b.installArtifact(capsule_exe);
|
||||
|
||||
// Run command: zig build run -- args
|
||||
const run_capsule = b.addRunArtifact(capsule_exe);
|
||||
if (b.args) |args| {
|
||||
run_capsule.addArgs(args);
|
||||
}
|
||||
const run_step = b.step("run", "Run the Capsule Node");
|
||||
run_step.dependOn(&run_capsule.step);
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
This directory is licensed under The Libertaria Commonwealth License v1.0 (LCL-1.0).
|
||||
See ../legal/LICENSE_COMMONWEALTH.md for full text.
|
||||
|
||||
SPDX-License-Identifier: LCL-1.0
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0122: Kademlia-lite DHT for Capsule Discovery
|
||||
//! Implements wide-area peer discovery using XOR distance metric.
|
||||
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0018: Gateway Protocol
|
||||
//!
|
||||
//! layer 1: Coordination Layer
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0000: Libertaria Wire Frame Protocol (v2)
|
||||
//!
|
||||
//! This module implements the core LWF frame structure for L0 transport.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0015: MIMIC_DNS Skin (DNS-over-HTTPS Tunnel)
|
||||
//!
|
||||
//! Encodes LWF frames as DNS queries for DPI evasion.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
const std = @import("std");
|
||||
const base64 = std.base64;
|
||||
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0015: MIMIC_QUIC Skin (HTTP/3 over QUIC)
|
||||
//!
|
||||
//! Modern replacement for WebSockets with 0-RTT connection establishment.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
const std = @import("std");
|
||||
|
||||
// Re-export LWF (Libertaria Wire Frame)
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! Noise Protocol Framework Implementation (noiseprotocol.org)
|
||||
//!
|
||||
//! Lightweight, modern cryptographic protocol framework.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! Sovereign Index for OPQ
|
||||
pub const store = @import("opq/store.zig");
|
||||
pub const quota = @import("opq/quota.zig");
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0015: Polymorphic Noise Generator (PNG)
|
||||
//!
|
||||
//! Per-session traffic shaping for DPI resistance.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! Quarantine List - Active Defense Enforcement
|
||||
//!
|
||||
//! Maintains a list of locally blocked/monitored DIDs based on SlashSignals.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0018: Relay Protocol (Layer 2)
|
||||
//!
|
||||
//! Implements onion-routed packet forwarding.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! RFC-0010 & RFC-0020: L0 Integrated Service
|
||||
//!
|
||||
//! Orchestrates the flow: [Network] -> [UTCP] -> [OPQ] -> [Application]
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! Sovereign Time Protocol (RFC-0105)
|
||||
//!
|
||||
//! Time is a first-class sovereign dimension in Libertaria.
|
||||
|
|
@ -1,3 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
const std = @import("std");
|
||||
const png = @import("png.zig");
|
||||
const mimic_dns = @import("mimic_dns.zig");
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
// SPDX-License-Identifier: LCL-1.0
|
||||
// Copyright (c) 2026 Libertaria Contributors
|
||||
// This file is part of the Libertaria Core, licensed under
|
||||
// The Libertaria Commonwealth License v1.0.
|
||||
|
||||
|
||||
//! Sovereign Index for UTCP
|
||||
pub const socket = @import("utcp/socket.zig");
|
||||
pub const UTCP = socket.UTCP;
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
//! Sovereign Index for UTCP
|
||||
pub const socket = @import("utcp/socket.zig");
|
||||
pub const UTCP = socket.UTCP;
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
# The Libertaria Commonwealth License (LCL-1.0)
|
||||
|
||||
### ⚡ Developer Summary (TL;DR)
|
||||
|
||||
**This software belongs to the tribe.** It is free to use, modify, and distribute, but you cannot privatize it.
|
||||
|
||||
We enforce **Total Reciprocity**:
|
||||
|
||||
1. **No Secrets:** If you modify this code, you must share your changes.
|
||||
|
||||
2. **No "Cloud" Loophole:** If you run this software as a Service (SaaS) or backend API, you **must** offer the source code to your users. Hiding behind a server does not exempt you.
|
||||
|
||||
3. **Virality:** You cannot link this code into a closed-source application. If you mix your code with ours, your code becomes Commonwealth too.
|
||||
|
||||
|
||||
Code for the common good, or not at all.
|
||||
|
||||
---
|
||||
|
||||
### 🛡️ Why LCL-1.0?
|
||||
|
||||
- **Anti-Monopoly:** Prevents "Strip-Mining"—where corporations take open code, wrap it in a paid cloud service, and contribute nothing back.
|
||||
|
||||
- **SaaS-Proof:** Closes the gap left by older licenses (like GPL) that didn't foresee the Cloud era.
|
||||
|
||||
- **Patent Disarmament:** Includes a "Cold War" clause. If you sue for patents, you lose your license.
|
||||
|
||||
- **Fortified:** Governed by **Dutch Law** (Amsterdam) to ensure the Commonwealth is protected by unshakeable legal certainty.
|
||||
|
||||
|
||||
_For the full legal text, see the `LICENSE` file._
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
# The Libertaria Sovereign License (LSL-1.0)
|
||||
|
||||
### ⚡ Developer Summary (TL;DR)
|
||||
|
||||
**This software is free.** You can use it, modify it, distribute it, and sell it. You can link it into proprietary applications without infecting your codebase.
|
||||
|
||||
We ask only two things:
|
||||
|
||||
1. **File-Level Reciprocity:** If you modify the **Core Files** (the engine), you must share those specific changes back.
|
||||
|
||||
2. **Proprietary Freedom:** If you build _on top_ of this engine (using new files), you own that work. You can keep your application closed and sell it.
|
||||
|
||||
|
||||
That’s it. **Communal Core. Individual Profit.**
|
||||
|
||||
---
|
||||
|
||||
### 🛡️ Why LSL-1.0?
|
||||
|
||||
- **Business Ready:** Safe for commercial use. Your proprietary logic stays yours; our core logic stays ours.
|
||||
|
||||
- **Patent Disarmament:** Includes a "Cold War" clause. If you sue for patents, you lose your license. Peace through strength.
|
||||
|
||||
- **No "Viral" Infection:** Unlike the Commonwealth License, this does not force your entire app open. It acts as a firewall between the Engine and the App.
|
||||
|
||||
- **Fortified:** Governed by **Dutch Law** (Amsterdam) for absolute _Rechtssicherheit_.
|
||||
|
||||
|
||||
_For the full legal text, see the `LICENSE` file._
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
# The Libertaria Unbound License (LUL-1.0)
|
||||
|
||||
### ⚡ Developer Summary (TL;DR)
|
||||
|
||||
**This work is Unbound.**
|
||||
|
||||
You have absolute freedom to:
|
||||
|
||||
- Use it.
|
||||
|
||||
- Change it.
|
||||
|
||||
- Sell it.
|
||||
|
||||
- Close it.
|
||||
|
||||
|
||||
The only requirement is **Attribution**: You must keep our copyright notice and the license text in your distribution.
|
||||
|
||||
Take this idea. Run with it. Make it the standard.
|
||||
|
||||
---
|
||||
|
||||
### 🛡️ Why LUL-1.0?
|
||||
|
||||
- **Zero Friction:** Designed for protocols, specifications, and rapid adoption. We want this technology everywhere, even in the hands of competitors.
|
||||
|
||||
- **Patent Disarmament:** Even though it is permissive, you are still protected by our "Cold War" patent grant.
|
||||
|
||||
- **Fortified:** Governed by **Dutch Law** (Amsterdam). Simple, but legally bulletproof.
|
||||
|
||||
|
||||
_For the full legal text, see the `LICENSE` file._
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
This directory is licensed under The Libertaria Sovereign License v1.0 (LSL-1.0).
|
||||
See ../legal/LICENSE_SOVEREIGN.md for full text.
|
||||
|
||||
SPDX-License-Identifier: LSL-1.0
|
||||
Loading…
Reference in New Issue