// Generated using `moon info`, DON'T EDIT IT package "experiments/moon_i2p/common" import { "experiments/moon_i2p/encoding", "moonbitlang/core/debug", } // Values // Errors #derive(Eq, @debug.Debug) pub suberror CommonError { Encoding(@encoding.EncodingError) InvalidLength(String) InvalidFormat(String) } // Types and methods #derive(Eq, @debug.Debug) pub(all) enum Certificate { Null HashCash(Bytes) Hidden Signed(Bytes) Multiple(Bytes) Key(KeyCertificate) Unknown(Byte, Bytes) } pub fn Certificate::decode(@encoding.Reader) -> Self raise CommonError pub fn Certificate::encode(Self, @encoding.Writer) -> Unit #derive(Eq, @debug.Debug) pub(all) enum CryptoPublicKeyType { ElGamal P256 P384 P521 X25519 Unknown(UInt32) } pub fn CryptoPublicKeyType::from_u16(UInt32) -> Self pub fn CryptoPublicKeyType::key_length(Self) -> Int32 pub fn CryptoPublicKeyType::to_u16(Self) -> UInt32 #derive(Eq, @debug.Debug) pub struct Destination { inner : KeysAndCert } pub fn Destination::b32_address(Self) -> String pub fn Destination::decode(@encoding.Reader) -> Self raise CommonError pub fn Destination::encode(Self, @encoding.Writer) -> Unit pub fn Destination::from_base64(String) -> Self raise CommonError pub fn Destination::hash(Self) -> Hash pub fn Destination::new(KeysAndCert) -> Self pub fn Destination::new_x25519_ed25519(Bytes, Bytes, padding? : Bytes) -> Self raise CommonError pub fn Destination::to_base64(Self) -> String pub fn Destination::to_bytes(Self) -> Bytes #derive(Eq, @debug.Debug) pub struct Hash { bytes : Bytes } pub fn Hash::as_bytes(Self) -> Bytes pub fn Hash::decode(@encoding.Reader) -> Self raise CommonError pub fn Hash::encode(Self, @encoding.Writer) -> Unit pub fn Hash::from_bytes(Bytes) -> Self raise CommonError pub fn Hash::sha256(Bytes) -> Self pub fn Hash::to_b32_address(Self) -> String pub fn Hash::to_base32(Self) -> String pub fn Hash::to_base64(Self) -> String pub fn Hash::to_hex(Self) -> String #derive(Eq, @debug.Debug) pub(all) struct KeyCertificate { sig_type : SigningPublicKeyType crypto_type : CryptoPublicKeyType excess_signing_key : Bytes excess_crypto_key : Bytes } pub fn KeyCertificate::new(SigningPublicKeyType, CryptoPublicKeyType, excess_signing_key? : Bytes, excess_crypto_key? : Bytes) -> Self #derive(Eq, @debug.Debug) pub struct KeysAndCert { key_data : Bytes certificate : Certificate } pub fn KeysAndCert::crypto_public_key(Self) -> Bytes pub fn KeysAndCert::crypto_type(Self) -> CryptoPublicKeyType pub fn KeysAndCert::decode(@encoding.Reader) -> Self raise CommonError pub fn KeysAndCert::encode(Self, @encoding.Writer) -> Unit pub fn KeysAndCert::hash(Self) -> Hash pub fn KeysAndCert::new_x25519_ed25519(Bytes, Bytes, padding? : Bytes) -> Self raise CommonError pub fn KeysAndCert::signing_public_key(Self) -> Bytes pub fn KeysAndCert::signing_type(Self) -> SigningPublicKeyType pub fn KeysAndCert::to_bytes(Self) -> Bytes #derive(Eq, @debug.Debug) pub(all) struct Lease { tunnel_gw : Hash tunnel_id : UInt32 end_date_ms : UInt64 } pub fn Lease::decode(@encoding.Reader) -> Self raise CommonError pub fn Lease::encode(Self, @encoding.Writer) -> Unit #derive(Eq, @debug.Debug) pub(all) struct Lease2 { tunnel_gw : Hash tunnel_id : UInt32 end_date_sec : UInt32 } pub fn Lease2::decode(@encoding.Reader) -> Self raise CommonError pub fn Lease2::encode(Self, @encoding.Writer) -> Unit #derive(Eq, @debug.Debug) pub(all) struct LeaseSet2 { destination : Destination published_sec : UInt32 expires_offset : UInt32 flags : UInt32 options : Mapping encryption_keys : Array[LeaseSet2EncryptionKey] leases : Array[Lease2] signature : Bytes } pub fn LeaseSet2::decode(@encoding.Reader) -> Self raise CommonError pub fn LeaseSet2::encode(Self, @encoding.Writer) -> Unit raise CommonError #derive(Eq, @debug.Debug) pub(all) struct LeaseSet2EncryptionKey { key_type : CryptoPublicKeyType key_data : Bytes } #derive(Eq, @debug.Debug) pub struct Mapping { entries : Array[(String, String)] } pub fn Mapping::decode(@encoding.Reader) -> Self raise CommonError pub fn Mapping::encode(Self, @encoding.Writer) -> Unit raise CommonError pub fn Mapping::from_entries(Array[(String, String)]) -> Self pub fn Mapping::get(Self, String) -> String? pub fn Mapping::length(Self) -> Int32 pub fn Mapping::new() -> Self pub fn Mapping::set(Self, String, String) -> Unit #derive(Eq, @debug.Debug) pub(all) struct RouterAddress { cost : Byte expiration : UInt64 transport_style : String options : Mapping } pub fn RouterAddress::decode(@encoding.Reader) -> Self raise CommonError pub fn RouterAddress::encode(Self, @encoding.Writer) -> Unit raise CommonError pub fn RouterAddress::new(Byte, String, Mapping, expiration? : UInt64) -> Self #derive(Eq, @debug.Debug) pub struct RouterIdentity { inner : KeysAndCert } pub fn RouterIdentity::b32_address(Self) -> String pub fn RouterIdentity::crypto_public_key(Self) -> Bytes pub fn RouterIdentity::decode(@encoding.Reader) -> Self raise CommonError pub fn RouterIdentity::encode(Self, @encoding.Writer) -> Unit pub fn RouterIdentity::hash(Self) -> Hash pub fn RouterIdentity::new(KeysAndCert) -> Self pub fn RouterIdentity::new_x25519_ed25519(Bytes, Bytes, padding? : Bytes) -> Self raise CommonError pub fn RouterIdentity::signing_public_key(Self) -> Bytes pub fn RouterIdentity::signing_type(Self) -> SigningPublicKeyType pub fn RouterIdentity::to_bytes(Self) -> Bytes #derive(Eq, @debug.Debug) pub(all) struct RouterInfo { identity : RouterIdentity published : UInt64 addresses : Array[RouterAddress] options : Mapping signature : Bytes } pub fn RouterInfo::decode(@encoding.Reader) -> Self raise CommonError pub fn RouterInfo::encode(Self, @encoding.Writer) -> Unit raise CommonError pub fn RouterInfo::unsigned_bytes(Self) -> Bytes raise CommonError #derive(Eq, @debug.Debug) pub struct SessionKey { bytes : Bytes } pub fn SessionKey::from_bytes(Bytes) -> Self raise CommonError #derive(Eq, @debug.Debug) pub struct SessionTag { bytes : Bytes } pub fn SessionTag::from_bytes(Bytes) -> Self raise CommonError #derive(Eq, @debug.Debug) pub(all) enum SigningPublicKeyType { DsaSha1 EcdsaSha256P256 EcdsaSha384P384 EcdsaSha512P521 RsaSha256_2048 RsaSha384_3072 RsaSha512_4096 EdDsaSha512Ed25519 EdDsaSha512Ed25519ph RedDsaSha512Ed25519 Unknown(UInt32) } pub fn SigningPublicKeyType::from_u16(UInt32) -> Self pub fn SigningPublicKeyType::public_key_length(Self) -> Int32 pub fn SigningPublicKeyType::signature_length(Self) -> Int32 pub fn SigningPublicKeyType::to_u16(Self) -> UInt32 // Type aliases // Traits