cdp_driver/protocol/digital_credentials.rs
1// @generated by `just generate-methods` from protocol/*.json.
2// Do not edit by hand; edit xtask/ and regenerate.
3
4//! This domain allows interacting with the Digital Credentials API for
5//! automation.
6//!
7//! Types, command parameters and event payloads for the `DigitalCredentials`
8//! domain. The method-name constants for the same domain are in
9//! [`crate::methods`].
10//!
11//! This domain is experimental and may change without notice.
12
13use serde::{Deserialize, Serialize};
14
15/// The type of virtual wallet action.
16#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
17pub enum VirtualWalletAction {
18 /// `respond`
19 #[serde(rename = "respond")]
20 Respond,
21 /// `decline`
22 #[serde(rename = "decline")]
23 Decline,
24 /// `wait`
25 #[serde(rename = "wait")]
26 Wait,
27 /// `clear`
28 #[serde(rename = "clear")]
29 Clear,
30 /// A value this vendored schema does not list. Chrome adds values ahead of
31 /// the published protocol, so an unrecognised one is kept as it arrived
32 /// rather than failing the payload it came in.
33 #[serde(untagged)]
34 Unrecognized(String),
35}
36
37/// Sets the behavior of the virtual wallet for digital credential requests
38/// issued from this frame.
39///
40/// Parameters of `DigitalCredentials.setVirtualWalletBehavior`.
41#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
42pub struct SetVirtualWalletBehaviorParams {
43 /// The action of the virtual wallet.
44 pub action: VirtualWalletAction,
45 /// The protocol identifier (e.g. "openid4vp"). Required when |action| is
46 /// "respond", forbidden otherwise.
47 #[serde(default, skip_serializing_if = "Option::is_none")]
48 pub protocol: Option<String>,
49 /// The response data object returned by the wallet. Required when |action| is
50 /// "respond", forbidden otherwise.
51 #[serde(default, skip_serializing_if = "Option::is_none")]
52 pub response: Option<serde_json::Value>,
53 /// The frame to scope the virtual wallet behavior to.
54 #[serde(rename = "frameId", default, skip_serializing_if = "Option::is_none")]
55 pub frame_id: Option<crate::protocol::page::FrameId>,
56}
57
58impl crate::typed::Command for SetVirtualWalletBehaviorParams {
59 const METHOD: &'static str = "DigitalCredentials.setVirtualWalletBehavior";
60 type Returns = crate::typed::NoReturns;
61}