yakmesh 1.7.1 → 2.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 CHANGED
@@ -2,7 +2,225 @@
2
2
 
3
3
  All notable changes to YAKMESH will be documented in this file.
4
4
 
5
- ## [1.7.0] - 2026-01-18
5
+ ## [2.0.0] - 2026-01-18
6
+
7
+ ### 🧭 NAMCHE Gateway & 📜 DOKO Identity — The "Sherpa Security Stack"
8
+
9
+ This major release introduces **mathematical trust** — replacing certificate authorities with cryptographic proof. The mesh now verifies identity through 7 independent gates, eliminating the need to trust any central authority.
10
+
11
+ > *"The Sherpa does not prove knowledge by certificate. The Sherpa proves knowledge by walking the path."*
12
+
13
+ ---
14
+
15
+ #### 🧭 NAMCHE: Network Authenticated Mesh Certificate Hub & Exchange
16
+
17
+ A 7-gate verification gateway inspired by Nepal's Namche Bazaar — the last checkpoint before Everest.
18
+
19
+ ##### The 7 Gates of Verification
20
+ | Gate | Name | Verification |
21
+ |------|------|-------------|
22
+ | 1 | Cryptographic Gate | Valid ML-DSA-65 signature |
23
+ | 2 | Format Gate | DOKO structure compliance |
24
+ | 3 | Temporal Gate | Not expired, within clock tolerance |
25
+ | 4 | Domain Gate | DNS TXT record verification |
26
+ | 5 | Mesh Gate | 3+ peer endorsements (KHATA protocol) |
27
+ | 6 | Behavioral Gate | Historical trust score ≥ threshold |
28
+ | 7 | Freshness Gate | Proof-of-liveliness within 5 minutes |
29
+
30
+ ##### New Module: `security/namche-gateway.js`
31
+ - `NamcheGateway` - Main verification orchestrator
32
+ - `GateResult` - Individual gate pass/fail with evidence
33
+ - `VerificationReport` - Complete 7-gate assessment
34
+ - `TrustDecision` - Final ALLOW/DENY/CHALLENGE decision
35
+
36
+ ##### Trust Levels
37
+ ```javascript
38
+ TRUST_LEVELS = {
39
+ UNTRUSTED: 0, // Failed critical gates
40
+ BRONZE: 1, // Passed gates 1-3 only
41
+ SILVER: 2, // Passed gates 1-5
42
+ GOLD: 3, // Passed all 7 gates
43
+ PLATINUM: 4 // Gold + extended history
44
+ }
45
+ ```
46
+
47
+ ---
48
+
49
+ #### 📜 DOKO: Distributed Ownership & Key Object
50
+
51
+ Self-sovereign identity documents verified by the mesh, not a CA.
52
+
53
+ ##### New Module: `security/doko-identity.js`
54
+ - `DOKODocument` - The identity document structure
55
+ - `DOKOGenerator` - Create new DOKO documents
56
+ - `DOKOValidator` - Validate document structure and signatures
57
+ - `DOKOExtensions` - Optional capability declarations
58
+
59
+ ##### DOKO Structure
60
+ ```javascript
61
+ {
62
+ version: "1.0",
63
+ type: "node" | "user" | "service" | "device",
64
+ nodeId: "cryptographic-hash",
65
+ publicKey: "ML-DSA-65 public key",
66
+ created: 1737225600000,
67
+ expires: 1768761600000,
68
+ claims: {
69
+ domain: "example.com",
70
+ name: "My Node"
71
+ },
72
+ extensions: {
73
+ capabilities: ["annex", "nakpak", "sherpa"],
74
+ tlsBinding: { ... }
75
+ },
76
+ endorsements: [...],
77
+ signature: "self-signature"
78
+ }
79
+ ```
80
+
81
+ ---
82
+
83
+ #### 🔐 mTLS Phase 1: TLS Certificate Binding
84
+
85
+ Bind DOKO identity to X.509 certificates for TLS-level verification.
86
+
87
+ ##### New Module: `security/tls-binding.js`
88
+ - `DOKOCertificateGenerator` - Create X.509 certs from DOKO
89
+ - `TLSVerifier` - Verify TLS connections against DOKO
90
+ - `TLSCapabilityAdvertiser` - Announce TLS capabilities to mesh
91
+
92
+ ---
93
+
94
+ #### 🤝 Hybrid Trust Model
95
+
96
+ Multi-factor trust assessment combining cryptographic proof with behavioral history.
97
+
98
+ ##### New Module: `security/hybrid-trust.js`
99
+ - `TrustEvidence` - Collect evidence from multiple sources
100
+ - `HybridTrustModel` - Calculate weighted trust scores
101
+ - `TrustBasedAccessControl` - Gate features by trust level
102
+
103
+ ##### Trust Factors
104
+ | Factor | Weight | Source |
105
+ |--------|--------|--------|
106
+ | Cryptographic | 40% | NAMCHE gates 1-3 |
107
+ | Social | 25% | Mesh endorsements (KHATA) |
108
+ | Behavioral | 20% | Historical interactions |
109
+ | Temporal | 15% | Identity age, freshness |
110
+
111
+ ---
112
+
113
+ #### 🌐 Domain Consensus Protocol
114
+
115
+ Mesh-verified domain ownership without centralized DNS authorities.
116
+
117
+ ##### New Module: `security/domain-consensus.js`
118
+ - `DomainClaim` - Claim domain ownership
119
+ - `DomainConsensus` - Multi-peer verification
120
+ - `DNSVerifier` - Check DNS TXT records
121
+
122
+ ---
123
+
124
+ #### 📊 Test Coverage
125
+
126
+ | Module | Tests | Status |
127
+ |--------|-------|--------|
128
+ | NAMCHE Gateway | 37 | ✅ Passing |
129
+ | Domain Consensus | 36 | ✅ Passing |
130
+ | TLS Binding | 26 | ✅ Passing |
131
+ | Hybrid Trust | 30 | ✅ Passing |
132
+ | **Total Security** | **129** | ✅ All Passing |
133
+
134
+ ---
135
+
136
+ #### 🏔️ The Sherpa Protocol Family
137
+
138
+ | Protocol | Full Name | Purpose |
139
+ |----------|-----------|---------|
140
+ | **NAMCHE** | Network Authenticated Mesh Certificate Hub & Exchange | 7-gate verification |
141
+ | **DOKO** | Distributed Ownership & Key Object | Self-sovereign identity |
142
+ | **SHERPA** | Secure Hidden Endpoint Resolution Path Architecture | Peer discovery |
143
+ | **NAKPAK** | NAK Protocol for Anonymous Kommunication | Onion routing |
144
+ | **ANNEX** | Autonomous Network Negotiated eXchange | Encrypted P2P channels |
145
+ | **KHATA** | Kryptographic Handshake for Automated Trust Acceptance | Trust distribution |
146
+
147
+ ---
148
+
149
+ #### Breaking Changes
150
+
151
+ - `identity.js` replaced by `doko-identity.js` (migration guide in docs)
152
+ - Trust verification now requires NAMCHE gateway for new connections
153
+ - Minimum Node.js version: 18.0.0
154
+
155
+ #### Migration Guide
156
+
157
+ ```javascript
158
+ // Before (v1.x)
159
+ import { Identity } from 'yakmesh/oracle/identity';
160
+ const id = new Identity();
161
+
162
+ // After (v2.0)
163
+ import { DOKOGenerator } from 'yakmesh/security/doko-identity';
164
+ const doko = await DOKOGenerator.create({ type: 'node', claims: { name: 'My Node' } });
165
+ ```
166
+
167
+ ---
168
+
169
+ ## [1.8.0] - 2026-01-18
170
+
171
+ ### 🏔️ SHERPA: Decentralized Peer Discovery
172
+
173
+ This release implements SHERPA, a novel peer discovery mechanism that uses the public web as a decentralized DHT.
174
+
175
+ #### New Feature: SHERPA Discovery
176
+
177
+ ##### The Innovation: "The Web IS the DHT"
178
+ - Each node exposes `/.well-known/yakmesh/beacon` with its peer list
179
+ - Discovery crawls known endpoints to find new peers
180
+ - No central authority - truly decentralized bootstrap
181
+ - Works with existing CDN infrastructure
182
+
183
+ ##### New Module: `mesh/sherpa-discovery.js`
184
+ - `SherpaDiscovery` - Main discovery engine with peer crawling
185
+ - `BeaconMessage` - Signed beacon format for peer advertisement
186
+ - `PeerRegistry` - Scored peer management with decay
187
+ - `createBeaconMiddleware` - Express middleware for beacon endpoint
188
+
189
+ ##### New Endpoints
190
+ - `GET /.well-known/yakmesh/beacon` - Advertise this node and known peers
191
+ - `GET /sherpa/status` - Discovery statistics
192
+ - `GET /sherpa/candidates` - Get connection candidates
193
+
194
+ ##### Configuration
195
+ ```javascript
196
+ // yakmesh.config.js
197
+ export default {
198
+ sherpa: {
199
+ enabled: true,
200
+ selfEndpoint: 'https://mynode.example.com',
201
+ wsEndpoint: 'wss://mynode.example.com:9001',
202
+ seeds: ['https://peer1.example.com', 'https://peer2.example.com'],
203
+ },
204
+ };
205
+ ```
206
+
207
+ ##### Beacon Response Format
208
+ ```json
209
+ {
210
+ "version": "1.0",
211
+ "nodeId": "abc123...",
212
+ "networkName": "mobius-rabi-junction",
213
+ "timestamp": 1737225600000,
214
+ "capabilities": { "wsPort": 9001, "supportsAnnex": true },
215
+ "peers": [{ "nodeId": "...", "endpoint": "https://..." }],
216
+ "publicKey": "...",
217
+ "signature": "..."
218
+ }
219
+ ```
220
+
221
+ ---
222
+
223
+ ## [1.7.1] - 2026-01-18
6
224
 
7
225
  ### 🦬 NAKPAK & SHERPA: Yak-Themed Protocol Naming
8
226
 
package/README.md CHANGED
@@ -52,6 +52,15 @@ In an era where traditional ECDSA is increasingly vulnerable and network jitter
52
52
  - 🔌 **Plugin Architecture** - Adapters for any database or API
53
53
  - 🛡️ **Phase Modulation** - Time-based anti-replay protection
54
54
 
55
+ ### v2.0 — The Sherpa Security Stack
56
+
57
+ - 🧭 **NAMCHE Gateway** - 7-gate mathematical verification (no CA required)
58
+ - 📜 **DOKO Identity** - Self-sovereign identity documents verified by mesh
59
+ - 🏔️ **SHERPA Discovery** - Decentralized peer discovery via public web beacons
60
+ - 🎒 **NAKPAK Routing** - Post-quantum onion routing for anonymity
61
+ - 🔐 **ANNEX Channels** - ML-KEM768 encrypted P2P with perfect forward secrecy
62
+ - 🤝 **Hybrid Trust** - Multi-factor trust combining crypto + behavior + social proof
63
+
55
64
  ## Quick Start
56
65
 
57
66
  ```bash
@@ -90,11 +99,18 @@ Full documentation available at **[yakmesh.dev](https://yakmesh.dev)**
90
99
 
91
100
  ```
92
101
  yakmesh/
102
+ ├── security/ # NAMCHE gateway, DOKO identity, trust models
103
+ │ ├── namche-gateway.js # 7-gate verification
104
+ │ ├── doko-identity.js # Self-sovereign identity
105
+ │ ├── hybrid-trust.js # Multi-factor trust scoring
106
+ │ ├── tls-binding.js # mTLS certificate binding
107
+ │ └── domain-consensus.js # Mesh-verified domains
93
108
  ├── oracle/ # Self-verifying validation engine
94
109
  ├── mesh/ # WebSocket P2P networking
110
+ │ ├── sherpa-discovery.js # Decentralized peer discovery
111
+ │ ├── nakpak-routing.js # Onion routing
112
+ │ └── annex-channel.js # Encrypted P2P channels
95
113
  ├── gossip/ # Epidemic-style message propagation
96
- ├── identity/ # Post-quantum key management
97
- ├── database/ # SQLite replication engine
98
114
  ├── adapters/ # Platform integration plugins
99
115
  ├── webserver/ # Embedded Caddy web server
100
116
  └── server/ # HTTP/WS server
package/SECURITY.md CHANGED
@@ -47,6 +47,89 @@ YAKMESH implements multiple layers of security:
47
47
  - **Replay Protection**: Phase-epoch based message validation
48
48
  - **Code Integrity**: Self-verifying oracle with module sealing
49
49
 
50
+ ---
51
+
52
+ ## 🔒 Protected Architectural Elements
53
+
54
+ > **WARNING**: The following architectural decisions are FOUNDATIONAL.
55
+ > They MUST NOT be changed without explicit cryptographic review.
56
+
57
+ ### NodeID Generation (CRITICAL)
58
+
59
+ **Location**: `identity/node-key.js`
60
+
61
+ The NodeID is a **two-part composite**:
62
+
63
+ ```
64
+ node-[networkName]-[instanceId]
65
+ ```
66
+
67
+ | Component | Derived From | Purpose |
68
+ |-----------|--------------|---------|
69
+ | `networkName` | Codebase hash via iO | Proves nodes run identical code |
70
+ | `instanceId` | Public key hash via iO | Unique per node instance |
71
+
72
+ **Security Properties**:
73
+ 1. **Codebase Integrity** - Network name proves nodes run identical code
74
+ 2. **Instance Uniqueness** - Instance ID is deterministically tied to keypair
75
+ 3. **Human Verifiability** - Word-based names can be verified verbally
76
+ 4. **Network Segmentation** - Different code versions form separate networks
77
+
78
+ **Rejected Simplifications**:
79
+
80
+ | Proposal | Status | Reason |
81
+ |----------|--------|--------|
82
+ | `NodeID = SHA3-256(publicKey)` | ❌ REJECTED | Removes codebase verification |
83
+ | `NodeID = base64(publicKey)` | ❌ REJECTED | Same as above, plus loses readability |
84
+ | `NodeID = UUID` | ❌ REJECTED | Breaks deterministic derivation |
85
+ | Remove codebase hash | ❌ REJECTED | Destroys network segmentation |
86
+
87
+ ### iO Oracle Integration (CRITICAL)
88
+
89
+ **Location**: `oracle/`
90
+
91
+ The indistinguishability obfuscation (iO) oracle provides:
92
+ - Deterministic codebase hashing
93
+ - Network identity derivation
94
+ - Phase modulation for replay protection
95
+
96
+ **DO NOT**:
97
+ - Bypass the oracle for "faster" identity generation
98
+ - Cache identities without oracle verification
99
+ - Accept identities that don't match expected network name
100
+
101
+ ### Security Anti-Pattern Examples
102
+
103
+ ```javascript
104
+ // ❌ WRONG: Simplified NodeID (NEVER DO THIS)
105
+ const nodeId = sha3_256(publicKey);
106
+
107
+ // ✅ CORRECT: Full iO-based derivation
108
+ const nodeId = generateNodeId(publicKey, codebaseHash);
109
+ ```
110
+
111
+ ---
112
+
113
+ ## 📋 Security Review Checklist
114
+
115
+ Before merging any identity/crypto changes:
116
+
117
+ - [ ] Does it maintain the two-part NodeID structure?
118
+ - [ ] Does it preserve codebase hash in identity derivation?
119
+ - [ ] Does it use ML-DSA-65 (not classical crypto)?
120
+ - [ ] Does it verify signatures before trusting data?
121
+ - [ ] Does it respect the iO oracle's role?
122
+
123
+ ---
124
+
125
+ ## 🕒 Security Incident Log
126
+
127
+ | Date | Description | Resolution |
128
+ |------|-------------|------------|
129
+ | 2026-01-18 | NAMCHE spec draft proposed `NodeID = SHA3-256(publicKey)` | Rejected. Spec corrected to document actual two-part design. Security warnings added to codebase. |
130
+
131
+ ---
132
+
50
133
  ## Known Limitations
51
134
 
52
135
  - NTP time sources are not suitable for oracle operations (use GPS/PTP/Atomic)