use serde::{Deserialize, Serialize};
pub type CertificateId = i64;
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum MixedContentType {
#[serde(rename = "blockable")]
Blockable,
#[serde(rename = "optionally-blockable")]
OptionallyBlockable,
#[serde(rename = "none")]
None,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SecurityState {
#[serde(rename = "unknown")]
Unknown,
#[serde(rename = "neutral")]
Neutral,
#[serde(rename = "insecure")]
Insecure,
#[serde(rename = "secure")]
Secure,
#[serde(rename = "info")]
Info,
#[serde(rename = "insecure-broken")]
InsecureBroken,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CertificateSecurityState {
pub protocol: String,
#[serde(rename = "keyExchange")]
pub key_exchange: String,
#[serde(
rename = "keyExchangeGroup",
default,
skip_serializing_if = "Option::is_none"
)]
pub key_exchange_group: Option<String>,
pub cipher: String,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub mac: Option<String>,
pub certificate: Vec<String>,
#[serde(rename = "subjectName")]
pub subject_name: String,
pub issuer: String,
#[serde(rename = "validFrom")]
pub valid_from: crate::protocol::network::TimeSinceEpoch,
#[serde(rename = "validTo")]
pub valid_to: crate::protocol::network::TimeSinceEpoch,
#[serde(
rename = "certificateNetworkError",
default,
skip_serializing_if = "Option::is_none"
)]
pub certificate_network_error: Option<String>,
#[serde(rename = "certificateHasWeakSignature")]
pub certificate_has_weak_signature: bool,
#[serde(rename = "certificateHasSha1Signature")]
pub certificate_has_sha1_signature: bool,
#[serde(rename = "modernSSL")]
pub modern_ssl: bool,
#[serde(rename = "obsoleteSslProtocol")]
pub obsolete_ssl_protocol: bool,
#[serde(rename = "obsoleteSslKeyExchange")]
pub obsolete_ssl_key_exchange: bool,
#[serde(rename = "obsoleteSslCipher")]
pub obsolete_ssl_cipher: bool,
#[serde(rename = "obsoleteSslSignature")]
pub obsolete_ssl_signature: bool,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum SafetyTipStatus {
#[serde(rename = "badReputation")]
BadReputation,
#[serde(rename = "lookalike")]
Lookalike,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SafetyTipInfo {
#[serde(rename = "safetyTipStatus")]
pub safety_tip_status: SafetyTipStatus,
#[serde(rename = "safeUrl", default, skip_serializing_if = "Option::is_none")]
pub safe_url: Option<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VisibleSecurityState {
#[serde(rename = "securityState")]
pub security_state: SecurityState,
#[serde(
rename = "certificateSecurityState",
default,
skip_serializing_if = "Option::is_none"
)]
pub certificate_security_state: Option<CertificateSecurityState>,
#[serde(
rename = "safetyTipInfo",
default,
skip_serializing_if = "Option::is_none"
)]
pub safety_tip_info: Option<SafetyTipInfo>,
#[serde(rename = "securityStateIssueIds")]
pub security_state_issue_ids: Vec<String>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SecurityStateExplanation {
#[serde(rename = "securityState")]
pub security_state: SecurityState,
pub title: String,
pub summary: String,
pub description: String,
#[serde(rename = "mixedContentType")]
pub mixed_content_type: MixedContentType,
pub certificate: Vec<String>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub recommendations: Option<Vec<String>>,
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct InsecureContentStatus {
#[serde(rename = "ranMixedContent")]
pub ran_mixed_content: bool,
#[serde(rename = "displayedMixedContent")]
pub displayed_mixed_content: bool,
#[serde(rename = "containedMixedForm")]
pub contained_mixed_form: bool,
#[serde(rename = "ranContentWithCertErrors")]
pub ran_content_with_cert_errors: bool,
#[serde(rename = "displayedContentWithCertErrors")]
pub displayed_content_with_cert_errors: bool,
#[serde(rename = "ranInsecureContentStyle")]
pub ran_insecure_content_style: SecurityState,
#[serde(rename = "displayedInsecureContentStyle")]
pub displayed_insecure_content_style: SecurityState,
}
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum CertificateErrorAction {
#[serde(rename = "continue")]
Continue,
#[serde(rename = "cancel")]
Cancel,
#[serde(untagged)]
Unrecognized(String),
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}
impl crate::typed::Command for DisableParams {
const METHOD: &'static str = "Security.disable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {}
impl crate::typed::Command for EnableParams {
const METHOD: &'static str = "Security.enable";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetIgnoreCertificateErrorsParams {
pub ignore: bool,
}
impl crate::typed::Command for SetIgnoreCertificateErrorsParams {
const METHOD: &'static str = "Security.setIgnoreCertificateErrors";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct HandleCertificateErrorParams {
#[serde(rename = "eventId")]
pub event_id: i64,
pub action: CertificateErrorAction,
}
impl crate::typed::Command for HandleCertificateErrorParams {
const METHOD: &'static str = "Security.handleCertificateError";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetOverrideCertificateErrorsParams {
pub r#override: bool,
}
impl crate::typed::Command for SetOverrideCertificateErrorsParams {
const METHOD: &'static str = "Security.setOverrideCertificateErrors";
type Returns = crate::typed::NoReturns;
}
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CertificateErrorEvent {
#[serde(rename = "eventId")]
pub event_id: i64,
#[serde(rename = "errorType")]
pub error_type: String,
#[serde(rename = "requestURL")]
pub request_url: String,
}
impl crate::typed::Event for CertificateErrorEvent {
const METHOD: &'static str = "Security.certificateError";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VisibleSecurityStateChangedEvent {
#[serde(rename = "visibleSecurityState")]
pub visible_security_state: VisibleSecurityState,
}
impl crate::typed::Event for VisibleSecurityStateChangedEvent {
const METHOD: &'static str = "Security.visibleSecurityStateChanged";
}
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct SecurityStateChangedEvent {
#[serde(rename = "securityState")]
pub security_state: SecurityState,
#[serde(rename = "schemeIsCryptographic")]
pub scheme_is_cryptographic: bool,
pub explanations: Vec<SecurityStateExplanation>,
#[serde(rename = "insecureContentStatus")]
pub insecure_content_status: InsecureContentStatus,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub summary: Option<String>,
}
impl crate::typed::Event for SecurityStateChangedEvent {
const METHOD: &'static str = "Security.securityStateChanged";
}