Struct massa_signature::signature_impl::SignatureV0
source · pub struct SignatureV0(Signature);
Expand description
Signature generated from a message and a KeyPair
.
Tuple Fields§
§0: Signature
Implementations§
source§impl SignatureV0
impl SignatureV0
sourcepub const SIGNATURE_SIZE_BYTES: usize = 64usize
pub const SIGNATURE_SIZE_BYTES: usize = 64usize
Size of a signature
source§impl SignatureV0
impl SignatureV0
sourcepub fn to_bs58_check(self) -> String
pub fn to_bs58_check(self) -> String
Serialize a Signature
using bs58
encoding with checksum.
§Example
let keypair = KeyPair::generate(0).unwrap();
let data = Hash::compute_from("Hello World!".as_bytes());
let signature = keypair.sign(&data).unwrap();
let serialized: String = signature.to_bs58_check();
sourcepub fn get_ser_len(&self) -> usize
pub fn get_ser_len(&self) -> usize
Return the total length after serialization
sourcepub fn to_bytes(self) -> Vec<u8>
pub fn to_bytes(self) -> Vec<u8>
Serialize a Signature into bytes.
§Example
let keypair = KeyPair::generate(0).unwrap();
let data = Hash::compute_from("Hello World!".as_bytes());
let signature = keypair.sign(&data).unwrap();
let serialized = signature.to_bytes();
sourcepub fn from_bytes(data: &[u8]) -> Result<SignatureV0, MassaSignatureError>
pub fn from_bytes(data: &[u8]) -> Result<SignatureV0, MassaSignatureError>
Deserialize a Signature from bytes.
IMPORTANT: providing more bytes than needed does not result in an error.
§Example
let keypair = KeyPair::generate(0).unwrap();
let data = Hash::compute_from("Hello World!".as_bytes());
let signature = keypair.sign(&data).unwrap();
let serialized = signature.to_bytes();
let deserialized: Signature = Signature::from_bytes(&serialized).unwrap();
sourcepub fn from_bs58_check(data: &str) -> Result<SignatureV0, MassaSignatureError>
pub fn from_bs58_check(data: &str) -> Result<SignatureV0, MassaSignatureError>
Deserialize a Signature
using bs58
encoding with checksum.
§Example
let keypair = KeyPair::generate(0).unwrap();
let data = Hash::compute_from("Hello World!".as_bytes());
let signature = keypair.sign(&data).unwrap();
let serialized: String = signature.to_bs58_check();
let deserialized: Signature = Signature::from_bs58_check(&serialized).unwrap();
Trait Implementations§
source§impl Clone for SignatureV0
impl Clone for SignatureV0
source§fn clone(&self) -> SignatureV0
fn clone(&self) -> SignatureV0
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SignatureV0
impl Debug for SignatureV0
source§impl Display for SignatureV0
impl Display for SignatureV0
source§impl PartialEq for SignatureV0
impl PartialEq for SignatureV0
source§fn eq(&self, other: &SignatureV0) -> bool
fn eq(&self, other: &SignatureV0) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Versioned for SignatureV0
impl Versioned for SignatureV0
impl Copy for SignatureV0
impl Eq for SignatureV0
impl StructuralPartialEq for SignatureV0
Auto Trait Implementations§
impl Freeze for SignatureV0
impl RefUnwindSafe for SignatureV0
impl Send for SignatureV0
impl Sync for SignatureV0
impl Unpin for SignatureV0
impl UnwindSafe for SignatureV0
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)