Struct ScramClient

Source
pub struct ScramClient<'a> { /* private fields */ }
Expand description

The initial state of the SCRAM mechanism. It’s the entry point for a SCRAM handshake.

Implementations§

Source§

impl<'a> ScramClient<'a>

Source

pub fn new( authcid: &'a str, password: &'a str, authzid: Option<&'a str>, ) -> Self

Constructs an initial state for the SCRAM mechanism using the provided credentials.

§Arguments
  • authcid - An username used for authentication.
  • password - A password used to prove that the user is authentic.
  • authzid - An username used for authorization. This can be used to impersonate as authzid using the credentials of authcid. If authzid is None the authorized username will be the same as the authenticated username.
§Return value

An I/O error is returned if the internal random number generator couldn’t be constructed.

Source

pub fn with_rng<R: Rng + ?Sized>( authcid: &'a str, password: &'a str, authzid: Option<&'a str>, rng: &mut R, ) -> Self

Constructs an initial state for the SCRAM mechanism using the provided credentials and a custom random number generator.

§Arguments
  • authcid - An username used for authentication.
  • password - A password used to prove that the user is authentic.
  • authzid - An username used for authorization. This can be used to impersonate as authzid using the credentials of authcid. If authzid is None the authorized username will be the same as the authenticated username.
  • rng: A random number generator used to generate random nonces. Please only use a cryptographically secure random number generator!
Source

pub fn client_first(self) -> (ServerFirst<'a>, String)

Returns the next state and the first client message.

Call the ServerFirst::handle_server_first method to continue the SCRAM handshake.

Trait Implementations§

Source§

impl<'a> Debug for ScramClient<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for ScramClient<'a>

§

impl<'a> RefUnwindSafe for ScramClient<'a>

§

impl<'a> Send for ScramClient<'a>

§

impl<'a> Sync for ScramClient<'a>

§

impl<'a> Unpin for ScramClient<'a>

§

impl<'a> UnwindSafe for ScramClient<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V