yakmesh 2.8.2 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +637 -0
- package/CONTRIBUTING.md +42 -0
- package/Caddyfile +77 -0
- package/README.md +119 -29
- package/adapters/adapter-mlv-bible/README.md +124 -0
- package/adapters/adapter-mlv-bible/index.js +400 -0
- package/adapters/chat-mod-adapter.js +532 -0
- package/adapters/content-adapter.js +273 -0
- package/content/api.js +50 -41
- package/content/index.js +2 -2
- package/content/store.js +355 -173
- package/dashboard/index.html +19 -3
- package/database/replication.js +117 -37
- package/docs/CRYPTO-AGILITY.md +204 -0
- package/docs/MTLS-RESEARCH.md +367 -0
- package/docs/NAMCHE-SPEC.md +681 -0
- package/docs/PEERQUANTA-YAKMESH-INTEGRATION.md +407 -0
- package/docs/PRECISION-DISCLOSURE.md +96 -0
- package/docs/README.md +76 -0
- package/docs/ROADMAP-2.4.0.md +447 -0
- package/docs/ROADMAP-2.5.0.md +244 -0
- package/docs/SECURITY-AUDIT-REPORT.md +306 -0
- package/docs/SST-INTEGRATION.md +712 -0
- package/docs/STEADYWATCH-IMPLEMENTATION.md +303 -0
- package/docs/TERNARY-AUDIT-REPORT.md +247 -0
- package/docs/TME-FAQ.md +221 -0
- package/docs/WHITEPAPER.md +623 -0
- package/docs/adapters.html +1001 -0
- package/docs/advanced-systems.html +1045 -0
- package/docs/annex.html +1046 -0
- package/docs/api.html +970 -0
- package/docs/business/response-templates.md +160 -0
- package/docs/c2c.html +1225 -0
- package/docs/cli.html +1332 -0
- package/docs/configuration.html +1248 -0
- package/docs/darshan.html +1085 -0
- package/docs/dharma.html +966 -0
- package/docs/docs-bundle.html +1075 -0
- package/docs/docs.css +3120 -0
- package/docs/docs.js +556 -0
- package/docs/doko.html +969 -0
- package/docs/geo-proof.html +858 -0
- package/docs/getting-started.html +840 -0
- package/docs/gumba-tutorial.html +1144 -0
- package/docs/gumba.html +1098 -0
- package/docs/index.html +914 -0
- package/docs/jhilke.html +1312 -0
- package/docs/karma.html +1100 -0
- package/docs/katha.html +1037 -0
- package/docs/lama.html +978 -0
- package/docs/mandala.html +1067 -0
- package/docs/mani.html +964 -0
- package/docs/mantra.html +967 -0
- package/docs/mesh.html +1409 -0
- package/docs/nakpak.html +869 -0
- package/docs/namche.html +928 -0
- package/docs/nav-order.json +53 -0
- package/docs/prahari.html +1043 -0
- package/docs/prism-bash.min.js +1 -0
- package/docs/prism-javascript.min.js +1 -0
- package/docs/prism-json.min.js +1 -0
- package/docs/prism-tomorrow.min.css +1 -0
- package/docs/prism.min.js +1 -0
- package/docs/privacy.html +699 -0
- package/docs/quick-reference.html +1181 -0
- package/docs/sakshi.html +1402 -0
- package/docs/sandboxing.md +386 -0
- package/docs/seva.html +911 -0
- package/docs/sherpa.html +871 -0
- package/docs/studio.html +860 -0
- package/docs/stupa.html +995 -0
- package/docs/tailwind.min.css +2 -0
- package/docs/tattva.html +1332 -0
- package/docs/terms.html +686 -0
- package/docs/time-server-deployment.md +166 -0
- package/docs/time-sources.html +1392 -0
- package/docs/tivra.html +1127 -0
- package/docs/trademark-policy.html +686 -0
- package/docs/tribhuj.html +1183 -0
- package/docs/trust-security.html +1029 -0
- package/docs/tutorials/backup-recovery.html +654 -0
- package/docs/tutorials/dashboard.html +604 -0
- package/docs/tutorials/domain-setup.html +605 -0
- package/docs/tutorials/host-website.html +456 -0
- package/docs/tutorials/mesh-network.html +505 -0
- package/docs/tutorials/mobile-access.html +445 -0
- package/docs/tutorials/privacy.html +467 -0
- package/docs/tutorials/raspberry-pi.html +600 -0
- package/docs/tutorials/security-basics.html +539 -0
- package/docs/tutorials/share-files.html +431 -0
- package/docs/tutorials/troubleshooting.html +637 -0
- package/docs/tutorials/trust-karma.html +419 -0
- package/docs/tutorials/yak-protocol.html +456 -0
- package/docs/tutorials.html +1034 -0
- package/docs/vani.html +1270 -0
- package/docs/webserver.html +809 -0
- package/docs/yak-protocol.html +940 -0
- package/docs/yak-timeserver-design.md +475 -0
- package/docs/yakapp.html +1015 -0
- package/docs/ypc27.html +1069 -0
- package/docs/yurt.html +1344 -0
- package/embedded-docs/bundle.js +334 -74
- package/gossip/protocol.js +247 -27
- package/identity/key-resolver.js +262 -0
- package/identity/machine-seed.js +632 -0
- package/identity/node-key.js +669 -368
- package/identity/tribhuj-ratchet.js +506 -0
- package/knowledge-base.js +37 -8
- package/launcher/yakmesh.bat +62 -0
- package/launcher/yakmesh.sh +70 -0
- package/mesh/annex.js +462 -108
- package/mesh/beacon-broadcast.js +113 -1
- package/mesh/darshan.js +1718 -0
- package/mesh/gumba.js +1567 -0
- package/mesh/jhilke.js +651 -0
- package/mesh/katha.js +1012 -0
- package/mesh/nakpak-routing.js +8 -5
- package/mesh/network.js +724 -34
- package/mesh/pulse-sync.js +4 -1
- package/mesh/rate-limiter.js +127 -15
- package/mesh/seva.js +526 -0
- package/mesh/sherpa-discovery.js +89 -8
- package/mesh/sybil-defense.js +19 -5
- package/mesh/temporal-encoder.js +4 -3
- package/mesh/vani.js +1364 -0
- package/mesh/yurt.js +1340 -0
- package/models/entropy-sentinel.onnx +0 -0
- package/models/karma-trust.onnx +0 -0
- package/models/manifest.json +43 -0
- package/models/sakshi-anomaly.onnx +0 -0
- package/oracle/code-proof-protocol.js +7 -6
- package/oracle/codebase-lock.js +257 -28
- package/oracle/index.js +74 -15
- package/oracle/ma902-snmp.js +678 -0
- package/oracle/module-sealer.js +5 -3
- package/oracle/network-identity.js +16 -0
- package/oracle/packet-checksum.js +201 -0
- package/oracle/sst.js +579 -0
- package/oracle/ternary-144t.js +714 -0
- package/oracle/ternary-ml.js +481 -0
- package/oracle/time-api.js +239 -0
- package/oracle/time-source.js +137 -47
- package/oracle/validation-oracle-hardened.js +1111 -1071
- package/oracle/validation-oracle.js +4 -2
- package/oracle/ypc27.js +211 -0
- package/package.json +20 -3
- package/protocol/yak-handler.js +35 -9
- package/protocol/yak-protocol.js +28 -13
- package/reference/cpp/yakmesh_mceliece_shard.cpp +168 -0
- package/reference/cpp/yakmesh_ypc27.cpp +179 -0
- package/sbom.json +87 -0
- package/scripts/security-audit.mjs +264 -0
- package/scripts/update-docs-nav.js +194 -0
- package/scripts/update-docs-sidebar.cjs +164 -0
- package/security/crypto-config.js +4 -3
- package/security/dharma-moderation.js +517 -0
- package/security/doko-identity.js +193 -143
- package/security/domain-consensus.js +86 -85
- package/security/fs-hardening.js +620 -0
- package/security/hardware-attestation.js +5 -3
- package/security/hybrid-trust.js +227 -87
- package/security/karma-rate-limiter.js +692 -0
- package/security/khata-protocol.js +22 -21
- package/security/khata-trust-integration.js +277 -150
- package/security/memory-safety.js +635 -0
- package/security/mesh-auth.js +11 -10
- package/security/mesh-revocation.js +373 -5
- package/security/namche-gateway.js +298 -69
- package/security/sakshi.js +460 -3
- package/security/sangha.js +770 -0
- package/security/secure-config.js +473 -0
- package/security/silicon-parity.js +13 -10
- package/security/steadywatch.js +1142 -0
- package/security/strike-system.js +32 -3
- package/security/temporal-signing.js +488 -0
- package/security/trit-commitment.js +464 -0
- package/server/crypto/annex.js +247 -0
- package/server/darshan-api.js +343 -0
- package/server/index.js +3259 -362
- package/server/komm-api.js +668 -0
- package/utils/accel.js +2273 -0
- package/utils/ternary-id.js +79 -0
- package/utils/verify-worker.js +57 -0
- package/webserver/index.js +95 -5
- package/assets/yakmesh-logo.png +0 -0
- package/assets/yakmesh-logo.svg +0 -80
- package/assets/yakmesh-logo2.png +0 -0
- package/assets/yakmesh-logo2sm.png +0 -0
- package/assets/ymsm.png +0 -0
- package/website/assets/silhouettes/adapters.svg +0 -107
- package/website/assets/silhouettes/api-endpoints.svg +0 -115
- package/website/assets/silhouettes/atomic-clock.svg +0 -83
- package/website/assets/silhouettes/base-camp.svg +0 -81
- package/website/assets/silhouettes/bridge.svg +0 -69
- package/website/assets/silhouettes/docs-bundle.svg +0 -113
- package/website/assets/silhouettes/doko-basket.svg +0 -70
- package/website/assets/silhouettes/fortress.svg +0 -93
- package/website/assets/silhouettes/gateway.svg +0 -54
- package/website/assets/silhouettes/gears.svg +0 -93
- package/website/assets/silhouettes/globe-satellite.svg +0 -67
- package/website/assets/silhouettes/karma-wheel.svg +0 -137
- package/website/assets/silhouettes/lama-council.svg +0 -141
- package/website/assets/silhouettes/mandala-network.svg +0 -169
- package/website/assets/silhouettes/mani-stones.svg +0 -149
- package/website/assets/silhouettes/mantra-wheel.svg +0 -116
- package/website/assets/silhouettes/mesh-nodes.svg +0 -113
- package/website/assets/silhouettes/nakpak.svg +0 -56
- package/website/assets/silhouettes/peak-lightning.svg +0 -73
- package/website/assets/silhouettes/sherpa.svg +0 -69
- package/website/assets/silhouettes/stupa-tower.svg +0 -119
- package/website/assets/silhouettes/tattva-eye.svg +0 -78
- package/website/assets/silhouettes/terminal.svg +0 -74
- package/website/assets/silhouettes/webserver.svg +0 -145
- package/website/assets/silhouettes/yak.svg +0 -78
- package/website/assets/yakmesh-logo.png +0 -0
- package/website/assets/yakmesh-logo.webp +0 -0
- package/website/assets/yakmesh-logo128x140.webp +0 -0
- package/website/assets/yakmesh-logo2.png +0 -0
- package/website/assets/yakmesh-logo2.svg +0 -51
- package/website/assets/yakmesh-logo40x44.webp +0 -0
- package/website/assets/yakmesh.gif +0 -0
- package/website/assets/yakmesh.ico +0 -0
- package/website/assets/yakmesh.jpg +0 -0
- package/website/assets/yakmesh.pdf +0 -0
- package/website/assets/yakmesh.png +0 -0
- package/website/assets/yakmesh.svg +0 -70
- package/website/assets/yakmesh128.webp +0 -0
- package/website/assets/yakmesh32.png +0 -0
- package/website/assets/yakmesh32.svg +0 -65
- package/website/assets/yakmesh32o.ico +0 -2
- package/website/assets/yakmesh32o.svg +0 -65
- package/website/assets/yakmesh32o.svgz +0 -0
|
@@ -0,0 +1,681 @@
|
|
|
1
|
+
# NAMCHE: Network Authenticated Mesh Certificate Hub & Exchange
|
|
2
|
+
|
|
3
|
+
> *The gateway where Math itself verifies your identity*
|
|
4
|
+
|
|
5
|
+
**Version**: 1.0.1-draft
|
|
6
|
+
**Status**: Specification Draft
|
|
7
|
+
**Authors**: YAKMESH Project
|
|
8
|
+
**Date**: 2026-01-18
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ⚠️ SECURITY NOTICE: Identity Architecture Integrity
|
|
13
|
+
|
|
14
|
+
> **CRITICAL**: The NodeID generation scheme is a foundational security primitive of YAKMESH.
|
|
15
|
+
> It MUST NOT be simplified, replaced, or "optimized" without explicit review.
|
|
16
|
+
>
|
|
17
|
+
> The correct NodeID format is:
|
|
18
|
+
> ```
|
|
19
|
+
> node-[networkName]-[instanceId]
|
|
20
|
+
> ```
|
|
21
|
+
> Where:
|
|
22
|
+
> - `networkName` = Derived from **codebase hash** via iO obfuscation (ensures code integrity)
|
|
23
|
+
> - `instanceId` = Derived from **public key hash** via iO obfuscation (ensures unique identity)
|
|
24
|
+
>
|
|
25
|
+
> **Any proposal to change NodeID to simple `SHA3-256(publicKey)` or similar MUST BE REJECTED.**
|
|
26
|
+
> Such changes would:
|
|
27
|
+
> 1. Remove the codebase integrity verification
|
|
28
|
+
> 2. Eliminate network segmentation by code version
|
|
29
|
+
> 3. Break the human-readable verification property
|
|
30
|
+
> 4. Undermine the iO oracle's security guarantees
|
|
31
|
+
>
|
|
32
|
+
> This notice exists because such a simplification was proposed during spec drafting.
|
|
33
|
+
> The existing design in `identity/node-key.js` is correct and intentional.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Abstract
|
|
38
|
+
|
|
39
|
+
NAMCHE is a trustless certificate verification and distribution system for the YAKMESH mesh network. Unlike traditional PKI where human-operated Certificate Authorities serve as trust anchors, NAMCHE uses pure mathematical verification to accept or reject identity claims. The system leverages ML-DSA-65 (post-quantum) signatures, mesh consensus for domain verification, and cryptographic proofs for all trust decisions.
|
|
40
|
+
|
|
41
|
+
**Philosophy**: *"No human in the loop = No human weakness"*
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Table of Contents
|
|
46
|
+
|
|
47
|
+
1. [Overview](#1-overview)
|
|
48
|
+
2. [DOKO: The Certificate Object](#2-doko-the-certificate-object)
|
|
49
|
+
3. [KHATA: Trust Distribution Protocol](#3-khata-trust-distribution-protocol)
|
|
50
|
+
4. [Mathematical Verification Flow](#4-mathematical-verification-flow)
|
|
51
|
+
5. [Domain Ownership Verification](#5-domain-ownership-verification)
|
|
52
|
+
6. [Revocation Mechanism](#6-revocation-mechanism)
|
|
53
|
+
7. [Integration with SHERPA](#7-integration-with-sherpa)
|
|
54
|
+
8. [Security Considerations](#8-security-considerations)
|
|
55
|
+
9. [Implementation Guide](#9-implementation-guide)
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## 1. Overview
|
|
60
|
+
|
|
61
|
+
### 1.1 The Problem with Traditional PKI
|
|
62
|
+
|
|
63
|
+
Traditional certificate authorities have fundamental weaknesses:
|
|
64
|
+
- **Single point of failure** - CA compromise affects all certificates
|
|
65
|
+
- **Human judgment** - Humans can be bribed, coerced, or make mistakes
|
|
66
|
+
- **Jurisdictional** - CAs are bound by legal frameworks that may conflict
|
|
67
|
+
- **Centralized trust** - "Trust me because I say so"
|
|
68
|
+
|
|
69
|
+
### 1.2 The NAMCHE Solution
|
|
70
|
+
|
|
71
|
+
NAMCHE replaces human authority with mathematical authority:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
Traditional: Human says "trust this" → You trust it
|
|
75
|
+
NAMCHE: Math proves "this is valid" → You verify it
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### 1.3 Design Principles
|
|
79
|
+
|
|
80
|
+
1. **Math as Authority** - All trust decisions are mathematical computations
|
|
81
|
+
2. **No Central CA** - Mesh consensus replaces central authority
|
|
82
|
+
3. **Automated Verification** - Accept/reject without human intervention
|
|
83
|
+
4. **Post-Quantum Ready** - ML-DSA-65 signatures throughout
|
|
84
|
+
5. **Transparent** - All certificate operations visible to mesh
|
|
85
|
+
6. **iO Integration** - NodeID derivation uses codebase hash for network integrity
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
89
|
+
## 2. DOKO: The Certificate Object
|
|
90
|
+
|
|
91
|
+
**DOKO** (Distributed Ownership & Key Object) is the certificate container.
|
|
92
|
+
|
|
93
|
+
### 2.1 DOKO Structure
|
|
94
|
+
|
|
95
|
+
```javascript
|
|
96
|
+
{
|
|
97
|
+
// Version & Type
|
|
98
|
+
"version": "1.0",
|
|
99
|
+
"type": "node-identity" | "domain-claim" | "service-binding",
|
|
100
|
+
|
|
101
|
+
// Core Identity (see identity/node-key.js for canonical implementation)
|
|
102
|
+
// Format: "node-[networkName]-[instanceId]"
|
|
103
|
+
// - networkName: derived from codebase hash via iO (same for all nodes on network)
|
|
104
|
+
// - instanceId: derived from public key hash via iO (unique per node)
|
|
105
|
+
"nodeId": "node-qubit-lattice-prism-pq-a7x9", // Example format
|
|
106
|
+
"publicKey": "<ML-DSA-65 public key, hex>",
|
|
107
|
+
|
|
108
|
+
// Temporal Bounds
|
|
109
|
+
"issuedAt": 1737200000000, // Unix timestamp (ms)
|
|
110
|
+
"expiresAt": 1768736000000, // Unix timestamp (ms)
|
|
111
|
+
"ttl": 31536000000, // 1 year in ms
|
|
112
|
+
|
|
113
|
+
// Domain Claims (optional)
|
|
114
|
+
"domains": [
|
|
115
|
+
{
|
|
116
|
+
"name": "example.com",
|
|
117
|
+
"verifiedAt": 1737200000000,
|
|
118
|
+
"verifiers": ["<nodeId1>", "<nodeId2>", "<nodeId3>"],
|
|
119
|
+
"proofs": [
|
|
120
|
+
{
|
|
121
|
+
"verifierNodeId": "<nodeId>",
|
|
122
|
+
"verifierPublicKey": "<ML-DSA-65 pubkey>",
|
|
123
|
+
"beaconHash": "<SHA3-256 of beacon content>",
|
|
124
|
+
"signature": "<ML-DSA-65 signature>",
|
|
125
|
+
"timestamp": 1737200000000
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
],
|
|
130
|
+
|
|
131
|
+
// Capabilities
|
|
132
|
+
"capabilities": {
|
|
133
|
+
"canVerifyDomains": true, // This node can verify others' domains
|
|
134
|
+
"canRouteNakpak": true, // This node participates in onion routing
|
|
135
|
+
"canServeContent": true, // This node serves ANNEX content
|
|
136
|
+
"supportsKhata": true // This node participates in trust distribution
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// Network Metadata
|
|
140
|
+
"networkName": "yakmesh-mainnet",
|
|
141
|
+
"endpoints": {
|
|
142
|
+
"ws": "wss://example.com:9001",
|
|
143
|
+
"http": "https://example.com:443",
|
|
144
|
+
"sherpa": "https://example.com/.well-known/yakmesh/beacon"
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
// Self-Signature (proves ownership of privateKey)
|
|
148
|
+
"signature": "<ML-DSA-65 signature over all above fields>"
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### 2.2 DOKO Hash Calculation
|
|
153
|
+
|
|
154
|
+
The DOKO's unique identifier is computed as:
|
|
155
|
+
|
|
156
|
+
```javascript
|
|
157
|
+
const dokoHash = sha3_256(
|
|
158
|
+
canonicalize({
|
|
159
|
+
version,
|
|
160
|
+
type,
|
|
161
|
+
nodeId,
|
|
162
|
+
publicKey,
|
|
163
|
+
issuedAt,
|
|
164
|
+
expiresAt,
|
|
165
|
+
domains,
|
|
166
|
+
capabilities,
|
|
167
|
+
networkName,
|
|
168
|
+
endpoints
|
|
169
|
+
})
|
|
170
|
+
);
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
Using RFC 8785 JSON Canonicalization for deterministic hashing.
|
|
174
|
+
|
|
175
|
+
### 2.3 DOKO Types
|
|
176
|
+
|
|
177
|
+
| Type | Purpose | Required Fields |
|
|
178
|
+
|------|---------|-----------------|
|
|
179
|
+
| `node-identity` | Prove node exists with this keypair | nodeId, publicKey, signature |
|
|
180
|
+
| `domain-claim` | Prove ownership of web domain | domains, verifiers, proofs |
|
|
181
|
+
| `service-binding` | Bind service to node identity | endpoints, capabilities |
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## 3. KHATA: Trust Distribution Protocol
|
|
186
|
+
|
|
187
|
+
**KHATA** (Kryptographic Handshake for Automated Trust Acceptance) handles the distribution and acceptance of DOKOs across the mesh.
|
|
188
|
+
|
|
189
|
+
### 3.1 KHATA Message Types
|
|
190
|
+
|
|
191
|
+
```javascript
|
|
192
|
+
// 1. ANNOUNCE - Broadcast new/updated DOKO
|
|
193
|
+
{
|
|
194
|
+
"type": "khata:announce",
|
|
195
|
+
"doko": { /* full DOKO object */ },
|
|
196
|
+
"timestamp": 1737200000000,
|
|
197
|
+
"ttl": 3600000, // How long to propagate (1 hour)
|
|
198
|
+
"hops": 0 // Incremented by each relay
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// 2. REQUEST - Ask for a specific DOKO
|
|
202
|
+
{
|
|
203
|
+
"type": "khata:request",
|
|
204
|
+
"query": {
|
|
205
|
+
"nodeId": "<nodeId>", // OR
|
|
206
|
+
"domain": "example.com", // OR
|
|
207
|
+
"dokoHash": "<hash>"
|
|
208
|
+
},
|
|
209
|
+
"requesterId": "<nodeId>",
|
|
210
|
+
"signature": "<request signature>"
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// 3. RESPONSE - Reply with DOKO(s)
|
|
214
|
+
{
|
|
215
|
+
"type": "khata:response",
|
|
216
|
+
"requestId": "<hash of request>",
|
|
217
|
+
"dokos": [ /* array of matching DOKOs */ ],
|
|
218
|
+
"responderId": "<nodeId>",
|
|
219
|
+
"signature": "<response signature>"
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// 4. REVOKE - Announce DOKO revocation
|
|
223
|
+
{
|
|
224
|
+
"type": "khata:revoke",
|
|
225
|
+
"dokoHash": "<hash of DOKO to revoke>",
|
|
226
|
+
"reason": "key-compromise" | "superseded" | "voluntary",
|
|
227
|
+
"revokedAt": 1737200000000,
|
|
228
|
+
"signature": "<signed by original DOKO owner>"
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### 3.2 KHATA Propagation Rules
|
|
233
|
+
|
|
234
|
+
1. **Announce Propagation**
|
|
235
|
+
- Forward to all connected peers (except sender)
|
|
236
|
+
- Increment `hops` counter
|
|
237
|
+
- Drop if `hops > MAX_HOPS` (default: 10)
|
|
238
|
+
- Drop if `ttl` expired
|
|
239
|
+
- Drop if signature invalid (don't propagate bad data)
|
|
240
|
+
|
|
241
|
+
2. **Request Propagation**
|
|
242
|
+
- Forward to K random peers if not found locally
|
|
243
|
+
- Track request ID to prevent loops
|
|
244
|
+
- Timeout after T seconds
|
|
245
|
+
|
|
246
|
+
3. **Revocation Propagation**
|
|
247
|
+
- ALWAYS propagate (high priority)
|
|
248
|
+
- Store in append-only revocation log
|
|
249
|
+
- Never expires (permanent record)
|
|
250
|
+
|
|
251
|
+
### 3.3 KHATA Storage
|
|
252
|
+
|
|
253
|
+
Each node maintains:
|
|
254
|
+
- **DOKO Cache** - Recently seen DOKOs (LRU cache)
|
|
255
|
+
- **Revocation Log** - Append-only list of revoked DOKOs
|
|
256
|
+
- **Verification Log** - Domain verifications this node performed
|
|
257
|
+
|
|
258
|
+
---
|
|
259
|
+
|
|
260
|
+
## 4. Mathematical Verification Flow
|
|
261
|
+
|
|
262
|
+
The NAMCHE gateway performs these checks in order:
|
|
263
|
+
|
|
264
|
+
### 4.1 Verification Algorithm
|
|
265
|
+
|
|
266
|
+
```javascript
|
|
267
|
+
async function verifyDoko(doko) {
|
|
268
|
+
const checks = [];
|
|
269
|
+
|
|
270
|
+
// CHECK 1: Structural Validity
|
|
271
|
+
if (!isValidDokoStructure(doko)) {
|
|
272
|
+
return { valid: false, reason: 'MALFORMED_STRUCTURE' };
|
|
273
|
+
}
|
|
274
|
+
checks.push('STRUCTURE_OK');
|
|
275
|
+
|
|
276
|
+
// CHECK 2: Signature Validity (Math!)
|
|
277
|
+
const payload = canonicalize(dokoWithoutSignature(doko));
|
|
278
|
+
const sigValid = await mlDsa65.verify(
|
|
279
|
+
doko.publicKey,
|
|
280
|
+
doko.signature,
|
|
281
|
+
payload
|
|
282
|
+
);
|
|
283
|
+
if (!sigValid) {
|
|
284
|
+
return { valid: false, reason: 'INVALID_SIGNATURE' };
|
|
285
|
+
}
|
|
286
|
+
checks.push('SIGNATURE_OK');
|
|
287
|
+
|
|
288
|
+
// CHECK 3: NodeID Derivation (Math + iO!)
|
|
289
|
+
// NodeID is a composite: node-[networkName]-[instanceId]
|
|
290
|
+
// See identity/node-key.js:generateNodeId() for canonical implementation
|
|
291
|
+
const expectedNodeId = generateNodeId(
|
|
292
|
+
hexToBytes(doko.publicKey),
|
|
293
|
+
doko.codebaseHash // Must match our network's codebase hash
|
|
294
|
+
);
|
|
295
|
+
if (doko.nodeId !== expectedNodeId) {
|
|
296
|
+
return { valid: false, reason: 'NODEID_MISMATCH' };
|
|
297
|
+
}
|
|
298
|
+
// Also verify the network portion matches our network
|
|
299
|
+
if (!doko.nodeId.startsWith(`node-${getNetworkName()}-`)) {
|
|
300
|
+
return { valid: false, reason: 'WRONG_NETWORK_IN_NODEID' };
|
|
301
|
+
}
|
|
302
|
+
checks.push('NODEID_OK');
|
|
303
|
+
|
|
304
|
+
// CHECK 4: Temporal Validity (Math!)
|
|
305
|
+
const now = Date.now();
|
|
306
|
+
if (doko.issuedAt > now) {
|
|
307
|
+
return { valid: false, reason: 'ISSUED_IN_FUTURE' };
|
|
308
|
+
}
|
|
309
|
+
if (doko.expiresAt < now) {
|
|
310
|
+
return { valid: false, reason: 'EXPIRED' };
|
|
311
|
+
}
|
|
312
|
+
checks.push('TEMPORAL_OK');
|
|
313
|
+
|
|
314
|
+
// CHECK 5: Network Match
|
|
315
|
+
if (doko.networkName !== config.networkName) {
|
|
316
|
+
return { valid: false, reason: 'WRONG_NETWORK' };
|
|
317
|
+
}
|
|
318
|
+
checks.push('NETWORK_OK');
|
|
319
|
+
|
|
320
|
+
// CHECK 6: Revocation Status
|
|
321
|
+
const revoked = await revocationLog.contains(dokoHash(doko));
|
|
322
|
+
if (revoked) {
|
|
323
|
+
return { valid: false, reason: 'REVOKED' };
|
|
324
|
+
}
|
|
325
|
+
checks.push('NOT_REVOKED');
|
|
326
|
+
|
|
327
|
+
// CHECK 7: Domain Proofs (if claiming domains)
|
|
328
|
+
if (doko.domains && doko.domains.length > 0) {
|
|
329
|
+
for (const domain of doko.domains) {
|
|
330
|
+
const domainValid = await verifyDomainClaim(domain);
|
|
331
|
+
if (!domainValid.valid) {
|
|
332
|
+
return {
|
|
333
|
+
valid: false,
|
|
334
|
+
reason: 'DOMAIN_VERIFICATION_FAILED',
|
|
335
|
+
domain: domain.name,
|
|
336
|
+
detail: domainValid.reason
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
checks.push('DOMAINS_OK');
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// ALL CHECKS PASSED
|
|
344
|
+
return {
|
|
345
|
+
valid: true,
|
|
346
|
+
reason: 'MATHEMATICALLY_VERIFIED',
|
|
347
|
+
checks
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### 4.2 Domain Claim Verification
|
|
353
|
+
|
|
354
|
+
```javascript
|
|
355
|
+
async function verifyDomainClaim(domainClaim) {
|
|
356
|
+
const { name, proofs } = domainClaim;
|
|
357
|
+
|
|
358
|
+
// Need quorum of verifiers
|
|
359
|
+
const QUORUM = 3; // Configurable
|
|
360
|
+
let validProofs = 0;
|
|
361
|
+
|
|
362
|
+
for (const proof of proofs) {
|
|
363
|
+
// Verify the verifier's signature on the beacon hash
|
|
364
|
+
const proofPayload = canonicalize({
|
|
365
|
+
domain: name,
|
|
366
|
+
beaconHash: proof.beaconHash,
|
|
367
|
+
timestamp: proof.timestamp
|
|
368
|
+
});
|
|
369
|
+
|
|
370
|
+
const proofValid = await mlDsa65.verify(
|
|
371
|
+
proof.verifierPublicKey,
|
|
372
|
+
proof.signature,
|
|
373
|
+
proofPayload
|
|
374
|
+
);
|
|
375
|
+
|
|
376
|
+
if (proofValid) {
|
|
377
|
+
// Also verify the verifier is a known trusted node
|
|
378
|
+
const verifierDoko = await khata.lookup(proof.verifierNodeId);
|
|
379
|
+
if (verifierDoko && verifierDoko.capabilities.canVerifyDomains) {
|
|
380
|
+
validProofs++;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
if (validProofs >= QUORUM) {
|
|
386
|
+
return { valid: true, verifiers: validProofs };
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
return {
|
|
390
|
+
valid: false,
|
|
391
|
+
reason: 'INSUFFICIENT_QUORUM',
|
|
392
|
+
have: validProofs,
|
|
393
|
+
need: QUORUM
|
|
394
|
+
};
|
|
395
|
+
}
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
---
|
|
399
|
+
|
|
400
|
+
## 5. Domain Ownership Verification
|
|
401
|
+
|
|
402
|
+
How a node proves it owns a domain (trustlessly):
|
|
403
|
+
|
|
404
|
+
### 5.1 The Process
|
|
405
|
+
|
|
406
|
+
```
|
|
407
|
+
1. Node A wants to claim "example.com"
|
|
408
|
+
2. Node A places SHERPA beacon at:
|
|
409
|
+
https://example.com/.well-known/yakmesh/beacon
|
|
410
|
+
|
|
411
|
+
3. Node A broadcasts domain-claim request to mesh
|
|
412
|
+
|
|
413
|
+
4. K random verifier nodes (B, C, D...) independently:
|
|
414
|
+
a. Fetch https://example.com/.well-known/yakmesh/beacon
|
|
415
|
+
b. Verify beacon contains Node A's nodeId and publicKey
|
|
416
|
+
c. Hash the beacon content
|
|
417
|
+
d. Sign: "I, Node B, saw this beacon hash at this time"
|
|
418
|
+
|
|
419
|
+
5. Node A collects signatures (proofs)
|
|
420
|
+
|
|
421
|
+
6. If >= QUORUM proofs collected:
|
|
422
|
+
- Domain claim is valid
|
|
423
|
+
- Include proofs in DOKO
|
|
424
|
+
- Broadcast via KHATA
|
|
425
|
+
|
|
426
|
+
7. Other nodes verify the proofs mathematically
|
|
427
|
+
- No need to re-fetch the beacon
|
|
428
|
+
- Just verify signatures
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
### 5.2 Beacon Requirements for Domain Claims
|
|
432
|
+
|
|
433
|
+
The SHERPA beacon MUST contain:
|
|
434
|
+
```json
|
|
435
|
+
{
|
|
436
|
+
"version": "1.0",
|
|
437
|
+
"nodeId": "<claiming node's ID>",
|
|
438
|
+
"publicKey": "<claiming node's ML-DSA-65 pubkey>",
|
|
439
|
+
"networkName": "yakmesh-mainnet",
|
|
440
|
+
"timestamp": 1737200000000,
|
|
441
|
+
"signature": "<signed by claiming node>"
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### 5.3 Why This Is Trustless
|
|
446
|
+
|
|
447
|
+
- **No CA decides** - Math verifies signatures
|
|
448
|
+
- **No single verifier** - Need quorum consensus
|
|
449
|
+
- **Transparent** - Anyone can re-verify proofs
|
|
450
|
+
- **Objective** - Either beacon exists or it doesn't
|
|
451
|
+
|
|
452
|
+
---
|
|
453
|
+
|
|
454
|
+
## 6. Revocation Mechanism
|
|
455
|
+
|
|
456
|
+
### 6.1 Revocation Types
|
|
457
|
+
|
|
458
|
+
| Type | Trigger | Authority |
|
|
459
|
+
|------|---------|-----------|
|
|
460
|
+
| `key-compromise` | Private key leaked | DOKO owner |
|
|
461
|
+
| `superseded` | New DOKO issued | DOKO owner |
|
|
462
|
+
| `voluntary` | Owner choice | DOKO owner |
|
|
463
|
+
| `mesh-consensus` | Malicious behavior detected | Quorum of nodes |
|
|
464
|
+
|
|
465
|
+
### 6.2 Revocation Message
|
|
466
|
+
|
|
467
|
+
```javascript
|
|
468
|
+
{
|
|
469
|
+
"type": "khata:revoke",
|
|
470
|
+
"dokoHash": "<SHA3-256 of DOKO being revoked>",
|
|
471
|
+
"reason": "key-compromise",
|
|
472
|
+
"revokedAt": 1737200000000,
|
|
473
|
+
"revokedBy": "<nodeId of revoker>",
|
|
474
|
+
"evidence": "<optional: proof of compromise>",
|
|
475
|
+
"signature": "<ML-DSA-65 signature>"
|
|
476
|
+
}
|
|
477
|
+
```
|
|
478
|
+
|
|
479
|
+
### 6.3 Revocation Verification
|
|
480
|
+
|
|
481
|
+
```javascript
|
|
482
|
+
function verifyRevocation(revocation, originalDoko) {
|
|
483
|
+
// Owner can always revoke their own DOKO
|
|
484
|
+
if (revocation.revokedBy === originalDoko.nodeId) {
|
|
485
|
+
return mlDsa65.verify(
|
|
486
|
+
originalDoko.publicKey,
|
|
487
|
+
revocation.signature,
|
|
488
|
+
canonicalize(revocationWithoutSig)
|
|
489
|
+
);
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
// Mesh consensus revocation requires quorum
|
|
493
|
+
if (revocation.type === 'mesh-consensus') {
|
|
494
|
+
return verifyQuorumRevocation(revocation);
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
return false;
|
|
498
|
+
}
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### 6.4 Append-Only Revocation Log
|
|
502
|
+
|
|
503
|
+
Every node maintains:
|
|
504
|
+
```javascript
|
|
505
|
+
class RevocationLog {
|
|
506
|
+
// Merkle tree of revocation hashes
|
|
507
|
+
// Enables efficient proof of (non-)revocation
|
|
508
|
+
|
|
509
|
+
add(revocation) {
|
|
510
|
+
this.tree.insert(revocation.dokoHash);
|
|
511
|
+
this.persist();
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
contains(dokoHash) {
|
|
515
|
+
return this.tree.has(dokoHash);
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
getProof(dokoHash) {
|
|
519
|
+
return this.tree.getMerkleProof(dokoHash);
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
```
|
|
523
|
+
|
|
524
|
+
---
|
|
525
|
+
|
|
526
|
+
## 7. Integration with SHERPA
|
|
527
|
+
|
|
528
|
+
### 7.1 Enhanced Beacon Format
|
|
529
|
+
|
|
530
|
+
```json
|
|
531
|
+
{
|
|
532
|
+
"version": "1.0",
|
|
533
|
+
"nodeId": "abc123...",
|
|
534
|
+
"publicKey": "<ML-DSA-65 public key>",
|
|
535
|
+
"networkName": "yakmesh-mainnet",
|
|
536
|
+
"timestamp": 1737200000000,
|
|
537
|
+
"ttl": 86400,
|
|
538
|
+
|
|
539
|
+
"namche": {
|
|
540
|
+
"dokoHash": "<hash of this node's current DOKO>",
|
|
541
|
+
"capabilities": {
|
|
542
|
+
"canVerifyDomains": true,
|
|
543
|
+
"canRouteNakpak": true,
|
|
544
|
+
"supportsKhata": true
|
|
545
|
+
},
|
|
546
|
+
"ssl": {
|
|
547
|
+
"hasPublicCert": true,
|
|
548
|
+
"certFingerprint": "sha256:...",
|
|
549
|
+
"issuer": "letsencrypt",
|
|
550
|
+
"domains": ["example.com", "*.example.com"]
|
|
551
|
+
}
|
|
552
|
+
},
|
|
553
|
+
|
|
554
|
+
"peers": [...],
|
|
555
|
+
"signature": "<ML-DSA-65 signature>"
|
|
556
|
+
}
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
### 7.2 Discovery → Verification Flow
|
|
560
|
+
|
|
561
|
+
```
|
|
562
|
+
1. SHERPA discovers node via beacon
|
|
563
|
+
2. Fetch node's DOKO via KHATA
|
|
564
|
+
3. NAMCHE verifies DOKO mathematically
|
|
565
|
+
4. If valid: Add to peer list, enable NAKPAK routing
|
|
566
|
+
5. If invalid: Reject connection, log attempt
|
|
567
|
+
```
|
|
568
|
+
|
|
569
|
+
---
|
|
570
|
+
|
|
571
|
+
## 8. Security Considerations
|
|
572
|
+
|
|
573
|
+
### 8.1 Attack Vectors
|
|
574
|
+
|
|
575
|
+
| Attack | Mitigation |
|
|
576
|
+
|--------|------------|
|
|
577
|
+
| Fake DOKO | Signature verification fails |
|
|
578
|
+
| Stolen private key | Revocation mechanism |
|
|
579
|
+
| Sybil (many fake nodes) | Domain verification requires real domains |
|
|
580
|
+
| Eclipse (surround target) | Multiple independent verifiers |
|
|
581
|
+
| Replay old DOKO | Timestamp + expiration checks |
|
|
582
|
+
| Man-in-the-middle | End-to-end ML-DSA-65 signatures |
|
|
583
|
+
|
|
584
|
+
### 8.2 Cryptographic Assumptions
|
|
585
|
+
|
|
586
|
+
NAMCHE security relies on:
|
|
587
|
+
- **ML-DSA-65** remaining secure (post-quantum)
|
|
588
|
+
- **SHA3-256** remaining collision-resistant
|
|
589
|
+
- **Network majority** being honest (for domain verification)
|
|
590
|
+
|
|
591
|
+
### 8.3 Privacy Considerations
|
|
592
|
+
|
|
593
|
+
- DOKOs are public (by design)
|
|
594
|
+
- Domain claims are public (required for verification)
|
|
595
|
+
- Node endpoints may be hidden via NAKPAK
|
|
596
|
+
|
|
597
|
+
---
|
|
598
|
+
|
|
599
|
+
## 9. Implementation Guide
|
|
600
|
+
|
|
601
|
+
### 9.1 Minimum Viable Implementation
|
|
602
|
+
|
|
603
|
+
```javascript
|
|
604
|
+
// namche.js - Core NAMCHE gateway
|
|
605
|
+
|
|
606
|
+
import { mlDsa65 } from '@yakmesh/crypto';
|
|
607
|
+
import { sha3_256 } from '@yakmesh/hash';
|
|
608
|
+
|
|
609
|
+
export class NamcheGateway {
|
|
610
|
+
constructor(options) {
|
|
611
|
+
this.networkName = options.networkName;
|
|
612
|
+
this.revocationLog = new RevocationLog();
|
|
613
|
+
this.dokoCache = new LRUCache({ max: 10000 });
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
async verify(doko) {
|
|
617
|
+
// Implement 7-step verification from Section 4.1
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
async requestDomainVerification(domain) {
|
|
621
|
+
// Request K verifiers to check beacon
|
|
622
|
+
}
|
|
623
|
+
|
|
624
|
+
async revoke(dokoHash, reason) {
|
|
625
|
+
// Broadcast revocation via KHATA
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
|
|
629
|
+
export class KhataProtocol {
|
|
630
|
+
async announce(doko) { /* ... */ }
|
|
631
|
+
async request(query) { /* ... */ }
|
|
632
|
+
async lookup(nodeId) { /* ... */ }
|
|
633
|
+
async propagateRevocation(revocation) { /* ... */ }
|
|
634
|
+
}
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
### 9.2 Configuration
|
|
638
|
+
|
|
639
|
+
```javascript
|
|
640
|
+
// namche.config.js
|
|
641
|
+
export default {
|
|
642
|
+
// Verification settings
|
|
643
|
+
domainVerificationQuorum: 3,
|
|
644
|
+
domainVerificationTimeout: 30000, // 30 seconds
|
|
645
|
+
|
|
646
|
+
// KHATA propagation
|
|
647
|
+
maxHops: 10,
|
|
648
|
+
announceTTL: 3600000, // 1 hour
|
|
649
|
+
|
|
650
|
+
// Cache settings
|
|
651
|
+
dokoCacheSize: 10000,
|
|
652
|
+
dokoCacheTTL: 86400000, // 24 hours
|
|
653
|
+
|
|
654
|
+
// Network
|
|
655
|
+
networkName: 'yakmesh-mainnet'
|
|
656
|
+
};
|
|
657
|
+
```
|
|
658
|
+
|
|
659
|
+
---
|
|
660
|
+
|
|
661
|
+
## Appendix A: Glossary
|
|
662
|
+
|
|
663
|
+
| Term | Definition |
|
|
664
|
+
|------|------------|
|
|
665
|
+
| **NAMCHE** | Network Authenticated Mesh Certificate Hub & Exchange |
|
|
666
|
+
| **DOKO** | Distributed Ownership & Key Object (the certificate) |
|
|
667
|
+
| **KHATA** | Kryptographic Handshake for Automated Trust Acceptance |
|
|
668
|
+
| **Quorum** | Minimum number of verifiers needed for consensus |
|
|
669
|
+
| **Revocation** | Invalidating a previously valid DOKO |
|
|
670
|
+
|
|
671
|
+
## Appendix B: References
|
|
672
|
+
|
|
673
|
+
- ML-DSA-65 (FIPS 204): Post-quantum digital signatures
|
|
674
|
+
- SHA3-256 (FIPS 202): Cryptographic hash function
|
|
675
|
+
- RFC 8785: JSON Canonicalization Scheme
|
|
676
|
+
- YAKMESH SHERPA Specification
|
|
677
|
+
- YAKMESH NAKPAK Specification
|
|
678
|
+
|
|
679
|
+
---
|
|
680
|
+
|
|
681
|
+
*"The gate opens not by bribe or plea, but by the truth that math reveals."*
|