- Add ratchet/ with ECIES-X25519-AEAD-Ratchet (Proposal 144), Garlic cloves, and ECIES DatabaseLookup replies - Add streaming/ with Ed25519-signed I2P Streaming (SYN/ACK/NACK/CLOSE/RESET, retransmit, window) and Repliable/Raw Datagrams - Add common/su3.mbt to parse and verify reseed .su3 bundles - Add Elligator2 encoding in crypto/ and OfflineSignature support in LeaseSet2 (flags bit 0) - Router: NTCP2 peer pool, floodfill NetDB crawl, transit tunnel relay, and Garlic/Streaming bridge - cmd/router: add --peer-dir, --su3, --reseed, --floodfill, --no-clock-skew - cmd/client: add --dest for persistent destination keys - Mark Phase 6 complete in README and document the transport scope (NTCP2 only, no SSU2)
131 lines
4.1 KiB
Plaintext
131 lines
4.1 KiB
Plaintext
// Generated using `moon info`, DON'T EDIT IT
|
|
package "experiments/moon_i2p/ratchet"
|
|
|
|
import {
|
|
"experiments/moon_i2p/common",
|
|
"experiments/moon_i2p/crypto",
|
|
"experiments/moon_i2p/encoding",
|
|
"experiments/moon_i2p/i2np",
|
|
"experiments/moon_i2p/noise",
|
|
"moonbitlang/core/debug",
|
|
}
|
|
|
|
// Values
|
|
pub fn decode_blocks(Bytes) -> Array[RatchetBlock] raise RatchetError
|
|
|
|
pub fn decode_garlic_clove_i2np(Bytes) -> (@i2np.ShortHeader, @i2np.I2npPayload) raise RatchetError
|
|
|
|
pub fn decrypt_ecies_lookup_reply(Bytes, Bytes, Bytes) -> Array[RatchetBlock] raise RatchetError
|
|
|
|
pub fn decrypt_new_session(@noise.KeyPair, Bytes) -> (Array[RatchetBlock], PendingNewSession?) raise RatchetError
|
|
|
|
pub fn decrypt_new_session_reply(@noise.KeyPair, PendingNewSession, Bytes) -> (Array[RatchetBlock], RatchetPeerSession) raise RatchetError
|
|
|
|
pub fn dh_initialize(Bytes, Bytes) -> (Bytes, TagSet) raise RatchetError
|
|
|
|
pub let ecies_protocol_name : Bytes
|
|
|
|
pub fn encode_blocks(Array[RatchetBlock]) -> Bytes raise RatchetError
|
|
|
|
pub fn encrypt_ecies_lookup_reply(Bytes, Bytes, Array[RatchetBlock]) -> Bytes raise RatchetError
|
|
|
|
pub fn encrypt_new_session(@noise.KeyPair?, Bytes, ElligatorKeyPair, Array[RatchetBlock]) -> (Bytes, PendingNewSession?) raise RatchetError
|
|
|
|
pub fn encrypt_new_session_reply(PendingNewSession, ElligatorKeyPair, Array[RatchetBlock]) -> (Bytes, RatchetPeerSession) raise RatchetError
|
|
|
|
pub fn garlic_clove_block(GarlicDelivery, UInt32, UInt32, @i2np.I2npPayload) -> RatchetBlock raise RatchetError
|
|
|
|
pub fn generate_elligator_keypair(() -> Bytes) -> ElligatorKeyPair raise RatchetError
|
|
|
|
// Errors
|
|
#derive(Eq, @debug.Debug)
|
|
pub suberror RatchetError {
|
|
Crypto(@crypto.CryptoError)
|
|
Noise(@noise.NoiseError)
|
|
Encoding(@encoding.EncodingError)
|
|
Common(@common.CommonError)
|
|
I2np(@i2np.I2npError)
|
|
InvalidLength(String)
|
|
InvalidFormat(String)
|
|
UnknownSession
|
|
AuthenticationFailed
|
|
}
|
|
|
|
// Types and methods
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct ElligatorKeyPair {
|
|
private_key : Bytes
|
|
public_key : Bytes
|
|
elligator_repr : Bytes
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum GarlicDelivery {
|
|
Local
|
|
Destination(@common.Hash)
|
|
Router(@common.Hash)
|
|
Tunnel(@common.Hash, UInt32)
|
|
}
|
|
|
|
pub struct PendingNewSession {
|
|
ck : Bytes
|
|
h : Bytes
|
|
local_ephem_priv : Bytes
|
|
remote_ephem_pub : Bytes
|
|
remote_static_pub : Bytes
|
|
nsr_tagset : TagSet
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum RatchetBlock {
|
|
DateTime(UInt32)
|
|
Termination(reason~ : Byte, additional_data~ : Bytes)
|
|
Options(Bytes)
|
|
MessageNumber(UInt32)
|
|
NextKey(flags~ : Byte, key_id~ : UInt32, public_key~ : Bytes?)
|
|
Ack(Array[(UInt32, UInt32)])
|
|
AckRequest(Byte)
|
|
GarlicClove(delivery~ : GarlicDelivery, i2np_short~ : Bytes)
|
|
Padding(Bytes)
|
|
Unknown(Byte, Bytes)
|
|
}
|
|
pub fn RatchetBlock::encode(Self, @encoding.Writer) -> Unit raise RatchetError
|
|
|
|
pub struct RatchetPeerSession {
|
|
remote_static_pub : Bytes
|
|
mut send_root_key : Bytes
|
|
mut send_tagset : TagSet
|
|
mut recv_root_key : Bytes
|
|
mut recv_tagset : TagSet
|
|
recv_window : Array[(UInt32, Bytes, Bytes)]
|
|
mut dh_ratchet_key_id : UInt32
|
|
mut local_next_priv : Bytes?
|
|
mut local_next_pub : Bytes?
|
|
mut remote_next_pub : Bytes?
|
|
}
|
|
pub fn RatchetPeerSession::apply_dh_ratchet(Self, Bytes, Bytes, for_send~ : Bool) -> Unit raise RatchetError
|
|
pub fn RatchetPeerSession::encrypt_existing(Self, Array[RatchetBlock]) -> Bytes raise RatchetError
|
|
|
|
pub struct RatchetSessionManager {
|
|
local_static : @noise.KeyPair
|
|
sessions : Array[RatchetPeerSession]
|
|
outbound_pending : Array[(Bytes, PendingNewSession)]
|
|
inbound_pending : Array[PendingNewSession]
|
|
}
|
|
pub fn RatchetSessionManager::create_next_key_block(Self, Bytes, () -> Bytes) -> RatchetBlock? raise RatchetError
|
|
pub fn RatchetSessionManager::decrypt_incoming(Self, Bytes) -> (Bytes?, Array[RatchetBlock]) raise RatchetError
|
|
pub fn RatchetSessionManager::encrypt_to_peer(Self, Bytes, Array[RatchetBlock], UInt32, () -> Bytes) -> Bytes raise RatchetError
|
|
pub fn RatchetSessionManager::new(@noise.KeyPair) -> Self
|
|
|
|
pub struct TagSet {
|
|
mut tag_ck : Bytes
|
|
sesstag_const : Bytes
|
|
mut symm_ck : Bytes
|
|
mut msg_num : UInt32
|
|
}
|
|
pub fn TagSet::next_entry(Self) -> (UInt32, Bytes, Bytes) raise RatchetError
|
|
|
|
// Type aliases
|
|
|
|
// Traits
|