Skip to content

Commit c4a5480

Browse files
authored
Revert "x509-cert: document builder mistakes (#1777)" (#1816)
This reverts commit 4f5a02a.
1 parent 4f5a02a commit c4a5480

File tree

1 file changed

+0
-153
lines changed

1 file changed

+0
-153
lines changed

x509-cert/src/builder.rs

-153
Original file line numberDiff line numberDiff line change
@@ -243,42 +243,6 @@ pub trait Builder: Sized {
243243
S::VerifyingKey: EncodePublicKey;
244244

245245
/// Run the object through the signer and build it.
246-
///
247-
/// # Notes
248-
///
249-
/// When using ECDSA signers, the `Signature` parameter will need to be explicit
250-
/// as multiple implementation of [`signature::Signer`] with various signature
251-
/// are available.
252-
///
253-
/// This would look like:
254-
#[cfg_attr(feature = "std", doc = "```no_run")]
255-
#[cfg_attr(not(feature = "std"), doc = "```ignore")]
256-
/// # use rand::rng;
257-
/// # use std::{
258-
/// # str::FromStr,
259-
/// # time::Duration
260-
/// # };
261-
/// # use x509_cert::{
262-
/// # builder::{self, CertificateBuilder, Builder},
263-
/// # name::Name,
264-
/// # serial_number::SerialNumber,
265-
/// # spki::SubjectPublicKeyInfo,
266-
/// # time::Validity
267-
/// # };
268-
/// #
269-
/// # let mut rng = rng();
270-
/// # let signer = p256::ecdsa::SigningKey::random(&mut rng);
271-
/// # let builder = CertificateBuilder::new(
272-
/// # builder::profile::cabf::Root::new(
273-
/// # false,
274-
/// # Name::from_str("CN=World domination corporation").unwrap()
275-
/// # ).unwrap(),
276-
/// # SerialNumber::from(42u32),
277-
/// # Validity::from_now(Duration::new(5, 0)).unwrap(),
278-
/// # SubjectPublicKeyInfo::from_key(signer.verifying_key()).unwrap()
279-
/// # ).unwrap();
280-
/// let certificate = builder.build::<_, ecdsa::der::Signature<_>>(&signer).unwrap();
281-
/// ```
282246
fn build<S, Signature>(mut self, signer: &S) -> Result<Self::Output>
283247
where
284248
S: Signer<Signature>,
@@ -294,45 +258,6 @@ pub trait Builder: Sized {
294258
}
295259

296260
/// Run the object through the signer and build it.
297-
///
298-
/// # Notes
299-
///
300-
/// When using ECDSA signers, the `Signature` parameter will need to be explicit
301-
/// as multiple implementation of [`signature::Signer`] with various signature
302-
/// are available.
303-
///
304-
/// This would look like:
305-
#[cfg_attr(feature = "std", doc = "```no_run")]
306-
#[cfg_attr(not(feature = "std"), doc = "```ignore")]
307-
/// # use rand::rng;
308-
/// # use std::{
309-
/// # str::FromStr,
310-
/// # time::Duration
311-
/// # };
312-
/// # use x509_cert::{
313-
/// # builder::{self, CertificateBuilder, Builder},
314-
/// # name::Name,
315-
/// # serial_number::SerialNumber,
316-
/// # spki::SubjectPublicKeyInfo,
317-
/// # time::Validity
318-
/// # };
319-
/// #
320-
/// # let mut rng = rng();
321-
/// # let signer = p256::ecdsa::SigningKey::random(&mut rng);
322-
/// # let builder = CertificateBuilder::new(
323-
/// # builder::profile::cabf::Root::new(
324-
/// # false,
325-
/// # Name::from_str("CN=World domination corporation").unwrap()
326-
/// # ).unwrap(),
327-
/// # SerialNumber::from(42u32),
328-
/// # Validity::from_now(Duration::new(5, 0)).unwrap(),
329-
/// # SubjectPublicKeyInfo::from_key(signer.verifying_key()).unwrap()
330-
/// # ).unwrap();
331-
/// let certificate = builder.build_with_rng::<_, ecdsa::der::Signature<_>, _>(
332-
/// &signer,
333-
/// &mut rng
334-
/// ).unwrap();
335-
/// ```
336261
fn build_with_rng<S, Signature, R>(mut self, signer: &S, rng: &mut R) -> Result<Self::Output>
337262
where
338263
S: RandomizedSigner<Signature>,
@@ -426,45 +351,6 @@ pub trait AsyncBuilder: Sized {
426351
S::VerifyingKey: EncodePublicKey;
427352

428353
/// Run the object through the signer and build it.
429-
///
430-
/// # Notes
431-
///
432-
/// When using ECDSA signers, the `Signature` parameter will need to be explicit
433-
/// as multiple implementation of [`signature::AsyncSigner`] with various signature
434-
/// are available.
435-
///
436-
/// This would look like:
437-
#[cfg_attr(feature = "std", doc = "```no_run")]
438-
#[cfg_attr(not(feature = "std"), doc = "```ignore")]
439-
/// # use rand::rng;
440-
/// # use std::{
441-
/// # str::FromStr,
442-
/// # time::Duration
443-
/// # };
444-
/// # use x509_cert::{
445-
/// # builder::{self, CertificateBuilder, AsyncBuilder},
446-
/// # name::Name,
447-
/// # serial_number::SerialNumber,
448-
/// # spki::SubjectPublicKeyInfo,
449-
/// # time::Validity
450-
/// # };
451-
/// #
452-
/// # async fn build() -> builder::Result<()> {
453-
/// # let mut rng = rng();
454-
/// # let signer = p256::ecdsa::SigningKey::random(&mut rng);
455-
/// # let builder = CertificateBuilder::new(
456-
/// # builder::profile::cabf::Root::new(
457-
/// # false,
458-
/// # Name::from_str("CN=World domination corporation").unwrap()
459-
/// # ).unwrap(),
460-
/// # SerialNumber::from(42u32),
461-
/// # Validity::from_now(Duration::new(5, 0)).unwrap(),
462-
/// # SubjectPublicKeyInfo::from_key(signer.verifying_key()).unwrap()
463-
/// # ).unwrap();
464-
/// let certificate = builder.build_async::<_, ecdsa::der::Signature<_>>(&signer).await?;
465-
/// # Ok(())
466-
/// # }
467-
/// ```
468354
async fn build_async<S, Signature>(mut self, signer: &S) -> Result<Self::Output>
469355
where
470356
S: AsyncSigner<Signature>,
@@ -480,45 +366,6 @@ pub trait AsyncBuilder: Sized {
480366
}
481367

482368
/// Run the object through the signer and build it.
483-
///
484-
/// # Notes
485-
///
486-
/// When using ECDSA signers, the `Signature` parameter will need to be explicit
487-
/// as multiple implementation of [`signature::AsyncSigner`] with various signature
488-
/// are available.
489-
///
490-
/// This would look like:
491-
#[cfg_attr(feature = "std", doc = "```no_run")]
492-
#[cfg_attr(not(feature = "std"), doc = "```ignore")]
493-
/// # use rand::rng;
494-
/// # use std::{
495-
/// # str::FromStr,
496-
/// # time::Duration
497-
/// # };
498-
/// # use x509_cert::{
499-
/// # builder::{self, CertificateBuilder, AsyncBuilder},
500-
/// # name::Name,
501-
/// # serial_number::SerialNumber,
502-
/// # spki::SubjectPublicKeyInfo,
503-
/// # time::Validity
504-
/// # };
505-
/// #
506-
/// # async fn build() -> builder::Result<()> {
507-
/// # let mut rng = rng();
508-
/// # let signer = p256::ecdsa::SigningKey::random(&mut rng);
509-
/// # let builder = CertificateBuilder::new(
510-
/// # builder::profile::cabf::Root::new(
511-
/// # false,
512-
/// # Name::from_str("CN=World domination corporation").unwrap()
513-
/// # ).unwrap(),
514-
/// # SerialNumber::from(42u32),
515-
/// # Validity::from_now(Duration::new(5, 0)).unwrap(),
516-
/// # SubjectPublicKeyInfo::from_key(signer.verifying_key()).unwrap()
517-
/// # ).unwrap();
518-
/// let certificate = builder.build_with_rng_async::<_, ecdsa::der::Signature<_>, _>(&signer, &mut rng).await?;
519-
/// # Ok(())
520-
/// # }
521-
/// ```
522369
async fn build_with_rng_async<S, Signature, R>(
523370
mut self,
524371
signer: &S,

0 commit comments

Comments
 (0)