Struct ruma::signatures::Signature
source · pub struct Signature { /* private fields */ }
Available on crate feature
signatures
only.Expand description
A digital signature.
Implementations§
source§impl Signature
impl Signature
sourcepub fn new(id: &str, bytes: &[u8]) -> Result<Signature, Error>
pub fn new(id: &str, bytes: &[u8]) -> Result<Signature, 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.source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more