|
6 | 6 | import time |
7 | 7 | from threading import Event |
8 | 8 |
|
9 | | -from fido2.client import Fido2Client |
| 9 | +from fido2.client import Fido2Client, UserInteraction |
10 | 10 | from fido2.ctap import CtapError |
11 | 11 | from fido2.ctap1 import Ctap1 |
12 | 12 | from fido2.ctap2 import Ctap2 |
13 | 13 | from fido2.hid import CTAPHID, CtapHidDevice |
14 | 14 | from intelhex import IntelHex |
| 15 | +from getpass import getpass |
15 | 16 |
|
16 | 17 | from .. import exceptions, helpers |
17 | 18 | from ..commands import SoloBootloader, SoloExtension |
18 | 19 | from .base import SoloClient |
19 | 20 |
|
| 21 | +# Handle user interaction |
| 22 | +class CliInteraction(UserInteraction): |
| 23 | + def prompt_up(self): |
| 24 | + print("\nTouch your authenticator device now...\n") |
| 25 | + |
| 26 | + def request_pin(self, permissions, rd_id): |
| 27 | + return getpass("Enter PIN: ") |
| 28 | + |
| 29 | + def request_uv(self, permissions, rd_id): |
| 30 | + print("User Verification required.") |
| 31 | + return True |
20 | 32 |
|
21 | 33 | class Client(SoloClient): |
22 | 34 | def __init__( |
@@ -71,7 +83,7 @@ def find_device(self, dev=None, solo_serial=None): |
71 | 83 | self.ctap2 = None |
72 | 84 |
|
73 | 85 | try: |
74 | | - self.client = Fido2Client(dev, self.origin) |
| 86 | + self.client = Fido2Client(dev, self.origin, user_interaction=CliInteraction()) |
75 | 87 | except CtapError: |
76 | 88 | print("Not using FIDO2 interface.") |
77 | 89 | self.client = None |
|
0 commit comments