mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
27 lines
767 B
Rust
27 lines
767 B
Rust
use common::Credentials;
|
|
|
|
/// A trait which defines SASL mechanisms.
|
|
pub trait Mechanism {
|
|
/// The name of the mechanism.
|
|
fn name(&self) -> &str;
|
|
|
|
/// Creates this mechanism from `Credentials`.
|
|
fn from_credentials(credentials: Credentials) -> Result<Self, String> where Self: Sized;
|
|
|
|
/// Provides initial payload of the SASL mechanism.
|
|
fn initial(&mut self) -> Result<Vec<u8>, String> {
|
|
Ok(Vec::new())
|
|
}
|
|
|
|
/// Creates a response to the SASL challenge.
|
|
fn response(&mut self, _challenge: &[u8]) -> Result<Vec<u8>, String> {
|
|
Ok(Vec::new())
|
|
}
|
|
|
|
/// Verifies the server success response, if there is one.
|
|
fn success(&mut self, _data: &[u8]) -> Result<(), String> {
|
|
Ok(())
|
|
}
|
|
}
|
|
|
|
pub mod mechanisms;
|