Skip to main content

tk_rs/
types.rs

1use reqwest::Client;
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug)]
5pub struct TurnkeySigner {
6    pub organization_id: String,
7    pub private_key_id: String,
8    pub api_public_key: String,
9    pub api_private_key: String,
10    pub public_key: String,
11    pub client: Client,
12}
13
14#[derive(Serialize, Debug)]
15#[serde(rename_all = "camelCase")]
16pub struct SignRequest {
17    #[serde(rename = "type")]
18    pub activity_type: String,
19    pub timestamp_ms: String,
20    pub organization_id: String,
21    pub parameters: SignParameters,
22}
23
24#[derive(Serialize, Debug)]
25#[serde(rename_all = "camelCase")]
26pub struct SignParameters {
27    pub sign_with: String,
28    pub payload: String,
29    pub encoding: String,
30    pub hash_function: String,
31}
32
33#[derive(Deserialize, Debug)]
34#[serde(rename_all = "camelCase")]
35pub struct ActivityResponse {
36    pub activity: Activity,
37}
38
39#[derive(Deserialize, Debug)]
40#[serde(rename_all = "camelCase")]
41pub struct Activity {
42    pub result: Option<ActivityResult>,
43}
44
45#[derive(Deserialize, Debug)]
46#[serde(rename_all = "camelCase")]
47pub struct ActivityResult {
48    pub sign_raw_payload_result: Option<SignResult>,
49}
50
51#[derive(Deserialize, Debug)]
52#[serde(rename_all = "camelCase")]
53pub struct SignResult {
54    pub r: String,
55    pub s: String,
56}