1use serde::{Serialize, Deserialize};
6use serde_json::Value as JsonValue;
7use std::borrow::Cow;
8
9
10pub type AuthenticatorId<'a> = Cow<'a, str>;
11
12
13#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
14pub enum AuthenticatorProtocol {
15 #[default]
16 #[serde(rename = "u2f")]
17 U2f,
18 #[serde(rename = "ctap2")]
19 Ctap2,
20}
21
22
23#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
24pub enum Ctap2Version {
25 #[default]
26 #[serde(rename = "ctap2_0")]
27 Ctap20,
28 #[serde(rename = "ctap2_1")]
29 Ctap21,
30 #[serde(rename = "ctap2_2")]
31 Ctap22,
32}
33
34
35#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Default)]
36pub enum AuthenticatorTransport {
37 #[default]
38 #[serde(rename = "usb")]
39 Usb,
40 #[serde(rename = "nfc")]
41 Nfc,
42 #[serde(rename = "ble")]
43 Ble,
44 #[serde(rename = "cable")]
45 Cable,
46 #[serde(rename = "internal")]
47 Internal,
48}
49
50
51#[derive(Debug, Clone, Serialize, Deserialize, Default)]
52#[serde(rename_all = "camelCase")]
53pub struct VirtualAuthenticatorOptions {
54 protocol: AuthenticatorProtocol,
55 #[serde(skip_serializing_if = "Option::is_none")]
57 ctap2Version: Option<Ctap2Version>,
58 transport: AuthenticatorTransport,
59 #[serde(skip_serializing_if = "Option::is_none")]
61 hasResidentKey: Option<bool>,
62 #[serde(skip_serializing_if = "Option::is_none")]
64 hasUserVerification: Option<bool>,
65 #[serde(skip_serializing_if = "Option::is_none")]
69 hasLargeBlob: Option<bool>,
70 #[serde(skip_serializing_if = "Option::is_none")]
74 hasCredBlob: Option<bool>,
75 #[serde(skip_serializing_if = "Option::is_none")]
79 hasMinPinLength: Option<bool>,
80 #[serde(skip_serializing_if = "Option::is_none")]
84 hasPrf: Option<bool>,
85 #[serde(skip_serializing_if = "Option::is_none")]
89 hasHmacSecret: Option<bool>,
90 #[serde(skip_serializing_if = "Option::is_none")]
94 hasHmacSecretMc: Option<bool>,
95 #[serde(skip_serializing_if = "Option::is_none")]
98 automaticPresenceSimulation: Option<bool>,
99 #[serde(skip_serializing_if = "Option::is_none")]
102 isUserVerified: Option<bool>,
103 #[serde(skip_serializing_if = "Option::is_none")]
107 defaultBackupEligibility: Option<bool>,
108 #[serde(skip_serializing_if = "Option::is_none")]
112 defaultBackupState: Option<bool>,
113}
114
115impl VirtualAuthenticatorOptions {
116 pub fn builder(protocol: AuthenticatorProtocol, transport: AuthenticatorTransport) -> VirtualAuthenticatorOptionsBuilder {
117 VirtualAuthenticatorOptionsBuilder {
118 protocol: protocol,
119 ctap2Version: None,
120 transport: transport,
121 hasResidentKey: None,
122 hasUserVerification: None,
123 hasLargeBlob: None,
124 hasCredBlob: None,
125 hasMinPinLength: None,
126 hasPrf: None,
127 hasHmacSecret: None,
128 hasHmacSecretMc: None,
129 automaticPresenceSimulation: None,
130 isUserVerified: None,
131 defaultBackupEligibility: None,
132 defaultBackupState: None,
133 }
134 }
135 pub fn protocol(&self) -> &AuthenticatorProtocol { &self.protocol }
136 pub fn ctap2Version(&self) -> Option<&Ctap2Version> { self.ctap2Version.as_ref() }
137 pub fn transport(&self) -> &AuthenticatorTransport { &self.transport }
138 pub fn hasResidentKey(&self) -> Option<bool> { self.hasResidentKey }
139 pub fn hasUserVerification(&self) -> Option<bool> { self.hasUserVerification }
140 pub fn hasLargeBlob(&self) -> Option<bool> { self.hasLargeBlob }
141 pub fn hasCredBlob(&self) -> Option<bool> { self.hasCredBlob }
142 pub fn hasMinPinLength(&self) -> Option<bool> { self.hasMinPinLength }
143 pub fn hasPrf(&self) -> Option<bool> { self.hasPrf }
144 pub fn hasHmacSecret(&self) -> Option<bool> { self.hasHmacSecret }
145 pub fn hasHmacSecretMc(&self) -> Option<bool> { self.hasHmacSecretMc }
146 pub fn automaticPresenceSimulation(&self) -> Option<bool> { self.automaticPresenceSimulation }
147 pub fn isUserVerified(&self) -> Option<bool> { self.isUserVerified }
148 pub fn defaultBackupEligibility(&self) -> Option<bool> { self.defaultBackupEligibility }
149 pub fn defaultBackupState(&self) -> Option<bool> { self.defaultBackupState }
150}
151
152
153pub struct VirtualAuthenticatorOptionsBuilder {
154 protocol: AuthenticatorProtocol,
155 ctap2Version: Option<Ctap2Version>,
156 transport: AuthenticatorTransport,
157 hasResidentKey: Option<bool>,
158 hasUserVerification: Option<bool>,
159 hasLargeBlob: Option<bool>,
160 hasCredBlob: Option<bool>,
161 hasMinPinLength: Option<bool>,
162 hasPrf: Option<bool>,
163 hasHmacSecret: Option<bool>,
164 hasHmacSecretMc: Option<bool>,
165 automaticPresenceSimulation: Option<bool>,
166 isUserVerified: Option<bool>,
167 defaultBackupEligibility: Option<bool>,
168 defaultBackupState: Option<bool>,
169}
170
171impl VirtualAuthenticatorOptionsBuilder {
172 pub fn ctap2Version(mut self, ctap2Version: Ctap2Version) -> Self { self.ctap2Version = Some(ctap2Version); self }
174 pub fn hasResidentKey(mut self, hasResidentKey: bool) -> Self { self.hasResidentKey = Some(hasResidentKey); self }
176 pub fn hasUserVerification(mut self, hasUserVerification: bool) -> Self { self.hasUserVerification = Some(hasUserVerification); self }
178 pub fn hasLargeBlob(mut self, hasLargeBlob: bool) -> Self { self.hasLargeBlob = Some(hasLargeBlob); self }
182 pub fn hasCredBlob(mut self, hasCredBlob: bool) -> Self { self.hasCredBlob = Some(hasCredBlob); self }
186 pub fn hasMinPinLength(mut self, hasMinPinLength: bool) -> Self { self.hasMinPinLength = Some(hasMinPinLength); self }
190 pub fn hasPrf(mut self, hasPrf: bool) -> Self { self.hasPrf = Some(hasPrf); self }
194 pub fn hasHmacSecret(mut self, hasHmacSecret: bool) -> Self { self.hasHmacSecret = Some(hasHmacSecret); self }
198 pub fn hasHmacSecretMc(mut self, hasHmacSecretMc: bool) -> Self { self.hasHmacSecretMc = Some(hasHmacSecretMc); self }
202 pub fn automaticPresenceSimulation(mut self, automaticPresenceSimulation: bool) -> Self { self.automaticPresenceSimulation = Some(automaticPresenceSimulation); self }
205 pub fn isUserVerified(mut self, isUserVerified: bool) -> Self { self.isUserVerified = Some(isUserVerified); self }
208 pub fn defaultBackupEligibility(mut self, defaultBackupEligibility: bool) -> Self { self.defaultBackupEligibility = Some(defaultBackupEligibility); self }
212 pub fn defaultBackupState(mut self, defaultBackupState: bool) -> Self { self.defaultBackupState = Some(defaultBackupState); self }
216 pub fn build(self) -> VirtualAuthenticatorOptions {
217 VirtualAuthenticatorOptions {
218 protocol: self.protocol,
219 ctap2Version: self.ctap2Version,
220 transport: self.transport,
221 hasResidentKey: self.hasResidentKey,
222 hasUserVerification: self.hasUserVerification,
223 hasLargeBlob: self.hasLargeBlob,
224 hasCredBlob: self.hasCredBlob,
225 hasMinPinLength: self.hasMinPinLength,
226 hasPrf: self.hasPrf,
227 hasHmacSecret: self.hasHmacSecret,
228 hasHmacSecretMc: self.hasHmacSecretMc,
229 automaticPresenceSimulation: self.automaticPresenceSimulation,
230 isUserVerified: self.isUserVerified,
231 defaultBackupEligibility: self.defaultBackupEligibility,
232 defaultBackupState: self.defaultBackupState,
233 }
234 }
235}
236
237
238#[derive(Debug, Clone, Serialize, Deserialize, Default)]
239#[serde(rename_all = "camelCase")]
240pub struct Credential<'a> {
241 credentialId: Cow<'a, str>,
242 isResidentCredential: bool,
243 #[serde(skip_serializing_if = "Option::is_none")]
246 rpId: Option<Cow<'a, str>>,
247 privateKey: Cow<'a, str>,
249 #[serde(skip_serializing_if = "Option::is_none")]
252 userHandle: Option<Cow<'a, str>>,
253 signCount: u64,
257 #[serde(skip_serializing_if = "Option::is_none")]
260 largeBlob: Option<Cow<'a, str>>,
261 #[serde(skip_serializing_if = "Option::is_none")]
265 backupEligibility: Option<bool>,
266 #[serde(skip_serializing_if = "Option::is_none")]
270 backupState: Option<bool>,
271 #[serde(skip_serializing_if = "Option::is_none")]
274 userName: Option<Cow<'a, str>>,
275 #[serde(skip_serializing_if = "Option::is_none")]
279 userDisplayName: Option<Cow<'a, str>>,
280}
281
282impl<'a> Credential<'a> {
283 pub fn builder(credentialId: impl Into<Cow<'a, str>>, isResidentCredential: bool, privateKey: impl Into<Cow<'a, str>>, signCount: u64) -> CredentialBuilder<'a> {
284 CredentialBuilder {
285 credentialId: credentialId.into(),
286 isResidentCredential: isResidentCredential,
287 rpId: None,
288 privateKey: privateKey.into(),
289 userHandle: None,
290 signCount: signCount,
291 largeBlob: None,
292 backupEligibility: None,
293 backupState: None,
294 userName: None,
295 userDisplayName: None,
296 }
297 }
298 pub fn credentialId(&self) -> &str { self.credentialId.as_ref() }
299 pub fn isResidentCredential(&self) -> bool { self.isResidentCredential }
300 pub fn rpId(&self) -> Option<&str> { self.rpId.as_deref() }
301 pub fn privateKey(&self) -> &str { self.privateKey.as_ref() }
302 pub fn userHandle(&self) -> Option<&str> { self.userHandle.as_deref() }
303 pub fn signCount(&self) -> u64 { self.signCount }
304 pub fn largeBlob(&self) -> Option<&str> { self.largeBlob.as_deref() }
305 pub fn backupEligibility(&self) -> Option<bool> { self.backupEligibility }
306 pub fn backupState(&self) -> Option<bool> { self.backupState }
307 pub fn userName(&self) -> Option<&str> { self.userName.as_deref() }
308 pub fn userDisplayName(&self) -> Option<&str> { self.userDisplayName.as_deref() }
309}
310
311
312pub struct CredentialBuilder<'a> {
313 credentialId: Cow<'a, str>,
314 isResidentCredential: bool,
315 rpId: Option<Cow<'a, str>>,
316 privateKey: Cow<'a, str>,
317 userHandle: Option<Cow<'a, str>>,
318 signCount: u64,
319 largeBlob: Option<Cow<'a, str>>,
320 backupEligibility: Option<bool>,
321 backupState: Option<bool>,
322 userName: Option<Cow<'a, str>>,
323 userDisplayName: Option<Cow<'a, str>>,
324}
325
326impl<'a> CredentialBuilder<'a> {
327 pub fn rpId(mut self, rpId: impl Into<Cow<'a, str>>) -> Self { self.rpId = Some(rpId.into()); self }
330 pub fn userHandle(mut self, userHandle: impl Into<Cow<'a, str>>) -> Self { self.userHandle = Some(userHandle.into()); self }
333 pub fn largeBlob(mut self, largeBlob: impl Into<Cow<'a, str>>) -> Self { self.largeBlob = Some(largeBlob.into()); self }
336 pub fn backupEligibility(mut self, backupEligibility: bool) -> Self { self.backupEligibility = Some(backupEligibility); self }
340 pub fn backupState(mut self, backupState: bool) -> Self { self.backupState = Some(backupState); self }
344 pub fn userName(mut self, userName: impl Into<Cow<'a, str>>) -> Self { self.userName = Some(userName.into()); self }
347 pub fn userDisplayName(mut self, userDisplayName: impl Into<Cow<'a, str>>) -> Self { self.userDisplayName = Some(userDisplayName.into()); self }
351 pub fn build(self) -> Credential<'a> {
352 Credential {
353 credentialId: self.credentialId,
354 isResidentCredential: self.isResidentCredential,
355 rpId: self.rpId,
356 privateKey: self.privateKey,
357 userHandle: self.userHandle,
358 signCount: self.signCount,
359 largeBlob: self.largeBlob,
360 backupEligibility: self.backupEligibility,
361 backupState: self.backupState,
362 userName: self.userName,
363 userDisplayName: self.userDisplayName,
364 }
365 }
366}
367
368#[derive(Debug, Clone, Serialize, Deserialize, Default)]
372#[serde(rename_all = "camelCase")]
373pub struct EnableParams {
374 #[serde(skip_serializing_if = "Option::is_none")]
380 enableUI: Option<bool>,
381}
382
383impl EnableParams {
384 pub fn builder() -> EnableParamsBuilder {
385 EnableParamsBuilder {
386 enableUI: None,
387 }
388 }
389 pub fn enableUI(&self) -> Option<bool> { self.enableUI }
390}
391
392#[derive(Default)]
393pub struct EnableParamsBuilder {
394 enableUI: Option<bool>,
395}
396
397impl EnableParamsBuilder {
398 pub fn enableUI(mut self, enableUI: bool) -> Self { self.enableUI = Some(enableUI); self }
404 pub fn build(self) -> EnableParams {
405 EnableParams {
406 enableUI: self.enableUI,
407 }
408 }
409}
410
411impl EnableParams { pub const METHOD: &'static str = "WebAuthn.enable"; }
412
413impl<'a> crate::CdpCommand<'a> for EnableParams {
414 const METHOD: &'static str = "WebAuthn.enable";
415 type Response = crate::EmptyReturns;
416}
417
418#[derive(Debug, Clone, Serialize, Deserialize, Default)]
419pub struct DisableParams {}
420
421impl DisableParams { pub const METHOD: &'static str = "WebAuthn.disable"; }
422
423impl<'a> crate::CdpCommand<'a> for DisableParams {
424 const METHOD: &'static str = "WebAuthn.disable";
425 type Response = crate::EmptyReturns;
426}
427
428#[derive(Debug, Clone, Serialize, Deserialize, Default)]
431#[serde(rename_all = "camelCase")]
432pub struct AddVirtualAuthenticatorParams {
433 options: VirtualAuthenticatorOptions,
434}
435
436impl AddVirtualAuthenticatorParams {
437 pub fn builder(options: VirtualAuthenticatorOptions) -> AddVirtualAuthenticatorParamsBuilder {
438 AddVirtualAuthenticatorParamsBuilder {
439 options: options,
440 }
441 }
442 pub fn options(&self) -> &VirtualAuthenticatorOptions { &self.options }
443}
444
445
446pub struct AddVirtualAuthenticatorParamsBuilder {
447 options: VirtualAuthenticatorOptions,
448}
449
450impl AddVirtualAuthenticatorParamsBuilder {
451 pub fn build(self) -> AddVirtualAuthenticatorParams {
452 AddVirtualAuthenticatorParams {
453 options: self.options,
454 }
455 }
456}
457
458#[derive(Debug, Clone, Serialize, Deserialize, Default)]
461#[serde(rename_all = "camelCase")]
462pub struct AddVirtualAuthenticatorReturns<'a> {
463 authenticatorId: AuthenticatorId<'a>,
464}
465
466impl<'a> AddVirtualAuthenticatorReturns<'a> {
467 pub fn builder(authenticatorId: AuthenticatorId<'a>) -> AddVirtualAuthenticatorReturnsBuilder<'a> {
468 AddVirtualAuthenticatorReturnsBuilder {
469 authenticatorId: authenticatorId,
470 }
471 }
472 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
473}
474
475
476pub struct AddVirtualAuthenticatorReturnsBuilder<'a> {
477 authenticatorId: AuthenticatorId<'a>,
478}
479
480impl<'a> AddVirtualAuthenticatorReturnsBuilder<'a> {
481 pub fn build(self) -> AddVirtualAuthenticatorReturns<'a> {
482 AddVirtualAuthenticatorReturns {
483 authenticatorId: self.authenticatorId,
484 }
485 }
486}
487
488impl AddVirtualAuthenticatorParams { pub const METHOD: &'static str = "WebAuthn.addVirtualAuthenticator"; }
489
490impl<'a> crate::CdpCommand<'a> for AddVirtualAuthenticatorParams {
491 const METHOD: &'static str = "WebAuthn.addVirtualAuthenticator";
492 type Response = AddVirtualAuthenticatorReturns<'a>;
493}
494
495#[derive(Debug, Clone, Serialize, Deserialize, Default)]
498#[serde(rename_all = "camelCase")]
499pub struct SetResponseOverrideBitsParams<'a> {
500 authenticatorId: AuthenticatorId<'a>,
501 #[serde(skip_serializing_if = "Option::is_none")]
504 isBogusSignature: Option<bool>,
505 #[serde(skip_serializing_if = "Option::is_none")]
508 isBadUV: Option<bool>,
509 #[serde(skip_serializing_if = "Option::is_none")]
512 isBadUP: Option<bool>,
513}
514
515impl<'a> SetResponseOverrideBitsParams<'a> {
516 pub fn builder(authenticatorId: AuthenticatorId<'a>) -> SetResponseOverrideBitsParamsBuilder<'a> {
517 SetResponseOverrideBitsParamsBuilder {
518 authenticatorId: authenticatorId,
519 isBogusSignature: None,
520 isBadUV: None,
521 isBadUP: None,
522 }
523 }
524 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
525 pub fn isBogusSignature(&self) -> Option<bool> { self.isBogusSignature }
526 pub fn isBadUV(&self) -> Option<bool> { self.isBadUV }
527 pub fn isBadUP(&self) -> Option<bool> { self.isBadUP }
528}
529
530
531pub struct SetResponseOverrideBitsParamsBuilder<'a> {
532 authenticatorId: AuthenticatorId<'a>,
533 isBogusSignature: Option<bool>,
534 isBadUV: Option<bool>,
535 isBadUP: Option<bool>,
536}
537
538impl<'a> SetResponseOverrideBitsParamsBuilder<'a> {
539 pub fn isBogusSignature(mut self, isBogusSignature: bool) -> Self { self.isBogusSignature = Some(isBogusSignature); self }
542 pub fn isBadUV(mut self, isBadUV: bool) -> Self { self.isBadUV = Some(isBadUV); self }
545 pub fn isBadUP(mut self, isBadUP: bool) -> Self { self.isBadUP = Some(isBadUP); self }
548 pub fn build(self) -> SetResponseOverrideBitsParams<'a> {
549 SetResponseOverrideBitsParams {
550 authenticatorId: self.authenticatorId,
551 isBogusSignature: self.isBogusSignature,
552 isBadUV: self.isBadUV,
553 isBadUP: self.isBadUP,
554 }
555 }
556}
557
558impl<'a> SetResponseOverrideBitsParams<'a> { pub const METHOD: &'static str = "WebAuthn.setResponseOverrideBits"; }
559
560impl<'a> crate::CdpCommand<'a> for SetResponseOverrideBitsParams<'a> {
561 const METHOD: &'static str = "WebAuthn.setResponseOverrideBits";
562 type Response = crate::EmptyReturns;
563}
564
565#[derive(Debug, Clone, Serialize, Deserialize, Default)]
568#[serde(rename_all = "camelCase")]
569pub struct RemoveVirtualAuthenticatorParams<'a> {
570 authenticatorId: AuthenticatorId<'a>,
571}
572
573impl<'a> RemoveVirtualAuthenticatorParams<'a> {
574 pub fn builder(authenticatorId: AuthenticatorId<'a>) -> RemoveVirtualAuthenticatorParamsBuilder<'a> {
575 RemoveVirtualAuthenticatorParamsBuilder {
576 authenticatorId: authenticatorId,
577 }
578 }
579 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
580}
581
582
583pub struct RemoveVirtualAuthenticatorParamsBuilder<'a> {
584 authenticatorId: AuthenticatorId<'a>,
585}
586
587impl<'a> RemoveVirtualAuthenticatorParamsBuilder<'a> {
588 pub fn build(self) -> RemoveVirtualAuthenticatorParams<'a> {
589 RemoveVirtualAuthenticatorParams {
590 authenticatorId: self.authenticatorId,
591 }
592 }
593}
594
595impl<'a> RemoveVirtualAuthenticatorParams<'a> { pub const METHOD: &'static str = "WebAuthn.removeVirtualAuthenticator"; }
596
597impl<'a> crate::CdpCommand<'a> for RemoveVirtualAuthenticatorParams<'a> {
598 const METHOD: &'static str = "WebAuthn.removeVirtualAuthenticator";
599 type Response = crate::EmptyReturns;
600}
601
602#[derive(Debug, Clone, Serialize, Deserialize, Default)]
605#[serde(rename_all = "camelCase")]
606pub struct AddCredentialParams<'a> {
607 authenticatorId: AuthenticatorId<'a>,
608 credential: Credential<'a>,
609}
610
611impl<'a> AddCredentialParams<'a> {
612 pub fn builder(authenticatorId: AuthenticatorId<'a>, credential: Credential<'a>) -> AddCredentialParamsBuilder<'a> {
613 AddCredentialParamsBuilder {
614 authenticatorId: authenticatorId,
615 credential: credential,
616 }
617 }
618 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
619 pub fn credential(&self) -> &Credential<'a> { &self.credential }
620}
621
622
623pub struct AddCredentialParamsBuilder<'a> {
624 authenticatorId: AuthenticatorId<'a>,
625 credential: Credential<'a>,
626}
627
628impl<'a> AddCredentialParamsBuilder<'a> {
629 pub fn build(self) -> AddCredentialParams<'a> {
630 AddCredentialParams {
631 authenticatorId: self.authenticatorId,
632 credential: self.credential,
633 }
634 }
635}
636
637impl<'a> AddCredentialParams<'a> { pub const METHOD: &'static str = "WebAuthn.addCredential"; }
638
639impl<'a> crate::CdpCommand<'a> for AddCredentialParams<'a> {
640 const METHOD: &'static str = "WebAuthn.addCredential";
641 type Response = crate::EmptyReturns;
642}
643
644#[derive(Debug, Clone, Serialize, Deserialize, Default)]
648#[serde(rename_all = "camelCase")]
649pub struct GetCredentialParams<'a> {
650 authenticatorId: AuthenticatorId<'a>,
651 credentialId: Cow<'a, str>,
652}
653
654impl<'a> GetCredentialParams<'a> {
655 pub fn builder(authenticatorId: AuthenticatorId<'a>, credentialId: impl Into<Cow<'a, str>>) -> GetCredentialParamsBuilder<'a> {
656 GetCredentialParamsBuilder {
657 authenticatorId: authenticatorId,
658 credentialId: credentialId.into(),
659 }
660 }
661 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
662 pub fn credentialId(&self) -> &str { self.credentialId.as_ref() }
663}
664
665
666pub struct GetCredentialParamsBuilder<'a> {
667 authenticatorId: AuthenticatorId<'a>,
668 credentialId: Cow<'a, str>,
669}
670
671impl<'a> GetCredentialParamsBuilder<'a> {
672 pub fn build(self) -> GetCredentialParams<'a> {
673 GetCredentialParams {
674 authenticatorId: self.authenticatorId,
675 credentialId: self.credentialId,
676 }
677 }
678}
679
680#[derive(Debug, Clone, Serialize, Deserialize, Default)]
684#[serde(rename_all = "camelCase")]
685pub struct GetCredentialReturns<'a> {
686 credential: Credential<'a>,
687}
688
689impl<'a> GetCredentialReturns<'a> {
690 pub fn builder(credential: Credential<'a>) -> GetCredentialReturnsBuilder<'a> {
691 GetCredentialReturnsBuilder {
692 credential: credential,
693 }
694 }
695 pub fn credential(&self) -> &Credential<'a> { &self.credential }
696}
697
698
699pub struct GetCredentialReturnsBuilder<'a> {
700 credential: Credential<'a>,
701}
702
703impl<'a> GetCredentialReturnsBuilder<'a> {
704 pub fn build(self) -> GetCredentialReturns<'a> {
705 GetCredentialReturns {
706 credential: self.credential,
707 }
708 }
709}
710
711impl<'a> GetCredentialParams<'a> { pub const METHOD: &'static str = "WebAuthn.getCredential"; }
712
713impl<'a> crate::CdpCommand<'a> for GetCredentialParams<'a> {
714 const METHOD: &'static str = "WebAuthn.getCredential";
715 type Response = GetCredentialReturns<'a>;
716}
717
718#[derive(Debug, Clone, Serialize, Deserialize, Default)]
721#[serde(rename_all = "camelCase")]
722pub struct GetCredentialsParams<'a> {
723 authenticatorId: AuthenticatorId<'a>,
724}
725
726impl<'a> GetCredentialsParams<'a> {
727 pub fn builder(authenticatorId: AuthenticatorId<'a>) -> GetCredentialsParamsBuilder<'a> {
728 GetCredentialsParamsBuilder {
729 authenticatorId: authenticatorId,
730 }
731 }
732 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
733}
734
735
736pub struct GetCredentialsParamsBuilder<'a> {
737 authenticatorId: AuthenticatorId<'a>,
738}
739
740impl<'a> GetCredentialsParamsBuilder<'a> {
741 pub fn build(self) -> GetCredentialsParams<'a> {
742 GetCredentialsParams {
743 authenticatorId: self.authenticatorId,
744 }
745 }
746}
747
748#[derive(Debug, Clone, Serialize, Deserialize, Default)]
751#[serde(rename_all = "camelCase")]
752pub struct GetCredentialsReturns<'a> {
753 credentials: Vec<Credential<'a>>,
754}
755
756impl<'a> GetCredentialsReturns<'a> {
757 pub fn builder(credentials: Vec<Credential<'a>>) -> GetCredentialsReturnsBuilder<'a> {
758 GetCredentialsReturnsBuilder {
759 credentials: credentials,
760 }
761 }
762 pub fn credentials(&self) -> &[Credential<'a>] { &self.credentials }
763}
764
765
766pub struct GetCredentialsReturnsBuilder<'a> {
767 credentials: Vec<Credential<'a>>,
768}
769
770impl<'a> GetCredentialsReturnsBuilder<'a> {
771 pub fn build(self) -> GetCredentialsReturns<'a> {
772 GetCredentialsReturns {
773 credentials: self.credentials,
774 }
775 }
776}
777
778impl<'a> GetCredentialsParams<'a> { pub const METHOD: &'static str = "WebAuthn.getCredentials"; }
779
780impl<'a> crate::CdpCommand<'a> for GetCredentialsParams<'a> {
781 const METHOD: &'static str = "WebAuthn.getCredentials";
782 type Response = GetCredentialsReturns<'a>;
783}
784
785#[derive(Debug, Clone, Serialize, Deserialize, Default)]
788#[serde(rename_all = "camelCase")]
789pub struct RemoveCredentialParams<'a> {
790 authenticatorId: AuthenticatorId<'a>,
791 credentialId: Cow<'a, str>,
792}
793
794impl<'a> RemoveCredentialParams<'a> {
795 pub fn builder(authenticatorId: AuthenticatorId<'a>, credentialId: impl Into<Cow<'a, str>>) -> RemoveCredentialParamsBuilder<'a> {
796 RemoveCredentialParamsBuilder {
797 authenticatorId: authenticatorId,
798 credentialId: credentialId.into(),
799 }
800 }
801 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
802 pub fn credentialId(&self) -> &str { self.credentialId.as_ref() }
803}
804
805
806pub struct RemoveCredentialParamsBuilder<'a> {
807 authenticatorId: AuthenticatorId<'a>,
808 credentialId: Cow<'a, str>,
809}
810
811impl<'a> RemoveCredentialParamsBuilder<'a> {
812 pub fn build(self) -> RemoveCredentialParams<'a> {
813 RemoveCredentialParams {
814 authenticatorId: self.authenticatorId,
815 credentialId: self.credentialId,
816 }
817 }
818}
819
820impl<'a> RemoveCredentialParams<'a> { pub const METHOD: &'static str = "WebAuthn.removeCredential"; }
821
822impl<'a> crate::CdpCommand<'a> for RemoveCredentialParams<'a> {
823 const METHOD: &'static str = "WebAuthn.removeCredential";
824 type Response = crate::EmptyReturns;
825}
826
827#[derive(Debug, Clone, Serialize, Deserialize, Default)]
830#[serde(rename_all = "camelCase")]
831pub struct ClearCredentialsParams<'a> {
832 authenticatorId: AuthenticatorId<'a>,
833}
834
835impl<'a> ClearCredentialsParams<'a> {
836 pub fn builder(authenticatorId: AuthenticatorId<'a>) -> ClearCredentialsParamsBuilder<'a> {
837 ClearCredentialsParamsBuilder {
838 authenticatorId: authenticatorId,
839 }
840 }
841 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
842}
843
844
845pub struct ClearCredentialsParamsBuilder<'a> {
846 authenticatorId: AuthenticatorId<'a>,
847}
848
849impl<'a> ClearCredentialsParamsBuilder<'a> {
850 pub fn build(self) -> ClearCredentialsParams<'a> {
851 ClearCredentialsParams {
852 authenticatorId: self.authenticatorId,
853 }
854 }
855}
856
857impl<'a> ClearCredentialsParams<'a> { pub const METHOD: &'static str = "WebAuthn.clearCredentials"; }
858
859impl<'a> crate::CdpCommand<'a> for ClearCredentialsParams<'a> {
860 const METHOD: &'static str = "WebAuthn.clearCredentials";
861 type Response = crate::EmptyReturns;
862}
863
864#[derive(Debug, Clone, Serialize, Deserialize, Default)]
868#[serde(rename_all = "camelCase")]
869pub struct SetUserVerifiedParams<'a> {
870 authenticatorId: AuthenticatorId<'a>,
871 isUserVerified: bool,
872}
873
874impl<'a> SetUserVerifiedParams<'a> {
875 pub fn builder(authenticatorId: AuthenticatorId<'a>, isUserVerified: bool) -> SetUserVerifiedParamsBuilder<'a> {
876 SetUserVerifiedParamsBuilder {
877 authenticatorId: authenticatorId,
878 isUserVerified: isUserVerified,
879 }
880 }
881 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
882 pub fn isUserVerified(&self) -> bool { self.isUserVerified }
883}
884
885
886pub struct SetUserVerifiedParamsBuilder<'a> {
887 authenticatorId: AuthenticatorId<'a>,
888 isUserVerified: bool,
889}
890
891impl<'a> SetUserVerifiedParamsBuilder<'a> {
892 pub fn build(self) -> SetUserVerifiedParams<'a> {
893 SetUserVerifiedParams {
894 authenticatorId: self.authenticatorId,
895 isUserVerified: self.isUserVerified,
896 }
897 }
898}
899
900impl<'a> SetUserVerifiedParams<'a> { pub const METHOD: &'static str = "WebAuthn.setUserVerified"; }
901
902impl<'a> crate::CdpCommand<'a> for SetUserVerifiedParams<'a> {
903 const METHOD: &'static str = "WebAuthn.setUserVerified";
904 type Response = crate::EmptyReturns;
905}
906
907#[derive(Debug, Clone, Serialize, Deserialize, Default)]
911#[serde(rename_all = "camelCase")]
912pub struct SetAutomaticPresenceSimulationParams<'a> {
913 authenticatorId: AuthenticatorId<'a>,
914 enabled: bool,
915}
916
917impl<'a> SetAutomaticPresenceSimulationParams<'a> {
918 pub fn builder(authenticatorId: AuthenticatorId<'a>, enabled: bool) -> SetAutomaticPresenceSimulationParamsBuilder<'a> {
919 SetAutomaticPresenceSimulationParamsBuilder {
920 authenticatorId: authenticatorId,
921 enabled: enabled,
922 }
923 }
924 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
925 pub fn enabled(&self) -> bool { self.enabled }
926}
927
928
929pub struct SetAutomaticPresenceSimulationParamsBuilder<'a> {
930 authenticatorId: AuthenticatorId<'a>,
931 enabled: bool,
932}
933
934impl<'a> SetAutomaticPresenceSimulationParamsBuilder<'a> {
935 pub fn build(self) -> SetAutomaticPresenceSimulationParams<'a> {
936 SetAutomaticPresenceSimulationParams {
937 authenticatorId: self.authenticatorId,
938 enabled: self.enabled,
939 }
940 }
941}
942
943impl<'a> SetAutomaticPresenceSimulationParams<'a> { pub const METHOD: &'static str = "WebAuthn.setAutomaticPresenceSimulation"; }
944
945impl<'a> crate::CdpCommand<'a> for SetAutomaticPresenceSimulationParams<'a> {
946 const METHOD: &'static str = "WebAuthn.setAutomaticPresenceSimulation";
947 type Response = crate::EmptyReturns;
948}
949
950#[derive(Debug, Clone, Serialize, Deserialize, Default)]
954#[serde(rename_all = "camelCase")]
955pub struct SetCredentialPropertiesParams<'a> {
956 authenticatorId: AuthenticatorId<'a>,
957 credentialId: Cow<'a, str>,
958 #[serde(skip_serializing_if = "Option::is_none")]
959 backupEligibility: Option<bool>,
960 #[serde(skip_serializing_if = "Option::is_none")]
961 backupState: Option<bool>,
962}
963
964impl<'a> SetCredentialPropertiesParams<'a> {
965 pub fn builder(authenticatorId: AuthenticatorId<'a>, credentialId: impl Into<Cow<'a, str>>) -> SetCredentialPropertiesParamsBuilder<'a> {
966 SetCredentialPropertiesParamsBuilder {
967 authenticatorId: authenticatorId,
968 credentialId: credentialId.into(),
969 backupEligibility: None,
970 backupState: None,
971 }
972 }
973 pub fn authenticatorId(&self) -> &AuthenticatorId<'a> { &self.authenticatorId }
974 pub fn credentialId(&self) -> &str { self.credentialId.as_ref() }
975 pub fn backupEligibility(&self) -> Option<bool> { self.backupEligibility }
976 pub fn backupState(&self) -> Option<bool> { self.backupState }
977}
978
979
980pub struct SetCredentialPropertiesParamsBuilder<'a> {
981 authenticatorId: AuthenticatorId<'a>,
982 credentialId: Cow<'a, str>,
983 backupEligibility: Option<bool>,
984 backupState: Option<bool>,
985}
986
987impl<'a> SetCredentialPropertiesParamsBuilder<'a> {
988 pub fn backupEligibility(mut self, backupEligibility: bool) -> Self { self.backupEligibility = Some(backupEligibility); self }
989 pub fn backupState(mut self, backupState: bool) -> Self { self.backupState = Some(backupState); self }
990 pub fn build(self) -> SetCredentialPropertiesParams<'a> {
991 SetCredentialPropertiesParams {
992 authenticatorId: self.authenticatorId,
993 credentialId: self.credentialId,
994 backupEligibility: self.backupEligibility,
995 backupState: self.backupState,
996 }
997 }
998}
999
1000impl<'a> SetCredentialPropertiesParams<'a> { pub const METHOD: &'static str = "WebAuthn.setCredentialProperties"; }
1001
1002impl<'a> crate::CdpCommand<'a> for SetCredentialPropertiesParams<'a> {
1003 const METHOD: &'static str = "WebAuthn.setCredentialProperties";
1004 type Response = crate::EmptyReturns;
1005}