pub struct SecretState { /* private fields */ }Expand description
Represent a private state contains generated secrets.
§Random Secrets
A group of secrets will be created when a new randomness is
initialized. The group contains a mask secret and a list of lock
secrets. Use mask, unmask and lock to encrypt the
ciphertexts from a randomness.
The mask secret should never be shared with others. If all mask secrets are shared, then the whole randomness is possibly revealed. We only share lock secrets When reveal or assign a random item.
§Decision Secrets
A decision is an immutable hidden answer from a player. We generate the secret when encrypting the answer. By sharing the secret, the answer is revealed.
Implementations§
Source§impl SecretState
impl SecretState
pub fn new(encryptor: Arc<dyn EncryptorT>) -> Self
pub fn clear(&mut self)
pub fn gen_random_secrets(&mut self, random_id: RandomId, size: usize)
pub fn is_random_loaded(&self, random_id: RandomId) -> bool
pub fn is_decision_loaded(&self, decision_id: DecisionId) -> bool
pub fn get_random_lock( &self, random_id: RandomId, index: usize, ) -> Result<SecretKey>
pub fn get_decision_secret(&self, decision_id: DecisionId) -> Option<SecretKey>
pub fn mask( &mut self, random_id: RandomId, ciphertexts: Vec<Ciphertext>, ) -> Result<Vec<Ciphertext>>
pub fn unmask( &mut self, random_id: RandomId, ciphertexts: Vec<Ciphertext>, ) -> Result<Vec<Ciphertext>>
pub fn lock( &mut self, random_id: RandomId, ciphertexts: Vec<Ciphertext>, ) -> Result<Vec<(Ciphertext, SecretDigest)>>
pub fn encrypt_answer( &mut self, decision_id: DecisionId, answer: String, ) -> Result<(Ciphertext, SecretDigest)>
pub fn list_random_secrets(&self) -> Vec<&RandomSecretGroup>
pub fn list_decision_secerts(&self) -> Vec<&SecretKey> ⓘ
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for SecretState
impl !UnwindSafe for SecretState
impl Freeze for SecretState
impl Send for SecretState
impl Sync for SecretState
impl Unpin for SecretState
impl UnsafeUnpin for SecretState
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