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>>);
fn is_auth_by_predecessor_id_enabled(&self, account_id: &AccountId) -> bool;
fn disable_auth_by_predecessor_id(&mut self);
}
Required Methods§
Sourcefn has_public_key(&self, account_id: &AccountId, public_key: &PublicKey) -> bool
fn has_public_key(&self, account_id: &AccountId, public_key: &PublicKey) -> bool
Check if account has given public key
Sourcefn public_keys_of(&self, account_id: &AccountId) -> HashSet<PublicKey>
fn public_keys_of(&self, account_id: &AccountId) -> HashSet<PublicKey>
Returns set of public keys registered for given account
Sourcefn add_public_key(&mut self, public_key: PublicKey)
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.
Sourcefn remove_public_key(&mut self, public_key: PublicKey)
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.
Sourcefn is_nonce_used(&self, account_id: &AccountId, nonce: AsBase64<Nonce>) -> bool
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.
Sourcefn invalidate_nonces(&mut self, nonces: Vec<AsBase64<Nonce>>)
fn invalidate_nonces(&mut self, nonces: Vec<AsBase64<Nonce>>)
NOTE: MUST attach 1 yⓃ for security purposes.
Sourcefn is_auth_by_predecessor_id_enabled(&self, account_id: &AccountId) -> bool
fn is_auth_by_predecessor_id_enabled(&self, account_id: &AccountId) -> bool
Returns whether authentication by PREDECESSOR_ID is enabled
for given account_id
.
NOTE: Authentication by PREDECESSOR_ID is enabled by default when creating new accounts.
Sourcefn disable_auth_by_predecessor_id(&mut self)
fn disable_auth_by_predecessor_id(&mut self)
Disables authentication by PREDECESSOR_ID for the caller, i.e. PREDECESSOR_ID itself.
WARN: Doing so might lock you out of your funds if you don’t have any other public_keys added to your account.
NOTE: MUST attach 1 yⓃ for security purposes.