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.
- dfns_sdk/__init__.py +24 -0
- dfns_sdk/_internal/__init__.py +5 -0
- dfns_sdk/_internal/http_client.py +395 -0
- dfns_sdk/auth.py +137 -0
- dfns_sdk/base_auth_api.py +129 -0
- dfns_sdk/client.py +81 -0
- dfns_sdk/delegated_client.py +97 -0
- dfns_sdk/generated/__init__.py +47 -0
- dfns_sdk/generated/agreements/__init__.py +7 -0
- dfns_sdk/generated/agreements/client.py +55 -0
- dfns_sdk/generated/agreements/delegated_client.py +95 -0
- dfns_sdk/generated/agreements/types.py +20 -0
- dfns_sdk/generated/allocations/__init__.py +7 -0
- dfns_sdk/generated/allocations/client.py +118 -0
- dfns_sdk/generated/allocations/delegated_client.py +187 -0
- dfns_sdk/generated/allocations/types.py +69 -0
- dfns_sdk/generated/auth/__init__.py +7 -0
- dfns_sdk/generated/auth/client.py +1215 -0
- dfns_sdk/generated/auth/delegated_client.py +1825 -0
- dfns_sdk/generated/auth/types.py +702 -0
- dfns_sdk/generated/exchanges/__init__.py +7 -0
- dfns_sdk/generated/exchanges/client.py +209 -0
- dfns_sdk/generated/exchanges/delegated_client.py +341 -0
- dfns_sdk/generated/exchanges/types.py +96 -0
- dfns_sdk/generated/fee_sponsors/__init__.py +7 -0
- dfns_sdk/generated/fee_sponsors/client.py +161 -0
- dfns_sdk/generated/fee_sponsors/delegated_client.py +287 -0
- dfns_sdk/generated/fee_sponsors/types.py +89 -0
- dfns_sdk/generated/keys/__init__.py +7 -0
- dfns_sdk/generated/keys/client.py +310 -0
- dfns_sdk/generated/keys/delegated_client.py +518 -0
- dfns_sdk/generated/keys/types.py +229 -0
- dfns_sdk/generated/networks/__init__.py +7 -0
- dfns_sdk/generated/networks/client.py +176 -0
- dfns_sdk/generated/networks/delegated_client.py +274 -0
- dfns_sdk/generated/networks/types.py +77 -0
- dfns_sdk/generated/permissions/__init__.py +7 -0
- dfns_sdk/generated/permissions/client.py +185 -0
- dfns_sdk/generated/permissions/delegated_client.py +344 -0
- dfns_sdk/generated/permissions/types.py +107 -0
- dfns_sdk/generated/policies/__init__.py +7 -0
- dfns_sdk/generated/policies/client.py +187 -0
- dfns_sdk/generated/policies/delegated_client.py +311 -0
- dfns_sdk/generated/policies/types.py +70 -0
- dfns_sdk/generated/signers/__init__.py +7 -0
- dfns_sdk/generated/signers/client.py +45 -0
- dfns_sdk/generated/signers/delegated_client.py +56 -0
- dfns_sdk/generated/signers/types.py +13 -0
- dfns_sdk/generated/staking/__init__.py +7 -0
- dfns_sdk/generated/staking/client.py +142 -0
- dfns_sdk/generated/staking/delegated_client.py +211 -0
- dfns_sdk/generated/staking/types.py +64 -0
- dfns_sdk/generated/swaps/__init__.py +7 -0
- dfns_sdk/generated/swaps/client.py +118 -0
- dfns_sdk/generated/swaps/delegated_client.py +157 -0
- dfns_sdk/generated/swaps/types.py +99 -0
- dfns_sdk/generated/wallets/__init__.py +7 -0
- dfns_sdk/generated/wallets/client.py +805 -0
- dfns_sdk/generated/wallets/delegated_client.py +1231 -0
- dfns_sdk/generated/wallets/types.py +534 -0
- dfns_sdk/generated/webhooks/__init__.py +7 -0
- dfns_sdk/generated/webhooks/client.py +193 -0
- dfns_sdk/generated/webhooks/delegated_client.py +320 -0
- dfns_sdk/generated/webhooks/types.py +101 -0
- dfns_sdk/types.py +72 -0
- dfns_sdk-0.0.0.dev0.dist-info/METADATA +191 -0
- dfns_sdk-0.0.0.dev0.dist-info/RECORD +69 -0
- dfns_sdk-0.0.0.dev0.dist-info/WHEEL +4 -0
- dfns_sdk-0.0.0.dev0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,1215 @@
|
|
|
1
|
+
"""Client for the auth domain."""
|
|
2
|
+
|
|
3
|
+
from typing import Any, Literal, Optional, TypedDict, Union
|
|
4
|
+
from warnings import deprecated
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
from ..._internal import HttpClient
|
|
8
|
+
from . import types as T
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class AuthClient:
|
|
12
|
+
"""Client for auth operations."""
|
|
13
|
+
|
|
14
|
+
def __init__(self, http_client: HttpClient):
|
|
15
|
+
self._http = http_client
|
|
16
|
+
|
|
17
|
+
def create_user_action_signature(self, body: T.CreateUserActionSignatureRequest) -> T.CreateUserActionSignatureResponse:
|
|
18
|
+
"""
|
|
19
|
+
Create User Action Signature.
|
|
20
|
+
|
|
21
|
+
Completes the user action signing process and provides a signing token that can be used to verify the user intended to perform the action.
|
|
22
|
+
|
|
23
|
+
This is the first step of the [User Action Signing flow](http://docs.dfns.co/api-reference/auth/signing-flows).
|
|
24
|
+
|
|
25
|
+
The type of credentials used to sign the action is determined by the `kind` field in the nested objects (`firstFactor` and `secondFactor`). Supported credential kinds are:
|
|
26
|
+
* `Fido2`: User action is signed by a user's signing device using `WebAuthn`.
|
|
27
|
+
* `Key`: User action is signed by a user's, or token's, private key.
|
|
28
|
+
* `PasswordProtectedKey`: Login challenge is signed by the decrypted user's private key that was sent during [Create User Action Signature Challenge](https://docs.dfns.co/api-reference/auth/create-user-action-challenge) step.
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
body: Request body.
|
|
32
|
+
|
|
33
|
+
Returns:
|
|
34
|
+
T.CreateUserActionSignatureResponse: The API response.
|
|
35
|
+
"""
|
|
36
|
+
return self._http.request(
|
|
37
|
+
method="POST",
|
|
38
|
+
path="/auth/action",
|
|
39
|
+
path_params={},
|
|
40
|
+
query_params=None,
|
|
41
|
+
body=body,
|
|
42
|
+
requires_signature=False,
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
def create_user_action_challenge(self, body: T.CreateUserActionChallengeRequest) -> T.CreateUserActionChallengeResponse:
|
|
46
|
+
"""
|
|
47
|
+
Create User Action Challenge.
|
|
48
|
+
|
|
49
|
+
Starts a user action signing session, returning a challenge that will be used to verify the user's intent to perform an action.
|
|
50
|
+
|
|
51
|
+
This is the first step of the [User Action Signing flow](http://docs.dfns.co/api-reference/auth/signing-flows).
|
|
52
|
+
|
|
53
|
+
Args:
|
|
54
|
+
body: Request body.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
T.CreateUserActionChallengeResponse: The API response.
|
|
58
|
+
"""
|
|
59
|
+
return self._http.request(
|
|
60
|
+
method="POST",
|
|
61
|
+
path="/auth/action/init",
|
|
62
|
+
path_params={},
|
|
63
|
+
query_params=None,
|
|
64
|
+
body=body,
|
|
65
|
+
requires_signature=False,
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
def list_audit_logs(self, query: T.ListAuditLogsQuery) -> None:
|
|
69
|
+
"""
|
|
70
|
+
List Audit Logs.
|
|
71
|
+
|
|
72
|
+
Gets all signature events which have occurred in the over the timeframe. The max range the API supports is 7 days.
|
|
73
|
+
|
|
74
|
+
StartTime and EndTime are URL-encoded UTC ISO timestamps:
|
|
75
|
+
`startTime=2025-08-29T02%3A46%3A40Z`
|
|
76
|
+
`endTime=2025-09-01T02%3A46%3A40Z`
|
|
77
|
+
|
|
78
|
+
An additional optional query parameter, `userId` can be specified to filter down events to a particular user. The API will return results found in CSV format.
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
Dfns maintains a script which can be used for audit log signature validation: [WebAuthn Signature Verifier](https://github.com/dfns/example-scripts/tree/m/python/utils)
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
query: Query parameters.
|
|
85
|
+
"""
|
|
86
|
+
return self._http.request(
|
|
87
|
+
method="GET",
|
|
88
|
+
path="/auth/action/logs",
|
|
89
|
+
path_params={},
|
|
90
|
+
query_params=query,
|
|
91
|
+
body=None,
|
|
92
|
+
requires_signature=False,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def get_audit_log(self, id: str) -> T.GetAuditLogResponse:
|
|
96
|
+
"""
|
|
97
|
+
Get Audit Log.
|
|
98
|
+
|
|
99
|
+
Gets detailed information for a particular audit log. Specifically, the API returns the action performed, as well as the `firstFactorCredential` in which you will find the signature information required to validate it.
|
|
100
|
+
|
|
101
|
+
Dfns maintains a script which can be used for audit log signature validation: [WebAuthn Signature Verifier](https://github.com/dfns/example-scripts/tree/m/python/utils)
|
|
102
|
+
|
|
103
|
+
Args:
|
|
104
|
+
id: Log id you need information about.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
T.GetAuditLogResponse: The API response.
|
|
108
|
+
"""
|
|
109
|
+
return self._http.request(
|
|
110
|
+
method="GET",
|
|
111
|
+
path="/auth/action/logs/{id}",
|
|
112
|
+
path_params={"id": id},
|
|
113
|
+
query_params=None,
|
|
114
|
+
body=None,
|
|
115
|
+
requires_signature=False,
|
|
116
|
+
)
|
|
117
|
+
|
|
118
|
+
@deprecated("This endpoint is deprecated.")
|
|
119
|
+
def list_applications(self) -> T.ListApplicationsResponse:
|
|
120
|
+
"""
|
|
121
|
+
List Applications.
|
|
122
|
+
|
|
123
|
+
<Warning>
|
|
124
|
+
Applications are deprecated and will be removed in a future release. See details [here](https://docs.dfns.co/developers/guides/applications-deprecation).
|
|
125
|
+
</Warning>
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
T.ListApplicationsResponse: The API response.
|
|
129
|
+
"""
|
|
130
|
+
return self._http.request(
|
|
131
|
+
method="GET",
|
|
132
|
+
path="/auth/apps",
|
|
133
|
+
path_params={},
|
|
134
|
+
query_params=None,
|
|
135
|
+
body=None,
|
|
136
|
+
requires_signature=False,
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
@deprecated("This endpoint is deprecated.")
|
|
140
|
+
def get_application(self, app_id: str) -> T.GetApplicationResponse:
|
|
141
|
+
"""
|
|
142
|
+
Get Application.
|
|
143
|
+
|
|
144
|
+
<Warning>
|
|
145
|
+
Applications are deprecated and will be removed in a future release. See details [here](https://docs.dfns.co/developers/guides/applications-deprecation).
|
|
146
|
+
</Warning>
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
app_id: Path parameter.
|
|
150
|
+
|
|
151
|
+
Returns:
|
|
152
|
+
T.GetApplicationResponse: The API response.
|
|
153
|
+
"""
|
|
154
|
+
return self._http.request(
|
|
155
|
+
method="GET",
|
|
156
|
+
path="/auth/apps/{appId}",
|
|
157
|
+
path_params={"appId": app_id},
|
|
158
|
+
query_params=None,
|
|
159
|
+
body=None,
|
|
160
|
+
requires_signature=False,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
def list_credentials(self) -> T.ListCredentialsResponse:
|
|
164
|
+
"""
|
|
165
|
+
List Credentials.
|
|
166
|
+
|
|
167
|
+
List all credentials for a user.
|
|
168
|
+
|
|
169
|
+
Returns:
|
|
170
|
+
T.ListCredentialsResponse: The API response.
|
|
171
|
+
"""
|
|
172
|
+
return self._http.request(
|
|
173
|
+
method="GET",
|
|
174
|
+
path="/auth/credentials",
|
|
175
|
+
path_params={},
|
|
176
|
+
query_params=None,
|
|
177
|
+
body=None,
|
|
178
|
+
requires_signature=False,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
def create_credential(self, body: dict[str, Any]) -> T.CreateCredentialResponse:
|
|
182
|
+
"""
|
|
183
|
+
Create Credential.
|
|
184
|
+
|
|
185
|
+
Part of the flow [Create Credential Regular flow](https://docs.dfns.co/api-reference/auth/credentials#regular-flow).
|
|
186
|
+
|
|
187
|
+
Adds a new credential to a user's account. See [Credential Kinds](https://docs.dfns.co/api-reference/auth/credentials#credential-kinds) for all supported credential types.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
body: Request body.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
T.CreateCredentialResponse: The API response.
|
|
194
|
+
"""
|
|
195
|
+
return self._http.request(
|
|
196
|
+
method="POST",
|
|
197
|
+
path="/auth/credentials",
|
|
198
|
+
path_params={},
|
|
199
|
+
query_params=None,
|
|
200
|
+
body=body,
|
|
201
|
+
requires_signature=True,
|
|
202
|
+
)
|
|
203
|
+
|
|
204
|
+
def create_credential_challenge(self, body: T.CreateCredentialChallengeRequest) -> TypedDict:
|
|
205
|
+
"""
|
|
206
|
+
Create Credential Challenge.
|
|
207
|
+
|
|
208
|
+
Part of the flow [Create Credential Regular flow](https://docs.dfns.co/api-reference/auth/credentials#regular-flow).
|
|
209
|
+
|
|
210
|
+
Starts a create user credential session, returning a challenge that will be used to verify the user's identity.
|
|
211
|
+
|
|
212
|
+
Args:
|
|
213
|
+
body: Request body.
|
|
214
|
+
|
|
215
|
+
Returns:
|
|
216
|
+
TypedDict: The API response.
|
|
217
|
+
"""
|
|
218
|
+
return self._http.request(
|
|
219
|
+
method="POST",
|
|
220
|
+
path="/auth/credentials/init",
|
|
221
|
+
path_params={},
|
|
222
|
+
query_params=None,
|
|
223
|
+
body=body,
|
|
224
|
+
requires_signature=False,
|
|
225
|
+
)
|
|
226
|
+
|
|
227
|
+
def activate_credential(self, body: T.ActivateCredentialRequest) -> T.ActivateCredentialResponse:
|
|
228
|
+
"""
|
|
229
|
+
Activate Credential.
|
|
230
|
+
|
|
231
|
+
Activates a credential that was previously deactivated. If the credential is already activated no action is taken.
|
|
232
|
+
|
|
233
|
+
Args:
|
|
234
|
+
body: Request body.
|
|
235
|
+
|
|
236
|
+
Returns:
|
|
237
|
+
T.ActivateCredentialResponse: The API response.
|
|
238
|
+
"""
|
|
239
|
+
return self._http.request(
|
|
240
|
+
method="PUT",
|
|
241
|
+
path="/auth/credentials/activate",
|
|
242
|
+
path_params={},
|
|
243
|
+
query_params=None,
|
|
244
|
+
body=body,
|
|
245
|
+
requires_signature=True,
|
|
246
|
+
)
|
|
247
|
+
|
|
248
|
+
def deactivate_credential(self, body: T.DeactivateCredentialRequest) -> T.DeactivateCredentialResponse:
|
|
249
|
+
"""
|
|
250
|
+
Deactivate Credential.
|
|
251
|
+
|
|
252
|
+
Deactivates a credential that was previously active. If the credential is already deactivated no action is taken.
|
|
253
|
+
|
|
254
|
+
Args:
|
|
255
|
+
body: Request body.
|
|
256
|
+
|
|
257
|
+
Returns:
|
|
258
|
+
T.DeactivateCredentialResponse: The API response.
|
|
259
|
+
"""
|
|
260
|
+
return self._http.request(
|
|
261
|
+
method="PUT",
|
|
262
|
+
path="/auth/credentials/deactivate",
|
|
263
|
+
path_params={},
|
|
264
|
+
query_params=None,
|
|
265
|
+
body=body,
|
|
266
|
+
requires_signature=True,
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
def create_credential_code(self, body: T.CreateCredentialCodeRequest) -> T.CreateCredentialCodeResponse:
|
|
270
|
+
"""
|
|
271
|
+
Create Credential Code.
|
|
272
|
+
|
|
273
|
+
Part of the [Create Credential With Code flow](https://docs.dfns.co/api-reference/auth/credentials#create-credential-with-code-flow).
|
|
274
|
+
|
|
275
|
+
Creates a one-time-code that can then be used to create a new credential from a place you don't have access to one of your existing credential.
|
|
276
|
+
|
|
277
|
+
Args:
|
|
278
|
+
body: Request body.
|
|
279
|
+
|
|
280
|
+
Returns:
|
|
281
|
+
T.CreateCredentialCodeResponse: The API response.
|
|
282
|
+
"""
|
|
283
|
+
return self._http.request(
|
|
284
|
+
method="POST",
|
|
285
|
+
path="/auth/credentials/code",
|
|
286
|
+
path_params={},
|
|
287
|
+
query_params=None,
|
|
288
|
+
body=body,
|
|
289
|
+
requires_signature=True,
|
|
290
|
+
)
|
|
291
|
+
|
|
292
|
+
def create_credential_challenge_with_code(self, body: T.CreateCredentialChallengeWithCodeRequest) -> TypedDict:
|
|
293
|
+
"""
|
|
294
|
+
Create Credential Challenge With Code.
|
|
295
|
+
|
|
296
|
+
Part of the flow [Create Credential With Code](https://docs.dfns.co/api-reference/auth/credentials#create-credential-with-code-flow).
|
|
297
|
+
|
|
298
|
+
Creates a credential challenge using a one time code-time-code. This challenge must then be signed by the new credential, before finalizing the flow.
|
|
299
|
+
|
|
300
|
+
Args:
|
|
301
|
+
body: Request body.
|
|
302
|
+
|
|
303
|
+
Returns:
|
|
304
|
+
TypedDict: The API response.
|
|
305
|
+
"""
|
|
306
|
+
return self._http.request(
|
|
307
|
+
method="POST",
|
|
308
|
+
path="/auth/credentials/code/init",
|
|
309
|
+
path_params={},
|
|
310
|
+
query_params=None,
|
|
311
|
+
body=body,
|
|
312
|
+
requires_signature=False,
|
|
313
|
+
)
|
|
314
|
+
|
|
315
|
+
def create_credential_with_code(self, body: dict[str, Any]) -> T.CreateCredentialWithCodeResponse:
|
|
316
|
+
"""
|
|
317
|
+
Create Credential With Code.
|
|
318
|
+
|
|
319
|
+
Finalizes the flow [Create Credential With Code](https://docs.dfns.co/api-reference/auth/credentials#create-credential-with-code-flow).
|
|
320
|
+
|
|
321
|
+
Adds a new credential to a user's account. This endpoint is similar to the [Create Credential](https://docs.dfns.co/api-reference/auth/create-credential) endpoint, except:
|
|
322
|
+
* it does not need the user to be authenticated
|
|
323
|
+
* it does not need user action signing
|
|
324
|
+
* it will only work with the challenge gotten from the [Create Credential Challenge With Code](https://docs.dfns.co/api-reference/auth/create-credential-challenge-with-code) endpoint
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
body: Request body.
|
|
328
|
+
|
|
329
|
+
Returns:
|
|
330
|
+
T.CreateCredentialWithCodeResponse: The API response.
|
|
331
|
+
"""
|
|
332
|
+
return self._http.request(
|
|
333
|
+
method="POST",
|
|
334
|
+
path="/auth/credentials/code/verify",
|
|
335
|
+
path_params={},
|
|
336
|
+
query_params=None,
|
|
337
|
+
body=body,
|
|
338
|
+
requires_signature=False,
|
|
339
|
+
)
|
|
340
|
+
|
|
341
|
+
def create_login_challenge(self, body: T.CreateLoginChallengeRequest) -> T.CreateLoginChallengeResponse:
|
|
342
|
+
"""
|
|
343
|
+
Create Login Challenge.
|
|
344
|
+
|
|
345
|
+
Start a user login session, returning a challenge that will be used to verify the user's identity.
|
|
346
|
+
|
|
347
|
+
If the user has a credential of kind `PasswordProtectedKey` a temporary one time code needs to be passed in the `loginCode` field.
|
|
348
|
+
|
|
349
|
+
If the user has at least one discoverable webauthn credential, `username` is optional (usernamless flow).
|
|
350
|
+
|
|
351
|
+
Args:
|
|
352
|
+
body: Request body.
|
|
353
|
+
|
|
354
|
+
Returns:
|
|
355
|
+
T.CreateLoginChallengeResponse: The API response.
|
|
356
|
+
"""
|
|
357
|
+
return self._http.request(
|
|
358
|
+
method="POST",
|
|
359
|
+
path="/auth/login/init",
|
|
360
|
+
path_params={},
|
|
361
|
+
query_params=None,
|
|
362
|
+
body=body,
|
|
363
|
+
requires_signature=False,
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
def delegated_login(self, body: T.DelegatedLoginRequest) -> T.DelegatedLoginResponse:
|
|
367
|
+
"""
|
|
368
|
+
Delegated Login.
|
|
369
|
+
|
|
370
|
+
<Warning>
|
|
371
|
+
Only a [Service Account](https://docs.dfns.co/api-reference/auth/service-accounts) can use this endpoint.
|
|
372
|
+
</Warning>
|
|
373
|
+
|
|
374
|
+
Logs a user into an organization without the user's credentials.
|
|
375
|
+
|
|
376
|
+
If you want to use your own authentication system, while still using `Delegated Signing`, you can use this endpoint to authenticate a user without needing the user's credentials.
|
|
377
|
+
|
|
378
|
+
The user authentication token can be used for read operations within the Dfns API, however, write operations will still require the user to sign the action.
|
|
379
|
+
|
|
380
|
+
Args:
|
|
381
|
+
body: Request body.
|
|
382
|
+
|
|
383
|
+
Returns:
|
|
384
|
+
T.DelegatedLoginResponse: The API response.
|
|
385
|
+
"""
|
|
386
|
+
return self._http.request(
|
|
387
|
+
method="POST",
|
|
388
|
+
path="/auth/login/delegated",
|
|
389
|
+
path_params={},
|
|
390
|
+
query_params=None,
|
|
391
|
+
body=body,
|
|
392
|
+
requires_signature=True,
|
|
393
|
+
)
|
|
394
|
+
|
|
395
|
+
def complete_user_login(self, body: T.CompleteUserLoginRequest) -> TypedDict:
|
|
396
|
+
"""
|
|
397
|
+
Complete User Login.
|
|
398
|
+
|
|
399
|
+
Completes the login process and provides the authenticated user with their authentication token.
|
|
400
|
+
|
|
401
|
+
The type of credentials used to login is determined by the `kind` field in the nested objects (`firstFactor` and `secondFactor`). Supported credential kinds are:
|
|
402
|
+
* `Fido2`: Login challenge is signed by a user's signing device using `WebAuthn`.
|
|
403
|
+
* `Key`: Login challenge is signed by a user's private key.
|
|
404
|
+
* `PasswordProtectedKey`: Login challenge is signed by the decrypted user's private key that was sent during [Create User Login Challenge](../registration/inituserregistration) step.
|
|
405
|
+
|
|
406
|
+
Args:
|
|
407
|
+
body: Request body.
|
|
408
|
+
|
|
409
|
+
Returns:
|
|
410
|
+
TypedDict: The API response.
|
|
411
|
+
"""
|
|
412
|
+
return self._http.request(
|
|
413
|
+
method="POST",
|
|
414
|
+
path="/auth/login",
|
|
415
|
+
path_params={},
|
|
416
|
+
query_params=None,
|
|
417
|
+
body=body,
|
|
418
|
+
requires_signature=False,
|
|
419
|
+
)
|
|
420
|
+
|
|
421
|
+
def logout(self, body: T.LogoutRequest) -> T.LogoutResponse:
|
|
422
|
+
"""
|
|
423
|
+
Logout.
|
|
424
|
+
|
|
425
|
+
Completes the user logout process.
|
|
426
|
+
|
|
427
|
+
Args:
|
|
428
|
+
body: Request body.
|
|
429
|
+
|
|
430
|
+
Returns:
|
|
431
|
+
T.LogoutResponse: The API response.
|
|
432
|
+
"""
|
|
433
|
+
return self._http.request(
|
|
434
|
+
method="PUT",
|
|
435
|
+
path="/auth/logout",
|
|
436
|
+
path_params={},
|
|
437
|
+
query_params=None,
|
|
438
|
+
body=body,
|
|
439
|
+
requires_signature=False,
|
|
440
|
+
)
|
|
441
|
+
|
|
442
|
+
def send_login_code(self, body: T.SendLoginCodeRequest) -> T.SendLoginCodeResponse:
|
|
443
|
+
"""
|
|
444
|
+
Send Login Code.
|
|
445
|
+
|
|
446
|
+
Sends a temporary one time code to the user that can be used during login flow.
|
|
447
|
+
|
|
448
|
+
If the user has a credential of kind `PasswordProtectedKey` a temporary one time code needs to be passed in the `loginCode` field. That's because the [Create Login Challenge](https://docs.dfns.co/api-reference/auth/create-login-challenge) is unauthenticated and returns the encrypted private key of the user. So we need a first step to verify the identity of the user to prevent anybody from fetching the encrypted private key and trying to brute force it offline.
|
|
449
|
+
|
|
450
|
+
Args:
|
|
451
|
+
body: Request body.
|
|
452
|
+
|
|
453
|
+
Returns:
|
|
454
|
+
T.SendLoginCodeResponse: The API response.
|
|
455
|
+
"""
|
|
456
|
+
return self._http.request(
|
|
457
|
+
method="POST",
|
|
458
|
+
path="/auth/login/code",
|
|
459
|
+
path_params={},
|
|
460
|
+
query_params=None,
|
|
461
|
+
body=body,
|
|
462
|
+
requires_signature=False,
|
|
463
|
+
)
|
|
464
|
+
|
|
465
|
+
def social_login(self, body: T.SocialLoginRequest) -> T.SocialLoginResponse:
|
|
466
|
+
"""
|
|
467
|
+
Social Login.
|
|
468
|
+
|
|
469
|
+
Completes the login process and provides the authenticated user with their authentication token.
|
|
470
|
+
|
|
471
|
+
Args:
|
|
472
|
+
body: Request body.
|
|
473
|
+
|
|
474
|
+
Returns:
|
|
475
|
+
T.SocialLoginResponse: The API response.
|
|
476
|
+
"""
|
|
477
|
+
return self._http.request(
|
|
478
|
+
method="POST",
|
|
479
|
+
path="/auth/login/social",
|
|
480
|
+
path_params={},
|
|
481
|
+
query_params=None,
|
|
482
|
+
body=body,
|
|
483
|
+
requires_signature=False,
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
def complete_sso_login(self, body: T.CompleteSsoLoginRequest) -> T.CompleteSsoLoginResponse:
|
|
487
|
+
"""
|
|
488
|
+
Complete SSO Login.
|
|
489
|
+
|
|
490
|
+
Completes the login process and provides the authenticated user with their authentication token.
|
|
491
|
+
|
|
492
|
+
Args:
|
|
493
|
+
body: Request body.
|
|
494
|
+
|
|
495
|
+
Returns:
|
|
496
|
+
T.CompleteSsoLoginResponse: The API response.
|
|
497
|
+
"""
|
|
498
|
+
return self._http.request(
|
|
499
|
+
method="POST",
|
|
500
|
+
path="/auth/login/sso",
|
|
501
|
+
path_params={},
|
|
502
|
+
query_params=None,
|
|
503
|
+
body=body,
|
|
504
|
+
requires_signature=False,
|
|
505
|
+
)
|
|
506
|
+
|
|
507
|
+
def initiate_sso_login(self, body: T.InitiateSsoLoginRequest) -> T.InitiateSsoLoginResponse:
|
|
508
|
+
"""
|
|
509
|
+
Initiate SSO Login.
|
|
510
|
+
|
|
511
|
+
Initialize the login process with SSO by returning the IdP Url to call.
|
|
512
|
+
|
|
513
|
+
Args:
|
|
514
|
+
body: Request body.
|
|
515
|
+
|
|
516
|
+
Returns:
|
|
517
|
+
T.InitiateSsoLoginResponse: The API response.
|
|
518
|
+
"""
|
|
519
|
+
return self._http.request(
|
|
520
|
+
method="POST",
|
|
521
|
+
path="/auth/login/sso/init",
|
|
522
|
+
path_params={},
|
|
523
|
+
query_params=None,
|
|
524
|
+
body=body,
|
|
525
|
+
requires_signature=False,
|
|
526
|
+
)
|
|
527
|
+
|
|
528
|
+
def list_personal_access_tokens(self) -> T.ListPersonalAccessTokensResponse:
|
|
529
|
+
"""
|
|
530
|
+
List Personal Access Tokens.
|
|
531
|
+
|
|
532
|
+
Retrieve the list of your Personal Access Tokens.
|
|
533
|
+
|
|
534
|
+
Returns:
|
|
535
|
+
T.ListPersonalAccessTokensResponse: The API response.
|
|
536
|
+
"""
|
|
537
|
+
return self._http.request(
|
|
538
|
+
method="GET",
|
|
539
|
+
path="/auth/pats",
|
|
540
|
+
path_params={},
|
|
541
|
+
query_params=None,
|
|
542
|
+
body=None,
|
|
543
|
+
requires_signature=False,
|
|
544
|
+
)
|
|
545
|
+
|
|
546
|
+
def create_personal_access_token(self, body: T.CreatePersonalAccessTokenRequest) -> T.CreatePersonalAccessTokenResponse:
|
|
547
|
+
"""
|
|
548
|
+
Create Personal Access Token.
|
|
549
|
+
|
|
550
|
+
Create a new Personal Access Token for the caller.
|
|
551
|
+
|
|
552
|
+
Args:
|
|
553
|
+
body: Request body.
|
|
554
|
+
|
|
555
|
+
Returns:
|
|
556
|
+
T.CreatePersonalAccessTokenResponse: The API response.
|
|
557
|
+
"""
|
|
558
|
+
return self._http.request(
|
|
559
|
+
method="POST",
|
|
560
|
+
path="/auth/pats",
|
|
561
|
+
path_params={},
|
|
562
|
+
query_params=None,
|
|
563
|
+
body=body,
|
|
564
|
+
requires_signature=True,
|
|
565
|
+
)
|
|
566
|
+
|
|
567
|
+
def get_personal_access_token(self, token_id: str) -> T.GetPersonalAccessTokenResponse:
|
|
568
|
+
"""
|
|
569
|
+
Get Personal Access Token.
|
|
570
|
+
|
|
571
|
+
Retrieve a specific Personal Access Token.
|
|
572
|
+
|
|
573
|
+
Args:
|
|
574
|
+
token_id: Path parameter.
|
|
575
|
+
|
|
576
|
+
Returns:
|
|
577
|
+
T.GetPersonalAccessTokenResponse: The API response.
|
|
578
|
+
"""
|
|
579
|
+
return self._http.request(
|
|
580
|
+
method="GET",
|
|
581
|
+
path="/auth/pats/{tokenId}",
|
|
582
|
+
path_params={"tokenId": token_id},
|
|
583
|
+
query_params=None,
|
|
584
|
+
body=None,
|
|
585
|
+
requires_signature=False,
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
def update_personal_access_token(self, token_id: str, body: T.UpdatePersonalAccessTokenRequest) -> T.UpdatePersonalAccessTokenResponse:
|
|
589
|
+
"""
|
|
590
|
+
Update Personal Access Token.
|
|
591
|
+
|
|
592
|
+
Update a specific Personal Access Token.
|
|
593
|
+
|
|
594
|
+
Args:
|
|
595
|
+
token_id: Path parameter.
|
|
596
|
+
body: Request body.
|
|
597
|
+
|
|
598
|
+
Returns:
|
|
599
|
+
T.UpdatePersonalAccessTokenResponse: The API response.
|
|
600
|
+
"""
|
|
601
|
+
return self._http.request(
|
|
602
|
+
method="PUT",
|
|
603
|
+
path="/auth/pats/{tokenId}",
|
|
604
|
+
path_params={"tokenId": token_id},
|
|
605
|
+
query_params=None,
|
|
606
|
+
body=body,
|
|
607
|
+
requires_signature=True,
|
|
608
|
+
)
|
|
609
|
+
|
|
610
|
+
def delete_personal_access_token(self, token_id: str) -> T.DeletePersonalAccessTokenResponse:
|
|
611
|
+
"""
|
|
612
|
+
Delete Personal Access Token.
|
|
613
|
+
|
|
614
|
+
Delete a specific Personal Access Token.
|
|
615
|
+
|
|
616
|
+
Args:
|
|
617
|
+
token_id: Path parameter.
|
|
618
|
+
|
|
619
|
+
Returns:
|
|
620
|
+
T.DeletePersonalAccessTokenResponse: The API response.
|
|
621
|
+
"""
|
|
622
|
+
return self._http.request(
|
|
623
|
+
method="DELETE",
|
|
624
|
+
path="/auth/pats/{tokenId}",
|
|
625
|
+
path_params={"tokenId": token_id},
|
|
626
|
+
query_params=None,
|
|
627
|
+
body=None,
|
|
628
|
+
requires_signature=True,
|
|
629
|
+
)
|
|
630
|
+
|
|
631
|
+
def activate_personal_access_token(self, token_id: str) -> T.ActivatePersonalAccessTokenResponse:
|
|
632
|
+
"""
|
|
633
|
+
Activate Personal Access Token.
|
|
634
|
+
|
|
635
|
+
Activate a specific Personal Access Token.
|
|
636
|
+
|
|
637
|
+
Args:
|
|
638
|
+
token_id: Path parameter.
|
|
639
|
+
|
|
640
|
+
Returns:
|
|
641
|
+
T.ActivatePersonalAccessTokenResponse: The API response.
|
|
642
|
+
"""
|
|
643
|
+
return self._http.request(
|
|
644
|
+
method="PUT",
|
|
645
|
+
path="/auth/pats/{tokenId}/activate",
|
|
646
|
+
path_params={"tokenId": token_id},
|
|
647
|
+
query_params=None,
|
|
648
|
+
body=None,
|
|
649
|
+
requires_signature=True,
|
|
650
|
+
)
|
|
651
|
+
|
|
652
|
+
def deactivate_personal_access_token(self, token_id: str) -> T.DeactivatePersonalAccessTokenResponse:
|
|
653
|
+
"""
|
|
654
|
+
Deactivate Personal Access Token.
|
|
655
|
+
|
|
656
|
+
Deactivates a credential that was previously active. If the credential is already deactivated no action is taken.
|
|
657
|
+
|
|
658
|
+
Args:
|
|
659
|
+
token_id: Path parameter.
|
|
660
|
+
|
|
661
|
+
Returns:
|
|
662
|
+
T.DeactivatePersonalAccessTokenResponse: The API response.
|
|
663
|
+
"""
|
|
664
|
+
return self._http.request(
|
|
665
|
+
method="PUT",
|
|
666
|
+
path="/auth/pats/{tokenId}/deactivate",
|
|
667
|
+
path_params={"tokenId": token_id},
|
|
668
|
+
query_params=None,
|
|
669
|
+
body=None,
|
|
670
|
+
requires_signature=True,
|
|
671
|
+
)
|
|
672
|
+
|
|
673
|
+
def create_delegated_recovery_challenge(self, body: T.CreateDelegatedRecoveryChallengeRequest) -> T.CreateDelegatedRecoveryChallengeResponse:
|
|
674
|
+
"""
|
|
675
|
+
Create Delegated Recovery Challenge.
|
|
676
|
+
|
|
677
|
+
<Warning>
|
|
678
|
+
Only a [Service Account](https://docs.dfns.co/api-reference/auth/service-accounts) can use this endpoint.
|
|
679
|
+
</Warning>
|
|
680
|
+
|
|
681
|
+
This endpoint enables setting up a recovery workflow for Delegated Signing. Via this configuration, the end user will not receive an email from Dfns but instead can establish recovery credentials that leverage the customer's brand for the recovery workflow.
|
|
682
|
+
|
|
683
|
+
Once the user has been verified by your auth system and this API has been called, you can call [Recover User](https://docs.dfns.co/api-reference/auth/recover-user) to complete the recovery process.
|
|
684
|
+
|
|
685
|
+
Args:
|
|
686
|
+
body: Request body.
|
|
687
|
+
|
|
688
|
+
Returns:
|
|
689
|
+
T.CreateDelegatedRecoveryChallengeResponse: The API response.
|
|
690
|
+
"""
|
|
691
|
+
return self._http.request(
|
|
692
|
+
method="POST",
|
|
693
|
+
path="/auth/recover/user/delegated",
|
|
694
|
+
path_params={},
|
|
695
|
+
query_params=None,
|
|
696
|
+
body=body,
|
|
697
|
+
requires_signature=True,
|
|
698
|
+
)
|
|
699
|
+
|
|
700
|
+
def recover_user(self, body: T.RecoverUserRequest) -> T.RecoverUserResponse:
|
|
701
|
+
"""
|
|
702
|
+
Recover User.
|
|
703
|
+
|
|
704
|
+
Recovers a user, using a recovery credential. After successfully recovering the user, all of the user's previous credentials and personal access tokens will be invalidated.
|
|
705
|
+
|
|
706
|
+
This flow requires cryptographic validation of newly created credential(s) using a recovery credential. The `recovery.credentialAssertion.clientData` field's challenge must be the _base64url-encoded_ representation of the `newCredential` object.
|
|
707
|
+
|
|
708
|
+
The process is as follows:
|
|
709
|
+
|
|
710
|
+
1. Construct the `newCredential` object, using the challenge obtained from either the [Create Recovery Challenge](https://docs.dfns.co/api-reference/auth/create-recovery-challenge) or [Create Delegated Recovery Challenge](https://docs.dfns.co/api-reference/auth/create-delegated-recovery-challenge) endpoints.
|
|
711
|
+
2. Serialize the `newCredential` object to JSON and then base64url-encode the resulting JSON string. This _base64url-encoded_ string will serve as the challenge for the `recovery.credentialAssertion` object.
|
|
712
|
+
3. Construct the `recovery.credentialAssertion` object, using the _base64url-encoded_ string generated in step 2 as its challenge.
|
|
713
|
+
|
|
714
|
+
Args:
|
|
715
|
+
body: Request body.
|
|
716
|
+
|
|
717
|
+
Returns:
|
|
718
|
+
T.RecoverUserResponse: The API response.
|
|
719
|
+
"""
|
|
720
|
+
return self._http.request(
|
|
721
|
+
method="POST",
|
|
722
|
+
path="/auth/recover/user",
|
|
723
|
+
path_params={},
|
|
724
|
+
query_params=None,
|
|
725
|
+
body=body,
|
|
726
|
+
requires_signature=False,
|
|
727
|
+
)
|
|
728
|
+
|
|
729
|
+
def create_recovery_challenge(self, body: T.CreateRecoveryChallengeRequest) -> T.CreateRecoveryChallengeResponse:
|
|
730
|
+
"""
|
|
731
|
+
Create Recovery Challenge.
|
|
732
|
+
|
|
733
|
+
Starts a user recovery session, returning a challenge that will be used to verify the user's identity.
|
|
734
|
+
|
|
735
|
+
Args:
|
|
736
|
+
body: Request body.
|
|
737
|
+
|
|
738
|
+
Returns:
|
|
739
|
+
T.CreateRecoveryChallengeResponse: The API response.
|
|
740
|
+
"""
|
|
741
|
+
return self._http.request(
|
|
742
|
+
method="POST",
|
|
743
|
+
path="/auth/recover/user/init",
|
|
744
|
+
path_params={},
|
|
745
|
+
query_params=None,
|
|
746
|
+
body=body,
|
|
747
|
+
requires_signature=False,
|
|
748
|
+
)
|
|
749
|
+
|
|
750
|
+
def send_recovery_code_email(self, body: T.SendRecoveryCodeEmailRequest) -> T.SendRecoveryCodeEmailResponse:
|
|
751
|
+
"""
|
|
752
|
+
Send Recovery Code Email.
|
|
753
|
+
|
|
754
|
+
Send the user a recovery verification code. This code is used as a second factor to verify the user initiated the recovery request.
|
|
755
|
+
|
|
756
|
+
Args:
|
|
757
|
+
body: Request body.
|
|
758
|
+
|
|
759
|
+
Returns:
|
|
760
|
+
T.SendRecoveryCodeEmailResponse: The API response.
|
|
761
|
+
"""
|
|
762
|
+
return self._http.request(
|
|
763
|
+
method="POST",
|
|
764
|
+
path="/auth/recover/user/code",
|
|
765
|
+
path_params={},
|
|
766
|
+
query_params=None,
|
|
767
|
+
body=body,
|
|
768
|
+
requires_signature=False,
|
|
769
|
+
)
|
|
770
|
+
|
|
771
|
+
def create_delegated_registration_challenge(self, body: T.CreateDelegatedRegistrationChallengeRequest) -> T.CreateDelegatedRegistrationChallengeResponse:
|
|
772
|
+
"""
|
|
773
|
+
Create Delegated Registration Challenge.
|
|
774
|
+
|
|
775
|
+
<Warning>
|
|
776
|
+
Only a [Service Account](https://docs.dfns.co/api-reference/auth/service-accounts) can use this endpoint.
|
|
777
|
+
</Warning>
|
|
778
|
+
|
|
779
|
+
If you want to use your own authentication system, while still using `Delegated Signing`, you can use this endpoint to register a new End User in your organization, without your user needing to receive an email from Dfns.
|
|
780
|
+
|
|
781
|
+
This endpoint will:
|
|
782
|
+
1. Create a new User attached to your organization
|
|
783
|
+
2. Initiates a User Registration Challenge and returns the registration challenge.
|
|
784
|
+
|
|
785
|
+
On successful creation, the user's registration challenge will be returned. You will then need to call [Complete User Registration](https://docs.dfns.co/api-reference/auth/complete-user-registration) or [Complete End User Registration with Wallets](https://docs.dfns.co/api-reference/auth/complete-end-user-registration-with-wallets) to complete the user's registration.
|
|
786
|
+
|
|
787
|
+
Args:
|
|
788
|
+
body: Request body.
|
|
789
|
+
|
|
790
|
+
Returns:
|
|
791
|
+
T.CreateDelegatedRegistrationChallengeResponse: The API response.
|
|
792
|
+
"""
|
|
793
|
+
return self._http.request(
|
|
794
|
+
method="POST",
|
|
795
|
+
path="/auth/registration/delegated",
|
|
796
|
+
path_params={},
|
|
797
|
+
query_params=None,
|
|
798
|
+
body=body,
|
|
799
|
+
requires_signature=True,
|
|
800
|
+
)
|
|
801
|
+
|
|
802
|
+
def create_registration_challenge(self, body: T.CreateRegistrationChallengeRequest) -> T.CreateRegistrationChallengeResponse:
|
|
803
|
+
"""
|
|
804
|
+
Create Registration Challenge.
|
|
805
|
+
|
|
806
|
+
Starts a user registration session. It returns a challenge that will need to be signed by a passkey and used to perform the step [Complete User Registration](/api-reference/auth/register)
|
|
807
|
+
|
|
808
|
+
Args:
|
|
809
|
+
body: Request body.
|
|
810
|
+
|
|
811
|
+
Returns:
|
|
812
|
+
T.CreateRegistrationChallengeResponse: The API response.
|
|
813
|
+
"""
|
|
814
|
+
return self._http.request(
|
|
815
|
+
method="POST",
|
|
816
|
+
path="/auth/registration/init",
|
|
817
|
+
path_params={},
|
|
818
|
+
query_params=None,
|
|
819
|
+
body=body,
|
|
820
|
+
requires_signature=False,
|
|
821
|
+
)
|
|
822
|
+
|
|
823
|
+
def create_social_registration_challenge(self, body: T.CreateSocialRegistrationChallengeRequest) -> T.CreateSocialRegistrationChallengeResponse:
|
|
824
|
+
"""
|
|
825
|
+
Create Social Registration Challenge.
|
|
826
|
+
|
|
827
|
+
Starts an end-user registration session by passing a JWT obtained by an IdP. It returns a challenge that will need to be signed by a passkey and used to perform [Complete End User Registration with Wallets](/api-reference/auth/register-end-user).
|
|
828
|
+
|
|
829
|
+
Args:
|
|
830
|
+
body: Request body.
|
|
831
|
+
|
|
832
|
+
Returns:
|
|
833
|
+
T.CreateSocialRegistrationChallengeResponse: The API response.
|
|
834
|
+
"""
|
|
835
|
+
return self._http.request(
|
|
836
|
+
method="POST",
|
|
837
|
+
path="/auth/registration/social",
|
|
838
|
+
path_params={},
|
|
839
|
+
query_params=None,
|
|
840
|
+
body=body,
|
|
841
|
+
requires_signature=False,
|
|
842
|
+
)
|
|
843
|
+
|
|
844
|
+
def complete_user_registration(self, body: T.CompleteUserRegistrationRequest) -> T.CompleteUserRegistrationResponse:
|
|
845
|
+
"""
|
|
846
|
+
Complete User Registration.
|
|
847
|
+
|
|
848
|
+
Completes the user registration process and creates the user's initial credentials.
|
|
849
|
+
|
|
850
|
+
The type of credentials being registered is determined by the `credentialKind` field in the nested objects (`firstFactorCredential` , `secondFactorCredential` and `RecoveryCredential`). Supported credential kinds are:
|
|
851
|
+
* `Fido2`: User action is signed by a user's signing device using `WebAuthn`.
|
|
852
|
+
* `Key`: User action is signed by a user's, or token's, private key.
|
|
853
|
+
* `PasswordProtectedKey`: User action is signed by a user's, or token's, private key. The encrypted version of the private key is stored by Dfns and returns during the signing flow for the user to decrypt it.
|
|
854
|
+
* `RecoveryKey` : Similar to `PasswordProtectedKey`, but this credential can only be used to recover an account not to sign an action or login. Once this credential is used all the other user's credentials are invalidated.
|
|
855
|
+
|
|
856
|
+
Args:
|
|
857
|
+
body: Request body.
|
|
858
|
+
|
|
859
|
+
Returns:
|
|
860
|
+
T.CompleteUserRegistrationResponse: The API response.
|
|
861
|
+
"""
|
|
862
|
+
return self._http.request(
|
|
863
|
+
method="POST",
|
|
864
|
+
path="/auth/registration",
|
|
865
|
+
path_params={},
|
|
866
|
+
query_params=None,
|
|
867
|
+
body=body,
|
|
868
|
+
requires_signature=False,
|
|
869
|
+
)
|
|
870
|
+
|
|
871
|
+
def complete_end_user_registration_with_wallets(self, body: T.CompleteEndUserRegistrationWithWalletsRequest) -> T.CompleteEndUserRegistrationWithWalletsResponse:
|
|
872
|
+
"""
|
|
873
|
+
Complete End User Registration with Wallets.
|
|
874
|
+
|
|
875
|
+
Completes the end user registration process and creates the user's initial credentials along with delegated wallets for the new end user.
|
|
876
|
+
|
|
877
|
+
The type of credentials being registered is determined by the `credentialKind` field in the nested objects (`firstFactorCredential` , `secondFactorCredential` and `RecoveryCredential`). Supported credential kinds are:
|
|
878
|
+
* `Fido2`: User action is signed by a user's signing device using `WebAuthn`.
|
|
879
|
+
* `Key`: User action is signed by a user's, or token's, private key.
|
|
880
|
+
* `PasswordProtectedKey`: User action is signed by a user's, or token's, private key. The encrypted version of the private key is stored by Dfns and returns during the signing flow for the user to decrypt it.
|
|
881
|
+
|
|
882
|
+
The number of delegated wallets created and the wallet types are determined by the `wallets` specifications. The end user is automatically assigned `ManagedDefaultEndUserAccess` managed permission that grants the end user full access to the wallets.
|
|
883
|
+
|
|
884
|
+
Args:
|
|
885
|
+
body: Request body.
|
|
886
|
+
|
|
887
|
+
Returns:
|
|
888
|
+
T.CompleteEndUserRegistrationWithWalletsResponse: The API response.
|
|
889
|
+
"""
|
|
890
|
+
return self._http.request(
|
|
891
|
+
method="POST",
|
|
892
|
+
path="/auth/registration/enduser",
|
|
893
|
+
path_params={},
|
|
894
|
+
query_params=None,
|
|
895
|
+
body=body,
|
|
896
|
+
requires_signature=False,
|
|
897
|
+
)
|
|
898
|
+
|
|
899
|
+
def resend_registration_code(self, body: T.ResendRegistrationCodeRequest) -> T.ResendRegistrationCodeResponse:
|
|
900
|
+
"""
|
|
901
|
+
Resend Registration Code.
|
|
902
|
+
|
|
903
|
+
Sends the user a new registration code. The previous registration code will be marked invalid. If the user has already completed their registration no action will be taken.
|
|
904
|
+
|
|
905
|
+
Args:
|
|
906
|
+
body: Request body.
|
|
907
|
+
|
|
908
|
+
Returns:
|
|
909
|
+
T.ResendRegistrationCodeResponse: The API response.
|
|
910
|
+
"""
|
|
911
|
+
return self._http.request(
|
|
912
|
+
method="PUT",
|
|
913
|
+
path="/auth/registration/code",
|
|
914
|
+
path_params={},
|
|
915
|
+
query_params=None,
|
|
916
|
+
body=body,
|
|
917
|
+
requires_signature=False,
|
|
918
|
+
)
|
|
919
|
+
|
|
920
|
+
def list_service_accounts(self) -> T.ListServiceAccountsResponse:
|
|
921
|
+
"""
|
|
922
|
+
List Service Accounts.
|
|
923
|
+
|
|
924
|
+
List all Service Accounts in your organization.
|
|
925
|
+
|
|
926
|
+
Returns:
|
|
927
|
+
T.ListServiceAccountsResponse: The API response.
|
|
928
|
+
"""
|
|
929
|
+
return self._http.request(
|
|
930
|
+
method="GET",
|
|
931
|
+
path="/auth/service-accounts",
|
|
932
|
+
path_params={},
|
|
933
|
+
query_params=None,
|
|
934
|
+
body=None,
|
|
935
|
+
requires_signature=False,
|
|
936
|
+
)
|
|
937
|
+
|
|
938
|
+
def create_service_account(self, body: T.CreateServiceAccountRequest) -> T.CreateServiceAccountResponse:
|
|
939
|
+
"""
|
|
940
|
+
Create Service Account.
|
|
941
|
+
|
|
942
|
+
Create a new Service Account for your organization.
|
|
943
|
+
|
|
944
|
+
Args:
|
|
945
|
+
body: Request body.
|
|
946
|
+
|
|
947
|
+
Returns:
|
|
948
|
+
T.CreateServiceAccountResponse: The API response.
|
|
949
|
+
"""
|
|
950
|
+
return self._http.request(
|
|
951
|
+
method="POST",
|
|
952
|
+
path="/auth/service-accounts",
|
|
953
|
+
path_params={},
|
|
954
|
+
query_params=None,
|
|
955
|
+
body=body,
|
|
956
|
+
requires_signature=True,
|
|
957
|
+
)
|
|
958
|
+
|
|
959
|
+
def get_service_account(self, service_account_id: str) -> T.GetServiceAccountResponse:
|
|
960
|
+
"""
|
|
961
|
+
Get Service Account.
|
|
962
|
+
|
|
963
|
+
Get information about a specific Service Account.
|
|
964
|
+
|
|
965
|
+
Args:
|
|
966
|
+
service_account_id: Path parameter.
|
|
967
|
+
|
|
968
|
+
Returns:
|
|
969
|
+
T.GetServiceAccountResponse: The API response.
|
|
970
|
+
"""
|
|
971
|
+
return self._http.request(
|
|
972
|
+
method="GET",
|
|
973
|
+
path="/auth/service-accounts/{serviceAccountId}",
|
|
974
|
+
path_params={"serviceAccountId": service_account_id},
|
|
975
|
+
query_params=None,
|
|
976
|
+
body=None,
|
|
977
|
+
requires_signature=False,
|
|
978
|
+
)
|
|
979
|
+
|
|
980
|
+
def update_service_account(self, service_account_id: str, body: T.UpdateServiceAccountRequest) -> T.UpdateServiceAccountResponse:
|
|
981
|
+
"""
|
|
982
|
+
Update Service Account.
|
|
983
|
+
|
|
984
|
+
Update a specific Service Account.
|
|
985
|
+
|
|
986
|
+
Args:
|
|
987
|
+
service_account_id: Path parameter.
|
|
988
|
+
body: Request body.
|
|
989
|
+
|
|
990
|
+
Returns:
|
|
991
|
+
T.UpdateServiceAccountResponse: The API response.
|
|
992
|
+
"""
|
|
993
|
+
return self._http.request(
|
|
994
|
+
method="PUT",
|
|
995
|
+
path="/auth/service-accounts/{serviceAccountId}",
|
|
996
|
+
path_params={"serviceAccountId": service_account_id},
|
|
997
|
+
query_params=None,
|
|
998
|
+
body=body,
|
|
999
|
+
requires_signature=True,
|
|
1000
|
+
)
|
|
1001
|
+
|
|
1002
|
+
def delete_service_account(self, service_account_id: str) -> T.DeleteServiceAccountResponse:
|
|
1003
|
+
"""
|
|
1004
|
+
Delete Service Account.
|
|
1005
|
+
|
|
1006
|
+
Delete a specific Service Account.
|
|
1007
|
+
|
|
1008
|
+
Args:
|
|
1009
|
+
service_account_id: Path parameter.
|
|
1010
|
+
|
|
1011
|
+
Returns:
|
|
1012
|
+
T.DeleteServiceAccountResponse: The API response.
|
|
1013
|
+
"""
|
|
1014
|
+
return self._http.request(
|
|
1015
|
+
method="DELETE",
|
|
1016
|
+
path="/auth/service-accounts/{serviceAccountId}",
|
|
1017
|
+
path_params={"serviceAccountId": service_account_id},
|
|
1018
|
+
query_params=None,
|
|
1019
|
+
body=None,
|
|
1020
|
+
requires_signature=True,
|
|
1021
|
+
)
|
|
1022
|
+
|
|
1023
|
+
def activate_service_account(self, service_account_id: str) -> T.ActivateServiceAccountResponse:
|
|
1024
|
+
"""
|
|
1025
|
+
Activate Service Account.
|
|
1026
|
+
|
|
1027
|
+
Activate a specific Service Account.
|
|
1028
|
+
|
|
1029
|
+
Args:
|
|
1030
|
+
service_account_id: Path parameter.
|
|
1031
|
+
|
|
1032
|
+
Returns:
|
|
1033
|
+
T.ActivateServiceAccountResponse: The API response.
|
|
1034
|
+
"""
|
|
1035
|
+
return self._http.request(
|
|
1036
|
+
method="PUT",
|
|
1037
|
+
path="/auth/service-accounts/{serviceAccountId}/activate",
|
|
1038
|
+
path_params={"serviceAccountId": service_account_id},
|
|
1039
|
+
query_params=None,
|
|
1040
|
+
body=None,
|
|
1041
|
+
requires_signature=True,
|
|
1042
|
+
)
|
|
1043
|
+
|
|
1044
|
+
def deactivate_service_account(self, service_account_id: str) -> T.DeactivateServiceAccountResponse:
|
|
1045
|
+
"""
|
|
1046
|
+
Deactivate Service Account.
|
|
1047
|
+
|
|
1048
|
+
Deactivate a specific Service Account.
|
|
1049
|
+
|
|
1050
|
+
Args:
|
|
1051
|
+
service_account_id: Path parameter.
|
|
1052
|
+
|
|
1053
|
+
Returns:
|
|
1054
|
+
T.DeactivateServiceAccountResponse: The API response.
|
|
1055
|
+
"""
|
|
1056
|
+
return self._http.request(
|
|
1057
|
+
method="PUT",
|
|
1058
|
+
path="/auth/service-accounts/{serviceAccountId}/deactivate",
|
|
1059
|
+
path_params={"serviceAccountId": service_account_id},
|
|
1060
|
+
query_params=None,
|
|
1061
|
+
body=None,
|
|
1062
|
+
requires_signature=True,
|
|
1063
|
+
)
|
|
1064
|
+
|
|
1065
|
+
def activate_user(self, user_id: str) -> T.ActivateUserResponse:
|
|
1066
|
+
"""
|
|
1067
|
+
Activate User.
|
|
1068
|
+
|
|
1069
|
+
Activate a specific User.
|
|
1070
|
+
|
|
1071
|
+
Args:
|
|
1072
|
+
user_id: Path parameter.
|
|
1073
|
+
|
|
1074
|
+
Returns:
|
|
1075
|
+
T.ActivateUserResponse: The API response.
|
|
1076
|
+
"""
|
|
1077
|
+
return self._http.request(
|
|
1078
|
+
method="PUT",
|
|
1079
|
+
path="/auth/users/{userId}/activate",
|
|
1080
|
+
path_params={"userId": user_id},
|
|
1081
|
+
query_params=None,
|
|
1082
|
+
body=None,
|
|
1083
|
+
requires_signature=True,
|
|
1084
|
+
)
|
|
1085
|
+
|
|
1086
|
+
def deactivate_user(self, user_id: str) -> T.DeactivateUserResponse:
|
|
1087
|
+
"""
|
|
1088
|
+
Deactivate User.
|
|
1089
|
+
|
|
1090
|
+
Deactivate a specific User.
|
|
1091
|
+
|
|
1092
|
+
Args:
|
|
1093
|
+
user_id: Path parameter.
|
|
1094
|
+
|
|
1095
|
+
Returns:
|
|
1096
|
+
T.DeactivateUserResponse: The API response.
|
|
1097
|
+
"""
|
|
1098
|
+
return self._http.request(
|
|
1099
|
+
method="PUT",
|
|
1100
|
+
path="/auth/users/{userId}/deactivate",
|
|
1101
|
+
path_params={"userId": user_id},
|
|
1102
|
+
query_params=None,
|
|
1103
|
+
body=None,
|
|
1104
|
+
requires_signature=True,
|
|
1105
|
+
)
|
|
1106
|
+
|
|
1107
|
+
def get_user(self, user_id: str) -> T.GetUserResponse:
|
|
1108
|
+
"""
|
|
1109
|
+
Get User.
|
|
1110
|
+
|
|
1111
|
+
Retrieve information about a specific User.
|
|
1112
|
+
|
|
1113
|
+
Args:
|
|
1114
|
+
user_id: Path parameter.
|
|
1115
|
+
|
|
1116
|
+
Returns:
|
|
1117
|
+
T.GetUserResponse: The API response.
|
|
1118
|
+
"""
|
|
1119
|
+
return self._http.request(
|
|
1120
|
+
method="GET",
|
|
1121
|
+
path="/auth/users/{userId}",
|
|
1122
|
+
path_params={"userId": user_id},
|
|
1123
|
+
query_params=None,
|
|
1124
|
+
body=None,
|
|
1125
|
+
requires_signature=False,
|
|
1126
|
+
)
|
|
1127
|
+
|
|
1128
|
+
def update_user(self, user_id: str, body: T.UpdateUserRequest) -> T.UpdateUserResponse:
|
|
1129
|
+
"""
|
|
1130
|
+
Update User.
|
|
1131
|
+
|
|
1132
|
+
Update a specific User.
|
|
1133
|
+
|
|
1134
|
+
Args:
|
|
1135
|
+
user_id: Path parameter.
|
|
1136
|
+
body: Request body.
|
|
1137
|
+
|
|
1138
|
+
Returns:
|
|
1139
|
+
T.UpdateUserResponse: The API response.
|
|
1140
|
+
"""
|
|
1141
|
+
return self._http.request(
|
|
1142
|
+
method="PUT",
|
|
1143
|
+
path="/auth/users/{userId}",
|
|
1144
|
+
path_params={"userId": user_id},
|
|
1145
|
+
query_params=None,
|
|
1146
|
+
body=body,
|
|
1147
|
+
requires_signature=True,
|
|
1148
|
+
)
|
|
1149
|
+
|
|
1150
|
+
def delete_user(self, user_id: str) -> T.DeleteUserResponse:
|
|
1151
|
+
"""
|
|
1152
|
+
Delete User.
|
|
1153
|
+
|
|
1154
|
+
Delete a specific User.
|
|
1155
|
+
|
|
1156
|
+
Args:
|
|
1157
|
+
user_id: Path parameter.
|
|
1158
|
+
|
|
1159
|
+
Returns:
|
|
1160
|
+
T.DeleteUserResponse: The API response.
|
|
1161
|
+
"""
|
|
1162
|
+
return self._http.request(
|
|
1163
|
+
method="DELETE",
|
|
1164
|
+
path="/auth/users/{userId}",
|
|
1165
|
+
path_params={"userId": user_id},
|
|
1166
|
+
query_params=None,
|
|
1167
|
+
body=None,
|
|
1168
|
+
requires_signature=True,
|
|
1169
|
+
)
|
|
1170
|
+
|
|
1171
|
+
def list_users(self, query: Optional[T.ListUsersQuery] = None) -> T.ListUsersResponse:
|
|
1172
|
+
"""
|
|
1173
|
+
List Users.
|
|
1174
|
+
|
|
1175
|
+
List all Users in your organization.
|
|
1176
|
+
|
|
1177
|
+
Args:
|
|
1178
|
+
query: Query parameters.
|
|
1179
|
+
|
|
1180
|
+
Returns:
|
|
1181
|
+
T.ListUsersResponse: The API response.
|
|
1182
|
+
"""
|
|
1183
|
+
return self._http.request(
|
|
1184
|
+
method="GET",
|
|
1185
|
+
path="/auth/users",
|
|
1186
|
+
path_params={},
|
|
1187
|
+
query_params=query,
|
|
1188
|
+
body=None,
|
|
1189
|
+
requires_signature=False,
|
|
1190
|
+
)
|
|
1191
|
+
|
|
1192
|
+
def create_user(self, body: T.CreateUserRequest) -> T.CreateUserResponse:
|
|
1193
|
+
"""
|
|
1194
|
+
Create User.
|
|
1195
|
+
|
|
1196
|
+
Invite a new user in the caller's org. This will create the user and send a registration email to the created User's email, with a registration code, and pointing him to complete his registration on Dfns Dashboard. The user is created without any permissions.
|
|
1197
|
+
|
|
1198
|
+
<Note>If you want the created User to not know about about Dfns, and don't want him to
|
|
1199
|
+
receive the registration email from Dfns, you should rather use the Delegated Registration
|
|
1200
|
+
endpoint.</Note>
|
|
1201
|
+
|
|
1202
|
+
Args:
|
|
1203
|
+
body: Request body.
|
|
1204
|
+
|
|
1205
|
+
Returns:
|
|
1206
|
+
T.CreateUserResponse: The API response.
|
|
1207
|
+
"""
|
|
1208
|
+
return self._http.request(
|
|
1209
|
+
method="POST",
|
|
1210
|
+
path="/auth/users",
|
|
1211
|
+
path_params={},
|
|
1212
|
+
query_params=None,
|
|
1213
|
+
body=body,
|
|
1214
|
+
requires_signature=True,
|
|
1215
|
+
)
|