defuse/
salts.rs

1use defuse_core::Salt;
2use near_sdk::ext_contract;
3
4#[ext_contract(ext_salt_manager)]
5#[allow(clippy::module_name_repetitions)]
6pub trait SaltManager {
7    /// Sets the current salt to a new one, previous salt remains valid.
8    /// Returns the new current salt.
9    fn update_current_salt(&mut self) -> Salt;
10
11    /// Invalidates the provided salt: invalidates provided salt,
12    /// sets a new one if it was current salt.
13    /// Returns the current salt.
14    fn invalidate_salts(&mut self, salts: Vec<Salt>) -> Salt;
15
16    /// Returns whether the provided salt is valid
17    fn is_valid_salt(&self, salt: Salt) -> bool;
18
19    /// Returns the current salt
20    fn current_salt(&self) -> Salt;
21}