pub struct RandomState {
pub id: RandomId,
pub size: usize,
pub owners: Vec<String>,
pub options: Vec<String>,
pub status: RandomStatus,
pub masks: Vec<Mask>,
pub ciphertexts: Vec<LockedCiphertext>,
pub secret_shares: Vec<Share>,
pub revealed: HashMap<usize, String>,
}Expand description
RandomState represents the public information for a single randomness.
Fields§
§id: RandomId§size: usize§owners: Vec<String>§options: Vec<String>§status: RandomStatus§masks: Vec<Mask>§ciphertexts: Vec<LockedCiphertext>§revealed: HashMap<usize, String>Implementations§
Source§impl RandomState
impl RandomState
pub fn is_fully_masked(&self) -> bool
pub fn is_fully_locked(&self) -> bool
pub fn is_ready(&self) -> bool
pub fn get_ciphertext(&self, index: usize) -> Option<&LockedCiphertext>
pub fn get_ciphertext_unchecked(&self, index: usize) -> &LockedCiphertext
pub fn try_new( id: RandomId, spec: RandomSpec, owners: &[String], ) -> Result<Self>
pub fn mask<S: AsRef<str>>( &mut self, addr: S, ciphertexts: Vec<Ciphertext>, ) -> Result<()>
pub fn lock<S>( &mut self, addr: S, ciphertexts_and_digests: Vec<(Ciphertext, SecretDigest)>, ) -> Result<()>
pub fn assign<S>(&mut self, addr: S, indexes: Vec<usize>) -> Result<()>
pub fn reveal(&mut self, indexes: Vec<usize>) -> Result<()>
pub fn list_required_secrets_by_from_addr( &self, from_addr: &str, ) -> Vec<SecretIdent>
pub fn list_revealed_secrets(&self) -> Result<HashMap<usize, Vec<Ciphertext>>>
Sourcepub fn list_assigned_ciphertexts(
&self,
addr: &str,
) -> HashMap<usize, Ciphertext>
pub fn list_assigned_ciphertexts( &self, addr: &str, ) -> HashMap<usize, Ciphertext>
List all ciphertexts assigned to a specific address. Return a mapping from item index to ciphertext.
pub fn list_revealed_ciphertexts(&self) -> HashMap<usize, Ciphertext>
List shared secrets by receiver address. Return a mapping from item index to list of secrets(each is in HEX format). Return [Error::SecretsNotReady] in case of any missing secret.
pub fn add_revealed(&mut self, revealed: HashMap<usize, String>) -> Result<()>
pub fn get_revealed(&self) -> &HashMap<usize, String>
pub fn add_secret( &mut self, from_addr: String, to_addr: Option<String>, index: usize, secret: SecretKey, ) -> Result<()>
Sourcepub fn list_operating_addrs(&self) -> Vec<String>
pub fn list_operating_addrs(&self) -> Vec<String>
Return addresses those haven’t submitted operation
Sourcepub fn update_status(&mut self)
pub fn update_status(&mut self)
Update randomness status
Trait Implementations§
Source§impl BorshDeserialize for RandomState
impl BorshDeserialize for RandomState
Source§impl BorshSerialize for RandomState
impl BorshSerialize for RandomState
Source§impl Clone for RandomState
impl Clone for RandomState
Source§fn clone(&self) -> RandomState
fn clone(&self) -> RandomState
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 RandomState
impl Debug for RandomState
Source§impl Default for RandomState
impl Default for RandomState
Source§fn default() -> RandomState
fn default() -> RandomState
Returns the “default value” for a type. Read more
Source§impl PartialEq for RandomState
impl PartialEq for RandomState
impl Eq for RandomState
impl StructuralPartialEq for RandomState
Auto Trait Implementations§
impl Freeze for RandomState
impl RefUnwindSafe for RandomState
impl Send for RandomState
impl Sync for RandomState
impl Unpin for RandomState
impl UnwindSafe for RandomState
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