File tree Expand file tree Collapse file tree 2 files changed +23
-21
lines changed
Expand file tree Collapse file tree 2 files changed +23
-21
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 55# http://opensource.org/licenses/MIT>, at your option. This file may not be
66# copied, modified, or distributed except according to those terms.
77
8+ import ctypes
9+ import sys
10+ from importlib .util import find_spec
811from typing import List , Optional
912
1013from ._base import Model as Model # noqa: F401
2326from ._utils import Version as Version # noqa: F401
2427
2528
26- def list (use_ccid : bool = False , * , model : Optional [Model ] = None ) -> List [TrussedBase ]:
29+ def should_default_ccid () -> bool :
30+ if find_spec ("smartcard" ) is None :
31+ return False
32+
33+ if sys .platform != "win32" and sys .platform != "cygwin" :
34+ # Linux or MacOS don't need admin to access with CTAPHID
35+ return False
36+
37+ try :
38+ if ctypes .windll .shell32 .IsUserAnAdmin ():
39+ return False
40+ else :
41+ return True
42+ except Exception :
43+ return False
44+
45+
46+ def list (
47+ use_ccid : bool = should_default_ccid (), * , model : Optional [Model ] = None
48+ ) -> List [TrussedBase ]:
2749 devices : List [TrussedBase ] = []
2850
2951 if model is None or model == Model .NK3 :
You can’t perform that action at this time.
0 commit comments