Skip to content

Commit 3dfe5f8

Browse files
christianhoelzldjc
authored andcommitted
fix: send_device_attestation yields challenge status
1 parent 7d7ee42 commit 3dfe5f8

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/order.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use crate::types::{
1515
Authorization, AuthorizationState, AuthorizationStatus, AuthorizedIdentifier, Challenge,
1616
ChallengeType, DeviceAttestation, Empty, FinalizeRequest, OrderState, OrderStatus, Problem,
1717
};
18-
use crate::{Error, Key, crypto, nonce_from_response, retry_after};
18+
use crate::{ChallengeStatus, Error, Key, crypto, nonce_from_response, retry_after};
1919

2020
/// An ACME order as described in RFC 8555 (section 7.1.3)
2121
///
@@ -462,10 +462,13 @@ impl ChallengeHandle<'_> {
462462
/// `payload` is the device attestation object as defined in link. Provide the attestation
463463
/// object as a raw blob. Base64 encoding of the attestation object `payload.att_obj`
464464
/// is done by this function.
465+
///
466+
/// The function yields the challenge status from the ACME server that validated the
467+
/// attestation challenge.
465468
pub async fn send_device_attestation(
466469
&mut self,
467470
payload: &DeviceAttestation<'_>,
468-
) -> Result<(), Error> {
471+
) -> Result<ChallengeStatus, Error> {
469472
if self.challenge.r#type != ChallengeType::DeviceAttest01 {
470473
return Err(Error::Str("challenge type should be device-attest-01"));
471474
}
@@ -483,7 +486,7 @@ impl ChallengeHandle<'_> {
483486
let response = Problem::check::<Challenge>(rsp).await?;
484487
match response.error {
485488
Some(details) => Err(Error::Api(details)),
486-
None => Ok(()),
489+
None => Ok(response.status),
487490
}
488491
}
489492

src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,7 @@ pub enum ChallengeType {
730730
Unknown(String),
731731
}
732732

733+
/// Status of an ACME [Challenge]
733734
#[allow(missing_docs)]
734735
#[derive(Clone, Copy, Debug, Deserialize, Eq, PartialEq)]
735736
#[serde(rename_all = "camelCase")]

0 commit comments

Comments
 (0)