- NTCP2: queue outbound data frames and flush them without blocking (send_blocks_nb, send_i2np_nb, flush_nonblocking) - NTCP2: bound write_all with a deadline and set TCP keepalive and user timeout on peer sockets - Firefox extension 0.1.3: save settings as a patch, keep unsaved form fields from being overwritten on refresh, add timeouts to router API calls, and honor the interceptTorrents toggle in the content script
146 lines
4.8 KiB
Plaintext
146 lines
4.8 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 decrypt_router_garlic(@noise.KeyPair, Bytes) -> Array[RatchetBlock] 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 encrypt_router_garlic(Bytes, @noise.KeyPair, Array[RatchetBlock]) -> Bytes raise RatchetError
|
|
|
|
pub fn garlic_clove_block(GarlicDelivery, UInt32, UInt32, @i2np.I2npPayload) -> RatchetBlock raise RatchetError
|
|
|
|
pub fn generate_elligator_keypair(() -> Bytes) -> ElligatorKeyPair raise RatchetError
|
|
|
|
pub let router_garlic_protocol_name : Bytes
|
|
|
|
// 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?
|
|
mut last_used_sec : UInt32
|
|
mut send_enabled : Bool
|
|
mut confirmed : Bool
|
|
mut sent_es : Bool
|
|
mut last_recv_sec : UInt32
|
|
}
|
|
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, now_sec? : UInt32) -> (Bytes?, Array[RatchetBlock]) raise RatchetError
|
|
pub fn RatchetSessionManager::drop_session(Self, Bytes) -> Unit
|
|
pub fn RatchetSessionManager::encrypt_to_peer(Self, Bytes, Array[RatchetBlock], UInt32, () -> Bytes) -> Bytes raise RatchetError
|
|
pub fn RatchetSessionManager::has_active_session(Self, Bytes, now_sec? : UInt32) -> Bool
|
|
pub fn RatchetSessionManager::last_recv_sec(Self, Bytes) -> UInt32
|
|
pub fn RatchetSessionManager::mark_send_stale(Self, Bytes) -> Unit
|
|
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
|