use bevy::{log::LogPlugin, prelude::*}; use bevy_key_rotation::{ AuthProvider, KeyRotationPlugin, KeyRotationSettings, Keystore, KeystoreState, StartKeyRotationExt, TokenRotationError, }; use std::sync::Arc; pub struct MyAuthProvider; #[cfg_attr(not(target_arch = "wasm32"), bevy_key_rotation::async_trait)] #[cfg_attr(target_arch = "wasm32", bevy_key_rotation::async_trait(?Send))] impl AuthProvider for MyAuthProvider { async fn authenticate( &self, username: String, password: String, ) -> Result { Ok(Keystore { username, password, access_token: "123".to_string(), refresh_token: "456".to_string(), access_expires: bevy_key_rotation::Instant::now() + bevy_key_rotation::Duration::from_secs(20), refresh_expires: bevy_key_rotation::Instant::now() + bevy_key_rotation::Duration::from_secs(60), }) } async fn refresh(&self, _keystore: Keystore) -> Result { #[derive(thiserror::Error, Default, Debug)] #[error("This fails on purpose!")] struct MyError; Err(TokenRotationError::new(MyError)) } } fn status_check(time: Res