Expand description
A versioned, type-safe wrapper around a raw XMTP inbox id.
§Why a newtype instead of [u8; 32]?
Plenty of 32-byte values fly around the codebase — installation ids,
commit hashes, TLS key hashes. Using [u8; 32] for inbox ids loses
the compiler’s ability to catch accidental mixing, and forces every
site that serializes an inbox id to re-derive the wire format from
first principles.
InboxId replaces the raw array everywhere an inbox id flows
through the AppData-dictionary wire format.
§Wire format
varint(version) || version_specific_payload
The version uses the QUIC variable-length integer encoding from RFC
9000 §16 — the same scheme TLS-codec uses for collection length
prefixes. Version 0 fits in a single byte (0x00), so v0 InboxId
values are 33 bytes on the wire (1 varint + 32 raw bytes).
- Version 0:
32raw bytes — the SHA-256 hash backing the hex-encoded string form (seexmtp_id::associations::member::inbox_id).
Future versions can encode completely different payload shapes (longer ids, different cryptographic schemes, …) without disturbing on-the-wire compatibility of existing values.
Structs§
- InboxId
- A type-safe XMTP inbox id.
Enums§
- Inbox
IdError - Errors surfaced by
InboxIdconstruction from hex strings orVec<u8>.
Constants§
- INBOX_
ID_ BYTE_ LEN - Length in raw bytes of a v0 XMTP inbox id (the SHA-256 hash that backs the hex-encoded string form).
- INBOX_
ID_ VERSION - Current wire-format version written by
InboxId::tls_serialize.