use crate::{AuthResult, AuthSchema};
use async_trait::async_trait;
#[derive(Clone)]
pub struct OAuthTokenSnapshot {
pub id: String,
pub user_id: String,
pub provider_id: String,
pub account_id: String,
pub tokens: OAuthTokenValues,
}
#[derive(Clone, PartialEq, Eq)]
pub struct OAuthTokenValues {
pub access_token: Option<String>,
pub refresh_token: Option<String>,
pub id_token: Option<String>,
}
#[async_trait]
pub trait OAuthTokenConversionStore<S: AuthSchema>: Send + Sync {
async fn compare_and_swap_oauth_tokens(
&self,
observed: &OAuthTokenSnapshot,
replacement: &OAuthTokenValues,
) -> AuthResult<bool>;
}