Skip to content
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ tracing-subscriber = { version = "0.3.16", features = ["env-filter"] }

[[example]]
name = "provision"
required-features = ["hyper-rustls", "rcgen"]
required-features = ["hyper-rustls", "rcgen", "aws-lc-rs"]

# Pebble integration test.
# Ignored by default because it requires pebble & pebble-challtestsrv.
# Run with:
# PEBBLE=path/to/pebble CHALLTESTSRV=path/to/pebble-challtestsrv cargo test -- --ignored
[[test]]
name = "pebble"
required-features = ["hyper-rustls"]
required-features = ["hyper-rustls", "rcgen"]

[package.metadata.docs.rs]
# all non-default features except fips (cannot build on docs.rs environment)
Expand All @@ -76,6 +76,7 @@ allowed_external_types = [
"http::*",
"http_body::*",
"hyper::*",
"rustls::crypto::CryptoProvider",
"rustls_pki_types::*",
"serde_core::*",
"serde_json::*",
Expand Down
26 changes: 22 additions & 4 deletions examples/provision.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
#![cfg(any(feature = "ring", feature = "aws-lc-rs"))]
use std::io;

use clap::Parser;
use rustls::crypto::CryptoProvider as RustlsCryptoProvider;
use tracing::info;

use instant_acme::{
Account, AuthorizationStatus, ChallengeType, Identifier, LetsEncrypt, NewAccount, NewOrder,
OrderStatus, RetryPolicy,
Account, AuthorizationStatus, ChallengeType, CryptoProvider, Identifier, LetsEncrypt,
NewAccount, NewOrder, OrderStatus, RetryPolicy,
};

#[tokio::main]
Expand All @@ -17,7 +19,13 @@ async fn main() -> anyhow::Result<()> {
// Alternatively, restore an account from serialized credentials by
// using `Account::from_credentials()`.

let (account, credentials) = Account::builder()?
#[cfg(feature = "aws-lc-rs")]
let provider = CryptoProvider::aws_lc_rs();

#[cfg(all(feature = "ring", not(feature = "aws-lc-rs")))]
let provider = CryptoProvider::ring();

let (account, credentials) = Account::builder(provider, rustls_crypto_provider())?
.create(
&NewAccount {
contact: &[],
Expand Down Expand Up @@ -71,7 +79,7 @@ async fn main() -> anyhow::Result<()> {
println!(
"_acme-challenge.{} IN TXT {}",
challenge.identifier(),
challenge.key_authorization().dns_value()
challenge.key_authorization()?.dns_value()
);
io::stdin().read_line(&mut String::new())?;

Expand Down Expand Up @@ -100,3 +108,13 @@ struct Options {
#[clap(long)]
names: Vec<String>,
}

#[cfg(feature = "aws-lc-rs")]
fn rustls_crypto_provider() -> RustlsCryptoProvider {
rustls::crypto::aws_lc_rs::default_provider()
}

#[cfg(all(feature = "ring", not(feature = "aws-lc-rs")))]
fn rustls_crypto_provider() -> RustlsCryptoProvider {
rustls::crypto::ring::default_provider()
}
Loading