From 30f830bd5ee71bfbf4b56bd4b735ba98f7059c94 Mon Sep 17 00:00:00 2001 From: Jimmy Cuadra Date: Tue, 9 Jul 2019 15:33:03 -0700 Subject: [PATCH] Be more clear about the Base64 encoding of signatures and hashes. --- src/functions.rs | 4 ++-- src/lib.rs | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/functions.rs b/src/functions.rs index dc2aaf2f..f6401697 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -160,7 +160,7 @@ where /// Creates a *content hash* for the JSON representation of an event. /// -/// Returns the hash as a Base64-encoded string without padding. +/// Returns the hash as a Base64-encoded string, using the standard character set, without padding. /// /// The content hash of an event covers the complete event including the unredacted contents. It is /// used during federation and is described in the Matrix server-server specification. @@ -182,7 +182,7 @@ pub fn content_hash(value: &Value) -> Result { /// Creates a *reference hash* for the JSON representation of an event. /// -/// Returns the hash as a Base64-encoded string without padding. +/// Returns the hash as a Base64-encoded string, using the standard character set, without padding. /// /// The reference hash of an event covers the essential fields of an event, including content /// hashes. It is used to generate event identifiers and is described in the Matrix server-server diff --git a/src/lib.rs b/src/lib.rs index 0e57a544..28d506f3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -11,6 +11,9 @@ //! algorithm it uses and a "version" string, separated by a colon. The version is an arbitrary //! identifier used to distinguish key pairs using the same algorithm from the same homeserver. //! +//! In JSON representations, signatures and hashes appear as Base64-encoded strings, using the +//! standard character set, without padding. +//! //! # Signing JSON //! //! A homeserver signs JSON with a key pair: