Function reference_hash

Source
pub fn reference_hash(
    object: &CanonicalJsonObject,
    room_version: &RoomVersionId,
) -> Result<String, Error>
Expand description

Creates a reference hash for an event.

The reference hash of an event covers the essential fields of an event, including content hashes.

Returns the hash as a base64-encoded string, without padding. The correct character set is used depending on the room version:

  • For room versions 1 and 2, the standard character set is used for sending the reference hash of the auth_events and prev_events.
  • For room version 3, the standard character set is used for using the reference hash as the event ID.
  • For newer versions, the URL-safe character set is used for using the reference hash as the event ID.

§Parameters

  • object: A JSON object to generate a reference hash for.
  • room_version: The version of the event’s room.

§Errors

Returns an error if the event is too large or redaction fails.