Function deltachat::tools::create_id

source ·
pub(crate) fn create_id() -> String
Expand description

Generate an ID. The generated ID should be as short and as unique as possible:

  • short, because it may also used as part of Message-ID headers or in QR codes
  • unique as two IDs generated on two devices should not be the same. However, collisions are not world-wide but only by the few contacts. IDs generated by this function are 66 bit wide and are returned as 11 base64 characters.

Additional information when used as a message-id or group-id:

  • for OUTGOING messages this ID is written to the header as Chat-Group-ID: and is added to the message ID as Gr.<grpid>.<random>@<random>
  • for INCOMING messages, the ID is taken from the Chat-Group-ID-header or from the Message-ID in the In-Reply-To: or References:-Header
  • the group-id should be a string with the characters [a-zA-Z0-9-_]