Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 20 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ tokio-stream = "0.1.17"
toml = "0.9"
trybuild = "1.0"
unic-langid = "0.9"
uniffi = "0.29.4"
uniffi = "0.30.0"
url = "2.5"
uuid = "1.18"
x509-cert = "0.3.0-pre.0"
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public final class WpRequestExecutor: SafeRequestExecutor {
)
}

private func getPeerCertificateChain(_ error: Error) -> [SSLCertificateInfo]? {
private func getPeerCertificateChain(_ error: Error) -> [SslCertificateInfo]? {
let nserror = error as NSError
let info = nserror.userInfo

Expand Down
8 changes: 4 additions & 4 deletions wp_api/src/ssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ use crate::date::WpGmtDateTime;
//
// If this returns `None`, we weren't able to parse the certificate
#[uniffi::export]
pub fn parse_certificate(data: &[u8]) -> Option<Arc<SSLCertificateInfo>> {
pub fn parse_certificate(data: &[u8]) -> Option<Arc<SslCertificateInfo>> {
let certificate = Certificate::from_der(data).ok()?;
let certificate: &x509_cert::certificate::TbsCertificateInner = certificate.tbs_certificate();

Some(
SSLCertificateInfo {
SslCertificateInfo {
valid_at: certificate.validity().not_before.into(),
expires_at: certificate.validity().not_after.into(),
common_name: extract_data_as_string(certificate.subject().common_name())?,
Expand Down Expand Up @@ -55,7 +55,7 @@ fn extract_alternative_names(cert: &x509_cert::certificate::TbsCertificateInner)

#[derive(Debug, PartialEq, Eq, Hash, uniffi::Object)]
#[uniffi::export(Eq, Hash)]
pub struct SSLCertificateInfo {
pub struct SslCertificateInfo {
/// The domain this certificate is valid for (or the signer's name, if this is an intermediate or root certificate)
pub common_name: String,
/// Other domains this certificate is valid for
Expand All @@ -69,7 +69,7 @@ pub struct SSLCertificateInfo {
}

#[uniffi::export]
impl SSLCertificateInfo {
impl SslCertificateInfo {
fn common_name(&self) -> String {
self.common_name.clone()
}
Expand Down