Struct ruma_signatures::Signature
source · pub struct Signature { /* private fields */ }
Expand description
A digital signature.
Implementations§
source§impl Signature
impl Signature
sourcepub fn new(id: &str, bytes: &[u8]) -> Result<Self, Error>
pub fn new(id: &str, bytes: &[u8]) -> Result<Self, Error>
Creates a signature from raw bytes.
While a signature can be created directly using struct literal syntax, this constructor can be used to automatically determine the algorithm and version from a key identifier in the form algorithm:version, e.g. “ed25519:1”.
This constructor will ensure that the version does not contain characters that violate the
guidelines in the specification. Because it may be necessary to represent signatures with
versions that don’t adhere to these guidelines, it’s possible to simply use the struct
literal syntax to construct a Signature
with an arbitrary key.
§Parameters
- id: A key identifier, e.g. “ed25519:1”.
- bytes: The digital signature, as a series of bytes.
§Errors
Returns an error if:
- The key ID specifies an unknown algorithm.
- The key ID is malformed.
- The key ID contains a version with invalid characters.
sourcepub fn base64(&self) -> String
pub fn base64(&self) -> String
A base64 encoding of the signature.
Uses the standard character set with no padding.
Trait Implementations§
impl Eq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.