use crate::{claims_error::ClaimsError, errors::AuthError};
use async_trait::async_trait;
use jsonwebtoken::Header;
use serde_json::Value;
#[async_trait]
pub trait TokenValidator: Send + Sync {
async fn validate_and_parse(&self, token: &str) -> Result<Value, AuthError>;
}
#[async_trait]
pub trait KeyProvider: Send + Sync {
fn name(&self) -> &str;
async fn validate_and_decode(&self, token: &str) -> Result<(Header, Value), ClaimsError>;
async fn refresh_keys(&self) -> Result<(), ClaimsError> {
Ok(())
}
}