File tree Expand file tree Collapse file tree 3 files changed +28
-5
lines changed
Expand file tree Collapse file tree 3 files changed +28
-5
lines changed Original file line number Diff line number Diff line change 6868/// };
6969///
7070/// let ca: CertificateAuthority<ecdsa::SigningKey> = CertificateAuthorityBuilder::builder()
71- /// .build()
7271/// .build_ca()
7372/// .expect("failed to build CA");
7473/// ```
9998 signing_key_pair : Option < SKP > ,
10099}
101100
101+ impl < SKP , S > CertificateAuthorityBuilderBuilder < ' _ , SKP , S >
102+ where
103+ SKP : CertificateKeypair ,
104+ <SKP :: SigningKey as signature:: Keypair >:: VerifyingKey : EncodePublicKey ,
105+ S : certificate_authority_builder_builder:: IsComplete ,
106+ {
107+ /// Convenience function to avoid calling `builder().build().build_ca()`
108+ pub fn build_ca (
109+ self : Self ,
110+ ) -> Result < CertificateAuthority < SKP > , CreateCertificateAuthorityError < SKP :: Error > > {
111+ self . build ( ) . build_ca ( )
112+ }
113+ }
114+
102115impl < SKP > CertificateAuthorityBuilder < ' _ , SKP >
103116where
104117 SKP : CertificateKeypair ,
Original file line number Diff line number Diff line change @@ -74,14 +74,12 @@ where
7474/// };
7575///
7676/// let ca: CertificateAuthority<ecdsa::SigningKey> = CertificateAuthorityBuilder::builder()
77- /// .build()
7877/// .build_ca()
7978/// .expect("failed to build CA");
8079///
8180/// let certificate = CertificateBuilder::builder()
8281/// .subject("CN=trino-coordinator-default-0")
8382/// .signed_by(&ca)
84- /// .build()
8583/// .build_certificate()
8684/// .expect("failed to build certificate");
8785/// ```
@@ -119,6 +117,20 @@ where
119117 signed_by : & ' a CertificateAuthority < KP > ,
120118}
121119
120+ impl < KP , S > CertificateBuilderBuilder < ' _ , KP , S >
121+ where
122+ KP : CertificateKeypair ,
123+ <KP :: SigningKey as signature:: Keypair >:: VerifyingKey : EncodePublicKey ,
124+ S : certificate_builder_builder:: IsComplete ,
125+ {
126+ /// Convenience function to avoid calling `builder().build().build_certificate()`
127+ pub fn build_certificate (
128+ self ,
129+ ) -> Result < CertificatePair < KP > , CreateCertificateError < KP :: Error > > {
130+ self . build ( ) . build_certificate ( )
131+ }
132+ }
133+
122134impl < KP > CertificateBuilder < ' _ , KP >
123135where
124136 KP : CertificateKeypair ,
Original file line number Diff line number Diff line change @@ -111,14 +111,12 @@ impl TlsServer {
111111 let task = tokio:: task:: spawn_blocking ( move || {
112112 let ca: CertificateAuthority < ecdsa:: SigningKey > =
113113 CertificateAuthorityBuilder :: builder ( )
114- . build ( )
115114 . build_ca ( )
116115 . context ( CreateCertificateAuthoritySnafu ) ?;
117116
118117 let certificate = CertificateBuilder :: builder ( )
119118 . subject ( "CN=webhook" )
120119 . signed_by ( & ca)
121- . build ( )
122120 . build_certificate ( )
123121 . context ( CreateCertificateSnafu ) ?;
124122
You can’t perform that action at this time.
0 commit comments