| 1 |
# Copyright 2026 Nitrokey Developers |
| 2 |
# |
| 3 |
# Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or |
| 4 |
# http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or |
| 5 |
# http://opensource.org/licenses/MIT>, at your option. This file may not be |
| 6 |
# copied, modified, or distributed except according to those terms. |
| 7 |
|
| 8 |
from typing import Any |
| 9 |
|
| 10 |
try: |
| 11 |
from smartcard.ExclusiveConnectCardConnection import ( |
| 12 |
ExclusiveConnectCardConnection as ExclusiveConnectCardConnection, |
| 13 |
) |
| 14 |
from smartcard.ExclusiveTransmitCardConnection import ( |
| 15 |
ExclusiveTransmitCardConnection as ExclusiveTransmitCardConnection, |
| 16 |
) |
| 17 |
except ModuleNotFoundError: |
| 18 |
|
| 19 |
class ExclusiveTransmitCardConnection: # type: ignore[no-redef] |
| 20 |
def __init__(self, connection: Any) -> None: |
| 21 |
raise NotImplementedError() |
| 22 |
|
| 23 |
def connect(self) -> None: |
| 24 |
raise NotImplementedError() |
| 25 |
|
| 26 |
def disconnect(self) -> None: |
| 27 |
raise NotImplementedError() |
| 28 |
|
| 29 |
def release(self) -> None: |
| 30 |
raise NotImplementedError() |
| 31 |
|
| 32 |
def getATR(self) -> list[int]: |
| 33 |
raise NotImplementedError() |
| 34 |
|
| 35 |
def transmit(self, data: list[int]) -> tuple[bytes, int, int]: |
| 36 |
raise NotImplementedError() |
| 37 |
|
| 38 |
def lock(self) -> None: |
| 39 |
raise NotImplementedError() |
| 40 |
|
| 41 |
def unlock(self) -> None: |
| 42 |
raise NotImplementedError() |
| 43 |
|
| 44 |
def getReader(self) -> str: |
| 45 |
raise NotImplementedError() |
| 46 |
|
| 47 |
class ExclusiveConnectCardConnection: # type: ignore[no-redef] |
| 48 |
def __init__(self, connection: Any) -> None: |
| 49 |
raise NotImplementedError() |
| 50 |
|
| 51 |
def connect(self) -> None: |
| 52 |
raise NotImplementedError() |
| 53 |
|
| 54 |
def disconnect(self) -> None: |
| 55 |
raise NotImplementedError() |
| 56 |
|
| 57 |
def release(self) -> None: |
| 58 |
raise NotImplementedError() |
| 59 |
|
| 60 |
def getATR(self) -> list[int]: |
| 61 |
raise NotImplementedError() |
| 62 |
|
| 63 |
def transmit(self, data: list[int]) -> tuple[bytes, int, int]: |
| 64 |
raise NotImplementedError() |
| 65 |
|
| 66 |
def lock(self) -> None: |
| 67 |
raise NotImplementedError() |
| 68 |
|
| 69 |
def unlock(self) -> None: |
| 70 |
raise NotImplementedError() |
| 71 |
|
| 72 |
def getReader(self) -> str: |
| 73 |
raise NotImplementedError() |