use super::{post_auth_request, AuthMethodInteractor};
use crate::error::WalletError;
use crate::wab_client::types::{CompleteAuthResponse, StartAuthResponse};
use async_trait::async_trait;
pub struct TwilioPhoneInteractor;
#[async_trait]
impl AuthMethodInteractor for TwilioPhoneInteractor {
fn method_type(&self) -> &str {
"TwilioPhone"
}
async fn start_auth(
&self,
server_url: &str,
presentation_key: &str,
payload: serde_json::Value,
) -> Result<StartAuthResponse, WalletError> {
post_auth_request(
server_url,
"/auth/start",
self.method_type(),
presentation_key,
&payload,
)
.await
}
async fn complete_auth(
&self,
server_url: &str,
presentation_key: &str,
payload: serde_json::Value,
) -> Result<CompleteAuthResponse, WalletError> {
post_auth_request(
server_url,
"/auth/complete",
self.method_type(),
presentation_key,
&payload,
)
.await
}
}