move config import into get_device_id function

grdddj/tt_enable_usb_by_default
grdddj 2 years ago
parent 68d3a687fd
commit 179ae05def

@ -4,7 +4,6 @@ from ubinascii import hexlify
import storage.cache
from storage import common
from trezor import config
if TYPE_CHECKING:
from trezor.enums import BackupType
@ -84,10 +83,12 @@ def _new_device_id() -> str:
def get_device_id() -> str:
import trezorconfig
dev_id = common.get(_NAMESPACE, DEVICE_ID, public=True)
if not dev_id:
dev_id = _new_device_id().encode()
config.unlock("", None)
trezorconfig.unlock("", None)
common.set(_NAMESPACE, DEVICE_ID, dev_id, public=True)
return dev_id.decode()

Loading…
Cancel
Save