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,891 @@
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: SmartCardEmulation (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 ResultCode(enum.Enum):
16
+ '''
17
+ Indicates the PC/SC error code.
18
+
19
+ This maps to:
20
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__ErrorCodes.html
21
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/secauthn/authentication-return-values
22
+ '''
23
+ SUCCESS = "success"
24
+ REMOVED_CARD = "removed-card"
25
+ RESET_CARD = "reset-card"
26
+ UNPOWERED_CARD = "unpowered-card"
27
+ UNRESPONSIVE_CARD = "unresponsive-card"
28
+ UNSUPPORTED_CARD = "unsupported-card"
29
+ READER_UNAVAILABLE = "reader-unavailable"
30
+ SHARING_VIOLATION = "sharing-violation"
31
+ NOT_TRANSACTED = "not-transacted"
32
+ NO_SMARTCARD = "no-smartcard"
33
+ PROTO_MISMATCH = "proto-mismatch"
34
+ SYSTEM_CANCELLED = "system-cancelled"
35
+ NOT_READY = "not-ready"
36
+ CANCELLED = "cancelled"
37
+ INSUFFICIENT_BUFFER = "insufficient-buffer"
38
+ INVALID_HANDLE = "invalid-handle"
39
+ INVALID_PARAMETER = "invalid-parameter"
40
+ INVALID_VALUE = "invalid-value"
41
+ NO_MEMORY = "no-memory"
42
+ TIMEOUT = "timeout"
43
+ UNKNOWN_READER = "unknown-reader"
44
+ UNSUPPORTED_FEATURE = "unsupported-feature"
45
+ NO_READERS_AVAILABLE = "no-readers-available"
46
+ SERVICE_STOPPED = "service-stopped"
47
+ NO_SERVICE = "no-service"
48
+ COMM_ERROR = "comm-error"
49
+ INTERNAL_ERROR = "internal-error"
50
+ SERVER_TOO_BUSY = "server-too-busy"
51
+ UNEXPECTED = "unexpected"
52
+ SHUTDOWN = "shutdown"
53
+ UNKNOWN_CARD = "unknown-card"
54
+ UNKNOWN = "unknown"
55
+
56
+ def to_json(self) -> str:
57
+ return self.value
58
+
59
+ @classmethod
60
+ def from_json(cls, json: str) -> ResultCode:
61
+ return cls(json)
62
+
63
+
64
+ class ShareMode(enum.Enum):
65
+ '''
66
+ Maps to the ``SCARD_SHARE_*`` values.
67
+ '''
68
+ SHARED = "shared"
69
+ EXCLUSIVE = "exclusive"
70
+ DIRECT = "direct"
71
+
72
+ def to_json(self) -> str:
73
+ return self.value
74
+
75
+ @classmethod
76
+ def from_json(cls, json: str) -> ShareMode:
77
+ return cls(json)
78
+
79
+
80
+ class Disposition(enum.Enum):
81
+ '''
82
+ Indicates what the reader should do with the card.
83
+ '''
84
+ LEAVE_CARD = "leave-card"
85
+ RESET_CARD = "reset-card"
86
+ UNPOWER_CARD = "unpower-card"
87
+ EJECT_CARD = "eject-card"
88
+
89
+ def to_json(self) -> str:
90
+ return self.value
91
+
92
+ @classmethod
93
+ def from_json(cls, json: str) -> Disposition:
94
+ return cls(json)
95
+
96
+
97
+ class ConnectionState(enum.Enum):
98
+ '''
99
+ Maps to ``SCARD_*`` connection state values.
100
+ '''
101
+ ABSENT = "absent"
102
+ PRESENT = "present"
103
+ SWALLOWED = "swallowed"
104
+ POWERED = "powered"
105
+ NEGOTIABLE = "negotiable"
106
+ SPECIFIC = "specific"
107
+
108
+ def to_json(self) -> str:
109
+ return self.value
110
+
111
+ @classmethod
112
+ def from_json(cls, json: str) -> ConnectionState:
113
+ return cls(json)
114
+
115
+
116
+ @dataclass
117
+ class ReaderStateFlags:
118
+ '''
119
+ Maps to the ``SCARD_STATE_*`` flags.
120
+ '''
121
+ unaware: typing.Optional[bool] = None
122
+
123
+ ignore: typing.Optional[bool] = None
124
+
125
+ changed: typing.Optional[bool] = None
126
+
127
+ unknown: typing.Optional[bool] = None
128
+
129
+ unavailable: typing.Optional[bool] = None
130
+
131
+ empty: typing.Optional[bool] = None
132
+
133
+ present: typing.Optional[bool] = None
134
+
135
+ exclusive: typing.Optional[bool] = None
136
+
137
+ inuse: typing.Optional[bool] = None
138
+
139
+ mute: typing.Optional[bool] = None
140
+
141
+ unpowered: typing.Optional[bool] = None
142
+
143
+ def to_json(self) -> T_JSON_DICT:
144
+ json: T_JSON_DICT = dict()
145
+ if self.unaware is not None:
146
+ json['unaware'] = self.unaware
147
+ if self.ignore is not None:
148
+ json['ignore'] = self.ignore
149
+ if self.changed is not None:
150
+ json['changed'] = self.changed
151
+ if self.unknown is not None:
152
+ json['unknown'] = self.unknown
153
+ if self.unavailable is not None:
154
+ json['unavailable'] = self.unavailable
155
+ if self.empty is not None:
156
+ json['empty'] = self.empty
157
+ if self.present is not None:
158
+ json['present'] = self.present
159
+ if self.exclusive is not None:
160
+ json['exclusive'] = self.exclusive
161
+ if self.inuse is not None:
162
+ json['inuse'] = self.inuse
163
+ if self.mute is not None:
164
+ json['mute'] = self.mute
165
+ if self.unpowered is not None:
166
+ json['unpowered'] = self.unpowered
167
+ return json
168
+
169
+ @classmethod
170
+ def from_json(cls, json: T_JSON_DICT) -> ReaderStateFlags:
171
+ return cls(
172
+ unaware=bool(json['unaware']) if json.get('unaware', None) is not None else None,
173
+ ignore=bool(json['ignore']) if json.get('ignore', None) is not None else None,
174
+ changed=bool(json['changed']) if json.get('changed', None) is not None else None,
175
+ unknown=bool(json['unknown']) if json.get('unknown', None) is not None else None,
176
+ unavailable=bool(json['unavailable']) if json.get('unavailable', None) is not None else None,
177
+ empty=bool(json['empty']) if json.get('empty', None) is not None else None,
178
+ present=bool(json['present']) if json.get('present', None) is not None else None,
179
+ exclusive=bool(json['exclusive']) if json.get('exclusive', None) is not None else None,
180
+ inuse=bool(json['inuse']) if json.get('inuse', None) is not None else None,
181
+ mute=bool(json['mute']) if json.get('mute', None) is not None else None,
182
+ unpowered=bool(json['unpowered']) if json.get('unpowered', None) is not None else None,
183
+ )
184
+
185
+
186
+ @dataclass
187
+ class ProtocolSet:
188
+ '''
189
+ Maps to the ``SCARD_PROTOCOL_*`` flags.
190
+ '''
191
+ t0: typing.Optional[bool] = None
192
+
193
+ t1: typing.Optional[bool] = None
194
+
195
+ raw: typing.Optional[bool] = None
196
+
197
+ def to_json(self) -> T_JSON_DICT:
198
+ json: T_JSON_DICT = dict()
199
+ if self.t0 is not None:
200
+ json['t0'] = self.t0
201
+ if self.t1 is not None:
202
+ json['t1'] = self.t1
203
+ if self.raw is not None:
204
+ json['raw'] = self.raw
205
+ return json
206
+
207
+ @classmethod
208
+ def from_json(cls, json: T_JSON_DICT) -> ProtocolSet:
209
+ return cls(
210
+ t0=bool(json['t0']) if json.get('t0', None) is not None else None,
211
+ t1=bool(json['t1']) if json.get('t1', None) is not None else None,
212
+ raw=bool(json['raw']) if json.get('raw', None) is not None else None,
213
+ )
214
+
215
+
216
+ class Protocol(enum.Enum):
217
+ '''
218
+ Maps to the ``SCARD_PROTOCOL_*`` values.
219
+ '''
220
+ T0 = "t0"
221
+ T1 = "t1"
222
+ RAW = "raw"
223
+
224
+ def to_json(self) -> str:
225
+ return self.value
226
+
227
+ @classmethod
228
+ def from_json(cls, json: str) -> Protocol:
229
+ return cls(json)
230
+
231
+
232
+ @dataclass
233
+ class ReaderStateIn:
234
+ reader: str
235
+
236
+ current_state: ReaderStateFlags
237
+
238
+ current_insertion_count: int
239
+
240
+ def to_json(self) -> T_JSON_DICT:
241
+ json: T_JSON_DICT = dict()
242
+ json['reader'] = self.reader
243
+ json['currentState'] = self.current_state.to_json()
244
+ json['currentInsertionCount'] = self.current_insertion_count
245
+ return json
246
+
247
+ @classmethod
248
+ def from_json(cls, json: T_JSON_DICT) -> ReaderStateIn:
249
+ return cls(
250
+ reader=str(json['reader']),
251
+ current_state=ReaderStateFlags.from_json(json['currentState']),
252
+ current_insertion_count=int(json['currentInsertionCount']),
253
+ )
254
+
255
+
256
+ @dataclass
257
+ class ReaderStateOut:
258
+ reader: str
259
+
260
+ event_state: ReaderStateFlags
261
+
262
+ event_count: int
263
+
264
+ atr: str
265
+
266
+ def to_json(self) -> T_JSON_DICT:
267
+ json: T_JSON_DICT = dict()
268
+ json['reader'] = self.reader
269
+ json['eventState'] = self.event_state.to_json()
270
+ json['eventCount'] = self.event_count
271
+ json['atr'] = self.atr
272
+ return json
273
+
274
+ @classmethod
275
+ def from_json(cls, json: T_JSON_DICT) -> ReaderStateOut:
276
+ return cls(
277
+ reader=str(json['reader']),
278
+ event_state=ReaderStateFlags.from_json(json['eventState']),
279
+ event_count=int(json['eventCount']),
280
+ atr=str(json['atr']),
281
+ )
282
+
283
+
284
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
285
+ '''
286
+ Enables the ``SmartCardEmulation`` domain.
287
+ '''
288
+ cmd_dict: T_JSON_DICT = {
289
+ 'method': 'SmartCardEmulation.enable',
290
+ }
291
+ json = yield cmd_dict
292
+
293
+
294
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
295
+ '''
296
+ Disables the ``SmartCardEmulation`` domain.
297
+ '''
298
+ cmd_dict: T_JSON_DICT = {
299
+ 'method': 'SmartCardEmulation.disable',
300
+ }
301
+ json = yield cmd_dict
302
+
303
+
304
+ def report_establish_context_result(
305
+ request_id: str,
306
+ context_id: int
307
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
308
+ '''
309
+ Reports the successful result of a ``SCardEstablishContext`` call.
310
+
311
+ This maps to:
312
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
313
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext
314
+
315
+ :param request_id:
316
+ :param context_id:
317
+ '''
318
+ params: T_JSON_DICT = dict()
319
+ params['requestId'] = request_id
320
+ params['contextId'] = context_id
321
+ cmd_dict: T_JSON_DICT = {
322
+ 'method': 'SmartCardEmulation.reportEstablishContextResult',
323
+ 'params': params,
324
+ }
325
+ json = yield cmd_dict
326
+
327
+
328
+ def report_release_context_result(
329
+ request_id: str
330
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
331
+ '''
332
+ Reports the successful result of a ``SCardReleaseContext`` call.
333
+
334
+ This maps to:
335
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934
336
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext
337
+
338
+ :param request_id:
339
+ '''
340
+ params: T_JSON_DICT = dict()
341
+ params['requestId'] = request_id
342
+ cmd_dict: T_JSON_DICT = {
343
+ 'method': 'SmartCardEmulation.reportReleaseContextResult',
344
+ 'params': params,
345
+ }
346
+ json = yield cmd_dict
347
+
348
+
349
+ def report_list_readers_result(
350
+ request_id: str,
351
+ readers: typing.List[str]
352
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
353
+ '''
354
+ Reports the successful result of a ``SCardListReaders`` call.
355
+
356
+ This maps to:
357
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
358
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa
359
+
360
+ :param request_id:
361
+ :param readers:
362
+ '''
363
+ params: T_JSON_DICT = dict()
364
+ params['requestId'] = request_id
365
+ params['readers'] = [i for i in readers]
366
+ cmd_dict: T_JSON_DICT = {
367
+ 'method': 'SmartCardEmulation.reportListReadersResult',
368
+ 'params': params,
369
+ }
370
+ json = yield cmd_dict
371
+
372
+
373
+ def report_get_status_change_result(
374
+ request_id: str,
375
+ reader_states: typing.List[ReaderStateOut]
376
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
377
+ '''
378
+ Reports the successful result of a ``SCardGetStatusChange`` call.
379
+
380
+ This maps to:
381
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24
382
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea
383
+
384
+ :param request_id:
385
+ :param reader_states:
386
+ '''
387
+ params: T_JSON_DICT = dict()
388
+ params['requestId'] = request_id
389
+ params['readerStates'] = [i.to_json() for i in reader_states]
390
+ cmd_dict: T_JSON_DICT = {
391
+ 'method': 'SmartCardEmulation.reportGetStatusChangeResult',
392
+ 'params': params,
393
+ }
394
+ json = yield cmd_dict
395
+
396
+
397
+ def report_begin_transaction_result(
398
+ request_id: str,
399
+ handle: int
400
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
401
+ '''
402
+ Reports the result of a ``SCardBeginTransaction`` call.
403
+ On success, this creates a new transaction object.
404
+
405
+ This maps to:
406
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861
407
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction
408
+
409
+ :param request_id:
410
+ :param handle:
411
+ '''
412
+ params: T_JSON_DICT = dict()
413
+ params['requestId'] = request_id
414
+ params['handle'] = handle
415
+ cmd_dict: T_JSON_DICT = {
416
+ 'method': 'SmartCardEmulation.reportBeginTransactionResult',
417
+ 'params': params,
418
+ }
419
+ json = yield cmd_dict
420
+
421
+
422
+ def report_plain_result(
423
+ request_id: str
424
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
425
+ '''
426
+ Reports the successful result of a call that returns only a result code.
427
+ Used for: ``SCardCancel``, ``SCardDisconnect``, ``SCardSetAttrib``, ``SCardEndTransaction``.
428
+
429
+ This maps to:
430
+ 1. SCardCancel
431
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6
432
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
433
+
434
+ 2. SCardDisconnect
435
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a
436
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect
437
+
438
+ 3. SCardSetAttrib
439
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f
440
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib
441
+
442
+ 4. SCardEndTransaction
443
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b
444
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction
445
+
446
+ :param request_id:
447
+ '''
448
+ params: T_JSON_DICT = dict()
449
+ params['requestId'] = request_id
450
+ cmd_dict: T_JSON_DICT = {
451
+ 'method': 'SmartCardEmulation.reportPlainResult',
452
+ 'params': params,
453
+ }
454
+ json = yield cmd_dict
455
+
456
+
457
+ def report_connect_result(
458
+ request_id: str,
459
+ handle: int,
460
+ active_protocol: typing.Optional[Protocol] = None
461
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
462
+ '''
463
+ Reports the successful result of a ``SCardConnect`` call.
464
+
465
+ This maps to:
466
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
467
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta
468
+
469
+ :param request_id:
470
+ :param handle:
471
+ :param active_protocol: *(Optional)*
472
+ '''
473
+ params: T_JSON_DICT = dict()
474
+ params['requestId'] = request_id
475
+ params['handle'] = handle
476
+ if active_protocol is not None:
477
+ params['activeProtocol'] = active_protocol.to_json()
478
+ cmd_dict: T_JSON_DICT = {
479
+ 'method': 'SmartCardEmulation.reportConnectResult',
480
+ 'params': params,
481
+ }
482
+ json = yield cmd_dict
483
+
484
+
485
+ def report_data_result(
486
+ request_id: str,
487
+ data: str
488
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
489
+ '''
490
+ Reports the successful result of a call that sends back data on success.
491
+ Used for ``SCardTransmit``, ``SCardControl``, and ``SCardGetAttrib``.
492
+
493
+ This maps to:
494
+ 1. SCardTransmit
495
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99
496
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit
497
+
498
+ 2. SCardControl
499
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f
500
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol
501
+
502
+ 3. SCardGetAttrib
503
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602
504
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib
505
+
506
+ :param request_id:
507
+ :param data:
508
+ '''
509
+ params: T_JSON_DICT = dict()
510
+ params['requestId'] = request_id
511
+ params['data'] = data
512
+ cmd_dict: T_JSON_DICT = {
513
+ 'method': 'SmartCardEmulation.reportDataResult',
514
+ 'params': params,
515
+ }
516
+ json = yield cmd_dict
517
+
518
+
519
+ def report_status_result(
520
+ request_id: str,
521
+ reader_name: str,
522
+ state: ConnectionState,
523
+ atr: str,
524
+ protocol: typing.Optional[Protocol] = None
525
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
526
+ '''
527
+ Reports the successful result of a ``SCardStatus`` call.
528
+
529
+ This maps to:
530
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382
531
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa
532
+
533
+ :param request_id:
534
+ :param reader_name:
535
+ :param state:
536
+ :param atr:
537
+ :param protocol: *(Optional)*
538
+ '''
539
+ params: T_JSON_DICT = dict()
540
+ params['requestId'] = request_id
541
+ params['readerName'] = reader_name
542
+ params['state'] = state.to_json()
543
+ params['atr'] = atr
544
+ if protocol is not None:
545
+ params['protocol'] = protocol.to_json()
546
+ cmd_dict: T_JSON_DICT = {
547
+ 'method': 'SmartCardEmulation.reportStatusResult',
548
+ 'params': params,
549
+ }
550
+ json = yield cmd_dict
551
+
552
+
553
+ def report_error(
554
+ request_id: str,
555
+ result_code: ResultCode
556
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
557
+ '''
558
+ Reports an error result for the given request.
559
+
560
+ :param request_id:
561
+ :param result_code:
562
+ '''
563
+ params: T_JSON_DICT = dict()
564
+ params['requestId'] = request_id
565
+ params['resultCode'] = result_code.to_json()
566
+ cmd_dict: T_JSON_DICT = {
567
+ 'method': 'SmartCardEmulation.reportError',
568
+ 'params': params,
569
+ }
570
+ json = yield cmd_dict
571
+
572
+
573
+ @event_class('SmartCardEmulation.establishContextRequested')
574
+ @dataclass
575
+ class EstablishContextRequested:
576
+ '''
577
+ Fired when ``SCardEstablishContext`` is called.
578
+
579
+ This maps to:
580
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaa1b8970169fd4883a6dc4a8f43f19b67
581
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardestablishcontext
582
+ '''
583
+ request_id: str
584
+
585
+ @classmethod
586
+ def from_json(cls, json: T_JSON_DICT) -> EstablishContextRequested:
587
+ return cls(
588
+ request_id=str(json['requestId'])
589
+ )
590
+
591
+
592
+ @event_class('SmartCardEmulation.releaseContextRequested')
593
+ @dataclass
594
+ class ReleaseContextRequested:
595
+ '''
596
+ Fired when ``SCardReleaseContext`` is called.
597
+
598
+ This maps to:
599
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga6aabcba7744c5c9419fdd6404f73a934
600
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardreleasecontext
601
+ '''
602
+ request_id: str
603
+ context_id: int
604
+
605
+ @classmethod
606
+ def from_json(cls, json: T_JSON_DICT) -> ReleaseContextRequested:
607
+ return cls(
608
+ request_id=str(json['requestId']),
609
+ context_id=int(json['contextId'])
610
+ )
611
+
612
+
613
+ @event_class('SmartCardEmulation.listReadersRequested')
614
+ @dataclass
615
+ class ListReadersRequested:
616
+ '''
617
+ Fired when ``SCardListReaders`` is called.
618
+
619
+ This maps to:
620
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga93b07815789b3cf2629d439ecf20f0d9
621
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardlistreadersa
622
+ '''
623
+ request_id: str
624
+ context_id: int
625
+
626
+ @classmethod
627
+ def from_json(cls, json: T_JSON_DICT) -> ListReadersRequested:
628
+ return cls(
629
+ request_id=str(json['requestId']),
630
+ context_id=int(json['contextId'])
631
+ )
632
+
633
+
634
+ @event_class('SmartCardEmulation.getStatusChangeRequested')
635
+ @dataclass
636
+ class GetStatusChangeRequested:
637
+ '''
638
+ Fired when ``SCardGetStatusChange`` is called. Timeout is specified in milliseconds.
639
+
640
+ This maps to:
641
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga33247d5d1257d59e55647c3bb717db24
642
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetstatuschangea
643
+ '''
644
+ request_id: str
645
+ context_id: int
646
+ reader_states: typing.List[ReaderStateIn]
647
+ #: in milliseconds, if absent, it means "infinite"
648
+ timeout: typing.Optional[int]
649
+
650
+ @classmethod
651
+ def from_json(cls, json: T_JSON_DICT) -> GetStatusChangeRequested:
652
+ return cls(
653
+ request_id=str(json['requestId']),
654
+ context_id=int(json['contextId']),
655
+ reader_states=[ReaderStateIn.from_json(i) for i in json['readerStates']],
656
+ timeout=int(json['timeout']) if json.get('timeout', None) is not None else None
657
+ )
658
+
659
+
660
+ @event_class('SmartCardEmulation.cancelRequested')
661
+ @dataclass
662
+ class CancelRequested:
663
+ '''
664
+ Fired when ``SCardCancel`` is called.
665
+
666
+ This maps to:
667
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacbbc0c6d6c0cbbeb4f4debf6fbeeee6
668
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcancel
669
+ '''
670
+ request_id: str
671
+ context_id: int
672
+
673
+ @classmethod
674
+ def from_json(cls, json: T_JSON_DICT) -> CancelRequested:
675
+ return cls(
676
+ request_id=str(json['requestId']),
677
+ context_id=int(json['contextId'])
678
+ )
679
+
680
+
681
+ @event_class('SmartCardEmulation.connectRequested')
682
+ @dataclass
683
+ class ConnectRequested:
684
+ '''
685
+ Fired when ``SCardConnect`` is called.
686
+
687
+ This maps to:
688
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4e515829752e0a8dbc4d630696a8d6a5
689
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardconnecta
690
+ '''
691
+ request_id: str
692
+ context_id: int
693
+ reader: str
694
+ share_mode: ShareMode
695
+ preferred_protocols: ProtocolSet
696
+
697
+ @classmethod
698
+ def from_json(cls, json: T_JSON_DICT) -> ConnectRequested:
699
+ return cls(
700
+ request_id=str(json['requestId']),
701
+ context_id=int(json['contextId']),
702
+ reader=str(json['reader']),
703
+ share_mode=ShareMode.from_json(json['shareMode']),
704
+ preferred_protocols=ProtocolSet.from_json(json['preferredProtocols'])
705
+ )
706
+
707
+
708
+ @event_class('SmartCardEmulation.disconnectRequested')
709
+ @dataclass
710
+ class DisconnectRequested:
711
+ '''
712
+ Fired when ``SCardDisconnect`` is called.
713
+
714
+ This maps to:
715
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga4be198045c73ec0deb79e66c0ca1738a
716
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scarddisconnect
717
+ '''
718
+ request_id: str
719
+ handle: int
720
+ disposition: Disposition
721
+
722
+ @classmethod
723
+ def from_json(cls, json: T_JSON_DICT) -> DisconnectRequested:
724
+ return cls(
725
+ request_id=str(json['requestId']),
726
+ handle=int(json['handle']),
727
+ disposition=Disposition.from_json(json['disposition'])
728
+ )
729
+
730
+
731
+ @event_class('SmartCardEmulation.transmitRequested')
732
+ @dataclass
733
+ class TransmitRequested:
734
+ '''
735
+ Fired when ``SCardTransmit`` is called.
736
+
737
+ This maps to:
738
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga9a2d77242a271310269065e64633ab99
739
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardtransmit
740
+ '''
741
+ request_id: str
742
+ handle: int
743
+ data: str
744
+ protocol: typing.Optional[Protocol]
745
+
746
+ @classmethod
747
+ def from_json(cls, json: T_JSON_DICT) -> TransmitRequested:
748
+ return cls(
749
+ request_id=str(json['requestId']),
750
+ handle=int(json['handle']),
751
+ data=str(json['data']),
752
+ protocol=Protocol.from_json(json['protocol']) if json.get('protocol', None) is not None else None
753
+ )
754
+
755
+
756
+ @event_class('SmartCardEmulation.controlRequested')
757
+ @dataclass
758
+ class ControlRequested:
759
+ '''
760
+ Fired when ``SCardControl`` is called.
761
+
762
+ This maps to:
763
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gac3454d4657110fd7f753b2d3d8f4e32f
764
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardcontrol
765
+ '''
766
+ request_id: str
767
+ handle: int
768
+ control_code: int
769
+ data: str
770
+
771
+ @classmethod
772
+ def from_json(cls, json: T_JSON_DICT) -> ControlRequested:
773
+ return cls(
774
+ request_id=str(json['requestId']),
775
+ handle=int(json['handle']),
776
+ control_code=int(json['controlCode']),
777
+ data=str(json['data'])
778
+ )
779
+
780
+
781
+ @event_class('SmartCardEmulation.getAttribRequested')
782
+ @dataclass
783
+ class GetAttribRequested:
784
+ '''
785
+ Fired when ``SCardGetAttrib`` is called.
786
+
787
+ This maps to:
788
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaacfec51917255b7a25b94c5104961602
789
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardgetattrib
790
+ '''
791
+ request_id: str
792
+ handle: int
793
+ attrib_id: int
794
+
795
+ @classmethod
796
+ def from_json(cls, json: T_JSON_DICT) -> GetAttribRequested:
797
+ return cls(
798
+ request_id=str(json['requestId']),
799
+ handle=int(json['handle']),
800
+ attrib_id=int(json['attribId'])
801
+ )
802
+
803
+
804
+ @event_class('SmartCardEmulation.setAttribRequested')
805
+ @dataclass
806
+ class SetAttribRequested:
807
+ '''
808
+ Fired when ``SCardSetAttrib`` is called.
809
+
810
+ This maps to:
811
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#ga060f0038a4ddfd5dd2b8fadf3c3a2e4f
812
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardsetattrib
813
+ '''
814
+ request_id: str
815
+ handle: int
816
+ attrib_id: int
817
+ data: str
818
+
819
+ @classmethod
820
+ def from_json(cls, json: T_JSON_DICT) -> SetAttribRequested:
821
+ return cls(
822
+ request_id=str(json['requestId']),
823
+ handle=int(json['handle']),
824
+ attrib_id=int(json['attribId']),
825
+ data=str(json['data'])
826
+ )
827
+
828
+
829
+ @event_class('SmartCardEmulation.statusRequested')
830
+ @dataclass
831
+ class StatusRequested:
832
+ '''
833
+ Fired when ``SCardStatus`` is called.
834
+
835
+ This maps to:
836
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae49c3c894ad7ac12a5b896bde70d0382
837
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardstatusa
838
+ '''
839
+ request_id: str
840
+ handle: int
841
+
842
+ @classmethod
843
+ def from_json(cls, json: T_JSON_DICT) -> StatusRequested:
844
+ return cls(
845
+ request_id=str(json['requestId']),
846
+ handle=int(json['handle'])
847
+ )
848
+
849
+
850
+ @event_class('SmartCardEmulation.beginTransactionRequested')
851
+ @dataclass
852
+ class BeginTransactionRequested:
853
+ '''
854
+ Fired when ``SCardBeginTransaction`` is called.
855
+
856
+ This maps to:
857
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gaddb835dce01a0da1d6ca02d33ee7d861
858
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardbegintransaction
859
+ '''
860
+ request_id: str
861
+ handle: int
862
+
863
+ @classmethod
864
+ def from_json(cls, json: T_JSON_DICT) -> BeginTransactionRequested:
865
+ return cls(
866
+ request_id=str(json['requestId']),
867
+ handle=int(json['handle'])
868
+ )
869
+
870
+
871
+ @event_class('SmartCardEmulation.endTransactionRequested')
872
+ @dataclass
873
+ class EndTransactionRequested:
874
+ '''
875
+ Fired when ``SCardEndTransaction`` is called.
876
+
877
+ This maps to:
878
+ PC/SC Lite: https://pcsclite.apdu.fr/api/group__API.html#gae8742473b404363e5c587f570d7e2f3b
879
+ Microsoft: https://learn.microsoft.com/en-us/windows/win32/api/winscard/nf-winscard-scardendtransaction
880
+ '''
881
+ request_id: str
882
+ handle: int
883
+ disposition: Disposition
884
+
885
+ @classmethod
886
+ def from_json(cls, json: T_JSON_DICT) -> EndTransactionRequested:
887
+ return cls(
888
+ request_id=str(json['requestId']),
889
+ handle=int(json['handle']),
890
+ disposition=Disposition.from_json(json['disposition'])
891
+ )