dfns-sdk 0.0.0.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. dfns_sdk/__init__.py +24 -0
  2. dfns_sdk/_internal/__init__.py +5 -0
  3. dfns_sdk/_internal/http_client.py +395 -0
  4. dfns_sdk/auth.py +137 -0
  5. dfns_sdk/base_auth_api.py +129 -0
  6. dfns_sdk/client.py +81 -0
  7. dfns_sdk/delegated_client.py +97 -0
  8. dfns_sdk/generated/__init__.py +47 -0
  9. dfns_sdk/generated/agreements/__init__.py +7 -0
  10. dfns_sdk/generated/agreements/client.py +55 -0
  11. dfns_sdk/generated/agreements/delegated_client.py +95 -0
  12. dfns_sdk/generated/agreements/types.py +20 -0
  13. dfns_sdk/generated/allocations/__init__.py +7 -0
  14. dfns_sdk/generated/allocations/client.py +118 -0
  15. dfns_sdk/generated/allocations/delegated_client.py +187 -0
  16. dfns_sdk/generated/allocations/types.py +69 -0
  17. dfns_sdk/generated/auth/__init__.py +7 -0
  18. dfns_sdk/generated/auth/client.py +1215 -0
  19. dfns_sdk/generated/auth/delegated_client.py +1825 -0
  20. dfns_sdk/generated/auth/types.py +702 -0
  21. dfns_sdk/generated/exchanges/__init__.py +7 -0
  22. dfns_sdk/generated/exchanges/client.py +209 -0
  23. dfns_sdk/generated/exchanges/delegated_client.py +341 -0
  24. dfns_sdk/generated/exchanges/types.py +96 -0
  25. dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
  26. dfns_sdk/generated/fee_sponsors/client.py +161 -0
  27. dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
  28. dfns_sdk/generated/fee_sponsors/types.py +89 -0
  29. dfns_sdk/generated/keys/__init__.py +7 -0
  30. dfns_sdk/generated/keys/client.py +310 -0
  31. dfns_sdk/generated/keys/delegated_client.py +518 -0
  32. dfns_sdk/generated/keys/types.py +229 -0
  33. dfns_sdk/generated/networks/__init__.py +7 -0
  34. dfns_sdk/generated/networks/client.py +176 -0
  35. dfns_sdk/generated/networks/delegated_client.py +274 -0
  36. dfns_sdk/generated/networks/types.py +77 -0
  37. dfns_sdk/generated/permissions/__init__.py +7 -0
  38. dfns_sdk/generated/permissions/client.py +185 -0
  39. dfns_sdk/generated/permissions/delegated_client.py +344 -0
  40. dfns_sdk/generated/permissions/types.py +107 -0
  41. dfns_sdk/generated/policies/__init__.py +7 -0
  42. dfns_sdk/generated/policies/client.py +187 -0
  43. dfns_sdk/generated/policies/delegated_client.py +311 -0
  44. dfns_sdk/generated/policies/types.py +70 -0
  45. dfns_sdk/generated/signers/__init__.py +7 -0
  46. dfns_sdk/generated/signers/client.py +45 -0
  47. dfns_sdk/generated/signers/delegated_client.py +56 -0
  48. dfns_sdk/generated/signers/types.py +13 -0
  49. dfns_sdk/generated/staking/__init__.py +7 -0
  50. dfns_sdk/generated/staking/client.py +142 -0
  51. dfns_sdk/generated/staking/delegated_client.py +211 -0
  52. dfns_sdk/generated/staking/types.py +64 -0
  53. dfns_sdk/generated/swaps/__init__.py +7 -0
  54. dfns_sdk/generated/swaps/client.py +118 -0
  55. dfns_sdk/generated/swaps/delegated_client.py +157 -0
  56. dfns_sdk/generated/swaps/types.py +99 -0
  57. dfns_sdk/generated/wallets/__init__.py +7 -0
  58. dfns_sdk/generated/wallets/client.py +805 -0
  59. dfns_sdk/generated/wallets/delegated_client.py +1231 -0
  60. dfns_sdk/generated/wallets/types.py +534 -0
  61. dfns_sdk/generated/webhooks/__init__.py +7 -0
  62. dfns_sdk/generated/webhooks/client.py +193 -0
  63. dfns_sdk/generated/webhooks/delegated_client.py +320 -0
  64. dfns_sdk/generated/webhooks/types.py +101 -0
  65. dfns_sdk/types.py +72 -0
  66. dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
  67. dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
  68. dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
  69. dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,518 @@
1
+ """Delegated client for the keys domain."""
2
+
3
+ import json
4
+ from typing import Any, Literal, Optional, TypedDict, Union
5
+
6
+ from ..._internal import HttpClient
7
+ from ...base_auth_api import (
8
+ BaseAuthApi,
9
+ SignUserActionChallengeRequest,
10
+ UserActionChallengeResponse,
11
+ )
12
+ from . import types as T
13
+
14
+
15
+ class DelegatedKeysClient:
16
+ """
17
+ Delegated client for keys operations.
18
+
19
+ This client separates user action signing into _init() and _complete() method pairs,
20
+ allowing external systems to handle the signing process.
21
+ """
22
+
23
+ def __init__(self, http_client: HttpClient):
24
+ self._http = http_client
25
+
26
+ def list_keys(self, query: Optional[T.ListKeysQuery] = None) -> T.ListKeysResponse:
27
+ """
28
+ List Keys.
29
+
30
+ Retrieve all keys registered for your organization.
31
+
32
+ Args:
33
+ query: Query parameters.
34
+
35
+ Returns:
36
+ T.ListKeysResponse: The API response.
37
+ """
38
+ return self._http.request(
39
+ method="GET",
40
+ path="/keys",
41
+ path_params={},
42
+ query_params=query,
43
+ body=None,
44
+ requires_signature=False,
45
+ )
46
+
47
+ def create_key_init(self, body: T.CreateKeyRequest) -> UserActionChallengeResponse:
48
+ """
49
+ Initialize Create Key.
50
+
51
+ Creates a user action challenge for external signing.
52
+
53
+ Args:
54
+ body: Request body.
55
+
56
+ Returns:
57
+ UserActionChallengeResponse: The challenge to sign externally.
58
+ """
59
+ path = "/keys"
60
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
61
+
62
+ return BaseAuthApi.create_user_action_challenge(
63
+ self._http,
64
+ user_action_http_method="POST",
65
+ user_action_http_path=path,
66
+ user_action_payload=payload,
67
+ )
68
+
69
+ def create_key_complete(self, body: T.CreateKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.CreateKeyResponse:
70
+ """
71
+ Complete Create Key.
72
+
73
+ Submits the signed challenge and makes the API request.
74
+
75
+ Args:
76
+ body: Request body.
77
+ signed_challenge: The signed challenge from external signing.
78
+
79
+ Returns:
80
+ T.CreateKeyResponse: The API response.
81
+ """
82
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
83
+ self._http, signed_challenge
84
+ )
85
+ user_action_token = user_action_result["userAction"]
86
+
87
+ return self._http.request_with_user_action(
88
+ method="POST",
89
+ path="/keys",
90
+ path_params={},
91
+ query_params=None,
92
+ body=body,
93
+ user_action=user_action_token,
94
+ )
95
+
96
+ def delegate_key_init(self, key_id: str, body: T.DelegateKeyRequest) -> UserActionChallengeResponse:
97
+ """
98
+ Initialize Delegate Key.
99
+
100
+ Creates a user action challenge for external signing.
101
+
102
+ Args:
103
+ key_id: Path parameter.
104
+ body: Request body.
105
+
106
+ Returns:
107
+ UserActionChallengeResponse: The challenge to sign externally.
108
+ """
109
+ path = "/keys/{keyId}/delegate"
110
+ path = path.replace("{keyId}", str(key_id))
111
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
112
+
113
+ return BaseAuthApi.create_user_action_challenge(
114
+ self._http,
115
+ user_action_http_method="POST",
116
+ user_action_http_path=path,
117
+ user_action_payload=payload,
118
+ )
119
+
120
+ def delegate_key_complete(self, key_id: str, body: T.DelegateKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.DelegateKeyResponse:
121
+ """
122
+ Complete Delegate Key.
123
+
124
+ Submits the signed challenge and makes the API request.
125
+
126
+ Args:
127
+ key_id: Path parameter.
128
+ body: Request body.
129
+ signed_challenge: The signed challenge from external signing.
130
+
131
+ Returns:
132
+ T.DelegateKeyResponse: The API response.
133
+ """
134
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
135
+ self._http, signed_challenge
136
+ )
137
+ user_action_token = user_action_result["userAction"]
138
+
139
+ return self._http.request_with_user_action(
140
+ method="POST",
141
+ path="/keys/{keyId}/delegate",
142
+ path_params={"keyId": key_id},
143
+ query_params=None,
144
+ body=body,
145
+ user_action=user_action_token,
146
+ )
147
+
148
+ def get_key(self, key_id: str) -> T.GetKeyResponse:
149
+ """
150
+ Get Key.
151
+
152
+ Retrieves a key information by its ID.
153
+
154
+ Args:
155
+ key_id: Path parameter.
156
+
157
+ Returns:
158
+ T.GetKeyResponse: The API response.
159
+ """
160
+ return self._http.request(
161
+ method="GET",
162
+ path="/keys/{keyId}",
163
+ path_params={"keyId": key_id},
164
+ query_params=None,
165
+ body=None,
166
+ requires_signature=False,
167
+ )
168
+
169
+ def update_key_init(self, key_id: str, body: T.UpdateKeyRequest) -> UserActionChallengeResponse:
170
+ """
171
+ Initialize Update Key.
172
+
173
+ Creates a user action challenge for external signing.
174
+
175
+ Args:
176
+ key_id: Path parameter.
177
+ body: Request body.
178
+
179
+ Returns:
180
+ UserActionChallengeResponse: The challenge to sign externally.
181
+ """
182
+ path = "/keys/{keyId}"
183
+ path = path.replace("{keyId}", str(key_id))
184
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
185
+
186
+ return BaseAuthApi.create_user_action_challenge(
187
+ self._http,
188
+ user_action_http_method="PUT",
189
+ user_action_http_path=path,
190
+ user_action_payload=payload,
191
+ )
192
+
193
+ def update_key_complete(self, key_id: str, body: T.UpdateKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.UpdateKeyResponse:
194
+ """
195
+ Complete Update Key.
196
+
197
+ Submits the signed challenge and makes the API request.
198
+
199
+ Args:
200
+ key_id: Path parameter.
201
+ body: Request body.
202
+ signed_challenge: The signed challenge from external signing.
203
+
204
+ Returns:
205
+ T.UpdateKeyResponse: The API response.
206
+ """
207
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
208
+ self._http, signed_challenge
209
+ )
210
+ user_action_token = user_action_result["userAction"]
211
+
212
+ return self._http.request_with_user_action(
213
+ method="PUT",
214
+ path="/keys/{keyId}",
215
+ path_params={"keyId": key_id},
216
+ query_params=None,
217
+ body=body,
218
+ user_action=user_action_token,
219
+ )
220
+
221
+ def delete_key_init(self, key_id: str) -> UserActionChallengeResponse:
222
+ """
223
+ Initialize Delete Key.
224
+
225
+ Creates a user action challenge for external signing.
226
+
227
+ Args:
228
+ key_id: Path parameter.
229
+
230
+ Returns:
231
+ UserActionChallengeResponse: The challenge to sign externally.
232
+ """
233
+ path = "/keys/{keyId}"
234
+ path = path.replace("{keyId}", str(key_id))
235
+ payload = ""
236
+
237
+ return BaseAuthApi.create_user_action_challenge(
238
+ self._http,
239
+ user_action_http_method="DELETE",
240
+ user_action_http_path=path,
241
+ user_action_payload=payload,
242
+ )
243
+
244
+ def delete_key_complete(self, key_id: str, signed_challenge: SignUserActionChallengeRequest) -> T.DeleteKeyResponse:
245
+ """
246
+ Complete Delete Key.
247
+
248
+ Submits the signed challenge and makes the API request.
249
+
250
+ Args:
251
+ key_id: Path parameter.
252
+ signed_challenge: The signed challenge from external signing.
253
+
254
+ Returns:
255
+ T.DeleteKeyResponse: The API response.
256
+ """
257
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
258
+ self._http, signed_challenge
259
+ )
260
+ user_action_token = user_action_result["userAction"]
261
+
262
+ return self._http.request_with_user_action(
263
+ method="DELETE",
264
+ path="/keys/{keyId}",
265
+ path_params={"keyId": key_id},
266
+ query_params=None,
267
+ body=None,
268
+ user_action=user_action_token,
269
+ )
270
+
271
+ def derive_key_init(self, key_id: str, body: T.DeriveKeyRequest) -> UserActionChallengeResponse:
272
+ """
273
+ Initialize Derive Key.
274
+
275
+ Creates a user action challenge for external signing.
276
+
277
+ Args:
278
+ key_id: Path parameter.
279
+ body: Request body.
280
+
281
+ Returns:
282
+ UserActionChallengeResponse: The challenge to sign externally.
283
+ """
284
+ path = "/keys/{keyId}/derive"
285
+ path = path.replace("{keyId}", str(key_id))
286
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
287
+
288
+ return BaseAuthApi.create_user_action_challenge(
289
+ self._http,
290
+ user_action_http_method="POST",
291
+ user_action_http_path=path,
292
+ user_action_payload=payload,
293
+ )
294
+
295
+ def derive_key_complete(self, key_id: str, body: T.DeriveKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.DeriveKeyResponse:
296
+ """
297
+ Complete Derive Key.
298
+
299
+ Submits the signed challenge and makes the API request.
300
+
301
+ Args:
302
+ key_id: Path parameter.
303
+ body: Request body.
304
+ signed_challenge: The signed challenge from external signing.
305
+
306
+ Returns:
307
+ T.DeriveKeyResponse: The API response.
308
+ """
309
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
310
+ self._http, signed_challenge
311
+ )
312
+ user_action_token = user_action_result["userAction"]
313
+
314
+ return self._http.request_with_user_action(
315
+ method="POST",
316
+ path="/keys/{keyId}/derive",
317
+ path_params={"keyId": key_id},
318
+ query_params=None,
319
+ body=body,
320
+ user_action=user_action_token,
321
+ )
322
+
323
+ def export_key_init(self, key_id: str, body: T.ExportKeyRequest) -> UserActionChallengeResponse:
324
+ """
325
+ Initialize Export Key.
326
+
327
+ Creates a user action challenge for external signing.
328
+
329
+ Args:
330
+ key_id: Path parameter.
331
+ body: Request body.
332
+
333
+ Returns:
334
+ UserActionChallengeResponse: The challenge to sign externally.
335
+ """
336
+ path = "/keys/{keyId}/export"
337
+ path = path.replace("{keyId}", str(key_id))
338
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
339
+
340
+ return BaseAuthApi.create_user_action_challenge(
341
+ self._http,
342
+ user_action_http_method="POST",
343
+ user_action_http_path=path,
344
+ user_action_payload=payload,
345
+ )
346
+
347
+ def export_key_complete(self, key_id: str, body: T.ExportKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.ExportKeyResponse:
348
+ """
349
+ Complete Export Key.
350
+
351
+ Submits the signed challenge and makes the API request.
352
+
353
+ Args:
354
+ key_id: Path parameter.
355
+ body: Request body.
356
+ signed_challenge: The signed challenge from external signing.
357
+
358
+ Returns:
359
+ T.ExportKeyResponse: The API response.
360
+ """
361
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
362
+ self._http, signed_challenge
363
+ )
364
+ user_action_token = user_action_result["userAction"]
365
+
366
+ return self._http.request_with_user_action(
367
+ method="POST",
368
+ path="/keys/{keyId}/export",
369
+ path_params={"keyId": key_id},
370
+ query_params=None,
371
+ body=body,
372
+ user_action=user_action_token,
373
+ )
374
+
375
+ def list_signatures(self, key_id: str, query: Optional[T.ListSignaturesQuery] = None) -> T.ListSignaturesResponse:
376
+ """
377
+ List Signatures.
378
+
379
+ List all signature requests for a key.
380
+
381
+ Args:
382
+ key_id: Path parameter.
383
+ query: Query parameters.
384
+
385
+ Returns:
386
+ T.ListSignaturesResponse: The API response.
387
+ """
388
+ return self._http.request(
389
+ method="GET",
390
+ path="/keys/{keyId}/signatures",
391
+ path_params={"keyId": key_id},
392
+ query_params=query,
393
+ body=None,
394
+ requires_signature=False,
395
+ )
396
+
397
+ def generate_signature_init(self, key_id: str, body: dict[str, Any]) -> UserActionChallengeResponse:
398
+ """
399
+ Initialize Generate Signature.
400
+
401
+ Creates a user action challenge for external signing.
402
+
403
+ Args:
404
+ key_id: Path parameter.
405
+ body: Request body.
406
+
407
+ Returns:
408
+ UserActionChallengeResponse: The challenge to sign externally.
409
+ """
410
+ path = "/keys/{keyId}/signatures"
411
+ path = path.replace("{keyId}", str(key_id))
412
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
413
+
414
+ return BaseAuthApi.create_user_action_challenge(
415
+ self._http,
416
+ user_action_http_method="POST",
417
+ user_action_http_path=path,
418
+ user_action_payload=payload,
419
+ )
420
+
421
+ def generate_signature_complete(self, key_id: str, body: dict[str, Any], signed_challenge: SignUserActionChallengeRequest) -> T.GenerateSignatureResponse:
422
+ """
423
+ Complete Generate Signature.
424
+
425
+ Submits the signed challenge and makes the API request.
426
+
427
+ Args:
428
+ key_id: Path parameter.
429
+ body: Request body.
430
+ signed_challenge: The signed challenge from external signing.
431
+
432
+ Returns:
433
+ T.GenerateSignatureResponse: The API response.
434
+ """
435
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
436
+ self._http, signed_challenge
437
+ )
438
+ user_action_token = user_action_result["userAction"]
439
+
440
+ return self._http.request_with_user_action(
441
+ method="POST",
442
+ path="/keys/{keyId}/signatures",
443
+ path_params={"keyId": key_id},
444
+ query_params=None,
445
+ body=body,
446
+ user_action=user_action_token,
447
+ )
448
+
449
+ def get_signature(self, key_id: str, signature_id: str) -> T.GetSignatureResponse:
450
+ """
451
+ Get Signature.
452
+
453
+ Retrieve a signature request details.
454
+
455
+ Args:
456
+ key_id: Path parameter.
457
+ signature_id: Path parameter.
458
+
459
+ Returns:
460
+ T.GetSignatureResponse: The API response.
461
+ """
462
+ return self._http.request(
463
+ method="GET",
464
+ path="/keys/{keyId}/signatures/{signatureId}",
465
+ path_params={"keyId": key_id, "signatureId": signature_id},
466
+ query_params=None,
467
+ body=None,
468
+ requires_signature=False,
469
+ )
470
+
471
+ def import_key_init(self, body: T.ImportKeyRequest) -> UserActionChallengeResponse:
472
+ """
473
+ Initialize Import Key.
474
+
475
+ Creates a user action challenge for external signing.
476
+
477
+ Args:
478
+ body: Request body.
479
+
480
+ Returns:
481
+ UserActionChallengeResponse: The challenge to sign externally.
482
+ """
483
+ path = "/keys/import"
484
+ payload = json.dumps(body, separators=(",", ":")) if body else ""
485
+
486
+ return BaseAuthApi.create_user_action_challenge(
487
+ self._http,
488
+ user_action_http_method="POST",
489
+ user_action_http_path=path,
490
+ user_action_payload=payload,
491
+ )
492
+
493
+ def import_key_complete(self, body: T.ImportKeyRequest, signed_challenge: SignUserActionChallengeRequest) -> T.ImportKeyResponse:
494
+ """
495
+ Complete Import Key.
496
+
497
+ Submits the signed challenge and makes the API request.
498
+
499
+ Args:
500
+ body: Request body.
501
+ signed_challenge: The signed challenge from external signing.
502
+
503
+ Returns:
504
+ T.ImportKeyResponse: The API response.
505
+ """
506
+ user_action_result = BaseAuthApi.sign_user_action_challenge(
507
+ self._http, signed_challenge
508
+ )
509
+ user_action_token = user_action_result["userAction"]
510
+
511
+ return self._http.request_with_user_action(
512
+ method="POST",
513
+ path="/keys/import",
514
+ path_params={},
515
+ query_params=None,
516
+ body=body,
517
+ user_action=user_action_token,
518
+ )