pub trait SessionKeyProvider: CougrAccount {
// Required methods
fn create_session(
&mut self,
env: &Env,
scope: SessionScope,
) -> Result<SessionKey, AccountError>;
fn validate_session(
&self,
env: &Env,
key: &SessionKey,
) -> Result<bool, AccountError>;
fn revoke_session(
&mut self,
env: &Env,
key_id: &BytesN<32>,
) -> Result<(), AccountError>;
}Expand description
Session key management for contract accounts.
This trait provides session key functionality for gasless gameplay. Only contract accounts (C-addresses) support this capability.
Required Methods§
Sourcefn create_session(
&mut self,
env: &Env,
scope: SessionScope,
) -> Result<SessionKey, AccountError>
fn create_session( &mut self, env: &Env, scope: SessionScope, ) -> Result<SessionKey, AccountError>
Create a new session key with the given scope.
Sourcefn validate_session(
&self,
env: &Env,
key: &SessionKey,
) -> Result<bool, AccountError>
fn validate_session( &self, env: &Env, key: &SessionKey, ) -> Result<bool, AccountError>
Validate that a session key is still active and within scope.
Sourcefn revoke_session(
&mut self,
env: &Env,
key_id: &BytesN<32>,
) -> Result<(), AccountError>
fn revoke_session( &mut self, env: &Env, key_id: &BytesN<32>, ) -> Result<(), AccountError>
Revoke an existing session key.