Skip to main content

cdp_protocol/
security.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: Security
2#![allow(dead_code)]
3use super::network;
4#[allow(unused_imports)]
5use super::types::*;
6#[allow(unused_imports)]
7use derive_builder::Builder;
8#[allow(unused_imports)]
9use serde::{Deserialize, Serialize};
10#[allow(unused_imports)]
11use serde_json::Value as Json;
12pub type CertificateId = JsUInt;
13#[allow(deprecated)]
14#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
15pub enum MixedContentType {
16    #[serde(rename = "blockable")]
17    Blockable,
18    #[serde(rename = "optionally-blockable")]
19    OptionallyBlockable,
20    #[serde(rename = "none")]
21    None,
22}
23#[allow(deprecated)]
24#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
25pub enum SecurityState {
26    #[serde(rename = "unknown")]
27    Unknown,
28    #[serde(rename = "neutral")]
29    Neutral,
30    #[serde(rename = "insecure")]
31    Insecure,
32    #[serde(rename = "secure")]
33    Secure,
34    #[serde(rename = "info")]
35    Info,
36    #[serde(rename = "insecure-broken")]
37    InsecureBroken,
38}
39#[allow(deprecated)]
40#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
41pub enum SafetyTipStatus {
42    #[serde(rename = "badReputation")]
43    BadReputation,
44    #[serde(rename = "lookalike")]
45    Lookalike,
46}
47#[allow(deprecated)]
48#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
49pub enum CertificateErrorAction {
50    #[serde(rename = "continue")]
51    Continue,
52    #[serde(rename = "cancel")]
53    Cancel,
54}
55#[allow(deprecated)]
56#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
57#[builder(setter(into, strip_option))]
58#[serde(rename_all = "camelCase")]
59#[doc = "Details about the security state of the page certificate."]
60pub struct CertificateSecurityState {
61    #[serde(default)]
62    #[doc = "Protocol name (e.g. \"TLS 1.2\" or \"QUIC\")."]
63    pub protocol: String,
64    #[serde(default)]
65    #[doc = "Key Exchange used by the connection, or the empty string if not applicable."]
66    pub key_exchange: String,
67    #[builder(default)]
68    #[serde(skip_serializing_if = "Option::is_none")]
69    #[serde(default)]
70    #[doc = "(EC)DH group used by the connection, if applicable."]
71    pub key_exchange_group: Option<String>,
72    #[serde(default)]
73    #[doc = "Cipher name."]
74    pub cipher: String,
75    #[builder(default)]
76    #[serde(skip_serializing_if = "Option::is_none")]
77    #[serde(default)]
78    #[doc = "TLS MAC. Note that AEAD ciphers do not have separate MACs."]
79    pub mac: Option<String>,
80    #[serde(default)]
81    #[doc = "Page certificate."]
82    pub certificate: Vec<String>,
83    #[serde(default)]
84    #[doc = "Certificate subject name."]
85    pub subject_name: String,
86    #[serde(default)]
87    #[doc = "Name of the issuing CA."]
88    pub issuer: String,
89    #[doc = "Certificate valid from date."]
90    pub valid_from: network::TimeSinceEpoch,
91    #[doc = "Certificate valid to (expiration) date"]
92    pub valid_to: network::TimeSinceEpoch,
93    #[builder(default)]
94    #[serde(skip_serializing_if = "Option::is_none")]
95    #[serde(default)]
96    #[doc = "The highest priority network error code, if the certificate has an error."]
97    pub certificate_network_error: Option<String>,
98    #[serde(default)]
99    #[doc = "True if the certificate uses a weak signature algorithm."]
100    pub certificate_has_weak_signature: bool,
101    #[serde(default)]
102    #[doc = "True if the certificate has a SHA1 signature in the chain."]
103    pub certificate_has_sha_1_signature: bool,
104    #[serde(default)]
105    #[doc = "True if modern SSL"]
106    #[serde(rename = "modernSSL")]
107    pub modern_ssl: bool,
108    #[serde(default)]
109    #[doc = "True if the connection is using an obsolete SSL protocol."]
110    pub obsolete_ssl_protocol: bool,
111    #[serde(default)]
112    #[doc = "True if the connection is using an obsolete SSL key exchange."]
113    pub obsolete_ssl_key_exchange: bool,
114    #[serde(default)]
115    #[doc = "True if the connection is using an obsolete SSL cipher."]
116    pub obsolete_ssl_cipher: bool,
117    #[serde(default)]
118    #[doc = "True if the connection is using an obsolete SSL signature."]
119    pub obsolete_ssl_signature: bool,
120}
121#[allow(deprecated)]
122#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
123#[builder(setter(into, strip_option))]
124#[serde(rename_all = "camelCase")]
125pub struct SafetyTipInfo {
126    #[doc = "Describes whether the page triggers any safety tips or reputation warnings. Default is unknown."]
127    pub safety_tip_status: SafetyTipStatus,
128    #[builder(default)]
129    #[serde(skip_serializing_if = "Option::is_none")]
130    #[serde(default)]
131    #[doc = "The URL the safety tip suggested (\"Did you mean?\"). Only filled in for lookalike matches."]
132    pub safe_url: Option<String>,
133}
134#[allow(deprecated)]
135#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
136#[builder(setter(into, strip_option))]
137#[serde(rename_all = "camelCase")]
138#[doc = "Security state information about the page."]
139pub struct VisibleSecurityState {
140    #[doc = "The security level of the page."]
141    pub security_state: SecurityState,
142    #[builder(default)]
143    #[serde(skip_serializing_if = "Option::is_none")]
144    #[doc = "Security state details about the page certificate."]
145    pub certificate_security_state: Option<CertificateSecurityState>,
146    #[builder(default)]
147    #[serde(skip_serializing_if = "Option::is_none")]
148    #[doc = "The type of Safety Tip triggered on the page. Note that this field will be set even if the Safety Tip UI was not actually shown."]
149    pub safety_tip_info: Option<SafetyTipInfo>,
150    #[serde(default)]
151    #[doc = "Array of security state issues ids."]
152    pub security_state_issue_ids: Vec<String>,
153}
154#[allow(deprecated)]
155#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
156#[builder(setter(into, strip_option))]
157#[serde(rename_all = "camelCase")]
158#[doc = "An explanation of an factor contributing to the security state."]
159pub struct SecurityStateExplanation {
160    #[doc = "Security state representing the severity of the factor being explained."]
161    pub security_state: SecurityState,
162    #[serde(default)]
163    #[doc = "Title describing the type of factor."]
164    pub title: String,
165    #[serde(default)]
166    #[doc = "Short phrase describing the type of factor."]
167    pub summary: String,
168    #[serde(default)]
169    #[doc = "Full text explanation of the factor."]
170    pub description: String,
171    #[doc = "The type of mixed content described by the explanation."]
172    pub mixed_content_type: MixedContentType,
173    #[serde(default)]
174    #[doc = "Page certificate."]
175    pub certificate: Vec<String>,
176    #[builder(default)]
177    #[serde(skip_serializing_if = "Option::is_none")]
178    #[serde(default)]
179    #[doc = "Recommendations to fix any issues."]
180    pub recommendations: Option<Vec<String>>,
181}
182#[allow(deprecated)]
183#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
184#[builder(setter(into, strip_option))]
185#[serde(rename_all = "camelCase")]
186#[doc = "Information about insecure content on the page."]
187#[deprecated]
188pub struct InsecureContentStatus {
189    #[serde(default)]
190    #[doc = "Always false."]
191    pub ran_mixed_content: bool,
192    #[serde(default)]
193    #[doc = "Always false."]
194    pub displayed_mixed_content: bool,
195    #[serde(default)]
196    #[doc = "Always false."]
197    pub contained_mixed_form: bool,
198    #[serde(default)]
199    #[doc = "Always false."]
200    pub ran_content_with_cert_errors: bool,
201    #[serde(default)]
202    #[doc = "Always false."]
203    pub displayed_content_with_cert_errors: bool,
204    #[doc = "Always set to unknown."]
205    pub ran_insecure_content_style: SecurityState,
206    #[doc = "Always set to unknown."]
207    pub displayed_insecure_content_style: SecurityState,
208}
209#[allow(deprecated)]
210#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
211pub struct Disable(pub Option<Json>);
212#[allow(deprecated)]
213#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
214pub struct Enable(pub Option<Json>);
215#[allow(deprecated)]
216#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
217#[builder(setter(into, strip_option))]
218#[serde(rename_all = "camelCase")]
219#[doc = "Enable/disable whether all certificate errors should be ignored."]
220pub struct SetIgnoreCertificateErrors {
221    #[serde(default)]
222    #[doc = "If true, all certificate errors will be ignored."]
223    pub ignore: bool,
224}
225#[allow(deprecated)]
226#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
227#[builder(setter(into, strip_option))]
228#[serde(rename_all = "camelCase")]
229#[doc = "Handles a certificate error that fired a certificateError event."]
230#[deprecated]
231pub struct HandleCertificateError {
232    #[serde(default)]
233    #[doc = "The ID of the event."]
234    pub event_id: JsUInt,
235    #[doc = "The action to take on the certificate error."]
236    pub action: CertificateErrorAction,
237}
238#[allow(deprecated)]
239#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
240#[builder(setter(into, strip_option))]
241#[serde(rename_all = "camelCase")]
242#[doc = "Enable/disable overriding certificate errors. If enabled, all certificate error events need to\n be handled by the DevTools client and should be answered with `handleCertificateError` commands."]
243#[deprecated]
244pub struct SetOverrideCertificateErrors {
245    #[serde(default)]
246    #[doc = "If true, certificate errors will be overridden."]
247    pub r#override: bool,
248}
249#[allow(deprecated)]
250#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
251#[doc = "Disables tracking security state changes."]
252pub struct DisableReturnObject(pub Option<Json>);
253#[allow(deprecated)]
254#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
255#[doc = "Enables tracking security state changes."]
256pub struct EnableReturnObject(pub Option<Json>);
257#[allow(deprecated)]
258#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
259#[doc = "Enable/disable whether all certificate errors should be ignored."]
260pub struct SetIgnoreCertificateErrorsReturnObject(pub Option<Json>);
261#[allow(deprecated)]
262#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
263#[doc = "Handles a certificate error that fired a certificateError event."]
264#[deprecated]
265pub struct HandleCertificateErrorReturnObject(pub Option<Json>);
266#[allow(deprecated)]
267#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
268#[doc = "Enable/disable overriding certificate errors. If enabled, all certificate error events need to\n be handled by the DevTools client and should be answered with `handleCertificateError` commands."]
269#[deprecated]
270pub struct SetOverrideCertificateErrorsReturnObject(pub Option<Json>);
271#[allow(deprecated)]
272impl Method for Disable {
273    const NAME: &'static str = "Security.disable";
274    type ReturnObject = DisableReturnObject;
275}
276#[allow(deprecated)]
277impl Method for Enable {
278    const NAME: &'static str = "Security.enable";
279    type ReturnObject = EnableReturnObject;
280}
281#[allow(deprecated)]
282impl Method for SetIgnoreCertificateErrors {
283    const NAME: &'static str = "Security.setIgnoreCertificateErrors";
284    type ReturnObject = SetIgnoreCertificateErrorsReturnObject;
285}
286#[allow(deprecated)]
287impl Method for HandleCertificateError {
288    const NAME: &'static str = "Security.handleCertificateError";
289    type ReturnObject = HandleCertificateErrorReturnObject;
290}
291#[allow(deprecated)]
292impl Method for SetOverrideCertificateErrors {
293    const NAME: &'static str = "Security.setOverrideCertificateErrors";
294    type ReturnObject = SetOverrideCertificateErrorsReturnObject;
295}
296#[allow(dead_code)]
297pub mod events {
298    #[allow(unused_imports)]
299    use super::super::types::*;
300    #[allow(unused_imports)]
301    use derive_builder::Builder;
302    #[allow(unused_imports)]
303    use serde::{Deserialize, Serialize};
304    #[allow(unused_imports)]
305    use serde_json::Value as Json;
306    #[allow(deprecated)]
307    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
308    pub struct CertificateErrorEvent {
309        pub params: CertificateErrorEventParams,
310    }
311    #[allow(deprecated)]
312    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
313    #[serde(rename_all = "camelCase")]
314    pub struct CertificateErrorEventParams {
315        #[serde(default)]
316        #[doc = "The ID of the event."]
317        pub event_id: JsUInt,
318        #[serde(default)]
319        #[doc = "The type of the error."]
320        pub error_type: String,
321        #[serde(default)]
322        #[doc = "The url that was requested."]
323        #[serde(rename = "requestURL")]
324        pub request_url: String,
325    }
326    #[allow(deprecated)]
327    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
328    pub struct VisibleSecurityStateChangedEvent {
329        pub params: VisibleSecurityStateChangedEventParams,
330    }
331    #[allow(deprecated)]
332    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
333    #[serde(rename_all = "camelCase")]
334    pub struct VisibleSecurityStateChangedEventParams {
335        #[doc = "Security state information about the page."]
336        pub visible_security_state: super::VisibleSecurityState,
337    }
338    #[allow(deprecated)]
339    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
340    pub struct SecurityStateChangedEvent {
341        pub params: SecurityStateChangedEventParams,
342    }
343    #[allow(deprecated)]
344    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
345    #[serde(rename_all = "camelCase")]
346    pub struct SecurityStateChangedEventParams {
347        #[doc = "Security state."]
348        pub security_state: super::SecurityState,
349        #[serde(default)]
350        #[doc = "True if the page was loaded over cryptographic transport such as HTTPS."]
351        #[deprecated]
352        pub scheme_is_cryptographic: bool,
353        #[doc = "Previously a list of explanations for the security state. Now always\n empty."]
354        #[deprecated]
355        pub explanations: Vec<super::SecurityStateExplanation>,
356        #[doc = "Information about insecure content on the page."]
357        #[deprecated]
358        pub insecure_content_status: super::InsecureContentStatus,
359        #[builder(default)]
360        #[serde(skip_serializing_if = "Option::is_none")]
361        #[serde(default)]
362        #[doc = "Overrides user-visible description of the state. Always omitted."]
363        #[deprecated]
364        pub summary: Option<String>,
365    }
366}