pub fn reference_hash(
object: &BTreeMap<String, CanonicalJsonValue>,
rules: &RoomVersionRules,
) -> Result<String, JsonError>Available on crate feature
signatures only.Expand description
Computes the reference hash of the given 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_eventsandprev_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.rules: The rules of the version of the current room.
§Errors
Returns an error if the event is too large or redaction fails.