Struct ruma_signatures::Signature
source · [−]pub struct Signature { /* private fields */ }
Expand description
A digital signature.
Implementations
sourceimpl 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 as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
pub fn as_bytes(&self) -> &[u8]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
The raw bytes of the signature.
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 StructuralEq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> CallHasher for T where
T: Hash + ?Sized,
impl<T> CallHasher for T where
T: Hash + ?Sized,
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more