clerk_rs/models/
web3_signature.rs

1/*
2 * Clerk Backend API
3 *
4 * The Clerk REST Backend API, meant to be accessed by backend servers. Please see https://clerk.com/docs for more information.
5 *
6 * The version of the OpenAPI document: v1
7 * Contact: support@clerk.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
12pub struct Web3Signature {
13	#[serde(rename = "status")]
14	pub status: Status,
15	#[serde(rename = "strategy")]
16	pub strategy: Strategy,
17	#[serde(rename = "nonce")]
18	pub nonce: Nonce,
19	#[serde(
20		rename = "attempts",
21		default,
22		with = "::serde_with::rust::double_option",
23		skip_serializing_if = "Option::is_none"
24	)]
25	pub attempts: Option<Option<i64>>,
26	#[serde(
27		rename = "expire_at",
28		default,
29		with = "::serde_with::rust::double_option",
30		skip_serializing_if = "Option::is_none"
31	)]
32	pub expire_at: Option<Option<i64>>,
33}
34
35impl Web3Signature {
36	pub fn new(status: Status, strategy: Strategy, nonce: Nonce) -> Web3Signature {
37		Web3Signature {
38			status,
39			strategy,
40			nonce,
41			attempts: None,
42			expire_at: None,
43		}
44	}
45}
46
47///
48#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
49pub enum Status {
50	#[serde(rename = "verified")]
51	Verified,
52}
53
54impl Default for Status {
55	fn default() -> Status {
56		Self::Verified
57	}
58}
59///
60#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
61pub enum Strategy {
62	#[serde(rename = "web3_metamask_signature")]
63	Web3MetamaskSignature,
64
65	#[serde(rename = "web3_coinbase_wallet_signature")]
66	Web3CoinbaseWalletSignature,
67
68	#[serde(rename = "web3_okx_wallet_signature")]
69	Web3OkxWalletSignature,
70}
71
72impl Default for Strategy {
73	fn default() -> Strategy {
74		Self::Web3MetamaskSignature
75	}
76}
77///
78#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
79pub enum Nonce {
80	#[serde(rename = "nonce")]
81	Nonce,
82}
83
84impl Default for Nonce {
85	fn default() -> Nonce {
86		Self::Nonce
87	}
88}