yakmesh 1.3.0 → 1.3.1

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,6 +2,24 @@
2
2
 
3
3
  All notable changes to YAKMESH will be documented in this file.
4
4
 
5
+ ## [1.3.1] - 2026-01-16
6
+
7
+ ### Security
8
+ - Hardened peer handshake protocol validation
9
+ - Enhanced network fingerprint verification in HELLO/WELCOME exchange
10
+ - Added CodebaseLock module for runtime source integrity
11
+
12
+ ### Added
13
+ - 3-node test infrastructure for protocol verification
14
+ - iO-style (indistinguishability obfuscation) network identity derivation
15
+ - Human-readable network names from codebase fingerprint
16
+
17
+ ### Fixed
18
+ - Config path resolution for relative/absolute paths
19
+ - Test suite node ID prefix assertion
20
+
21
+ ---
22
+
5
23
  ## [1.3.0] - 2026-01-15
6
24
 
7
25
  ### 🌟 Major New Systems - "A Beacon in the Darkness"
@@ -40,6 +58,19 @@ All notable changes to YAKMESH will be documented in this file.
40
58
  - Timing attack resistance in PHANTOM
41
59
  - Improved rate limiting integration
42
60
 
61
+ ### 🛡️ Code Proof Protocol Hardening
62
+ - **CRITICAL FIX**: HELLO message now includes `networkFingerprint`
63
+ - **CRITICAL FIX**: WELCOME handler validates fingerprint, rejects mismatches (code 1008)
64
+ - Added `CodebaseLock` module for runtime source file protection
65
+ - Fixed config loading for relative/absolute path handling
66
+ - Comprehensive 3-node test suite: 17/17 tests passing
67
+ - Same-codebase peering verification
68
+ - Cross-codebase rejection (bidirectional)
69
+ - N-way fingerprint isolation matrix
70
+ - Empty/partial fingerprint attack blocking
71
+ - Flood attack resistance (20 simultaneous rejected)
72
+ - Fingerprint spoofing prevention
73
+
43
74
  ---
44
75
 
45
76
  ## [1.2.0] - 2026-01-15
@@ -79,4 +110,4 @@ All notable changes to YAKMESH will be documented in this file.
79
110
  - ML-DSA-65 post-quantum signatures
80
111
  - SQLite-based distributed oracle
81
112
  - WebSocket mesh networking
82
- - Phase-based consensus timing
113
+ - Phase-based consensus timing
package/README.md CHANGED
@@ -1,185 +1,185 @@
1
- <div align="center">
2
- <img src="https://yakmesh.dev/assets/yakmesh-logo2.png" alt="YAKMESH" width="200">
3
-
4
- <h1>🏔️ YAKMESH™: Sturdy & Secure</h1>
5
-
6
- <p><strong>Yielding Atomic Kernel Modular Encryption Secured Hub</strong></p>
7
-
8
- <p>
9
- <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
10
- <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node.js-18+-green.svg" alt="Node.js"></a>
11
- <a href="https://csrc.nist.gov/projects/post-quantum-cryptography"><img src="https://img.shields.io/badge/Crypto-Post--Quantum-blue.svg" alt="Post-Quantum"></a>
12
- <a href="https://www.npmjs.com/package/yakmesh"><img src="https://img.shields.io/npm/v/yakmesh.svg" alt="npm version"></a>
13
- </p>
14
- </div>
15
-
16
- ---
17
-
18
- YAKMESH is a high-resiliency, decentralized networking layer designed for the 2026 threat landscape. Built with quantum-resistant cryptography at its core and anchored by PCIe atomic timing synchronization, YAKMESH provides a "sturdy" substrate for distributed systems that cannot afford to fail.
19
-
20
- ## Why YAKMESH?
21
-
22
- In an era where traditional ECDSA is increasingly vulnerable and network jitter can desynchronize global state, YAKMESH offers a three-pillar solution:
23
-
24
- 🌿 **Yielding Resilience**: A self-healing mesh topology that adapts to node failure and adversarial interference without central authority.
25
-
26
- ⚛️ **Atomic Precision**: Integrated support for PCIe atomic clock hardware, enabling nanosecond-level hardware timestamping for low-latency synchronization.
27
-
28
- 🔐 **Quantum Hardened**: Fully compatible with Project Zond and the QRL (Quantum Resistant Ledger) ecosystem, utilizing stateless lattice-based signatures (ML-DSA) from Genesis.
29
-
30
- ---
31
-
32
- ## The Y.A.K.M.E.S.H. Philosophy
33
-
34
- | Letter | Principle | Description |
35
- |--------|-----------|-------------|
36
- | **Y** | **Yielding** | Not brittle; flexible enough to absorb network shocks |
37
- | **A** | **Atomic** | Grounded in the absolute truth of physical time |
38
- | **K** | **Kernel** | The essential, innermost part of the secure stack |
39
- | **M** | **Modular** | Swap out encryption primitives or transport layers as tech evolves |
40
- | **E** | **Encryption** | Privacy and integrity by default |
41
- | **S** | **Secured** | Hardened against both classical and quantum vectors |
42
- | **H** | **Hub** | A nexus for decentralized data and peer-to-peer logic |
43
-
44
- ---
45
-
46
- ## Features
47
-
48
- - 🔒 **Post-Quantum Secure** - ML-DSA-65 (NIST FIPS 204) signatures
49
- - 🔮 **Self-Verifying Oracle** - Deterministic validation without external trust
50
- - 🌐 **Mesh Networking** - P2P WebSocket communication with gossip protocol
51
- - ⏱️ **Precision Timing** - Support for atomic clocks, GPS, PTP, NTP
52
- - 🔌 **Plugin Architecture** - Adapters for any database or API
53
- - 🛡️ **Phase Modulation** - Time-based anti-replay protection
54
-
55
- ## Quick Start
56
-
57
- ```bash
58
- npm install yakmesh
59
- ```
60
-
61
- ```javascript
62
- import { YakmeshNode } from 'yakmesh';
63
-
64
- const node = new YakmeshNode({
65
- node: { name: 'My Node' },
66
- network: { httpPort: 3000, wsPort: 9001 },
67
- });
68
-
69
- await node.start();
70
- ```
71
-
72
- ## CLI
73
-
74
- ```bash
75
- # Initialize a new node
76
- npx yakmesh init
77
-
78
- # Start the node
79
- npx yakmesh start
80
-
81
- # Check status
82
- npx yakmesh status
83
- ```
84
-
85
- ## Documentation
86
-
87
- Full documentation available at **[yakmesh.dev](https://yakmesh.dev)**
88
-
89
- ## Architecture
90
-
91
- ```
92
- yakmesh/
93
- ├── oracle/ # Self-verifying validation engine
94
- ├── mesh/ # WebSocket P2P networking
95
- ├── gossip/ # Epidemic-style message propagation
96
- ├── identity/ # Post-quantum key management
97
- ├── database/ # SQLite replication engine
98
- ├── adapters/ # Platform integration plugins
99
- ├── webserver/ # Embedded Caddy web server
100
- └── server/ # HTTP/WS server
101
- ```
102
-
103
- ## Network Identity
104
-
105
- Each YAKMESH network has a unique identity derived from configurable salts:
106
-
107
- ```javascript
108
- import { setIdentityConfig } from 'yakmesh/oracle/network-identity.js';
109
-
110
- setIdentityConfig({
111
- networkPrefix: 'my', // Network ID prefix
112
- identitySalt: 'my-app-v1', // Unique network salt
113
- });
114
-
115
- // Different salt = different network (cannot interoperate)
116
- ```
117
-
118
- ## Time Source Trust Levels
119
-
120
- | Level | Source | Tolerance | Oracle Capable |
121
- |-------|--------|-----------|----------------|
122
- | ATOMIC | PCIe atomic clock | ±100ms | ✅ Yes |
123
- | GPS | GPS with PPS | ±500ms | ✅ Yes |
124
- | PTP | IEEE 1588 (Meinberg) | ±500ms | ⚠️ Partial |
125
- | NTP | Standard NTP | ±5000ms | ❌ No |
126
-
127
- ## Adapters
128
-
129
- Create custom adapters by extending `BaseAdapter`:
130
-
131
- ```javascript
132
- import { BaseAdapter } from 'yakmesh/adapters/base-adapter.js';
133
-
134
- class MyAdapter extends BaseAdapter {
135
- async init() { /* Connect to your database */ }
136
- getSchema() { return { tables: ['users', 'orders'] }; }
137
- async fetchChanges(since) { /* Return changed records */ }
138
- async applyChange(table, record, op) { /* Write to database */ }
139
- }
140
- ```
141
-
142
- ### Official Adapters
143
-
144
- - `@yakmesh/adapter-peerquanta` - PeerQuanta phpBB marketplace
145
-
146
- ## API Endpoints
147
-
148
- | Endpoint | Method | Description |
149
- |----------|--------|-------------|
150
- | `/health` | GET | Node health status |
151
- | `/node` | GET | Node identity info |
152
- | `/peers` | GET | Connected peers |
153
- | `/oracle/status` | GET | Oracle integrity check |
154
- | `/network/identity` | GET | Network identity (hash obfuscated) |
155
- | `/time/status` | GET | Time source detection |
156
- | `/time/capabilities` | GET | Time oracle eligibility |
157
- | `/connect` | POST | Connect to a peer |
158
-
159
- ## Pro Features
160
-
161
- YAKMESH Pro includes additional security features:
162
-
163
- - 🔐 **WebSocket Authentication** - Challenge-response auth with signatures
164
- - 🔒 **Message Encryption** - XChaCha20-Poly1305 encrypted messages
165
- - 📋 **Peer Allowlist/Blocklist** - Access control for private networks
166
- - 🛡️ **Connection Rate Limiting** - DDoS protection
167
-
168
- ## License
169
-
170
- - **Community Edition**: MIT License (see [LICENSE](LICENSE))
171
- - **Pro Edition**: Proprietary License
172
-
173
- See [TRADEMARK.md](TRADEMARK.md) for trademark usage policy.
174
-
175
- ---
176
-
177
- <div align="center">
178
- <sub>Built with quantum principles. Secured by math.</sub>
179
- <br><br>
180
- <strong><a href="https://yakmesh.dev">yakmesh.dev</a></strong>
181
- <br><br>
182
- <sub>© 2026 YAKMESH™ Project. Sturdy & Secure.</sub>
183
- <br>
184
- <sub>YAKMESH™ is a trademark of PeerQuanta, application pending (Serial No. 99594620).</sub>
185
- </div>
1
+ <div align="center">
2
+ <img src="https://yakmesh.dev/assets/yakmesh-logo2.png" alt="YAKMESH" width="200">
3
+
4
+ <h1>🏔️ YAKMESH™: Sturdy & Secure</h1>
5
+
6
+ <p><strong>Yielding Atomic Kernel Modular Encryption Secured Hub</strong></p>
7
+
8
+ <p>
9
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
10
+ <a href="https://nodejs.org"><img src="https://img.shields.io/badge/Node.js-18+-green.svg" alt="Node.js"></a>
11
+ <a href="https://csrc.nist.gov/projects/post-quantum-cryptography"><img src="https://img.shields.io/badge/Crypto-Post--Quantum-blue.svg" alt="Post-Quantum"></a>
12
+ <a href="https://www.npmjs.com/package/yakmesh"><img src="https://img.shields.io/npm/v/yakmesh.svg" alt="npm version"></a>
13
+ </p>
14
+ </div>
15
+
16
+ ---
17
+
18
+ YAKMESH is a high-resiliency, decentralized networking layer designed for the 2026 threat landscape. Built with quantum-resistant cryptography at its core and anchored by PCIe atomic timing synchronization, YAKMESH provides a "sturdy" substrate for distributed systems that cannot afford to fail.
19
+
20
+ ## Why YAKMESH?
21
+
22
+ In an era where traditional ECDSA is increasingly vulnerable and network jitter can desynchronize global state, YAKMESH offers a three-pillar solution:
23
+
24
+ 🌿 **Yielding Resilience**: A self-healing mesh topology that adapts to node failure and adversarial interference without central authority.
25
+
26
+ ⚛️ **Atomic Precision**: Integrated support for PCIe atomic clock hardware, enabling hardware timestamping with support for high-precision time sources for low-latency synchronization.
27
+
28
+ 🔐 **Quantum Hardened**: Fully compatible with Project Zond and the QRL (Quantum Resistant Ledger) ecosystem, utilizing stateless lattice-based signatures (ML-DSA) from Genesis.
29
+
30
+ ---
31
+
32
+ ## The Y.A.K.M.E.S.H. Philosophy
33
+
34
+ | Letter | Principle | Description |
35
+ |--------|-----------|-------------|
36
+ | **Y** | **Yielding** | Not brittle; flexible enough to absorb network shocks |
37
+ | **A** | **Atomic** | Grounded in the absolute truth of physical time |
38
+ | **K** | **Kernel** | The essential, innermost part of the secure stack |
39
+ | **M** | **Modular** | Swap out encryption primitives or transport layers as tech evolves |
40
+ | **E** | **Encryption** | Privacy and integrity by default |
41
+ | **S** | **Secured** | Hardened against both classical and quantum vectors |
42
+ | **H** | **Hub** | A nexus for decentralized data and peer-to-peer logic |
43
+
44
+ ---
45
+
46
+ ## Features
47
+
48
+ - 🔒 **Post-Quantum Secure** - ML-DSA-65 (NIST FIPS 204) signatures
49
+ - 🔮 **Self-Verifying Oracle** - Deterministic validation without external trust
50
+ - 🌐 **Mesh Networking** - P2P WebSocket communication with gossip protocol
51
+ - ⏱️ **Precision Timing** - Support for atomic clocks, GPS, PTP, NTP
52
+ - 🔌 **Plugin Architecture** - Adapters for any database or API
53
+ - 🛡️ **Phase Modulation** - Time-based anti-replay protection
54
+
55
+ ## Quick Start
56
+
57
+ ```bash
58
+ npm install yakmesh
59
+ ```
60
+
61
+ ```javascript
62
+ import { YakmeshNode } from 'yakmesh';
63
+
64
+ const node = new YakmeshNode({
65
+ node: { name: 'My Node' },
66
+ network: { httpPort: 3000, wsPort: 9001 },
67
+ });
68
+
69
+ await node.start();
70
+ ```
71
+
72
+ ## CLI
73
+
74
+ ```bash
75
+ # Initialize a new node
76
+ npx yakmesh init
77
+
78
+ # Start the node
79
+ npx yakmesh start
80
+
81
+ # Check status
82
+ npx yakmesh status
83
+ ```
84
+
85
+ ## Documentation
86
+
87
+ Full documentation available at **[yakmesh.dev](https://yakmesh.dev)**
88
+
89
+ ## Architecture
90
+
91
+ ```
92
+ yakmesh/
93
+ ├── oracle/ # Self-verifying validation engine
94
+ ├── mesh/ # WebSocket P2P networking
95
+ ├── gossip/ # Epidemic-style message propagation
96
+ ├── identity/ # Post-quantum key management
97
+ ├── database/ # SQLite replication engine
98
+ ├── adapters/ # Platform integration plugins
99
+ ├── webserver/ # Embedded Caddy web server
100
+ └── server/ # HTTP/WS server
101
+ ```
102
+
103
+ ## Network Identity
104
+
105
+ Each YAKMESH network has a unique identity derived from configurable salts:
106
+
107
+ ```javascript
108
+ import { setIdentityConfig } from 'yakmesh/oracle/network-identity.js';
109
+
110
+ setIdentityConfig({
111
+ networkPrefix: 'my', // Network ID prefix
112
+ identitySalt: 'my-app-v1', // Unique network salt
113
+ });
114
+
115
+ // Different salt = different network (cannot interoperate)
116
+ ```
117
+
118
+ ## Time Source Trust Levels
119
+
120
+ | Level | Source | Tolerance | Oracle Capable |
121
+ |-------|--------|-----------|----------------|
122
+ | ATOMIC | PCIe atomic clock | ±100ms | ✅ Yes |
123
+ | GPS | GPS with PPS | ±500ms | ✅ Yes |
124
+ | PTP | IEEE 1588 (Meinberg) | ±500ms | ⚠️ Partial |
125
+ | NTP | Standard NTP | ±5000ms | ❌ No |
126
+
127
+ ## Adapters
128
+
129
+ Create custom adapters by extending `BaseAdapter`:
130
+
131
+ ```javascript
132
+ import { BaseAdapter } from 'yakmesh/adapters/base-adapter.js';
133
+
134
+ class MyAdapter extends BaseAdapter {
135
+ async init() { /* Connect to your database */ }
136
+ getSchema() { return { tables: ['users', 'orders'] }; }
137
+ async fetchChanges(since) { /* Return changed records */ }
138
+ async applyChange(table, record, op) { /* Write to database */ }
139
+ }
140
+ ```
141
+
142
+ ### Official Adapters
143
+
144
+ - `@yakmesh/adapter-peerquanta` - PeerQuanta phpBB marketplace
145
+
146
+ ## API Endpoints
147
+
148
+ | Endpoint | Method | Description |
149
+ |----------|--------|-------------|
150
+ | `/health` | GET | Node health status |
151
+ | `/node` | GET | Node identity info |
152
+ | `/peers` | GET | Connected peers |
153
+ | `/oracle/status` | GET | Oracle integrity check |
154
+ | `/network/identity` | GET | Network identity (hash obfuscated) |
155
+ | `/time/status` | GET | Time source detection |
156
+ | `/time/capabilities` | GET | Time oracle eligibility |
157
+ | `/connect` | POST | Connect to a peer |
158
+
159
+ ## Pro Features
160
+
161
+ YAKMESH Pro includes additional security features:
162
+
163
+ - 🔐 **WebSocket Authentication** - Challenge-response auth with signatures
164
+ - 🔒 **Message Encryption** - XChaCha20-Poly1305 encrypted messages
165
+ - 📋 **Peer Allowlist/Blocklist** - Access control for private networks
166
+ - 🛡️ **Connection Rate Limiting** - DDoS protection
167
+
168
+ ## License
169
+
170
+ - **Community Edition**: MIT License (see [LICENSE](LICENSE))
171
+ - **Pro Edition**: Proprietary License
172
+
173
+ See [TRADEMARK.md](TRADEMARK.md) for trademark usage policy.
174
+
175
+ ---
176
+
177
+ <div align="center">
178
+ <sub>Built with quantum principles. Secured by math.</sub>
179
+ <br><br>
180
+ <strong><a href="https://yakmesh.dev">yakmesh.dev</a></strong>
181
+ <br><br>
182
+ <sub>© 2026 YAKMESH™ Project. Sturdy & Secure.</sub>
183
+ <br>
184
+ <sub>YAKMESH™ is a trademark of PeerQuanta, application pending (Serial No. 99594620).</sub>
185
+ </div>
package/discord.md CHANGED
@@ -1,74 +1,74 @@
1
- # 🦬 YAKMESH™ — Post-Quantum Mesh Networking
2
-
3
- **The Yielding Atomic Kernel for quantum-resistant mesh orchestration**
4
-
5
- ```
6
- npm install yakmesh
7
- ```
8
-
9
- ---
10
-
11
- ## ⚡ What is YAKMESH?
12
-
13
- A **post-quantum secure** mesh networking library featuring:
14
-
15
- 🔐 **ML-DSA-65 Signatures** — NIST FIPS 204 standard, quantum-resistant
16
- ⏱️ **Atomic Time Sync** — Nanosecond precision for mesh coordination
17
- 🛡️ **TME™ (Temporal Matrix Encoding)** — Novel packet resilience without retransmission
18
-
19
- ---
20
-
21
- ## 🆚 How is TME Different?
22
-
23
- | Walrus/Red Stuff | YAKMESH TME |
24
- |------------------|-------------|
25
- | Encodes across **space** (nodes) | Encodes across **time** (slices) |
26
- | For storage | For transmission |
27
- | Retransmit on loss | **Zero latency** recovery |
28
-
29
- > *"Time IS the redundancy dimension."*
30
-
31
- ---
32
-
33
- ## 🛠️ Quick Start
34
-
35
- ```js
36
- import { TemporalMeshEncoder } from 'yakmesh';
37
-
38
- const encoder = new TemporalMeshEncoder();
39
- const { slices } = encoder.encode('Hello mesh!');
40
- // Slices sent across different paths
41
- // Lost slices reconstructed from timing proofs
42
- ```
43
-
44
- ---
45
-
46
- ## 🔒 Security Modules
47
-
48
- - **NAVR** — Sybil attack prevention (computational identity puzzle)
49
- - **Replay Defense** — Nonces + timestamps + sequence tracking
50
- - **Rate Limiter** — DoS protection (30 conn/min per IP)
51
- - **Message Validator** — Size limits, depth checks, prototype pollution protection
52
-
53
- ---
54
-
55
- ## 📦 Current Version: `1.2.0`
56
-
57
- ✅ TME (Temporal Matrix Encoding)
58
- ✅ ML-DSA-65 Post-Quantum Signatures
59
- ✅ Full security hardening suite
60
- ✅ 42+ tests passing
61
-
62
- ---
63
-
64
- **Links:**
65
- 🌐 Website: https://yakmesh.dev
66
- 📦 npm: https://npmjs.com/package/yakmesh
67
- 📖 GitHub: https://github.com/yakmesh/yakmesh
68
- 📄 Whitepaper: `docs/WHITEPAPER.md`
69
-
70
- **USPTO Serial No. 99594620**
71
-
72
- ---
73
-
1
+ # 🦬 YAKMESH™ — Post-Quantum Mesh Networking
2
+
3
+ **The Yielding Atomic Kernel for quantum-resistant mesh orchestration**
4
+
5
+ ```
6
+ npm install yakmesh
7
+ ```
8
+
9
+ ---
10
+
11
+ ## ⚡ What is YAKMESH?
12
+
13
+ A **post-quantum secure** mesh networking library featuring:
14
+
15
+ 🔐 **ML-DSA-65 Signatures** — NIST FIPS 204 standard, quantum-resistant
16
+ ⏱️ **Atomic Time Sync** — High-precision timing for mesh coordination
17
+ 🛡️ **TME™ (Temporal Matrix Encoding)** — Novel packet resilience without retransmission
18
+
19
+ ---
20
+
21
+ ## 🆚 How is TME Different?
22
+
23
+ | Walrus/Red Stuff | YAKMESH TME |
24
+ |------------------|-------------|
25
+ | Encodes across **space** (nodes) | Encodes across **time** (slices) |
26
+ | For storage | For transmission |
27
+ | Retransmit on loss | **Zero latency** recovery |
28
+
29
+ > *"Time IS the redundancy dimension."*
30
+
31
+ ---
32
+
33
+ ## 🛠️ Quick Start
34
+
35
+ ```js
36
+ import { TemporalMeshEncoder } from 'yakmesh';
37
+
38
+ const encoder = new TemporalMeshEncoder();
39
+ const { slices } = encoder.encode('Hello mesh!');
40
+ // Slices sent across different paths
41
+ // Lost slices reconstructed from timing proofs
42
+ ```
43
+
44
+ ---
45
+
46
+ ## 🔒 Security Modules
47
+
48
+ - **NAVR** — Sybil attack prevention (computational identity puzzle)
49
+ - **Replay Defense** — Nonces + timestamps + sequence tracking
50
+ - **Rate Limiter** — DoS protection (30 conn/min per IP)
51
+ - **Message Validator** — Size limits, depth checks, prototype pollution protection
52
+
53
+ ---
54
+
55
+ ## 📦 Current Version: `1.2.0`
56
+
57
+ ✅ TME (Temporal Matrix Encoding)
58
+ ✅ ML-DSA-65 Post-Quantum Signatures
59
+ ✅ Full security hardening suite
60
+ ✅ 42+ tests passing
61
+
62
+ ---
63
+
64
+ **Links:**
65
+ 🌐 Website: https://yakmesh.dev
66
+ 📦 npm: https://npmjs.com/package/yakmesh
67
+ 📖 GitHub: https://github.com/yakmesh/yakmesh
68
+ 📄 Whitepaper: `docs/WHITEPAPER.md`
69
+
70
+ **USPTO Serial No. 99594620**
71
+
72
+ ---
73
+
74
74
  *Powered by TME™ — The world's first temporal-erasure protocol for atomically-synced mesh networks.*
@@ -4,6 +4,10 @@
4
4
  *
5
5
  * Security Level: NIST Level 3 (~192-bit classical security)
6
6
  * Quantum Resistant: Yes (lattice-based)
7
+ *
8
+ * IMPORTANT: Node IDs use iO (indistinguishability obfuscation) style
9
+ * derivation to avoid exposing raw hashes. The internal hash is kept
10
+ * private while the public-facing ID is a human-readable derived name.
7
11
  */
8
12
 
9
13
  import { ml_dsa65 } from '@noble/post-quantum/ml-dsa.js';
@@ -12,14 +16,37 @@ import { bytesToHex, hexToBytes } from '@noble/hashes/utils.js';
12
16
  import { readFileSync, writeFileSync, existsSync, mkdirSync } from 'fs';
13
17
  import { join } from 'path';
14
18
 
19
+ // Import iO network identity for obfuscated node IDs
20
+ import { deriveNetworkName, deriveNetworkId } from '../oracle/network-identity.js';
21
+
15
22
  /**
16
- * Generate a unique node ID from public key
17
- * Uses SHA3-256 hash of public key, truncated to 16 bytes
23
+ * Generate a unique node ID from public key using iO obfuscation
24
+ * Instead of exposing raw hashes, we derive a human-readable name
25
+ *
26
+ * @param {Uint8Array} publicKey - The node's public key
27
+ * @returns {string} iO-derived node ID like "qubit-lattice-prism"
18
28
  */
19
29
  export function generateNodeId(publicKey) {
20
30
  const hash = sha3_256(publicKey);
21
- const idBytes = hash.slice(0, 16);
22
- return 'lantern_' + bytesToHex(idBytes);
31
+ const hashHex = bytesToHex(hash);
32
+
33
+ // Use iO to derive a human-readable, non-reversible ID
34
+ // The raw hash is never exposed externally
35
+ const networkName = deriveNetworkName(hashHex, 3);
36
+ const shortId = deriveNetworkId(hashHex);
37
+
38
+ // Format: "node-[3-word-name]-[short-id]"
39
+ // e.g., "node-qubit-lattice-prism-pq-a7x9"
40
+ return `node-${networkName}-${shortId}`;
41
+ }
42
+
43
+ /**
44
+ * Generate internal hash for private operations (NOT exposed externally)
45
+ * This is kept for signature verification and internal lookups
46
+ */
47
+ export function generateInternalHash(publicKey) {
48
+ const hash = sha3_256(publicKey);
49
+ return bytesToHex(hash.slice(0, 16));
23
50
  }
24
51
 
25
52
  /**