1414//! channel via mTLS (mutual-auth TLS).
1515
1616use rcgen:: {
17- date_time_ymd, BasicConstraints , CertificateParams , DistinguishedName ,
18- DnType , IsCa , RcgenError , SanType ,
17+ date_time_ymd, BasicConstraints , CertificateParams , DnType , IsCa ,
18+ RcgenError , SanType ,
1919} ;
2020
21- use crate :: ed25519;
21+ use crate :: { constants , ed25519} ;
2222
2323/// The CA cert used as the trust anchor for both client and node.
2424///
@@ -39,19 +39,11 @@ pub struct ClientCert(rcgen::Certificate);
3939/// The key pair for the node cert is sampled.
4040pub struct NodeCert ( rcgen:: Certificate ) ;
4141
42- pub fn lexe_distinguished_name_prefix ( ) -> DistinguishedName {
43- let mut name = DistinguishedName :: new ( ) ;
44- name. push ( DnType :: CountryName , "US" ) ;
45- name. push ( DnType :: StateOrProvinceName , "CA" ) ;
46- name. push ( DnType :: OrganizationName , "lexe-tech" ) ;
47- name
48- }
49-
5042// -- impl CaCert -- //
5143
5244impl CaCert {
5345 pub fn from_key_pair ( key_pair : rcgen:: KeyPair ) -> Result < Self , RcgenError > {
54- let mut name = lexe_distinguished_name_prefix ( ) ;
46+ let mut name = constants :: lexe_distinguished_name_prefix ( ) ;
5547 name. push ( DnType :: CommonName , "client CA cert" ) ;
5648
5749 let mut params = CertificateParams :: default ( ) ;
@@ -81,7 +73,7 @@ impl CaCert {
8173
8274impl ClientCert {
8375 pub fn from_key_pair ( key_pair : rcgen:: KeyPair ) -> Result < Self , RcgenError > {
84- let mut name = lexe_distinguished_name_prefix ( ) ;
76+ let mut name = constants :: lexe_distinguished_name_prefix ( ) ;
8577 name. push ( DnType :: CommonName , "client cert" ) ;
8678
8779 let mut params = CertificateParams :: default ( ) ;
@@ -123,7 +115,7 @@ impl NodeCert {
123115 key_pair : rcgen:: KeyPair ,
124116 dns_names : Vec < String > ,
125117 ) -> Result < Self , RcgenError > {
126- let mut name = lexe_distinguished_name_prefix ( ) ;
118+ let mut name = constants :: lexe_distinguished_name_prefix ( ) ;
127119 name. push ( DnType :: CommonName , "node cert" ) ;
128120
129121 let subject_alt_names = dns_names
0 commit comments