mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Optional ENFORCE_HWI_INITIALISATION_AT_STARTUP (#2383)
* Revert "revert removal of enumerate (#2378)"
This reverts commit 23ad11975b.
* Make HWI initialisation not default but enforcable
This commit is contained in:
parent
2c8e5533a0
commit
8a06e9b716
3 changed files with 13 additions and 7 deletions
|
|
@ -82,6 +82,9 @@ class BaseConfig(object):
|
|||
CERT = os.getenv("CERT", None)
|
||||
KEY = os.getenv("KEY", None)
|
||||
|
||||
# It might be necessary to enforce the HWI initialisation
|
||||
ENFORCE_HWI_INITIALISATION_AT_STARTUP = False
|
||||
|
||||
# This will be used to search for a bitcoin.conf in order to enable the
|
||||
# auth method "RPC password as pin"
|
||||
RASPIBLITZ_SPECTER_RPC_LOGIN_BITCOIN_CONF_LOCATION = os.getenv(
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class HWIBridge(JSONRPC):
|
|||
All methods of this class are callable over JSON-RPC, except _underscored.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, enforce_hwi_initialisation=False):
|
||||
self.exposed_rpc = {
|
||||
"enumerate": self.enumerate,
|
||||
"detect_device": self.detect_device,
|
||||
|
|
@ -81,11 +81,14 @@ class HWIBridge(JSONRPC):
|
|||
"extract_master_blinding_key": self.extract_master_blinding_key,
|
||||
"bitbox02_pairing": self.bitbox02_pairing,
|
||||
}
|
||||
# Running enumerate after beginning an interaction with a specific device
|
||||
# crashes python or make HWI misbehave. For now we just get all connected
|
||||
# devices once per session and save them.
|
||||
logger.info("Initializing HWI...") # to explain user why it takes so long
|
||||
self.enumerate()
|
||||
if enforce_hwi_initialisation:
|
||||
# Running enumerate after beginning an interaction with a specific device
|
||||
# crashes python or make HWI misbehave. For now we just get all connected
|
||||
# devices once per session and save them.
|
||||
logger.info("Initializing HWI...") # to explain user why it takes so long
|
||||
self.enumerate()
|
||||
logger.info("Finished initializing HWI!")
|
||||
self.devices = []
|
||||
|
||||
@locked(hwilock)
|
||||
def enumerate(self, passphrase="", chain=""):
|
||||
|
|
|
|||
|
|
@ -177,7 +177,7 @@ def init_app(app: SpecterFlask, hwibridge=False, specter=None):
|
|||
specter.initialize()
|
||||
|
||||
# HWI
|
||||
specter.hwi = HWIBridge()
|
||||
specter.hwi = HWIBridge(app.config["ENFORCE_HWI_INITIALISATION_AT_STARTUP"])
|
||||
|
||||
login_manager = LoginManager()
|
||||
login_manager.session_protection = app.config.get("SESSION_PROTECTION", "strong")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue