dittolive-ditto 5.0.0

Ditto is a peer to peer cross-platform database that allows mobile, web, IoT and server apps to sync with or without an internet connection.
Documentation
use std::time::Duration;

use crate::identity::DittoAuthenticator;

/// Implement this trait for a type in order to use
/// [`DittoConfigConnect::Server`] mode with the old callback-based
/// authentication API.
///
/// **v5 note:** This trait is superseded by [`DittoAuthExpirationHandler`] in v5.
/// Use `DittoAuthExpirationHandler` with [`DittoConfigConnect::Server`] mode instead.
///
/// [`DittoConfigConnect::Server`]: crate::DittoConfigConnect::Server
/// [`DittoAuthExpirationHandler`]: crate::DittoAuthExpirationHandler
pub trait DittoAuthenticationEventHandler: Send + Sync {
    /// This will be called when you need to authenticate.
    /// Usually it will involve a call to `auth.login`.
    fn authentication_required(&self, auth: DittoAuthenticator);

    /// Allows for custom behavior hooks when authentication is expiring
    fn authentication_expiring_soon(&self, auth: DittoAuthenticator, seconds_remaining: Duration);
}