pub struct MultiKeySignature { /* private fields */ }Expand description
A multi-key signature containing signatures from multiple signers.
Implementations§
Source§impl MultiKeySignature
impl MultiKeySignature
Sourcepub fn new(signatures: Vec<(u8, AnySignature)>) -> AptosResult<Self>
pub fn new(signatures: Vec<(u8, AnySignature)>) -> AptosResult<Self>
Creates a new multi-key signature from individual signatures.
§Arguments
signatures- Vec of (signer_index, signature) pairs
§Errors
Returns AptosError::InvalidSignature if:
- No signatures are provided
- More than 32 signatures are provided
- A signer index is out of bounds (>= 32)
- Duplicate signer indices are present
Sourcepub fn num_signatures(&self) -> usize
pub fn num_signatures(&self) -> usize
Returns the number of signatures.
Sourcepub fn signatures(&self) -> &[(u8, AnySignature)]
pub fn signatures(&self) -> &[(u8, AnySignature)]
Returns the individual signatures with their indices.
Sourcepub fn has_signature(&self, index: u8) -> bool
pub fn has_signature(&self, index: u8) -> bool
Checks if a particular index signed.
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serializes to bytes.
Format: num_signatures || sig1_bcs || sig2_bcs || … || bitmap (4 bytes)
Sourcepub fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
pub fn from_bytes(bytes: &[u8]) -> AptosResult<Self>
Creates from bytes.
§Errors
Returns AptosError::InvalidSignature if:
- The bytes are too short (less than 5 bytes for
num_sigs+ bitmap) - The number of signatures is invalid (0 or > 32)
- The bitmap doesn’t match the number of signatures
- The bytes are too short for the expected structure
- Any signature variant byte is invalid
- Any signature length or data is invalid
Trait Implementations§
Source§impl Clone for MultiKeySignature
impl Clone for MultiKeySignature
Source§fn clone(&self) -> MultiKeySignature
fn clone(&self) -> MultiKeySignature
Returns a duplicate 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 MultiKeySignature
impl Debug for MultiKeySignature
Source§impl Display for MultiKeySignature
impl Display for MultiKeySignature
Source§impl PartialEq for MultiKeySignature
impl PartialEq for MultiKeySignature
impl Eq for MultiKeySignature
impl StructuralPartialEq for MultiKeySignature
Auto Trait Implementations§
impl Freeze for MultiKeySignature
impl RefUnwindSafe for MultiKeySignature
impl Send for MultiKeySignature
impl Sync for MultiKeySignature
impl Unpin for MultiKeySignature
impl UnwindSafe for MultiKeySignature
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§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> 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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.