92 lines
2.8 KiB
Plaintext
92 lines
2.8 KiB
Plaintext
// Generated using `moon info`, DON'T EDIT IT
|
|
package "experiments/moon_i2p/noise"
|
|
|
|
import {
|
|
"experiments/moon_i2p/crypto",
|
|
"moonbitlang/core/debug",
|
|
}
|
|
|
|
// Values
|
|
pub let noise_xk_protocol_name : Bytes
|
|
|
|
pub let ntcp2_protocol_name : Bytes
|
|
|
|
// Errors
|
|
#derive(Eq, @debug.Debug)
|
|
pub suberror NoiseError {
|
|
Crypto(@crypto.CryptoError)
|
|
InvalidState(String)
|
|
InvalidLength(String)
|
|
NonceOverflow
|
|
}
|
|
|
|
// Types and methods
|
|
pub struct CipherState {
|
|
mut key : Bytes?
|
|
mut nonce : UInt64
|
|
}
|
|
pub fn CipherState::decrypt_with_ad(Self, Bytes, Bytes) -> Bytes raise NoiseError
|
|
pub fn CipherState::empty() -> Self
|
|
pub fn CipherState::encrypt_with_ad(Self, Bytes, Bytes) -> Bytes raise NoiseError
|
|
pub fn CipherState::has_key(Self) -> Bool
|
|
pub fn CipherState::initialize_key(Self, Bytes) -> Unit
|
|
|
|
pub struct HandshakeState {
|
|
symmetric : SymmetricState
|
|
initiator : Bool
|
|
s : KeyPair
|
|
mut e : KeyPair?
|
|
mut rs : Bytes?
|
|
mut re : Bytes?
|
|
mut step : Int32
|
|
}
|
|
pub fn HandshakeState::into_transport(Self) -> TransportSession raise NoiseError
|
|
pub fn HandshakeState::new_initiator(KeyPair, Bytes, protocol_name? : Bytes, prologue? : Bytes) -> Self raise NoiseError
|
|
pub fn HandshakeState::new_responder(KeyPair, protocol_name? : Bytes, prologue? : Bytes) -> Self
|
|
pub fn HandshakeState::read_message(Self, Bytes) -> Bytes raise NoiseError
|
|
pub fn HandshakeState::set_ephemeral(Self, KeyPair) -> Unit
|
|
pub fn HandshakeState::write_message(Self, Bytes) -> Bytes raise NoiseError
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct KeyPair {
|
|
private_key : Bytes
|
|
public_key : Bytes
|
|
}
|
|
pub fn KeyPair::from_private(Bytes) -> Self raise NoiseError
|
|
|
|
pub struct SipHashLengthMask {
|
|
key : Bytes
|
|
mut iv : Bytes
|
|
}
|
|
pub fn SipHashLengthMask::new(Bytes, Bytes) -> Self raise NoiseError
|
|
pub fn SipHashLengthMask::next_mask(Self) -> UInt32 raise NoiseError
|
|
pub fn SipHashLengthMask::xor_length(Self, UInt32) -> UInt32 raise NoiseError
|
|
|
|
pub struct SymmetricState {
|
|
mut ck : Bytes
|
|
mut h : Bytes
|
|
cipher : CipherState
|
|
}
|
|
pub fn SymmetricState::decrypt_and_hash(Self, Bytes) -> Bytes raise NoiseError
|
|
pub fn SymmetricState::encrypt_and_hash(Self, Bytes) -> Bytes raise NoiseError
|
|
pub fn SymmetricState::handshake_hash(Self) -> Bytes
|
|
pub fn SymmetricState::initialize(Bytes) -> Self
|
|
pub fn SymmetricState::mix_hash(Self, Bytes) -> Unit
|
|
pub fn SymmetricState::mix_key(Self, Bytes) -> Unit
|
|
pub fn SymmetricState::split(Self) -> (CipherState, CipherState)
|
|
|
|
pub struct TransportSession {
|
|
send_cipher : CipherState
|
|
recv_cipher : CipherState
|
|
handshake_hash : Bytes
|
|
remote_static : Bytes
|
|
}
|
|
pub fn TransportSession::decrypt(Self, Bytes) -> Bytes raise NoiseError
|
|
pub fn TransportSession::encrypt(Self, Bytes) -> Bytes raise NoiseError
|
|
pub fn TransportSession::handshake_hash(Self) -> Bytes
|
|
pub fn TransportSession::remote_static(Self) -> Bytes
|
|
|
|
// Type aliases
|
|
|
|
// Traits
|