defuse::accounts

Trait AccountManager

Source
pub trait AccountManager {
    // Required methods
    fn has_public_key(
        &self,
        account_id: &AccountId,
        public_key: &PublicKey,
    ) -> bool;
    fn public_keys_of(&self, account_id: &AccountId) -> HashSet<PublicKey>;
    fn add_public_key(&mut self, public_key: PublicKey);
    fn remove_public_key(&mut self, public_key: &PublicKey);
    fn is_nonce_used(
        &self,
        account_id: &AccountId,
        nonce: AsBase64<Nonce>,
    ) -> bool;
    fn invalidate_nonces(&mut self, nonces: Vec<AsBase64<Nonce>>);
}

Required Methods§

Source

fn has_public_key(&self, account_id: &AccountId, public_key: &PublicKey) -> bool

Check if account has given public key

Source

fn public_keys_of(&self, account_id: &AccountId) -> HashSet<PublicKey>

Returns set of public keys registered for given account

Source

fn add_public_key(&mut self, public_key: PublicKey)

Registers or re-activates public_key under the caller account_id.

NOTE: MUST attach 1 yⓃ for security purposes.

Source

fn remove_public_key(&mut self, public_key: &PublicKey)

Deactivate public_key from the caller account_id, i.e. this key can’t be used to make any actions unless it’s re-created.

NOTE: MUST attach 1 yⓃ for security purposes.

Source

fn is_nonce_used(&self, account_id: &AccountId, nonce: AsBase64<Nonce>) -> bool

Returns whether given nonce was already used by the account NOTE: nonces are non-sequential and follow permit2 nonce schema.

Source

fn invalidate_nonces(&mut self, nonces: Vec<AsBase64<Nonce>>)

NOTE: MUST attach 1 yⓃ for security purposes.

Implementors§