1use serde::{Deserialize, Serialize};
11
12pub type CertificateId = i64;
14
15#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
18pub enum MixedContentType {
19 #[serde(rename = "blockable")]
21 Blockable,
22 #[serde(rename = "optionally-blockable")]
24 OptionallyBlockable,
25 #[serde(rename = "none")]
27 None,
28 #[serde(untagged)]
32 Unrecognized(String),
33}
34
35#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
37pub enum SecurityState {
38 #[serde(rename = "unknown")]
40 Unknown,
41 #[serde(rename = "neutral")]
43 Neutral,
44 #[serde(rename = "insecure")]
46 Insecure,
47 #[serde(rename = "secure")]
49 Secure,
50 #[serde(rename = "info")]
52 Info,
53 #[serde(rename = "insecure-broken")]
55 InsecureBroken,
56 #[serde(untagged)]
60 Unrecognized(String),
61}
62
63#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
67pub struct CertificateSecurityState {
68 pub protocol: String,
70 #[serde(rename = "keyExchange")]
73 pub key_exchange: String,
74 #[serde(
76 rename = "keyExchangeGroup",
77 default,
78 skip_serializing_if = "Option::is_none"
79 )]
80 pub key_exchange_group: Option<String>,
81 pub cipher: String,
83 #[serde(default, skip_serializing_if = "Option::is_none")]
85 pub mac: Option<String>,
86 pub certificate: Vec<String>,
88 #[serde(rename = "subjectName")]
90 pub subject_name: String,
91 pub issuer: String,
93 #[serde(rename = "validFrom")]
95 pub valid_from: crate::protocol::network::TimeSinceEpoch,
96 #[serde(rename = "validTo")]
98 pub valid_to: crate::protocol::network::TimeSinceEpoch,
99 #[serde(
101 rename = "certificateNetworkError",
102 default,
103 skip_serializing_if = "Option::is_none"
104 )]
105 pub certificate_network_error: Option<String>,
106 #[serde(rename = "certificateHasWeakSignature")]
108 pub certificate_has_weak_signature: bool,
109 #[serde(rename = "certificateHasSha1Signature")]
111 pub certificate_has_sha1_signature: bool,
112 #[serde(rename = "modernSSL")]
114 pub modern_ssl: bool,
115 #[serde(rename = "obsoleteSslProtocol")]
117 pub obsolete_ssl_protocol: bool,
118 #[serde(rename = "obsoleteSslKeyExchange")]
120 pub obsolete_ssl_key_exchange: bool,
121 #[serde(rename = "obsoleteSslCipher")]
123 pub obsolete_ssl_cipher: bool,
124 #[serde(rename = "obsoleteSslSignature")]
126 pub obsolete_ssl_signature: bool,
127}
128
129#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
131pub enum SafetyTipStatus {
132 #[serde(rename = "badReputation")]
134 BadReputation,
135 #[serde(rename = "lookalike")]
137 Lookalike,
138 #[serde(untagged)]
142 Unrecognized(String),
143}
144
145#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
147pub struct SafetyTipInfo {
148 #[serde(rename = "safetyTipStatus")]
151 pub safety_tip_status: SafetyTipStatus,
152 #[serde(rename = "safeUrl", default, skip_serializing_if = "Option::is_none")]
155 pub safe_url: Option<String>,
156}
157
158#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
162pub struct VisibleSecurityState {
163 #[serde(rename = "securityState")]
165 pub security_state: SecurityState,
166 #[serde(
168 rename = "certificateSecurityState",
169 default,
170 skip_serializing_if = "Option::is_none"
171 )]
172 pub certificate_security_state: Option<CertificateSecurityState>,
173 #[serde(
176 rename = "safetyTipInfo",
177 default,
178 skip_serializing_if = "Option::is_none"
179 )]
180 pub safety_tip_info: Option<SafetyTipInfo>,
181 #[serde(rename = "securityStateIssueIds")]
183 pub security_state_issue_ids: Vec<String>,
184}
185
186#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
188pub struct SecurityStateExplanation {
189 #[serde(rename = "securityState")]
191 pub security_state: SecurityState,
192 pub title: String,
194 pub summary: String,
196 pub description: String,
198 #[serde(rename = "mixedContentType")]
200 pub mixed_content_type: MixedContentType,
201 pub certificate: Vec<String>,
203 #[serde(default, skip_serializing_if = "Option::is_none")]
205 pub recommendations: Option<Vec<String>>,
206}
207
208#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
212pub struct InsecureContentStatus {
213 #[serde(rename = "ranMixedContent")]
215 pub ran_mixed_content: bool,
216 #[serde(rename = "displayedMixedContent")]
218 pub displayed_mixed_content: bool,
219 #[serde(rename = "containedMixedForm")]
221 pub contained_mixed_form: bool,
222 #[serde(rename = "ranContentWithCertErrors")]
224 pub ran_content_with_cert_errors: bool,
225 #[serde(rename = "displayedContentWithCertErrors")]
227 pub displayed_content_with_cert_errors: bool,
228 #[serde(rename = "ranInsecureContentStyle")]
230 pub ran_insecure_content_style: SecurityState,
231 #[serde(rename = "displayedInsecureContentStyle")]
233 pub displayed_insecure_content_style: SecurityState,
234}
235
236#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
239pub enum CertificateErrorAction {
240 #[serde(rename = "continue")]
242 Continue,
243 #[serde(rename = "cancel")]
245 Cancel,
246 #[serde(untagged)]
250 Unrecognized(String),
251}
252
253#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
257pub struct DisableParams {}
258
259impl crate::typed::Command for DisableParams {
260 const METHOD: &'static str = "Security.disable";
261 type Returns = crate::typed::NoReturns;
262}
263
264#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
268pub struct EnableParams {}
269
270impl crate::typed::Command for EnableParams {
271 const METHOD: &'static str = "Security.enable";
272 type Returns = crate::typed::NoReturns;
273}
274
275#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
279pub struct SetIgnoreCertificateErrorsParams {
280 pub ignore: bool,
282}
283
284impl crate::typed::Command for SetIgnoreCertificateErrorsParams {
285 const METHOD: &'static str = "Security.setIgnoreCertificateErrors";
286 type Returns = crate::typed::NoReturns;
287}
288
289#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
295pub struct HandleCertificateErrorParams {
296 #[serde(rename = "eventId")]
298 pub event_id: i64,
299 pub action: CertificateErrorAction,
301}
302
303impl crate::typed::Command for HandleCertificateErrorParams {
304 const METHOD: &'static str = "Security.handleCertificateError";
305 type Returns = crate::typed::NoReturns;
306}
307
308#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
316pub struct SetOverrideCertificateErrorsParams {
317 pub r#override: bool,
319}
320
321impl crate::typed::Command for SetOverrideCertificateErrorsParams {
322 const METHOD: &'static str = "Security.setOverrideCertificateErrors";
323 type Returns = crate::typed::NoReturns;
324}
325
326#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
336pub struct CertificateErrorEvent {
337 #[serde(rename = "eventId")]
339 pub event_id: i64,
340 #[serde(rename = "errorType")]
342 pub error_type: String,
343 #[serde(rename = "requestURL")]
345 pub request_url: String,
346}
347
348impl crate::typed::Event for CertificateErrorEvent {
349 const METHOD: &'static str = "Security.certificateError";
350}
351
352#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
358pub struct VisibleSecurityStateChangedEvent {
359 #[serde(rename = "visibleSecurityState")]
361 pub visible_security_state: VisibleSecurityState,
362}
363
364impl crate::typed::Event for VisibleSecurityStateChangedEvent {
365 const METHOD: &'static str = "Security.visibleSecurityStateChanged";
366}
367
368#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
374pub struct SecurityStateChangedEvent {
375 #[serde(rename = "securityState")]
377 pub security_state: SecurityState,
378 #[serde(rename = "schemeIsCryptographic")]
382 pub scheme_is_cryptographic: bool,
383 pub explanations: Vec<SecurityStateExplanation>,
388 #[serde(rename = "insecureContentStatus")]
392 pub insecure_content_status: InsecureContentStatus,
393 #[serde(default, skip_serializing_if = "Option::is_none")]
397 pub summary: Option<String>,
398}
399
400impl crate::typed::Event for SecurityStateChangedEvent {
401 const METHOD: &'static str = "Security.securityStateChanged";
402}