Skip to content

Commit d6ffd8c

Browse files
introduce set_ready_with_payload() for device-attest-01 challenge
1 parent 1e68826 commit d6ffd8c

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

src/order.rs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,28 @@ impl ChallengeHandle<'_> {
456456
}
457457
}
458458

459+
/// Notify the server that the challenge is ready and provide a payload
460+
///
461+
/// This function is for the ACME challenge device-attest-01.
462+
/// See <https://datatracker.ietf.org/doc/draft-acme-device-attest/> for details.
463+
///
464+
/// Note: Do not use this function for http-01, tls-alpn-01 or dns-01 challenges.
465+
///
466+
/// `payload` should serialize to "attObj" as defined in link.
467+
pub async fn set_ready_with_payload(&mut self, payload: &impl Serialize) -> Result<(), Error> {
468+
let rsp = self
469+
.account
470+
.post(Some(payload), self.nonce.take(), &self.challenge.url)
471+
.await?;
472+
473+
*self.nonce = nonce_from_response(&rsp);
474+
let response = Problem::check::<Challenge>(rsp).await?;
475+
match response.error {
476+
Some(details) => Err(Error::Api(details)),
477+
None => Ok(()),
478+
}
479+
}
480+
459481
/// Create a [`KeyAuthorization`] for this challenge
460482
///
461483
/// Combines a challenge's token with the thumbprint of the account's public key to compute

0 commit comments

Comments
 (0)