Skip to main content

cdp_protocol/
web_authn.rs

1// Auto-generated from Chrome at version 146.0.7680.165 domain: WebAuthn
2#![allow(dead_code)]
3#[allow(unused_imports)]
4use super::types::*;
5#[allow(unused_imports)]
6use derive_builder::Builder;
7#[allow(unused_imports)]
8use serde::{Deserialize, Serialize};
9#[allow(unused_imports)]
10use serde_json::Value as Json;
11pub type AuthenticatorId = String;
12#[allow(deprecated)]
13#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
14pub enum AuthenticatorProtocol {
15    #[serde(rename = "u2f")]
16    U2F,
17    #[serde(rename = "ctap2")]
18    Ctap2,
19}
20#[allow(deprecated)]
21#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
22pub enum Ctap2Version {
23    #[serde(rename = "ctap2_0")]
24    Ctap20,
25    #[serde(rename = "ctap2_1")]
26    Ctap21,
27}
28#[allow(deprecated)]
29#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
30pub enum AuthenticatorTransport {
31    #[serde(rename = "usb")]
32    Usb,
33    #[serde(rename = "nfc")]
34    Nfc,
35    #[serde(rename = "ble")]
36    Ble,
37    #[serde(rename = "cable")]
38    Cable,
39    #[serde(rename = "internal")]
40    Internal,
41}
42#[allow(deprecated)]
43#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
44#[builder(setter(into, strip_option))]
45#[serde(rename_all = "camelCase")]
46pub struct VirtualAuthenticatorOptions {
47    pub protocol: AuthenticatorProtocol,
48    #[builder(default)]
49    #[serde(skip_serializing_if = "Option::is_none")]
50    #[doc = "Defaults to ctap2_0. Ignored if |protocol| == u2f."]
51    pub ctap_2_version: Option<Ctap2Version>,
52    pub transport: AuthenticatorTransport,
53    #[builder(default)]
54    #[serde(skip_serializing_if = "Option::is_none")]
55    #[serde(default)]
56    #[doc = "Defaults to false."]
57    pub has_resident_key: Option<bool>,
58    #[builder(default)]
59    #[serde(skip_serializing_if = "Option::is_none")]
60    #[serde(default)]
61    #[doc = "Defaults to false."]
62    pub has_user_verification: Option<bool>,
63    #[builder(default)]
64    #[serde(skip_serializing_if = "Option::is_none")]
65    #[serde(default)]
66    #[doc = "If set to true, the authenticator will support the largeBlob extension.\n <https://w3c.github.io/webauthn#largeBlob>\n Defaults to false."]
67    pub has_large_blob: Option<bool>,
68    #[builder(default)]
69    #[serde(skip_serializing_if = "Option::is_none")]
70    #[serde(default)]
71    #[doc = "If set to true, the authenticator will support the credBlob extension.\n <https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension>\n Defaults to false."]
72    pub has_cred_blob: Option<bool>,
73    #[builder(default)]
74    #[serde(skip_serializing_if = "Option::is_none")]
75    #[serde(default)]
76    #[doc = "If set to true, the authenticator will support the minPinLength extension.\n <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension>\n Defaults to false."]
77    pub has_min_pin_length: Option<bool>,
78    #[builder(default)]
79    #[serde(skip_serializing_if = "Option::is_none")]
80    #[serde(default)]
81    #[doc = "If set to true, the authenticator will support the prf extension.\n <https://w3c.github.io/webauthn/#prf-extension>\n Defaults to false."]
82    pub has_prf: Option<bool>,
83    #[builder(default)]
84    #[serde(skip_serializing_if = "Option::is_none")]
85    #[serde(default)]
86    #[doc = "If set to true, tests of user presence will succeed immediately.\n Otherwise, they will not be resolved. Defaults to true."]
87    pub automatic_presence_simulation: Option<bool>,
88    #[builder(default)]
89    #[serde(skip_serializing_if = "Option::is_none")]
90    #[serde(default)]
91    #[doc = "Sets whether User Verification succeeds or fails for an authenticator.\n Defaults to false."]
92    pub is_user_verified: Option<bool>,
93    #[builder(default)]
94    #[serde(skip_serializing_if = "Option::is_none")]
95    #[serde(default)]
96    #[doc = "Credentials created by this authenticator will have the backup\n eligibility (BE) flag set to this value. Defaults to false.\n <https://w3c.github.io/webauthn/#sctn-credential-backup>"]
97    pub default_backup_eligibility: Option<bool>,
98    #[builder(default)]
99    #[serde(skip_serializing_if = "Option::is_none")]
100    #[serde(default)]
101    #[doc = "Credentials created by this authenticator will have the backup state\n (BS) flag set to this value. Defaults to false.\n <https://w3c.github.io/webauthn/#sctn-credential-backup>"]
102    pub default_backup_state: Option<bool>,
103}
104#[allow(deprecated)]
105#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
106#[builder(setter(into, strip_option))]
107#[serde(rename_all = "camelCase")]
108pub struct Credential {
109    pub credential_id: String,
110    #[serde(default)]
111    pub is_resident_credential: bool,
112    #[builder(default)]
113    #[serde(skip_serializing_if = "Option::is_none")]
114    #[serde(default)]
115    #[doc = "Relying Party ID the credential is scoped to. Must be set when adding a\n credential."]
116    pub rp_id: Option<String>,
117    #[doc = "The ECDSA P-256 private key in PKCS#8 format."]
118    pub private_key: String,
119    #[builder(default)]
120    #[serde(skip_serializing_if = "Option::is_none")]
121    #[doc = "An opaque byte sequence with a maximum size of 64 bytes mapping the\n credential to a specific user."]
122    pub user_handle: Option<String>,
123    #[serde(default)]
124    #[doc = "Signature counter. This is incremented by one for each successful\n assertion.\n See <https://w3c.github.io/webauthn/#signature-counter>"]
125    pub sign_count: JsUInt,
126    #[builder(default)]
127    #[serde(skip_serializing_if = "Option::is_none")]
128    #[doc = "The large blob associated with the credential.\n See <https://w3c.github.io/webauthn/#sctn-large-blob-extension>"]
129    pub large_blob: Option<String>,
130    #[builder(default)]
131    #[serde(skip_serializing_if = "Option::is_none")]
132    #[serde(default)]
133    #[doc = "Assertions returned by this credential will have the backup eligibility\n (BE) flag set to this value. Defaults to the authenticator's\n defaultBackupEligibility value."]
134    pub backup_eligibility: Option<bool>,
135    #[builder(default)]
136    #[serde(skip_serializing_if = "Option::is_none")]
137    #[serde(default)]
138    #[doc = "Assertions returned by this credential will have the backup state (BS)\n flag set to this value. Defaults to the authenticator's\n defaultBackupState value."]
139    pub backup_state: Option<bool>,
140    #[builder(default)]
141    #[serde(skip_serializing_if = "Option::is_none")]
142    #[serde(default)]
143    #[doc = "The credential's user.name property. Equivalent to empty if not set.\n <https://w3c.github.io/webauthn/#dom-publickeycredentialentity-name>"]
144    pub user_name: Option<String>,
145    #[builder(default)]
146    #[serde(skip_serializing_if = "Option::is_none")]
147    #[serde(default)]
148    #[doc = "The credential's user.displayName property. Equivalent to empty if\n not set.\n <https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname>"]
149    pub user_display_name: Option<String>,
150}
151#[allow(deprecated)]
152#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
153#[builder(setter(into, strip_option))]
154#[serde(rename_all = "camelCase")]
155#[doc = "Enable the WebAuthn domain and start intercepting credential storage and\n retrieval with a virtual authenticator."]
156pub struct Enable {
157    #[builder(default)]
158    #[serde(skip_serializing_if = "Option::is_none")]
159    #[serde(default)]
160    #[doc = "Whether to enable the WebAuthn user interface. Enabling the UI is\n recommended for debugging and demo purposes, as it is closer to the real\n experience. Disabling the UI is recommended for automated testing.\n Supported at the embedder's discretion if UI is available.\n Defaults to false."]
161    #[serde(rename = "enableUI")]
162    pub enable_ui: Option<bool>,
163}
164#[allow(deprecated)]
165#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
166pub struct Disable(pub Option<Json>);
167#[allow(deprecated)]
168#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
169#[builder(setter(into, strip_option))]
170#[serde(rename_all = "camelCase")]
171#[doc = "Creates and adds a virtual authenticator."]
172pub struct AddVirtualAuthenticator {
173    pub options: VirtualAuthenticatorOptions,
174}
175#[allow(deprecated)]
176#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
177#[builder(setter(into, strip_option))]
178#[serde(rename_all = "camelCase")]
179#[doc = "Resets parameters isBogusSignature, isBadUV, isBadUP to false if they are not present."]
180pub struct SetResponseOverrideBits {
181    pub authenticator_id: AuthenticatorId,
182    #[builder(default)]
183    #[serde(skip_serializing_if = "Option::is_none")]
184    #[serde(default)]
185    #[doc = "If isBogusSignature is set, overrides the signature in the authenticator response to be zero.\n Defaults to false."]
186    pub is_bogus_signature: Option<bool>,
187    #[builder(default)]
188    #[serde(skip_serializing_if = "Option::is_none")]
189    #[serde(default)]
190    #[doc = "If isBadUV is set, overrides the UV bit in the flags in the authenticator response to\n be zero. Defaults to false."]
191    #[serde(rename = "isBadUV")]
192    pub is_bad_uv: Option<bool>,
193    #[builder(default)]
194    #[serde(skip_serializing_if = "Option::is_none")]
195    #[serde(default)]
196    #[doc = "If isBadUP is set, overrides the UP bit in the flags in the authenticator response to\n be zero. Defaults to false."]
197    #[serde(rename = "isBadUP")]
198    pub is_bad_up: Option<bool>,
199}
200#[allow(deprecated)]
201#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
202#[builder(setter(into, strip_option))]
203#[serde(rename_all = "camelCase")]
204#[doc = "Removes the given authenticator."]
205pub struct RemoveVirtualAuthenticator {
206    pub authenticator_id: AuthenticatorId,
207}
208#[allow(deprecated)]
209#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
210#[builder(setter(into, strip_option))]
211#[serde(rename_all = "camelCase")]
212#[doc = "Adds the credential to the specified authenticator."]
213pub struct AddCredential {
214    pub authenticator_id: AuthenticatorId,
215    pub credential: Credential,
216}
217#[allow(deprecated)]
218#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
219#[builder(setter(into, strip_option))]
220#[serde(rename_all = "camelCase")]
221#[doc = "Returns a single credential stored in the given virtual authenticator that\n matches the credential ID."]
222pub struct GetCredential {
223    pub authenticator_id: AuthenticatorId,
224    pub credential_id: Vec<u8>,
225}
226#[allow(deprecated)]
227#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
228#[builder(setter(into, strip_option))]
229#[serde(rename_all = "camelCase")]
230#[doc = "Returns all the credentials stored in the given virtual authenticator."]
231pub struct GetCredentials {
232    pub authenticator_id: AuthenticatorId,
233}
234#[allow(deprecated)]
235#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
236#[builder(setter(into, strip_option))]
237#[serde(rename_all = "camelCase")]
238#[doc = "Removes a credential from the authenticator."]
239pub struct RemoveCredential {
240    pub authenticator_id: AuthenticatorId,
241    pub credential_id: Vec<u8>,
242}
243#[allow(deprecated)]
244#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
245#[builder(setter(into, strip_option))]
246#[serde(rename_all = "camelCase")]
247#[doc = "Clears all the credentials from the specified device."]
248pub struct ClearCredentials {
249    pub authenticator_id: AuthenticatorId,
250}
251#[allow(deprecated)]
252#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
253#[builder(setter(into, strip_option))]
254#[serde(rename_all = "camelCase")]
255#[doc = "Sets whether User Verification succeeds or fails for an authenticator.\n The default is true."]
256pub struct SetUserVerified {
257    pub authenticator_id: AuthenticatorId,
258    #[serde(default)]
259    pub is_user_verified: bool,
260}
261#[allow(deprecated)]
262#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
263#[builder(setter(into, strip_option))]
264#[serde(rename_all = "camelCase")]
265#[doc = "Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator.\n The default is true."]
266pub struct SetAutomaticPresenceSimulation {
267    pub authenticator_id: AuthenticatorId,
268    #[serde(default)]
269    pub enabled: bool,
270}
271#[allow(deprecated)]
272#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
273#[builder(setter(into, strip_option))]
274#[serde(rename_all = "camelCase")]
275#[doc = "Allows setting credential properties.\n <https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties>"]
276pub struct SetCredentialProperties {
277    pub authenticator_id: AuthenticatorId,
278    pub credential_id: Vec<u8>,
279    #[builder(default)]
280    #[serde(skip_serializing_if = "Option::is_none")]
281    #[serde(default)]
282    pub backup_eligibility: Option<bool>,
283    #[builder(default)]
284    #[serde(skip_serializing_if = "Option::is_none")]
285    #[serde(default)]
286    pub backup_state: Option<bool>,
287}
288#[allow(deprecated)]
289#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
290#[doc = "Enable the WebAuthn domain and start intercepting credential storage and\n retrieval with a virtual authenticator."]
291pub struct EnableReturnObject(pub Option<Json>);
292#[allow(deprecated)]
293#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
294#[doc = "Disable the WebAuthn domain."]
295pub struct DisableReturnObject(pub Option<Json>);
296#[allow(deprecated)]
297#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
298#[serde(rename_all = "camelCase")]
299#[doc = "Creates and adds a virtual authenticator."]
300pub struct AddVirtualAuthenticatorReturnObject {
301    pub authenticator_id: AuthenticatorId,
302}
303#[allow(deprecated)]
304#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
305#[doc = "Resets parameters isBogusSignature, isBadUV, isBadUP to false if they are not present."]
306pub struct SetResponseOverrideBitsReturnObject(pub Option<Json>);
307#[allow(deprecated)]
308#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
309#[doc = "Removes the given authenticator."]
310pub struct RemoveVirtualAuthenticatorReturnObject(pub Option<Json>);
311#[allow(deprecated)]
312#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
313#[doc = "Adds the credential to the specified authenticator."]
314pub struct AddCredentialReturnObject(pub Option<Json>);
315#[allow(deprecated)]
316#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
317#[serde(rename_all = "camelCase")]
318#[doc = "Returns a single credential stored in the given virtual authenticator that\n matches the credential ID."]
319pub struct GetCredentialReturnObject {
320    pub credential: Credential,
321}
322#[allow(deprecated)]
323#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
324#[serde(rename_all = "camelCase")]
325#[doc = "Returns all the credentials stored in the given virtual authenticator."]
326pub struct GetCredentialsReturnObject {
327    pub credentials: Vec<Credential>,
328}
329#[allow(deprecated)]
330#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
331#[doc = "Removes a credential from the authenticator."]
332pub struct RemoveCredentialReturnObject(pub Option<Json>);
333#[allow(deprecated)]
334#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
335#[doc = "Clears all the credentials from the specified device."]
336pub struct ClearCredentialsReturnObject(pub Option<Json>);
337#[allow(deprecated)]
338#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
339#[doc = "Sets whether User Verification succeeds or fails for an authenticator.\n The default is true."]
340pub struct SetUserVerifiedReturnObject(pub Option<Json>);
341#[allow(deprecated)]
342#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
343#[doc = "Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator.\n The default is true."]
344pub struct SetAutomaticPresenceSimulationReturnObject(pub Option<Json>);
345#[allow(deprecated)]
346#[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
347#[doc = "Allows setting credential properties.\n <https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties>"]
348pub struct SetCredentialPropertiesReturnObject(pub Option<Json>);
349#[allow(deprecated)]
350impl Method for Enable {
351    const NAME: &'static str = "WebAuthn.enable";
352    type ReturnObject = EnableReturnObject;
353}
354#[allow(deprecated)]
355impl Method for Disable {
356    const NAME: &'static str = "WebAuthn.disable";
357    type ReturnObject = DisableReturnObject;
358}
359#[allow(deprecated)]
360impl Method for AddVirtualAuthenticator {
361    const NAME: &'static str = "WebAuthn.addVirtualAuthenticator";
362    type ReturnObject = AddVirtualAuthenticatorReturnObject;
363}
364#[allow(deprecated)]
365impl Method for SetResponseOverrideBits {
366    const NAME: &'static str = "WebAuthn.setResponseOverrideBits";
367    type ReturnObject = SetResponseOverrideBitsReturnObject;
368}
369#[allow(deprecated)]
370impl Method for RemoveVirtualAuthenticator {
371    const NAME: &'static str = "WebAuthn.removeVirtualAuthenticator";
372    type ReturnObject = RemoveVirtualAuthenticatorReturnObject;
373}
374#[allow(deprecated)]
375impl Method for AddCredential {
376    const NAME: &'static str = "WebAuthn.addCredential";
377    type ReturnObject = AddCredentialReturnObject;
378}
379#[allow(deprecated)]
380impl Method for GetCredential {
381    const NAME: &'static str = "WebAuthn.getCredential";
382    type ReturnObject = GetCredentialReturnObject;
383}
384#[allow(deprecated)]
385impl Method for GetCredentials {
386    const NAME: &'static str = "WebAuthn.getCredentials";
387    type ReturnObject = GetCredentialsReturnObject;
388}
389#[allow(deprecated)]
390impl Method for RemoveCredential {
391    const NAME: &'static str = "WebAuthn.removeCredential";
392    type ReturnObject = RemoveCredentialReturnObject;
393}
394#[allow(deprecated)]
395impl Method for ClearCredentials {
396    const NAME: &'static str = "WebAuthn.clearCredentials";
397    type ReturnObject = ClearCredentialsReturnObject;
398}
399#[allow(deprecated)]
400impl Method for SetUserVerified {
401    const NAME: &'static str = "WebAuthn.setUserVerified";
402    type ReturnObject = SetUserVerifiedReturnObject;
403}
404#[allow(deprecated)]
405impl Method for SetAutomaticPresenceSimulation {
406    const NAME: &'static str = "WebAuthn.setAutomaticPresenceSimulation";
407    type ReturnObject = SetAutomaticPresenceSimulationReturnObject;
408}
409#[allow(deprecated)]
410impl Method for SetCredentialProperties {
411    const NAME: &'static str = "WebAuthn.setCredentialProperties";
412    type ReturnObject = SetCredentialPropertiesReturnObject;
413}
414#[allow(dead_code)]
415pub mod events {
416    #[allow(unused_imports)]
417    use super::super::types::*;
418    #[allow(unused_imports)]
419    use derive_builder::Builder;
420    #[allow(unused_imports)]
421    use serde::{Deserialize, Serialize};
422    #[allow(unused_imports)]
423    use serde_json::Value as Json;
424    #[allow(deprecated)]
425    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
426    pub struct CredentialAddedEvent {
427        pub params: CredentialAddedEventParams,
428    }
429    #[allow(deprecated)]
430    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
431    #[serde(rename_all = "camelCase")]
432    pub struct CredentialAddedEventParams {
433        pub authenticator_id: super::AuthenticatorId,
434        pub credential: super::Credential,
435    }
436    #[allow(deprecated)]
437    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
438    pub struct CredentialDeletedEvent {
439        pub params: CredentialDeletedEventParams,
440    }
441    #[allow(deprecated)]
442    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
443    #[serde(rename_all = "camelCase")]
444    pub struct CredentialDeletedEventParams {
445        pub authenticator_id: super::AuthenticatorId,
446        #[serde(default)]
447        pub credential_id: String,
448    }
449    #[allow(deprecated)]
450    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
451    pub struct CredentialUpdatedEvent {
452        pub params: CredentialUpdatedEventParams,
453    }
454    #[allow(deprecated)]
455    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
456    #[serde(rename_all = "camelCase")]
457    pub struct CredentialUpdatedEventParams {
458        pub authenticator_id: super::AuthenticatorId,
459        pub credential: super::Credential,
460    }
461    #[allow(deprecated)]
462    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq)]
463    pub struct CredentialAssertedEvent {
464        pub params: CredentialAssertedEventParams,
465    }
466    #[allow(deprecated)]
467    #[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Builder)]
468    #[serde(rename_all = "camelCase")]
469    pub struct CredentialAssertedEventParams {
470        pub authenticator_id: super::AuthenticatorId,
471        pub credential: super::Credential,
472    }
473}