cdp-driver 0.5.0

Chrome DevTools Protocol (CDP) client for Rust: every command, event and type generated from the schema, with sessions, for browser automation and AI agents
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
// @generated by `just generate-methods` from protocol/*.json.
// Do not edit by hand; edit xtask/ and regenerate.

//! This domain allows configuring virtual authenticators to test the WebAuthn
//! API.
//!
//! Types, command parameters and event payloads for the `WebAuthn`
//! domain. The method-name constants for the same domain are in
//! [`crate::methods`].
//!
//! This domain is experimental and may change without notice.

use serde::{Deserialize, Serialize};

pub type AuthenticatorId = String;

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AuthenticatorProtocol {
    /// `u2f`
    #[serde(rename = "u2f")]
    U2f,
    /// `ctap2`
    #[serde(rename = "ctap2")]
    Ctap2,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum Ctap2Version {
    /// `ctap2_0`
    #[serde(rename = "ctap2_0")]
    Ctap20,
    /// `ctap2_1`
    #[serde(rename = "ctap2_1")]
    Ctap21,
    /// `ctap2_2`
    #[serde(rename = "ctap2_2")]
    Ctap22,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

/// LINT.IfChange(AuthenticatorTransport)
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum AuthenticatorTransport {
    /// `usb`
    #[serde(rename = "usb")]
    Usb,
    /// `nfc`
    #[serde(rename = "nfc")]
    Nfc,
    /// `ble`
    #[serde(rename = "ble")]
    Ble,
    /// `cable`
    #[serde(rename = "cable")]
    Cable,
    /// `hybrid`
    #[serde(rename = "hybrid")]
    Hybrid,
    /// `smart-card`
    #[serde(rename = "smart-card")]
    SmartCard,
    /// `internal`
    #[serde(rename = "internal")]
    Internal,
    /// A value this vendored schema does not list. Chrome adds values ahead of
    /// the published protocol, so an unrecognised one is kept as it arrived
    /// rather than failing the payload it came in.
    #[serde(untagged)]
    Unrecognized(String),
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct VirtualAuthenticatorOptions {
    pub protocol: AuthenticatorProtocol,
    /// Defaults to ctap2_0. Ignored if |protocol| == u2f.
    #[serde(
        rename = "ctap2Version",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub ctap2_version: Option<Ctap2Version>,
    pub transport: AuthenticatorTransport,
    /// Defaults to false.
    #[serde(
        rename = "hasResidentKey",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_resident_key: Option<bool>,
    /// Defaults to false.
    #[serde(
        rename = "hasUserVerification",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_user_verification: Option<bool>,
    /// If set to true, the authenticator will support the largeBlob extension.
    /// <https://w3c.github.io/webauthn#largeBlob> Defaults to false.
    #[serde(
        rename = "hasLargeBlob",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_large_blob: Option<bool>,
    /// If set to true, the authenticator will support the credBlob extension.
    /// <https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension>
    /// Defaults to false.
    #[serde(
        rename = "hasCredBlob",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_cred_blob: Option<bool>,
    /// If set to true, the authenticator will support the minPinLength extension.
    /// <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension>
    /// Defaults to false.
    #[serde(
        rename = "hasMinPinLength",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_min_pin_length: Option<bool>,
    /// If set to true, the authenticator will support the prf extension.
    /// <https://w3c.github.io/webauthn/#prf-extension> Defaults to false.
    #[serde(rename = "hasPrf", default, skip_serializing_if = "Option::is_none")]
    pub has_prf: Option<bool>,
    /// If set to true, the authenticator will support the hmac-secret extension.
    /// <https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-hmac-secret-extension>
    /// Defaults to false.
    #[serde(
        rename = "hasHmacSecret",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_hmac_secret: Option<bool>,
    /// If set to true, the authenticator will support the hmac-secret-mc
    /// extension.
    /// <https://fidoalliance.org/specs/fido-v2.2-rd-20241003/fido-client-to-authenticator-protocol-v2.2-rd-20241003.html#sctn-hmac-secret-make-cred-extension>
    /// Defaults to false.
    #[serde(
        rename = "hasHmacSecretMc",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_hmac_secret_mc: Option<bool>,
    /// If set to true, the authenticator will support the cmtgKey (Credential
    /// Manager Trust Group Key) extension.
    /// <https://github.com/w3c/webauthn/pull/2377> Defaults to false.
    #[serde(
        rename = "hasCmtgKey",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub has_cmtg_key: Option<bool>,
    /// If set to true, tests of user presence will succeed immediately.
    /// Otherwise, they will not be resolved. Defaults to true.
    #[serde(
        rename = "automaticPresenceSimulation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub automatic_presence_simulation: Option<bool>,
    /// Sets whether User Verification succeeds or fails for an authenticator.
    /// Defaults to false.
    #[serde(
        rename = "isUserVerified",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_user_verified: Option<bool>,
    /// Credentials created by this authenticator will have the backup eligibility
    /// (BE) flag set to this value. Defaults to false.
    /// <https://w3c.github.io/webauthn/#sctn-credential-backup>
    #[serde(
        rename = "defaultBackupEligibility",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub default_backup_eligibility: Option<bool>,
    /// Credentials created by this authenticator will have the backup state (BS)
    /// flag set to this value. Defaults to false.
    /// <https://w3c.github.io/webauthn/#sctn-credential-backup>
    #[serde(
        rename = "defaultBackupState",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub default_backup_state: Option<bool>,
}

#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct Credential {
    #[serde(rename = "credentialId")]
    pub credential_id: String,
    #[serde(rename = "isResidentCredential")]
    pub is_resident_credential: bool,
    /// Relying Party ID the credential is scoped to. Must be set when adding a
    /// credential.
    #[serde(rename = "rpId", default, skip_serializing_if = "Option::is_none")]
    pub rp_id: Option<String>,
    /// The ECDSA P-256 private key in PKCS#8 format. (Encoded as a base64 string
    /// when passed over JSON)
    #[serde(rename = "privateKey")]
    pub private_key: String,
    /// An opaque byte sequence with a maximum size of 64 bytes mapping the
    /// credential to a specific user. (Encoded as a base64 string when passed
    /// over JSON)
    #[serde(
        rename = "userHandle",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub user_handle: Option<String>,
    /// Signature counter. Must be equal to or greater than -1. If -1, the
    /// credential won't have an associated signature counter, and every assertion
    /// operation will report a value of 0. See
    /// <https://w3c.github.io/webauthn/#signature-counter>
    #[serde(rename = "signCount")]
    pub sign_count: f64,
    /// The large blob associated with the credential. See
    /// <https://w3c.github.io/webauthn/#sctn-large-blob-extension> (Encoded as a
    /// base64 string when passed over JSON)
    #[serde(rename = "largeBlob", default, skip_serializing_if = "Option::is_none")]
    pub large_blob: Option<String>,
    /// Assertions returned by this credential will have the backup eligibility
    /// (BE) flag set to this value. Defaults to the authenticator's
    /// defaultBackupEligibility value.
    #[serde(
        rename = "backupEligibility",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub backup_eligibility: Option<bool>,
    /// Assertions returned by this credential will have the backup state (BS)
    /// flag set to this value. Defaults to the authenticator's defaultBackupState
    /// value.
    #[serde(
        rename = "backupState",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub backup_state: Option<bool>,
    /// The credential's user.name property. Equivalent to empty if not set.
    /// <https://w3c.github.io/webauthn/#dom-publickeycredentialentity-name>
    #[serde(rename = "userName", default, skip_serializing_if = "Option::is_none")]
    pub user_name: Option<String>,
    /// The credential's user.displayName property. Equivalent to empty if not
    /// set.
    /// <https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname>
    #[serde(
        rename = "userDisplayName",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub user_display_name: Option<String>,
    /// The CMTG keys associated with the credential.
    #[serde(rename = "cmtgKeys", default, skip_serializing_if = "Option::is_none")]
    pub cmtg_keys: Option<Vec<String>>,
    /// The 0-based index of the active key in cmtgKeys.
    #[serde(
        rename = "activeCmtgKeyIndex",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub active_cmtg_key_index: Option<i64>,
    /// If true, the authenticator will generate a new CMTG key on the next
    /// operation.
    #[serde(
        rename = "generateCmtgKeyOnNextOperation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub generate_cmtg_key_on_next_operation: Option<bool>,
}

/// Enable the WebAuthn domain and start intercepting credential storage and
/// retrieval with a virtual authenticator.
///
/// Parameters of `WebAuthn.enable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct EnableParams {
    /// Whether to enable the WebAuthn user interface. Enabling the UI is
    /// recommended for debugging and demo purposes, as it is closer to the real
    /// experience. Disabling the UI is recommended for automated testing.
    /// Supported at the embedder's discretion if UI is available. Defaults to
    /// false.
    #[serde(rename = "enableUI", default, skip_serializing_if = "Option::is_none")]
    pub enable_ui: Option<bool>,
}

impl crate::typed::Command for EnableParams {
    const METHOD: &'static str = "WebAuthn.enable";
    type Returns = crate::typed::NoReturns;
}

/// Disable the WebAuthn domain.
///
/// Parameters of `WebAuthn.disable`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct DisableParams {}

impl crate::typed::Command for DisableParams {
    const METHOD: &'static str = "WebAuthn.disable";
    type Returns = crate::typed::NoReturns;
}

/// Creates and adds a virtual authenticator.
///
/// Parameters of `WebAuthn.addVirtualAuthenticator`.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct AddVirtualAuthenticatorParams {
    pub options: VirtualAuthenticatorOptions,
}

/// What `WebAuthn.addVirtualAuthenticator` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddVirtualAuthenticatorReturns {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
}

impl crate::typed::Command for AddVirtualAuthenticatorParams {
    const METHOD: &'static str = "WebAuthn.addVirtualAuthenticator";
    type Returns = AddVirtualAuthenticatorReturns;
}

/// Resets parameters isBogusSignature, isBadUV, isBadUP to false if they are
/// not present.
///
/// Parameters of `WebAuthn.setResponseOverrideBits`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetResponseOverrideBitsParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    /// If isBogusSignature is set, overrides the signature in the authenticator
    /// response to be zero. Defaults to false.
    #[serde(
        rename = "isBogusSignature",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub is_bogus_signature: Option<bool>,
    /// If isBadUV is set, overrides the UV bit in the flags in the authenticator
    /// response to be zero. Defaults to false.
    #[serde(rename = "isBadUV", default, skip_serializing_if = "Option::is_none")]
    pub is_bad_uv: Option<bool>,
    /// If isBadUP is set, overrides the UP bit in the flags in the authenticator
    /// response to be zero. Defaults to false.
    #[serde(rename = "isBadUP", default, skip_serializing_if = "Option::is_none")]
    pub is_bad_up: Option<bool>,
}

impl crate::typed::Command for SetResponseOverrideBitsParams {
    const METHOD: &'static str = "WebAuthn.setResponseOverrideBits";
    type Returns = crate::typed::NoReturns;
}

/// Removes the given authenticator.
///
/// Parameters of `WebAuthn.removeVirtualAuthenticator`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveVirtualAuthenticatorParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
}

impl crate::typed::Command for RemoveVirtualAuthenticatorParams {
    const METHOD: &'static str = "WebAuthn.removeVirtualAuthenticator";
    type Returns = crate::typed::NoReturns;
}

/// Adds the credential to the specified authenticator.
///
/// Parameters of `WebAuthn.addCredential`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct AddCredentialParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    pub credential: Credential,
}

impl crate::typed::Command for AddCredentialParams {
    const METHOD: &'static str = "WebAuthn.addCredential";
    type Returns = crate::typed::NoReturns;
}

/// Returns a single credential stored in the given virtual authenticator that
/// matches the credential ID.
///
/// Parameters of `WebAuthn.getCredential`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCredentialParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    #[serde(rename = "credentialId")]
    pub credential_id: String,
}

/// What `WebAuthn.getCredential` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCredentialReturns {
    pub credential: Credential,
}

impl crate::typed::Command for GetCredentialParams {
    const METHOD: &'static str = "WebAuthn.getCredential";
    type Returns = GetCredentialReturns;
}

/// Returns all the credentials stored in the given virtual authenticator.
///
/// Parameters of `WebAuthn.getCredentials`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCredentialsParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
}

/// What `WebAuthn.getCredentials` answers with.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct GetCredentialsReturns {
    pub credentials: Vec<Credential>,
}

impl crate::typed::Command for GetCredentialsParams {
    const METHOD: &'static str = "WebAuthn.getCredentials";
    type Returns = GetCredentialsReturns;
}

/// Removes a credential from the authenticator.
///
/// Parameters of `WebAuthn.removeCredential`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct RemoveCredentialParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    #[serde(rename = "credentialId")]
    pub credential_id: String,
}

impl crate::typed::Command for RemoveCredentialParams {
    const METHOD: &'static str = "WebAuthn.removeCredential";
    type Returns = crate::typed::NoReturns;
}

/// Clears all the credentials from the specified device.
///
/// Parameters of `WebAuthn.clearCredentials`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct ClearCredentialsParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
}

impl crate::typed::Command for ClearCredentialsParams {
    const METHOD: &'static str = "WebAuthn.clearCredentials";
    type Returns = crate::typed::NoReturns;
}

/// Sets whether User Verification succeeds or fails for an authenticator. The
/// default is true.
///
/// Parameters of `WebAuthn.setUserVerified`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetUserVerifiedParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    #[serde(rename = "isUserVerified")]
    pub is_user_verified: bool,
}

impl crate::typed::Command for SetUserVerifiedParams {
    const METHOD: &'static str = "WebAuthn.setUserVerified";
    type Returns = crate::typed::NoReturns;
}

/// Sets whether tests of user presence will succeed immediately (if true) or
/// fail to resolve (if false) for an authenticator. The default is true.
///
/// Parameters of `WebAuthn.setAutomaticPresenceSimulation`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetAutomaticPresenceSimulationParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    pub enabled: bool,
}

impl crate::typed::Command for SetAutomaticPresenceSimulationParams {
    const METHOD: &'static str = "WebAuthn.setAutomaticPresenceSimulation";
    type Returns = crate::typed::NoReturns;
}

/// Allows setting credential properties.
/// <https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties>
///
/// Parameters of `WebAuthn.setCredentialProperties`.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct SetCredentialPropertiesParams {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    #[serde(rename = "credentialId")]
    pub credential_id: String,
    #[serde(
        rename = "backupEligibility",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub backup_eligibility: Option<bool>,
    #[serde(
        rename = "backupState",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub backup_state: Option<bool>,
    #[serde(
        rename = "activeCmtgKeyIndex",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub active_cmtg_key_index: Option<i64>,
    #[serde(
        rename = "generateCmtgKeyOnNextOperation",
        default,
        skip_serializing_if = "Option::is_none"
    )]
    pub generate_cmtg_key_on_next_operation: Option<bool>,
    /// Must be equal to or greater than -1. If -1, the signature counter is
    /// removed from the credential, and every assertion operation will report a
    /// value of 0. See <https://w3c.github.io/webauthn/#signature-counter>
    #[serde(rename = "signCount", default, skip_serializing_if = "Option::is_none")]
    pub sign_count: Option<f64>,
}

impl crate::typed::Command for SetCredentialPropertiesParams {
    const METHOD: &'static str = "WebAuthn.setCredentialProperties";
    type Returns = crate::typed::NoReturns;
}

/// Triggered when a credential is added to an authenticator.
///
/// Payload of the `WebAuthn.credentialAdded` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CredentialAddedEvent {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    pub credential: Credential,
}

impl crate::typed::Event for CredentialAddedEvent {
    const METHOD: &'static str = "WebAuthn.credentialAdded";
}

/// Triggered when a credential is deleted, e.g. through
/// PublicKeyCredential.signalUnknownCredential().
///
/// Payload of the `WebAuthn.credentialDeleted` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CredentialDeletedEvent {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    #[serde(rename = "credentialId")]
    pub credential_id: String,
}

impl crate::typed::Event for CredentialDeletedEvent {
    const METHOD: &'static str = "WebAuthn.credentialDeleted";
}

/// Triggered when a credential is updated, e.g. through
/// PublicKeyCredential.signalCurrentUserDetails().
///
/// Payload of the `WebAuthn.credentialUpdated` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CredentialUpdatedEvent {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    pub credential: Credential,
}

impl crate::typed::Event for CredentialUpdatedEvent {
    const METHOD: &'static str = "WebAuthn.credentialUpdated";
}

/// Triggered when a credential is used in a webauthn assertion.
///
/// Payload of the `WebAuthn.credentialAsserted` event.
#[derive(Debug, Clone, Default, PartialEq, Serialize, Deserialize)]
pub struct CredentialAssertedEvent {
    #[serde(rename = "authenticatorId")]
    pub authenticator_id: AuthenticatorId,
    pub credential: Credential,
}

impl crate::typed::Event for CredentialAssertedEvent {
    const METHOD: &'static str = "WebAuthn.credentialAsserted";
}