pub struct ServerOtpClient { /* private fields */ }Expand description
Server-only OTP client authenticated by an application-scoped API key.
Implementations§
Source§impl ServerOtpClient
impl ServerOtpClient
pub fn new(issuer_url: impl Into<String>, api_key: impl Into<String>) -> Self
pub async fn send_otp( &self, recipient: &str, app: &str, channel: &str, ) -> Result<OtpSendResponse, AuthError>
pub async fn verify_otp( &self, recipient: &str, otp: &str, app: &str, channel: &str, ) -> Result<OtpVerificationResponse, AuthError>
Sourcepub async fn send_session_otp(
&self,
recipient: &str,
app: &str,
channel: &str,
binding: &OtpSessionBinding,
) -> Result<OtpSendResponse, AuthError>
pub async fn send_session_otp( &self, recipient: &str, app: &str, channel: &str, binding: &OtpSessionBinding, ) -> Result<OtpSendResponse, AuthError>
Send a backend-mediated login OTP using an explicitly selected public client.
Sourcepub async fn send_session_otp_with_nonce(
&self,
recipient: &str,
app: &str,
channel: &str,
binding: &OtpSessionBinding,
nonce: &str,
) -> Result<OtpSendResponse, AuthError>
pub async fn send_session_otp_with_nonce( &self, recipient: &str, app: &str, channel: &str, binding: &OtpSessionBinding, nonce: &str, ) -> Result<OtpSendResponse, AuthError>
Opt in to a fresh OTP ID-token receipt. Store this exact nonce in the BFF attempt.
Sourcepub async fn verify_session_otp_with_nonce(
&self,
recipient: &str,
otp: &str,
app: &str,
channel: &str,
binding: &OtpSessionBinding,
nonce: &str,
) -> Result<OtpSessionReceipt, AuthError>
pub async fn verify_session_otp_with_nonce( &self, recipient: &str, otp: &str, app: &str, channel: &str, binding: &OtpSessionBinding, nonce: &str, ) -> Result<OtpSessionReceipt, AuthError>
Verify the same nonce/binding as send, using the actual returned delivery channel. This checks transport shape only; verify the signed receipt before creating a BFF session.
Sourcepub async fn cancel_session_otp(
&self,
app: &str,
binding: &OtpSessionBinding,
nonce: &str,
) -> Result<OtpSessionCancellation, AuthError>
pub async fn cancel_session_otp( &self, app: &str, binding: &OtpSessionBinding, nonce: &str, ) -> Result<OtpSessionCancellation, AuthError>
Cancel one nonce-bound attempt using its original server API key (otp:verify). Use a raw environment UUID. Persist/retry uncertain cancellations in the BFF; this client never retries automatically and never recovers session tokens.
Sourcepub async fn verify_session_otp(
&self,
recipient: &str,
otp: &str,
app: &str,
channel: &str,
binding: &OtpSessionBinding,
) -> Result<LoginResponse, AuthError>
pub async fn verify_session_otp( &self, recipient: &str, otp: &str, app: &str, channel: &str, binding: &OtpSessionBinding, ) -> Result<LoginResponse, AuthError>
Verify with the exact session binding used when sending the OTP.
Auto Trait Implementations§
impl Freeze for ServerOtpClient
impl !RefUnwindSafe for ServerOtpClient
impl Send for ServerOtpClient
impl Sync for ServerOtpClient
impl Unpin for ServerOtpClient
impl UnsafeUnpin for ServerOtpClient
impl !UnwindSafe for ServerOtpClient
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more