mithwire 0.50.3__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 (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,598 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: WebAuthn (experimental)
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+
15
+ class AuthenticatorId(str):
16
+ def to_json(self) -> str:
17
+ return self
18
+
19
+ @classmethod
20
+ def from_json(cls, json: str) -> AuthenticatorId:
21
+ return cls(json)
22
+
23
+ def __repr__(self):
24
+ return 'AuthenticatorId({})'.format(super().__repr__())
25
+
26
+
27
+ class AuthenticatorProtocol(enum.Enum):
28
+ U2F = "u2f"
29
+ CTAP2 = "ctap2"
30
+
31
+ def to_json(self) -> str:
32
+ return self.value
33
+
34
+ @classmethod
35
+ def from_json(cls, json: str) -> AuthenticatorProtocol:
36
+ return cls(json)
37
+
38
+
39
+ class Ctap2Version(enum.Enum):
40
+ CTAP2_0 = "ctap2_0"
41
+ CTAP2_1 = "ctap2_1"
42
+ CTAP2_2 = "ctap2_2"
43
+
44
+ def to_json(self) -> str:
45
+ return self.value
46
+
47
+ @classmethod
48
+ def from_json(cls, json: str) -> Ctap2Version:
49
+ return cls(json)
50
+
51
+
52
+ class AuthenticatorTransport(enum.Enum):
53
+ USB = "usb"
54
+ NFC = "nfc"
55
+ BLE = "ble"
56
+ CABLE = "cable"
57
+ INTERNAL = "internal"
58
+
59
+ def to_json(self) -> str:
60
+ return self.value
61
+
62
+ @classmethod
63
+ def from_json(cls, json: str) -> AuthenticatorTransport:
64
+ return cls(json)
65
+
66
+
67
+ @dataclass
68
+ class VirtualAuthenticatorOptions:
69
+ protocol: AuthenticatorProtocol
70
+
71
+ transport: AuthenticatorTransport
72
+
73
+ #: Defaults to ctap2_0. Ignored if ``protocol`` == u2f.
74
+ ctap2_version: typing.Optional[Ctap2Version] = None
75
+
76
+ #: Defaults to false.
77
+ has_resident_key: typing.Optional[bool] = None
78
+
79
+ #: Defaults to false.
80
+ has_user_verification: typing.Optional[bool] = None
81
+
82
+ #: If set to true, the authenticator will support the largeBlob extension.
83
+ #: https://w3c.github.io/webauthn#largeBlob
84
+ #: Defaults to false.
85
+ has_large_blob: typing.Optional[bool] = None
86
+
87
+ #: If set to true, the authenticator will support the credBlob extension.
88
+ #: https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension
89
+ #: Defaults to false.
90
+ has_cred_blob: typing.Optional[bool] = None
91
+
92
+ #: If set to true, the authenticator will support the minPinLength extension.
93
+ #: https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension
94
+ #: Defaults to false.
95
+ has_min_pin_length: typing.Optional[bool] = None
96
+
97
+ #: If set to true, the authenticator will support the prf extension.
98
+ #: https://w3c.github.io/webauthn/#prf-extension
99
+ #: Defaults to false.
100
+ has_prf: typing.Optional[bool] = None
101
+
102
+ #: If set to true, the authenticator will support the hmac-secret extension.
103
+ #: https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-hmac-secret-extension
104
+ #: Defaults to false.
105
+ has_hmac_secret: typing.Optional[bool] = None
106
+
107
+ #: If set to true, the authenticator will support the hmac-secret-mc extension.
108
+ #: https://fidoalliance.org/specs/fido-v2.2-rd-20241003/fido-client-to-authenticator-protocol-v2.2-rd-20241003.html#sctn-hmac-secret-make-cred-extension
109
+ #: Defaults to false.
110
+ has_hmac_secret_mc: typing.Optional[bool] = None
111
+
112
+ #: If set to true, tests of user presence will succeed immediately.
113
+ #: Otherwise, they will not be resolved. Defaults to true.
114
+ automatic_presence_simulation: typing.Optional[bool] = None
115
+
116
+ #: Sets whether User Verification succeeds or fails for an authenticator.
117
+ #: Defaults to false.
118
+ is_user_verified: typing.Optional[bool] = None
119
+
120
+ #: Credentials created by this authenticator will have the backup
121
+ #: eligibility (BE) flag set to this value. Defaults to false.
122
+ #: https://w3c.github.io/webauthn/#sctn-credential-backup
123
+ default_backup_eligibility: typing.Optional[bool] = None
124
+
125
+ #: Credentials created by this authenticator will have the backup state
126
+ #: (BS) flag set to this value. Defaults to false.
127
+ #: https://w3c.github.io/webauthn/#sctn-credential-backup
128
+ default_backup_state: typing.Optional[bool] = None
129
+
130
+ def to_json(self) -> T_JSON_DICT:
131
+ json: T_JSON_DICT = dict()
132
+ json['protocol'] = self.protocol.to_json()
133
+ json['transport'] = self.transport.to_json()
134
+ if self.ctap2_version is not None:
135
+ json['ctap2Version'] = self.ctap2_version.to_json()
136
+ if self.has_resident_key is not None:
137
+ json['hasResidentKey'] = self.has_resident_key
138
+ if self.has_user_verification is not None:
139
+ json['hasUserVerification'] = self.has_user_verification
140
+ if self.has_large_blob is not None:
141
+ json['hasLargeBlob'] = self.has_large_blob
142
+ if self.has_cred_blob is not None:
143
+ json['hasCredBlob'] = self.has_cred_blob
144
+ if self.has_min_pin_length is not None:
145
+ json['hasMinPinLength'] = self.has_min_pin_length
146
+ if self.has_prf is not None:
147
+ json['hasPrf'] = self.has_prf
148
+ if self.has_hmac_secret is not None:
149
+ json['hasHmacSecret'] = self.has_hmac_secret
150
+ if self.has_hmac_secret_mc is not None:
151
+ json['hasHmacSecretMc'] = self.has_hmac_secret_mc
152
+ if self.automatic_presence_simulation is not None:
153
+ json['automaticPresenceSimulation'] = self.automatic_presence_simulation
154
+ if self.is_user_verified is not None:
155
+ json['isUserVerified'] = self.is_user_verified
156
+ if self.default_backup_eligibility is not None:
157
+ json['defaultBackupEligibility'] = self.default_backup_eligibility
158
+ if self.default_backup_state is not None:
159
+ json['defaultBackupState'] = self.default_backup_state
160
+ return json
161
+
162
+ @classmethod
163
+ def from_json(cls, json: T_JSON_DICT) -> VirtualAuthenticatorOptions:
164
+ return cls(
165
+ protocol=AuthenticatorProtocol.from_json(json['protocol']),
166
+ transport=AuthenticatorTransport.from_json(json['transport']),
167
+ ctap2_version=Ctap2Version.from_json(json['ctap2Version']) if json.get('ctap2Version', None) is not None else None,
168
+ has_resident_key=bool(json['hasResidentKey']) if json.get('hasResidentKey', None) is not None else None,
169
+ has_user_verification=bool(json['hasUserVerification']) if json.get('hasUserVerification', None) is not None else None,
170
+ has_large_blob=bool(json['hasLargeBlob']) if json.get('hasLargeBlob', None) is not None else None,
171
+ has_cred_blob=bool(json['hasCredBlob']) if json.get('hasCredBlob', None) is not None else None,
172
+ has_min_pin_length=bool(json['hasMinPinLength']) if json.get('hasMinPinLength', None) is not None else None,
173
+ has_prf=bool(json['hasPrf']) if json.get('hasPrf', None) is not None else None,
174
+ has_hmac_secret=bool(json['hasHmacSecret']) if json.get('hasHmacSecret', None) is not None else None,
175
+ has_hmac_secret_mc=bool(json['hasHmacSecretMc']) if json.get('hasHmacSecretMc', None) is not None else None,
176
+ automatic_presence_simulation=bool(json['automaticPresenceSimulation']) if json.get('automaticPresenceSimulation', None) is not None else None,
177
+ is_user_verified=bool(json['isUserVerified']) if json.get('isUserVerified', None) is not None else None,
178
+ default_backup_eligibility=bool(json['defaultBackupEligibility']) if json.get('defaultBackupEligibility', None) is not None else None,
179
+ default_backup_state=bool(json['defaultBackupState']) if json.get('defaultBackupState', None) is not None else None,
180
+ )
181
+
182
+
183
+ @dataclass
184
+ class Credential:
185
+ credential_id: str
186
+
187
+ is_resident_credential: bool
188
+
189
+ #: The ECDSA P-256 private key in PKCS#8 format. (Encoded as a base64 string when passed over JSON)
190
+ private_key: str
191
+
192
+ #: Signature counter. This is incremented by one for each successful
193
+ #: assertion.
194
+ #: See https://w3c.github.io/webauthn/#signature-counter
195
+ sign_count: int
196
+
197
+ #: Relying Party ID the credential is scoped to. Must be set when adding a
198
+ #: credential.
199
+ rp_id: typing.Optional[str] = None
200
+
201
+ #: An opaque byte sequence with a maximum size of 64 bytes mapping the
202
+ #: credential to a specific user. (Encoded as a base64 string when passed over JSON)
203
+ user_handle: typing.Optional[str] = None
204
+
205
+ #: The large blob associated with the credential.
206
+ #: See https://w3c.github.io/webauthn/#sctn-large-blob-extension (Encoded as a base64 string when passed over JSON)
207
+ large_blob: typing.Optional[str] = None
208
+
209
+ #: Assertions returned by this credential will have the backup eligibility
210
+ #: (BE) flag set to this value. Defaults to the authenticator's
211
+ #: defaultBackupEligibility value.
212
+ backup_eligibility: typing.Optional[bool] = None
213
+
214
+ #: Assertions returned by this credential will have the backup state (BS)
215
+ #: flag set to this value. Defaults to the authenticator's
216
+ #: defaultBackupState value.
217
+ backup_state: typing.Optional[bool] = None
218
+
219
+ #: The credential's user.name property. Equivalent to empty if not set.
220
+ #: https://w3c.github.io/webauthn/#dom-publickeycredentialentity-name
221
+ user_name: typing.Optional[str] = None
222
+
223
+ #: The credential's user.displayName property. Equivalent to empty if
224
+ #: not set.
225
+ #: https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname
226
+ user_display_name: typing.Optional[str] = None
227
+
228
+ def to_json(self) -> T_JSON_DICT:
229
+ json: T_JSON_DICT = dict()
230
+ json['credentialId'] = self.credential_id
231
+ json['isResidentCredential'] = self.is_resident_credential
232
+ json['privateKey'] = self.private_key
233
+ json['signCount'] = self.sign_count
234
+ if self.rp_id is not None:
235
+ json['rpId'] = self.rp_id
236
+ if self.user_handle is not None:
237
+ json['userHandle'] = self.user_handle
238
+ if self.large_blob is not None:
239
+ json['largeBlob'] = self.large_blob
240
+ if self.backup_eligibility is not None:
241
+ json['backupEligibility'] = self.backup_eligibility
242
+ if self.backup_state is not None:
243
+ json['backupState'] = self.backup_state
244
+ if self.user_name is not None:
245
+ json['userName'] = self.user_name
246
+ if self.user_display_name is not None:
247
+ json['userDisplayName'] = self.user_display_name
248
+ return json
249
+
250
+ @classmethod
251
+ def from_json(cls, json: T_JSON_DICT) -> Credential:
252
+ return cls(
253
+ credential_id=str(json['credentialId']),
254
+ is_resident_credential=bool(json['isResidentCredential']),
255
+ private_key=str(json['privateKey']),
256
+ sign_count=int(json['signCount']),
257
+ rp_id=str(json['rpId']) if json.get('rpId', None) is not None else None,
258
+ user_handle=str(json['userHandle']) if json.get('userHandle', None) is not None else None,
259
+ large_blob=str(json['largeBlob']) if json.get('largeBlob', None) is not None else None,
260
+ backup_eligibility=bool(json['backupEligibility']) if json.get('backupEligibility', None) is not None else None,
261
+ backup_state=bool(json['backupState']) if json.get('backupState', None) is not None else None,
262
+ user_name=str(json['userName']) if json.get('userName', None) is not None else None,
263
+ user_display_name=str(json['userDisplayName']) if json.get('userDisplayName', None) is not None else None,
264
+ )
265
+
266
+
267
+ def enable(
268
+ enable_ui: typing.Optional[bool] = None
269
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
270
+ '''
271
+ Enable the WebAuthn domain and start intercepting credential storage and
272
+ retrieval with a virtual authenticator.
273
+
274
+ :param enable_ui: *(Optional)* Whether to enable the WebAuthn user interface. Enabling the UI is recommended for debugging and demo purposes, as it is closer to the real experience. Disabling the UI is recommended for automated testing. Supported at the embedder's discretion if UI is available. Defaults to false.
275
+ '''
276
+ params: T_JSON_DICT = dict()
277
+ if enable_ui is not None:
278
+ params['enableUI'] = enable_ui
279
+ cmd_dict: T_JSON_DICT = {
280
+ 'method': 'WebAuthn.enable',
281
+ 'params': params,
282
+ }
283
+ json = yield cmd_dict
284
+
285
+
286
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
287
+ '''
288
+ Disable the WebAuthn domain.
289
+ '''
290
+ cmd_dict: T_JSON_DICT = {
291
+ 'method': 'WebAuthn.disable',
292
+ }
293
+ json = yield cmd_dict
294
+
295
+
296
+ def add_virtual_authenticator(
297
+ options: VirtualAuthenticatorOptions
298
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,AuthenticatorId]:
299
+ '''
300
+ Creates and adds a virtual authenticator.
301
+
302
+ :param options:
303
+ :returns:
304
+ '''
305
+ params: T_JSON_DICT = dict()
306
+ params['options'] = options.to_json()
307
+ cmd_dict: T_JSON_DICT = {
308
+ 'method': 'WebAuthn.addVirtualAuthenticator',
309
+ 'params': params,
310
+ }
311
+ json = yield cmd_dict
312
+ return AuthenticatorId.from_json(json['authenticatorId'])
313
+
314
+
315
+ def set_response_override_bits(
316
+ authenticator_id: AuthenticatorId,
317
+ is_bogus_signature: typing.Optional[bool] = None,
318
+ is_bad_uv: typing.Optional[bool] = None,
319
+ is_bad_up: typing.Optional[bool] = None
320
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
321
+ '''
322
+ Resets parameters isBogusSignature, isBadUV, isBadUP to false if they are not present.
323
+
324
+ :param authenticator_id:
325
+ :param is_bogus_signature: *(Optional)* If isBogusSignature is set, overrides the signature in the authenticator response to be zero. Defaults to false.
326
+ :param is_bad_uv: *(Optional)* If isBadUV is set, overrides the UV bit in the flags in the authenticator response to be zero. Defaults to false.
327
+ :param is_bad_up: *(Optional)* If isBadUP is set, overrides the UP bit in the flags in the authenticator response to be zero. Defaults to false.
328
+ '''
329
+ params: T_JSON_DICT = dict()
330
+ params['authenticatorId'] = authenticator_id.to_json()
331
+ if is_bogus_signature is not None:
332
+ params['isBogusSignature'] = is_bogus_signature
333
+ if is_bad_uv is not None:
334
+ params['isBadUV'] = is_bad_uv
335
+ if is_bad_up is not None:
336
+ params['isBadUP'] = is_bad_up
337
+ cmd_dict: T_JSON_DICT = {
338
+ 'method': 'WebAuthn.setResponseOverrideBits',
339
+ 'params': params,
340
+ }
341
+ json = yield cmd_dict
342
+
343
+
344
+ def remove_virtual_authenticator(
345
+ authenticator_id: AuthenticatorId
346
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
347
+ '''
348
+ Removes the given authenticator.
349
+
350
+ :param authenticator_id:
351
+ '''
352
+ params: T_JSON_DICT = dict()
353
+ params['authenticatorId'] = authenticator_id.to_json()
354
+ cmd_dict: T_JSON_DICT = {
355
+ 'method': 'WebAuthn.removeVirtualAuthenticator',
356
+ 'params': params,
357
+ }
358
+ json = yield cmd_dict
359
+
360
+
361
+ def add_credential(
362
+ authenticator_id: AuthenticatorId,
363
+ credential: Credential
364
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
365
+ '''
366
+ Adds the credential to the specified authenticator.
367
+
368
+ :param authenticator_id:
369
+ :param credential:
370
+ '''
371
+ params: T_JSON_DICT = dict()
372
+ params['authenticatorId'] = authenticator_id.to_json()
373
+ params['credential'] = credential.to_json()
374
+ cmd_dict: T_JSON_DICT = {
375
+ 'method': 'WebAuthn.addCredential',
376
+ 'params': params,
377
+ }
378
+ json = yield cmd_dict
379
+
380
+
381
+ def get_credential(
382
+ authenticator_id: AuthenticatorId,
383
+ credential_id: str
384
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Credential]:
385
+ '''
386
+ Returns a single credential stored in the given virtual authenticator that
387
+ matches the credential ID.
388
+
389
+ :param authenticator_id:
390
+ :param credential_id:
391
+ :returns:
392
+ '''
393
+ params: T_JSON_DICT = dict()
394
+ params['authenticatorId'] = authenticator_id.to_json()
395
+ params['credentialId'] = credential_id
396
+ cmd_dict: T_JSON_DICT = {
397
+ 'method': 'WebAuthn.getCredential',
398
+ 'params': params,
399
+ }
400
+ json = yield cmd_dict
401
+ return Credential.from_json(json['credential'])
402
+
403
+
404
+ def get_credentials(
405
+ authenticator_id: AuthenticatorId
406
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[Credential]]:
407
+ '''
408
+ Returns all the credentials stored in the given virtual authenticator.
409
+
410
+ :param authenticator_id:
411
+ :returns:
412
+ '''
413
+ params: T_JSON_DICT = dict()
414
+ params['authenticatorId'] = authenticator_id.to_json()
415
+ cmd_dict: T_JSON_DICT = {
416
+ 'method': 'WebAuthn.getCredentials',
417
+ 'params': params,
418
+ }
419
+ json = yield cmd_dict
420
+ return [Credential.from_json(i) for i in json['credentials']]
421
+
422
+
423
+ def remove_credential(
424
+ authenticator_id: AuthenticatorId,
425
+ credential_id: str
426
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
427
+ '''
428
+ Removes a credential from the authenticator.
429
+
430
+ :param authenticator_id:
431
+ :param credential_id:
432
+ '''
433
+ params: T_JSON_DICT = dict()
434
+ params['authenticatorId'] = authenticator_id.to_json()
435
+ params['credentialId'] = credential_id
436
+ cmd_dict: T_JSON_DICT = {
437
+ 'method': 'WebAuthn.removeCredential',
438
+ 'params': params,
439
+ }
440
+ json = yield cmd_dict
441
+
442
+
443
+ def clear_credentials(
444
+ authenticator_id: AuthenticatorId
445
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
446
+ '''
447
+ Clears all the credentials from the specified device.
448
+
449
+ :param authenticator_id:
450
+ '''
451
+ params: T_JSON_DICT = dict()
452
+ params['authenticatorId'] = authenticator_id.to_json()
453
+ cmd_dict: T_JSON_DICT = {
454
+ 'method': 'WebAuthn.clearCredentials',
455
+ 'params': params,
456
+ }
457
+ json = yield cmd_dict
458
+
459
+
460
+ def set_user_verified(
461
+ authenticator_id: AuthenticatorId,
462
+ is_user_verified: bool
463
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
464
+ '''
465
+ Sets whether User Verification succeeds or fails for an authenticator.
466
+ The default is true.
467
+
468
+ :param authenticator_id:
469
+ :param is_user_verified:
470
+ '''
471
+ params: T_JSON_DICT = dict()
472
+ params['authenticatorId'] = authenticator_id.to_json()
473
+ params['isUserVerified'] = is_user_verified
474
+ cmd_dict: T_JSON_DICT = {
475
+ 'method': 'WebAuthn.setUserVerified',
476
+ 'params': params,
477
+ }
478
+ json = yield cmd_dict
479
+
480
+
481
+ def set_automatic_presence_simulation(
482
+ authenticator_id: AuthenticatorId,
483
+ enabled: bool
484
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
485
+ '''
486
+ Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator.
487
+ The default is true.
488
+
489
+ :param authenticator_id:
490
+ :param enabled:
491
+ '''
492
+ params: T_JSON_DICT = dict()
493
+ params['authenticatorId'] = authenticator_id.to_json()
494
+ params['enabled'] = enabled
495
+ cmd_dict: T_JSON_DICT = {
496
+ 'method': 'WebAuthn.setAutomaticPresenceSimulation',
497
+ 'params': params,
498
+ }
499
+ json = yield cmd_dict
500
+
501
+
502
+ def set_credential_properties(
503
+ authenticator_id: AuthenticatorId,
504
+ credential_id: str,
505
+ backup_eligibility: typing.Optional[bool] = None,
506
+ backup_state: typing.Optional[bool] = None
507
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
508
+ '''
509
+ Allows setting credential properties.
510
+ https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties
511
+
512
+ :param authenticator_id:
513
+ :param credential_id:
514
+ :param backup_eligibility: *(Optional)*
515
+ :param backup_state: *(Optional)*
516
+ '''
517
+ params: T_JSON_DICT = dict()
518
+ params['authenticatorId'] = authenticator_id.to_json()
519
+ params['credentialId'] = credential_id
520
+ if backup_eligibility is not None:
521
+ params['backupEligibility'] = backup_eligibility
522
+ if backup_state is not None:
523
+ params['backupState'] = backup_state
524
+ cmd_dict: T_JSON_DICT = {
525
+ 'method': 'WebAuthn.setCredentialProperties',
526
+ 'params': params,
527
+ }
528
+ json = yield cmd_dict
529
+
530
+
531
+ @event_class('WebAuthn.credentialAdded')
532
+ @dataclass
533
+ class CredentialAdded:
534
+ '''
535
+ Triggered when a credential is added to an authenticator.
536
+ '''
537
+ authenticator_id: AuthenticatorId
538
+ credential: Credential
539
+
540
+ @classmethod
541
+ def from_json(cls, json: T_JSON_DICT) -> CredentialAdded:
542
+ return cls(
543
+ authenticator_id=AuthenticatorId.from_json(json['authenticatorId']),
544
+ credential=Credential.from_json(json['credential'])
545
+ )
546
+
547
+
548
+ @event_class('WebAuthn.credentialDeleted')
549
+ @dataclass
550
+ class CredentialDeleted:
551
+ '''
552
+ Triggered when a credential is deleted, e.g. through
553
+ PublicKeyCredential.signalUnknownCredential().
554
+ '''
555
+ authenticator_id: AuthenticatorId
556
+ credential_id: str
557
+
558
+ @classmethod
559
+ def from_json(cls, json: T_JSON_DICT) -> CredentialDeleted:
560
+ return cls(
561
+ authenticator_id=AuthenticatorId.from_json(json['authenticatorId']),
562
+ credential_id=str(json['credentialId'])
563
+ )
564
+
565
+
566
+ @event_class('WebAuthn.credentialUpdated')
567
+ @dataclass
568
+ class CredentialUpdated:
569
+ '''
570
+ Triggered when a credential is updated, e.g. through
571
+ PublicKeyCredential.signalCurrentUserDetails().
572
+ '''
573
+ authenticator_id: AuthenticatorId
574
+ credential: Credential
575
+
576
+ @classmethod
577
+ def from_json(cls, json: T_JSON_DICT) -> CredentialUpdated:
578
+ return cls(
579
+ authenticator_id=AuthenticatorId.from_json(json['authenticatorId']),
580
+ credential=Credential.from_json(json['credential'])
581
+ )
582
+
583
+
584
+ @event_class('WebAuthn.credentialAsserted')
585
+ @dataclass
586
+ class CredentialAsserted:
587
+ '''
588
+ Triggered when a credential is used in a webauthn assertion.
589
+ '''
590
+ authenticator_id: AuthenticatorId
591
+ credential: Credential
592
+
593
+ @classmethod
594
+ def from_json(cls, json: T_JSON_DICT) -> CredentialAsserted:
595
+ return cls(
596
+ authenticator_id=AuthenticatorId.from_json(json['authenticatorId']),
597
+ credential=Credential.from_json(json['credential'])
598
+ )