rig_core/client/
verify.rs1use crate::driver::{Model, Transport};
5use crate::error::ProviderError;
6use crate::wire::Wire;
7
8impl<W, T> Model<W, T>
9where
10 W: Wire<Op = crate::operation::Verify>,
11 T: Transport<W>,
12{
13 pub async fn verify(&self) -> Result<(), ProviderError> {
16 self.call(()).await.map_err(authentication)
17 }
18}
19
20pub(crate) fn authentication(error: ProviderError) -> ProviderError {
23 match error {
24 ProviderError::ProviderResponse(response)
25 if matches!(
26 response.status,
27 Some(http::StatusCode::UNAUTHORIZED | http::StatusCode::FORBIDDEN)
28 ) =>
29 {
30 ProviderError::InvalidAuthentication(response)
31 }
32 other => other,
33 }
34}
35
36#[cfg(test)]
37mod tests;