Initialize passphrase cache at UI c-tor
This commit is contained in:
@@ -28,7 +28,8 @@ class UI:
|
|||||||
default_pinentry)
|
default_pinentry)
|
||||||
self.options_getter = create_default_options_getter()
|
self.options_getter = create_default_options_getter()
|
||||||
self.device_name = device_type.__name__
|
self.device_name = device_type.__name__
|
||||||
self.cached_passphrase_ack = None
|
self.cached_passphrase_ack = util.ExpiringCache(
|
||||||
|
seconds=float(config.get('cache_expiry_seconds', 'inf')))
|
||||||
|
|
||||||
def get_pin(self, _code=None):
|
def get_pin(self, _code=None):
|
||||||
"""Ask the user for (scrambled) PIN."""
|
"""Ask the user for (scrambled) PIN."""
|
||||||
|
|||||||
@@ -249,8 +249,6 @@ def run_agent(device_type):
|
|||||||
pubkey_bytes = keyring.export_public_keys(env=env)
|
pubkey_bytes = keyring.export_public_keys(env=env)
|
||||||
device_type.ui = device.ui.UI(device_type=device_type,
|
device_type.ui = device.ui.UI(device_type=device_type,
|
||||||
config=vars(args))
|
config=vars(args))
|
||||||
device_type.ui.cached_passphrase_ack = util.ExpiringCache(
|
|
||||||
seconds=float(args.cache_expiry_seconds))
|
|
||||||
handler = agent.Handler(device=device_type(),
|
handler = agent.Handler(device=device_type(),
|
||||||
pubkey_bytes=pubkey_bytes)
|
pubkey_bytes=pubkey_bytes)
|
||||||
|
|
||||||
@@ -318,7 +316,5 @@ def main(device_type):
|
|||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
device_type.ui = device.ui.UI(device_type=device_type, config=vars(args))
|
device_type.ui = device.ui.UI(device_type=device_type, config=vars(args))
|
||||||
device_type.ui.cached_passphrase_ack = util.ExpiringCache(
|
|
||||||
seconds=float(args.cache_expiry_seconds))
|
|
||||||
|
|
||||||
return args.func(device_type=device_type, args=args)
|
return args.func(device_type=device_type, args=args)
|
||||||
|
|||||||
@@ -274,8 +274,6 @@ def main(device_type):
|
|||||||
|
|
||||||
# override default PIN/passphrase entry tools (relevant for TREZOR/Keepkey):
|
# override default PIN/passphrase entry tools (relevant for TREZOR/Keepkey):
|
||||||
device_type.ui = device.ui.UI(device_type=device_type, config=vars(args))
|
device_type.ui = device.ui.UI(device_type=device_type, config=vars(args))
|
||||||
device_type.ui.cached_passphrase_ack = util.ExpiringCache(
|
|
||||||
args.cache_expiry_seconds)
|
|
||||||
|
|
||||||
conn = JustInTimeConnection(
|
conn = JustInTimeConnection(
|
||||||
conn_factory=lambda: client.Client(device_type()),
|
conn_factory=lambda: client.Client(device_type()),
|
||||||
|
|||||||
Reference in New Issue
Block a user