2.4 KiB
2.4 KiB
moon-i2p
A clean, zero-dependency, pure-MoonBit port of the modern I2P (Invisible Internet Project) protocol suite targeting wasm, wasm-gc, js, and native.
Architecture & Implemented Modules
moon-i2p/
├── encoding/ # I2P Base64 (-/~), Base32 (.b32.i2p), big-endian Reader/Writer, UTF-8, Hex
├── crypto/ # Pure-MoonBit SHA-256, HMAC-SHA256, HKDF-SHA256, ChaCha20-Poly1305, X25519, SipHash-2-4
├── common/ # Hash, KeyTypes, Certificate/KeyCertificate, Mapping, Destination, RouterIdentity, RouterInfo, Lease2, LeaseSet2
├── i2np/ # 16-byte standard & 9-byte NTCP2 short headers, SHA-256 checksums, core I2NP messages
├── noise/ # Noise_XK_25519_ChaChaPoly_SHA256 handshake/transport + NTCP2 SipHash-2-4 length masking
├── sam/ # SAMv3 text protocol parser, serializer, and command builders
└── cmd/main/ # Demo CLI entrypoint
Verified Test Vectors
Every cryptographic primitive in crypto/ is verified against official standards:
- SHA-256: FIPS 180-4 / NIST test vectors
- HMAC-SHA256: RFC 4231 test cases 1 & 2
- HKDF-SHA256: RFC 5869 test case 1
- ChaCha20-Poly1305 AEAD: RFC 8439 Section 2.8.2
- X25519: RFC 7748 Sections 5.2 & 6.1
- SipHash-2-4: Official SipHash reference test vector
Running Checks & Tests
moon check
moon test
moon test --target native
moon run cmd/main
Roadmap
- Phase 1–2 (Completed): Core encoding, pure-MoonBit modern crypto, I2P Common Structures, I2NP messages,
Noise_XK_25519_ChaChaPoly_SHA256state machine, NTCP2 SipHash length masking, and SAMv3 protocol codec. - Phase 3 (Signatures & Ratchet):
- Pure-MoonBit Ed25519 signing & verification (
RouterInfo&LeaseSet2signatures). - ECIES-X25519-AEAD-Ratchet (Proposal 144) for Garlic encryption & end-to-end sessions.
- Pure-MoonBit Ed25519 signing & verification (
- Phase 4 (Transports & Networking):
- NTCP2 full TCP transport (AES-256-CBC ephemeral key obfuscation, options/padding blocks, session manager).
- SAMv3 live TCP client for interacting with an existing I2P/i2pd router.
- Phase 5 (Router Core):
- NetDB & Floodfill DHT (Kademlia XOR routing with daily routing key derivation).
- Tunnel builder (
ShortTunnelBuildProposal 157), layered tunnel encryption, and tunnel pool management. - Streaming & Repliable Datagrams libraries.