Skip to main content

canonical_dm_room_id

Function canonical_dm_room_id 

Source
pub fn canonical_dm_room_id(a: &str, b: &str) -> String
Expand description

huddle 0.7: compute the deterministic room_id for a 1-1 DM between two fingerprints. Both peers, regardless of who calls start_direct first, derive identical IDs — no created_at mixing, no creator-fingerprint asymmetry. The pair is sorted lexicographically so the function is commutative.

Format: hex(sha256("huddle-dm-v1\0" || min(a, b) || "\0" || max(a, b))) truncated to 16 bytes (32 hex chars), matching the derive_room_id output length so the new DM IDs are indistinguishable from group IDs at the topic-name layer (small attacker uniformity benefit).