[][src]Struct ssb_crypto::Signature

#[repr(C)]pub struct Signature(pub [u8; 64]);

A cryptographic signature of some content, generated by Keypair::sign and verified by PublicKey::verify.

Implementations

impl Signature[src]

pub const SIZE: usize[src]

Size of a signature, in bytes (== 64).

pub fn from_slice(s: &[u8]) -> Option<Self>[src]

Deserialize a signature from a byte slice. The slice length must be 64.

pub fn from_base64(s: &str) -> Option<Self>[src]

Deserialize a signature from a base-64 encoded string. Ignores optional .sig.ed25519 suffix.

Example

use ssb_crypto::Signature;
let s = "QTsCZ+INzDENs1dAdej14Lsp1v2UCXUtRZBv4HlDGo6WZn29ZYM5lZtxnyNC53LxX0ucY1x8NlC1A1RjY7FHBA==.sig.ed25519";
let sig = Signature::from_base64(s).unwrap();

pub fn as_base64(&self) -> String[src]

Does not include ".sig.ed25519" suffix or a prefix sigil.

Example

use ssb_crypto::Signature;
let s = "QTsCZ+INzDENs1dAdej14Lsp1v2UCXUtRZBv4HlDGo6WZn29ZYM5lZtxnyNC53LxX0ucY1x8NlC1A1RjY7FHBA==";
let sig = Signature::from_base64(s).unwrap();
assert_eq!(sig.as_base64(), s);

Trait Implementations

impl AsBytes for Signature[src]

impl Clone for Signature[src]

impl Copy for Signature[src]

impl Debug for Signature[src]

impl Eq for Signature[src]

impl FromBytes for Signature[src]

impl PartialEq<Signature> for Signature[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,