elemental-core 0.3.0

Core library for Elemental, providing common utilities and abstractions used across the project.
Documentation
use async_trait::async_trait;

use crate::auth::accounts::offline::{OFFLINE_AUTHORIZER_ID, OfflineAccount};
use crate::auth::error::Result;
use crate::auth::providers::TypedAccountProvider;

#[derive(Debug, Clone, Copy, Default)]
pub struct OfflineAccountProvider;

#[async_trait]
impl TypedAccountProvider for OfflineAccountProvider {
    type Account = OfflineAccount;

    fn authorizer_id(&self) -> &'static str {
        OFFLINE_AUTHORIZER_ID
    }

    async fn refresh(&self, account: &Self::Account) -> Result<Self::Account> {
        Ok(account.clone())
    }
}