#[repr(C)]pub struct Signature(pub [u8; 64]);Expand description
A cryptographic signature of some content, generated by Keypair::sign
and verified by PublicKey::verify.
Tuple Fields§
§0: [u8; 64]Implementations§
Source§impl Signature
impl Signature
Sourcepub fn from_slice(s: &[u8]) -> Option<Self>
pub fn from_slice(s: &[u8]) -> Option<Self>
Deserialize a signature from a byte slice. The slice length must be 64.
Sourcepub fn from_base64(s: &str) -> Option<Self>
pub fn from_base64(s: &str) -> Option<Self>
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();Sourcepub fn as_base64(&self) -> String
pub fn as_base64(&self) -> String
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 Copy for Signature
impl Eq for Signature
impl FromBytes 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