Skip to main content

dfns_sdk_rust/signers/
mod.rs

1// Code generated by rust-sdk-generator. DO NOT EDIT.
2
3pub mod delegated;
4pub mod types;
5
6#[allow(unused_imports)]
7use types::*;
8
9/// Client for signers operations.
10#[derive(Clone)]
11pub struct SignersClient {
12    client: crate::client::Client,
13}
14
15impl SignersClient {
16    pub fn new(client: crate::client::Client) -> Self {
17        SignersClient { client }
18    }
19
20    /// Cancel Fleet Operation
21    pub async fn cancel_fleet_operation(
22        &self,
23        store_id: String,
24        body: CancelFleetOperationRequest,
25    ) -> Result<CancelFleetOperationResponse, crate::error::Error> {
26        let path = format!(
27            "/key-stores/{}/fleet-operations/cancel",
28            urlencoding::encode(&store_id)
29        );
30        let body = serde_json::to_value(&body)?;
31        self.client
32            .request::<CancelFleetOperationResponse>(
33                reqwest::Method::POST,
34                &path,
35                Some(&body),
36                true,
37            )
38            .await
39    }
40
41    /// Creates the input archive for an add-mac-user fleet operation, which registers a new Mac operator machine with an HSM in the key store's trust set.
42    pub async fn create_add_mac_user_input(
43        &self,
44        store_id: String,
45        body: CreateAddMacUserInputRequest,
46    ) -> Result<(), crate::error::Error> {
47        let path = format!(
48            "/key-stores/{}/add-mac-user/input",
49            urlencoding::encode(&store_id)
50        );
51        let body = serde_json::to_value(&body)?;
52        self.client
53            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
54            .await
55    }
56
57    /// Creates the input archive for an add-provisioner fleet operation, which registers a new provisioner YubiKey into the key store's governance set.
58    pub async fn create_add_provisioner_input(
59        &self,
60        store_id: String,
61        body: CreateAddProvisionerInputRequest,
62    ) -> Result<(), crate::error::Error> {
63        let path = format!(
64            "/key-stores/{}/add-provisioner/input",
65            urlencoding::encode(&store_id)
66        );
67        let body = serde_json::to_value(&body)?;
68        self.client
69            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
70            .await
71    }
72
73    /// Creates the input archive for a clone fleet operation, which replicates a key store from a source HSM to a target HSM.
74    pub async fn create_clone_input(
75        &self,
76        store_id: String,
77        body: CreateCloneInputRequest,
78    ) -> Result<(), crate::error::Error> {
79        let path = format!("/key-stores/{}/clone/input", urlencoding::encode(&store_id));
80        let body = serde_json::to_value(&body)?;
81        self.client
82            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
83            .await
84    }
85
86    /// Creates the input archive for a genesis fleet operation, which provisions a new offline signer fleet and generates the key store's initial signing keys.
87    pub async fn create_genesis_input(
88        &self,
89        store_id: String,
90        body: CreateGenesisInputRequest,
91    ) -> Result<(), crate::error::Error> {
92        let path = format!(
93            "/key-stores/{}/genesis/input",
94            urlencoding::encode(&store_id)
95        );
96        let body = serde_json::to_value(&body)?;
97        self.client
98            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
99            .await
100    }
101
102    /// Create Key Harvest Input
103    pub async fn create_key_harvest_input(
104        &self,
105        store_id: String,
106        body: CreateKeyHarvestInputRequest,
107    ) -> Result<(), crate::error::Error> {
108        let path = format!(
109            "/key-stores/{}/key-harvest/input",
110            urlencoding::encode(&store_id)
111        );
112        let body = serde_json::to_value(&body)?;
113        self.client
114            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
115            .await
116    }
117
118    /// Creates the input archive for an onchain-sign operation covering the key store's pending signature requests.
119    pub async fn create_onchain_sign_input(
120        &self,
121        store_id: String,
122        body: CreateOnchainSignInputRequest,
123    ) -> Result<(), crate::error::Error> {
124        let path = format!(
125            "/key-stores/{}/onchain-sign/input",
126            urlencoding::encode(&store_id)
127        );
128        let body = serde_json::to_value(&body)?;
129        self.client
130            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
131            .await
132    }
133
134    /// Creates the input archive for a proof-of-control operation covering the keys of the specified wallets.
135    pub async fn create_proof_of_control_input(
136        &self,
137        store_id: String,
138        body: CreateProofOfControlInputRequest,
139    ) -> Result<(), crate::error::Error> {
140        let path = format!(
141            "/key-stores/{}/proof-of-control/input",
142            urlencoding::encode(&store_id)
143        );
144        let body = serde_json::to_value(&body)?;
145        self.client
146            .request_no_content(reqwest::Method::POST, &path, Some(&body), true)
147            .await
148    }
149
150    /// Lists the key stores of your organization.
151    pub async fn list_key_stores(&self) -> Result<ListKeyStoresResponse, crate::error::Error> {
152        let path = String::from("/key-stores");
153        self.client
154            .request::<ListKeyStoresResponse>(reqwest::Method::GET, &path, None, false)
155            .await
156    }
157
158    /// Lists the signer clusters of your key store, including each signer's ID and encryption public key.
159    pub async fn list_signers(&self) -> Result<ListSignersResponse, crate::error::Error> {
160        let path = String::from("/signers");
161        self.client
162            .request::<ListSignersResponse>(reqwest::Method::GET, &path, None, false)
163            .await
164    }
165
166    /// Submits the output archive produced by the offline signer fleet for an add-mac-user operation.
167    pub async fn submit_add_mac_user_output(
168        &self,
169        store_id: String,
170        body: SubmitAddMacUserOutputRequest,
171        file: crate::client::MultipartFile,
172    ) -> Result<SubmitAddMacUserOutputResponse, crate::error::Error> {
173        let path = format!(
174            "/key-stores/{}/add-mac-user/output",
175            urlencoding::encode(&store_id)
176        );
177        let body = serde_json::to_value(&body)?;
178        self.client
179            .request_multipart::<SubmitAddMacUserOutputResponse>(
180                reqwest::Method::POST,
181                &path,
182                Some(&body),
183                file,
184                true,
185            )
186            .await
187    }
188
189    /// Submits the output archive produced by the offline signer fleet for an add-provisioner operation.
190    pub async fn submit_add_provisioner_output(
191        &self,
192        store_id: String,
193        body: SubmitAddProvisionerOutputRequest,
194        file: crate::client::MultipartFile,
195    ) -> Result<SubmitAddProvisionerOutputResponse, crate::error::Error> {
196        let path = format!(
197            "/key-stores/{}/add-provisioner/output",
198            urlencoding::encode(&store_id)
199        );
200        let body = serde_json::to_value(&body)?;
201        self.client
202            .request_multipart::<SubmitAddProvisionerOutputResponse>(
203                reqwest::Method::POST,
204                &path,
205                Some(&body),
206                file,
207                true,
208            )
209            .await
210    }
211
212    /// Submits the output archive produced by the offline signer fleet for a clone operation.
213    pub async fn submit_clone_output(
214        &self,
215        store_id: String,
216        body: SubmitCloneOutputRequest,
217        file: crate::client::MultipartFile,
218    ) -> Result<SubmitCloneOutputResponse, crate::error::Error> {
219        let path = format!(
220            "/key-stores/{}/clone/output",
221            urlencoding::encode(&store_id)
222        );
223        let body = serde_json::to_value(&body)?;
224        self.client
225            .request_multipart::<SubmitCloneOutputResponse>(
226                reqwest::Method::POST,
227                &path,
228                Some(&body),
229                file,
230                true,
231            )
232            .await
233    }
234
235    /// Submits the output archive produced by the offline signer fleet for a genesis operation.
236    pub async fn submit_genesis_output(
237        &self,
238        store_id: String,
239        body: SubmitGenesisOutputRequest,
240        file: crate::client::MultipartFile,
241    ) -> Result<SubmitGenesisOutputResponse, crate::error::Error> {
242        let path = format!(
243            "/key-stores/{}/genesis/output",
244            urlencoding::encode(&store_id)
245        );
246        let body = serde_json::to_value(&body)?;
247        self.client
248            .request_multipart::<SubmitGenesisOutputResponse>(
249                reqwest::Method::POST,
250                &path,
251                Some(&body),
252                file,
253                true,
254            )
255            .await
256    }
257
258    /// Submit Key Harvest Output
259    pub async fn submit_key_harvest_output(
260        &self,
261        store_id: String,
262        body: SubmitKeyHarvestOutputRequest,
263        file: crate::client::MultipartFile,
264    ) -> Result<SubmitKeyHarvestOutputResponse, crate::error::Error> {
265        let path = format!(
266            "/key-stores/{}/key-harvest/output",
267            urlencoding::encode(&store_id)
268        );
269        let body = serde_json::to_value(&body)?;
270        self.client
271            .request_multipart::<SubmitKeyHarvestOutputResponse>(
272                reqwest::Method::POST,
273                &path,
274                Some(&body),
275                file,
276                true,
277            )
278            .await
279    }
280
281    /// Submits the output archive produced by the offline signer fleet for an onchain-sign operation.
282    pub async fn submit_onchain_sign_output(
283        &self,
284        store_id: String,
285        body: SubmitOnchainSignOutputRequest,
286        file: crate::client::MultipartFile,
287    ) -> Result<SubmitOnchainSignOutputResponse, crate::error::Error> {
288        let path = format!(
289            "/key-stores/{}/onchain-sign/output",
290            urlencoding::encode(&store_id)
291        );
292        let body = serde_json::to_value(&body)?;
293        self.client
294            .request_multipart::<SubmitOnchainSignOutputResponse>(
295                reqwest::Method::POST,
296                &path,
297                Some(&body),
298                file,
299                true,
300            )
301            .await
302    }
303
304    /// Submits the output archive produced by the offline signer fleet for a proof-of-control operation.
305    pub async fn submit_proof_of_control_output(
306        &self,
307        store_id: String,
308        body: SubmitProofOfControlOutputRequest,
309        file: crate::client::MultipartFile,
310    ) -> Result<SubmitProofOfControlOutputResponse, crate::error::Error> {
311        let path = format!(
312            "/key-stores/{}/proof-of-control/output",
313            urlencoding::encode(&store_id)
314        );
315        let body = serde_json::to_value(&body)?;
316        self.client
317            .request_multipart::<SubmitProofOfControlOutputResponse>(
318                reqwest::Method::POST,
319                &path,
320                Some(&body),
321                file,
322                true,
323            )
324            .await
325    }
326}