DhtKeySizes

The fixed-size ed25519 / sequence-number value types used by BEP-44 mutable DHT items. This is the port of libtorrent's dht::public_key, dht::secret_key, dht::signature and dht::sequence_number (include/libtorrent/kademlia/types.hpp).

libtorrent fixes these widths as std::array<char, len>; here they're plain ByteArrays validated against PUBLIC_KEY_LEN / SECRET_KEY_LEN / SIGNATURE_LEN. The sequence_number is a 64-bit value, so a Kotlin Long.

Properties

Link copied to clipboard
const val MAX_SALT_LEN: Int = 64

Maximum salt length the DHT will accept for a mutable put. libtorrent rejects a salt longer than this in node::incoming_request ("salt too big", 207).

Link copied to clipboard
const val MAX_VALUE_LEN: Int = 1000

Maximum size of the bencoded v value libtorrent will store/sign for a DHT item. node::incoming_request rejects a v larger than this ("message too big", 205). The assign path asserts the bencoding fits in 1000 bytes.

Link copied to clipboard
const val PUBLIC_KEY_LEN: Int = 32

ed25519 public key length, from public_key::len.

Link copied to clipboard
const val SECRET_KEY_LEN: Int = 64

ed25519 secret (private) key length, from secret_key::len.

Link copied to clipboard
const val SIGNATURE_LEN: Int = 64

ed25519 signature length, from signature::len.