pub trait SigningKey<K: KeyName + ?Sized>: Serialize {
// Required methods
fn keymap(&self) -> Result<PublicKeyMap, BadJson>;
fn key_id(&self) -> Result<OwnedSigningKeyId<K>, BadJson>;
// Provided methods
fn stripped_canonical_string(&self) -> Result<String, BadJson> { ... }
fn compare(&self, other: &Self) -> Result<bool, BadJson> { ... }
}Expand description
This trait provides helper functions on any signing key.
Required Methods§
Provided Methods§
Sourcefn stripped_canonical_string(&self) -> Result<String, BadJson>
fn stripped_canonical_string(&self) -> Result<String, BadJson>
This converts the key in self into its canonical string, but
stripped off of its signatures and unsigned fields. This is
useful to compare two objects that were signed and tell if they were
the same, or in tests to prepare a key for being signed.
§Error
The function will error out a BadJson in the
following cases:
- Calling
serde_json::to_valueonselffails (See https://docs.rs/serde_json/latest/serde_json/fn.to_value.html#errors). - The canonicalization of the object fails (See https://docs.rs/ruma/latest/ruma/enum.CanonicalJsonError.html).
Sourcefn compare(&self, other: &Self) -> Result<bool, BadJson>
fn compare(&self, other: &Self) -> Result<bool, BadJson>
Compares the key in self with another one, using their stripped
canonical strings (See Self::stripped_canonical_string).
This is for example called on every signature upload to compare the uploaded signed key with the corresponding stored one.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".