nooberfsh / prusto

A presto/trino client library written in rust.
MIT License
37 stars 23 forks source link

SSL root cert support #21

Closed comphead closed 2 years ago

nooberfsh commented 2 years ago

What about this:

pub struct Certificate(pub (crate) reqwest::Certificate);

impl Certificate {
    pub fn read_pem<P: AsRef<Path>>(p: P) -> Result<Self> {...}  
    pub fn read_der<P: AsRef<Path>>(p: P) -> Result<Self> {...}
}

impl ClientBuilder {
    pub fn add_root_certificate(self, cert: Certificate) -> ClientBuilder {...}
}
comphead commented 2 years ago

What about this:

pub struct Certificate(pub (crate) reqwest::Certificate);

impl Certificate {
    pub fn read_pem<P: AsRef<Path>>(p: P) -> Result<Self> {...}  
    pub fn read_der<P: AsRef<Path>>(p: P) -> Result<Self> {...}
}

impl ClientBuilder {
    pub fn add_root_certificate(self, cert: Certificate) -> ClientBuilder {...}
}

Im wondering do we really need a thin wrapper over reqwest::Certificate?

Reg ClientBuilder,root_cert is not really part of Client. Rather its good to have kind of SslBuilder, which can contain ssl related params like root_certificate, client certificate, ssl trustore, ssl trust store pwd, etc. I can do ssl builder as part of another PR to keep this readable and relatively small