mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-07-25 16:08:32 +00:00
WIP - better importing compatible with pyright
This commit is contained in:
parent
ac744c001c
commit
3b74bfa368
@ -2,8 +2,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import storage.cache
|
||||
import storage.device
|
||||
from storage import trezorstoragedevice
|
||||
from trezor import config, utils, wire, workflow
|
||||
from trezor import config, storagedevice, utils, wire, workflow
|
||||
from trezor.enums import MessageType
|
||||
from trezor.messages import Success
|
||||
|
||||
@ -77,7 +76,7 @@ def get_features() -> Features:
|
||||
Capability.PassphraseEntry,
|
||||
]
|
||||
f.sd_card_present = sdcard.is_present()
|
||||
f.initialized = trezorstoragedevice.is_initialized()
|
||||
f.initialized = storagedevice.is_initialized()
|
||||
|
||||
# private fields:
|
||||
if config.is_unlocked():
|
||||
@ -94,7 +93,7 @@ def get_features() -> Features:
|
||||
f.passphrase_always_on_device = storage.device.get_passphrase_always_on_device()
|
||||
f.safety_checks = safety_checks.read_setting()
|
||||
f.auto_lock_delay_ms = storage.device.get_autolock_delay_ms()
|
||||
f.display_rotation = trezorstoragedevice.get_rotation()
|
||||
f.display_rotation = storagedevice.get_rotation()
|
||||
f.experimental_features = storage.device.get_experimental_features()
|
||||
|
||||
return f
|
||||
@ -279,7 +278,7 @@ def reload_settings_from_storage() -> None:
|
||||
storage.device.get_autolock_delay_ms(), lock_device_if_unlocked
|
||||
)
|
||||
wire.experimental_enabled = storage.device.get_experimental_features()
|
||||
ui.display.orientation(trezorstoragedevice.get_rotation())
|
||||
ui.display.orientation(storagedevice.get_rotation())
|
||||
|
||||
|
||||
def boot() -> None:
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from storage import cache, trezorstoragedevice
|
||||
from trezor import wire
|
||||
from storage import cache
|
||||
from trezor import storagedevice, wire
|
||||
from trezor.crypto import bip32, cardano
|
||||
from trezor.enums import CardanoDerivationType
|
||||
|
||||
@ -115,7 +115,7 @@ def is_minting_path(path: Bip32Path) -> bool:
|
||||
|
||||
|
||||
def derive_and_store_secrets(passphrase: str) -> None:
|
||||
assert trezorstoragedevice.is_initialized()
|
||||
assert storagedevice.is_initialized()
|
||||
assert cache.get(cache.APP_COMMON_DERIVE_CARDANO)
|
||||
|
||||
if not mnemonic.is_bip39():
|
||||
@ -152,7 +152,7 @@ async def _get_secret(ctx: wire.Context, cache_entry: int) -> bytes:
|
||||
async def _get_keychain_bip39(
|
||||
ctx: wire.Context, derivation_type: CardanoDerivationType
|
||||
) -> Keychain:
|
||||
if not trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
if derivation_type == CardanoDerivationType.LEDGER:
|
||||
|
@ -1,6 +1,5 @@
|
||||
import storage.device
|
||||
from storage import trezorstoragedevice
|
||||
from trezor import ui, utils, workflow
|
||||
from trezor import storagedevice, ui, utils, workflow
|
||||
from trezor.enums import BackupType
|
||||
|
||||
|
||||
@ -9,7 +8,7 @@ def get() -> tuple[bytes | None, BackupType]:
|
||||
|
||||
|
||||
def get_secret() -> bytes | None:
|
||||
return trezorstoragedevice.get_mnemonic_secret()
|
||||
return storagedevice.get_mnemonic_secret()
|
||||
|
||||
|
||||
def get_type() -> BackupType:
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from storage import cache, device, trezorstoragedevice
|
||||
from trezor import utils, wire
|
||||
from storage import cache
|
||||
from trezor import storagedevice, utils, wire
|
||||
from trezor.crypto import bip32, hmac
|
||||
|
||||
from . import mnemonic
|
||||
@ -48,7 +48,7 @@ if not utils.BITCOIN_ONLY:
|
||||
# expose a method for Cardano to do the same
|
||||
|
||||
async def derive_and_store_roots(ctx: wire.Context) -> None:
|
||||
if not trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
need_seed = not cache.is_set(cache.APP_COMMON_SEED)
|
||||
@ -89,7 +89,7 @@ else:
|
||||
|
||||
@cache.stored(cache.APP_COMMON_SEED_WITHOUT_PASSPHRASE)
|
||||
def _get_seed_without_passphrase() -> bytes:
|
||||
if not trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise Exception("Device is not initialized")
|
||||
return mnemonic.get_seed(progress_bar=False)
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
import storage
|
||||
import storage.device
|
||||
from trezor import config, wire
|
||||
from trezor import config, storagedevice, wire
|
||||
from trezor.crypto import bip39, slip39
|
||||
from trezor.enums import BackupType
|
||||
from trezor.messages import LoadDevice, Success
|
||||
@ -51,7 +51,7 @@ async def load_device(ctx: wire.Context, msg: LoadDevice) -> Success:
|
||||
|
||||
|
||||
def _validate(msg: LoadDevice) -> int:
|
||||
if storage.trezorstoragedevice.is_initialized():
|
||||
if storagedevice.is_initialized():
|
||||
raise wire.UnexpectedMessage("Already initialized")
|
||||
|
||||
if not msg.mnemonics:
|
||||
|
@ -4,7 +4,7 @@ from micropython import const
|
||||
import storage
|
||||
import storage.cache
|
||||
import storage.device
|
||||
from trezor import config, ui
|
||||
from trezor import config, storagedevice, ui
|
||||
from trezor.ui.loader import Loader, LoaderNeutral
|
||||
|
||||
from apps.base import lock_device
|
||||
@ -25,7 +25,7 @@ class Homescreen(HomescreenBase):
|
||||
|
||||
def __init__(self) -> None:
|
||||
super().__init__()
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
self.label = "Go to trezor.io/start"
|
||||
|
||||
self.loader = Loader(
|
||||
@ -38,19 +38,13 @@ class Homescreen(HomescreenBase):
|
||||
|
||||
def do_render(self) -> None:
|
||||
# warning bar on top
|
||||
if storage.trezorstoragedevice.is_initialized() and storage.device.no_backup():
|
||||
if storagedevice.is_initialized() and storage.device.no_backup():
|
||||
ui.header_error("SEEDLESS")
|
||||
elif (
|
||||
storage.trezorstoragedevice.is_initialized()
|
||||
and storage.device.unfinished_backup()
|
||||
):
|
||||
elif storagedevice.is_initialized() and storage.device.unfinished_backup():
|
||||
ui.header_error("BACKUP FAILED!")
|
||||
elif (
|
||||
storage.trezorstoragedevice.is_initialized()
|
||||
and storage.device.needs_backup()
|
||||
):
|
||||
elif storagedevice.is_initialized() and storage.device.needs_backup():
|
||||
ui.header_warning("NEEDS BACKUP!")
|
||||
elif storage.trezorstoragedevice.is_initialized() and not config.has_pin():
|
||||
elif storagedevice.is_initialized() and not config.has_pin():
|
||||
ui.header_warning("PIN NOT SET!")
|
||||
elif storage.device.get_experimental_features():
|
||||
ui.header_warning("EXPERIMENTAL MODE!")
|
||||
|
@ -1,8 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import storage.device
|
||||
from storage.device import set_flags
|
||||
from trezor import wire
|
||||
from trezor import storagedevice, wire
|
||||
from trezor.messages import Success
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -10,7 +9,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def apply_flags(ctx: wire.GenericContext, msg: ApplyFlags) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
set_flags(msg.flags)
|
||||
return Success(message="Flags applied")
|
||||
|
@ -1,7 +1,7 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
import storage.device
|
||||
from trezor import ui, wire
|
||||
from trezor import storagedevice, ui, wire
|
||||
from trezor.enums import ButtonRequestType, SafetyCheckLevel
|
||||
from trezor.messages import Success
|
||||
from trezor.strings import format_duration_ms
|
||||
@ -34,7 +34,7 @@ def validate_homescreen(homescreen: bytes) -> None:
|
||||
|
||||
|
||||
async def apply_settings(ctx: wire.Context, msg: ApplySettings) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
if (
|
||||
msg.homescreen is None
|
||||
@ -88,7 +88,7 @@ async def apply_settings(ctx: wire.Context, msg: ApplySettings) -> Success:
|
||||
|
||||
if msg.display_rotation is not None:
|
||||
await require_confirm_change_display_rotation(ctx, msg.display_rotation)
|
||||
storage.device.set_rotation(msg.display_rotation)
|
||||
storagedevice.set_rotation(msg.display_rotation)
|
||||
|
||||
if msg.experimental_features is not None:
|
||||
await require_confirm_experimental_features(ctx, msg.experimental_features)
|
||||
|
@ -2,7 +2,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import storage
|
||||
import storage.device
|
||||
from trezor import wire
|
||||
from trezor import storagedevice, wire
|
||||
from trezor.messages import Success
|
||||
|
||||
from apps.common import mnemonic
|
||||
@ -14,7 +14,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def backup_device(ctx: wire.Context, msg: BackupDevice) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
if not storage.device.needs_backup():
|
||||
raise wire.ProcessError("Seed already backed up")
|
||||
|
@ -1,7 +1,6 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from storage.device import is_initialized
|
||||
from trezor import config, wire
|
||||
from trezor import config, storagedevice, wire
|
||||
from trezor.messages import Success
|
||||
from trezor.ui.layouts import confirm_action, show_success
|
||||
|
||||
@ -19,7 +18,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def change_pin(ctx: wire.Context, msg: ChangePin) -> Success:
|
||||
if not is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
# confirm that user wants to change the pin
|
||||
|
@ -1,7 +1,6 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from storage.device import is_initialized
|
||||
from trezor import config, ui, wire
|
||||
from trezor import config, storagedevice, ui, wire
|
||||
from trezor.messages import Success
|
||||
from trezor.ui.layouts import confirm_action, show_popup, show_success
|
||||
|
||||
@ -18,7 +17,7 @@ if TYPE_CHECKING:
|
||||
|
||||
|
||||
async def change_wipe_code(ctx: wire.Context, msg: ChangeWipeCode) -> Success:
|
||||
if not is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
# Confirm that user wants to set or remove the wipe code.
|
||||
|
@ -1,5 +1,5 @@
|
||||
import storage.device
|
||||
from trezor import ui, wire
|
||||
from trezor import storagedevice, ui, wire
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.messages import GetNextU2FCounter, NextU2FCounter
|
||||
from trezor.ui.layouts import confirm_action
|
||||
@ -8,7 +8,7 @@ from trezor.ui.layouts import confirm_action
|
||||
async def get_next_u2f_counter(
|
||||
ctx: wire.Context, msg: GetNextU2FCounter
|
||||
) -> NextU2FCounter:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
await confirm_action(
|
||||
|
@ -3,7 +3,7 @@ from typing import TYPE_CHECKING
|
||||
import storage
|
||||
import storage.device
|
||||
import storage.recovery
|
||||
from trezor import config, ui, wire, workflow
|
||||
from trezor import config, storagedevice, ui, wire, workflow
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.messages import Success
|
||||
from trezor.ui.layouts import confirm_action, confirm_reset_device
|
||||
@ -70,9 +70,9 @@ async def recovery_device(ctx: wire.Context, msg: RecoveryDevice) -> Success:
|
||||
|
||||
|
||||
def _validate(msg: RecoveryDevice) -> None:
|
||||
if not msg.dry_run and storage.trezorstoragedevice.is_initialized():
|
||||
if not msg.dry_run and storagedevice.is_initialized():
|
||||
raise wire.UnexpectedMessage("Already initialized")
|
||||
if msg.dry_run and not storage.trezorstoragedevice.is_initialized():
|
||||
if msg.dry_run and not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
if msg.enforce_wordlist is False:
|
||||
|
@ -2,7 +2,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import storage
|
||||
import storage.device
|
||||
from trezor import config, wire
|
||||
from trezor import config, storagedevice, wire
|
||||
from trezor.crypto import bip39, hashlib, random, slip39
|
||||
from trezor.enums import BackupType
|
||||
from trezor.messages import EntropyAck, EntropyRequest, Success
|
||||
@ -185,7 +185,7 @@ def _validate_reset_device(msg: ResetDevice) -> None:
|
||||
raise wire.ProcessError("Invalid strength (has to be 128, 192 or 256 bits)")
|
||||
if msg.display_random and (msg.skip_backup or msg.no_backup):
|
||||
raise wire.ProcessError("Can't show internal entropy when backup is skipped")
|
||||
if storage.trezorstoragedevice.is_initialized():
|
||||
if storagedevice.is_initialized():
|
||||
raise wire.UnexpectedMessage("Already initialized")
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@ from typing import TYPE_CHECKING
|
||||
|
||||
import storage.device
|
||||
import storage.sd_salt
|
||||
from trezor import config, wire
|
||||
from trezor import config, storagedevice, wire
|
||||
from trezor.crypto import random
|
||||
from trezor.enums import SdProtectOperationType
|
||||
from trezor.messages import Success
|
||||
@ -39,7 +39,7 @@ async def _set_salt(
|
||||
|
||||
|
||||
async def sd_protect(ctx: wire.Context, msg: SdProtect) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
|
||||
if msg.operation == SdProtectOperationType.ENABLE:
|
||||
|
@ -1,12 +1,12 @@
|
||||
import storage.device
|
||||
from trezor import ui, wire
|
||||
from trezor import storagedevice, ui, wire
|
||||
from trezor.enums import ButtonRequestType
|
||||
from trezor.messages import SetU2FCounter, Success
|
||||
from trezor.ui.layouts import confirm_action
|
||||
|
||||
|
||||
async def set_u2f_counter(ctx: wire.Context, msg: SetU2FCounter) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
if msg.u2f_counter is None:
|
||||
raise wire.ProcessError("No value provided")
|
||||
|
@ -1,5 +1,4 @@
|
||||
import storage.device
|
||||
from trezor import wire
|
||||
from trezor import storagedevice, wire
|
||||
from trezor.messages import Success, WebAuthnAddResidentCredential
|
||||
from trezor.ui.components.common.webauthn import ConfirmInfo
|
||||
from trezor.ui.layouts import show_error_and_raise
|
||||
@ -28,7 +27,7 @@ class ConfirmAddCredential(ConfirmInfo):
|
||||
async def add_resident_credential(
|
||||
ctx: wire.Context, msg: WebAuthnAddResidentCredential
|
||||
) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
if not msg.credential_id:
|
||||
raise wire.ProcessError("Missing credential ID parameter.")
|
||||
|
@ -7,7 +7,7 @@ from typing import Any, Callable, Coroutine, Iterable, Iterator
|
||||
import storage
|
||||
import storage.resident_credentials
|
||||
from storage.fido2 import KEY_AGREEMENT_PRIVKEY, KEY_AGREEMENT_PUBKEY
|
||||
from trezor import config, io, log, loop, ui, utils, workflow
|
||||
from trezor import config, io, log, loop, storagedevice, ui, utils, workflow
|
||||
from trezor.crypto import aes, der, hashlib, hmac, random
|
||||
from trezor.crypto.curve import nist256p1
|
||||
from trezor.ui.components.common.confirm import Pageable
|
||||
@ -1190,7 +1190,7 @@ def msg_register(req: Msg, dialog_mgr: DialogManager) -> Cmd:
|
||||
dialog_mgr.set_state(new_state)
|
||||
return msg_error(req.cid, _SW_CONDITIONS_NOT_SATISFIED)
|
||||
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
if __debug__:
|
||||
log.warning(__name__, "not initialized")
|
||||
# There is no standard way to decline a U2F request, but responding with ERR_CHANNEL_BUSY
|
||||
@ -1271,7 +1271,7 @@ def msg_authenticate(req: Msg, dialog_mgr: DialogManager) -> Cmd:
|
||||
dialog_mgr.set_state(new_state)
|
||||
return msg_error(req.cid, _SW_CONDITIONS_NOT_SATISFIED)
|
||||
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
if __debug__:
|
||||
log.warning(__name__, "not initialized")
|
||||
# Device is not registered with the RP.
|
||||
@ -1450,7 +1450,7 @@ def cbor_make_credential(req: Cmd, dialog_mgr: DialogManager) -> Cmd | None:
|
||||
def cbor_make_credential_process(req: Cmd, dialog_mgr: DialogManager) -> State | Cmd:
|
||||
from . import knownapps
|
||||
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
if __debug__:
|
||||
log.warning(__name__, "not initialized")
|
||||
return cbor_error(req.cid, _ERR_OTHER)
|
||||
@ -1628,7 +1628,7 @@ def cbor_get_assertion(req: Cmd, dialog_mgr: DialogManager) -> Cmd | None:
|
||||
|
||||
|
||||
def cbor_get_assertion_process(req: Cmd, dialog_mgr: DialogManager) -> State | Cmd:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
if __debug__:
|
||||
log.warning(__name__, "not initialized")
|
||||
return cbor_error(req.cid, _ERR_OTHER)
|
||||
@ -1888,7 +1888,7 @@ def cbor_client_pin(req: Cmd) -> Cmd:
|
||||
|
||||
|
||||
def cbor_reset(req: Cmd, dialog_mgr: DialogManager) -> Cmd | None:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
if __debug__:
|
||||
log.warning(__name__, "not initialized")
|
||||
# Return success, because the authenticator is already in factory default state.
|
||||
|
@ -1,6 +1,6 @@
|
||||
import storage.device
|
||||
import storage.resident_credentials
|
||||
from trezor import wire
|
||||
from trezor import storagedevice, wire
|
||||
from trezor.messages import Success, WebAuthnRemoveResidentCredential
|
||||
from trezor.ui.components.common.webauthn import ConfirmInfo
|
||||
from trezor.ui.layouts.tt.webauthn import confirm_webauthn
|
||||
@ -28,7 +28,7 @@ class ConfirmRemoveCredential(ConfirmInfo):
|
||||
async def remove_resident_credential(
|
||||
ctx: wire.Context, msg: WebAuthnRemoveResidentCredential
|
||||
) -> Success:
|
||||
if not storage.trezorstoragedevice.is_initialized():
|
||||
if not storagedevice.is_initialized():
|
||||
raise wire.NotInitialized("Device is not initialized")
|
||||
if msg.index is None:
|
||||
raise wire.ProcessError("Missing credential index parameter.")
|
||||
|
@ -1,7 +1,6 @@
|
||||
import storage
|
||||
import storage.device
|
||||
from storage import trezorstoragedevice
|
||||
from trezor import config, log, loop, ui, utils, wire
|
||||
from trezor import config, log, loop, storagedevice, ui, utils, wire
|
||||
from trezor.pin import show_pin_timeout
|
||||
|
||||
from apps.common.request_pin import can_lock_device, verify_user_pin
|
||||
@ -10,7 +9,7 @@ from apps.homescreen.lockscreen import Lockscreen
|
||||
|
||||
async def bootscreen() -> None:
|
||||
lockscreen = Lockscreen(bootscreen=True)
|
||||
ui.display.orientation(trezorstoragedevice.get_rotation())
|
||||
ui.display.orientation(storagedevice.get_rotation())
|
||||
while True:
|
||||
try:
|
||||
if can_lock_device():
|
||||
|
@ -1,11 +1,9 @@
|
||||
from storage import cache, common, device
|
||||
from trezor import config
|
||||
|
||||
import trezorstoragedevice
|
||||
from trezor import config, storagedevice
|
||||
|
||||
|
||||
def set_current_version() -> None:
|
||||
trezorstoragedevice.set_version(common.STORAGE_VERSION_CURRENT)
|
||||
storagedevice.set_version(common.STORAGE_VERSION_CURRENT)
|
||||
|
||||
|
||||
def wipe() -> None:
|
||||
@ -15,16 +13,13 @@ def wipe() -> None:
|
||||
|
||||
def init_unlocked() -> None:
|
||||
# Check for storage version upgrade.
|
||||
version = trezorstoragedevice.get_version()
|
||||
version = storagedevice.get_version()
|
||||
if version == common.STORAGE_VERSION_01:
|
||||
_migrate_from_version_01()
|
||||
|
||||
# In FWs <= 2.3.1 'version' denoted whether the device is initialized or not.
|
||||
# In 2.3.2 we have introduced a new field 'initialized' for that.
|
||||
if (
|
||||
trezorstoragedevice.is_version_stored()
|
||||
and not trezorstoragedevice.is_initialized()
|
||||
):
|
||||
if storagedevice.is_version_stored() and not storagedevice.is_initialized():
|
||||
common.set_bool(common.APP_DEVICE, device.INITIALIZED, True, public=True)
|
||||
|
||||
|
||||
|
@ -4,8 +4,7 @@ from ubinascii import hexlify
|
||||
|
||||
import storage.cache
|
||||
from storage import common
|
||||
|
||||
import trezorstoragedevice
|
||||
from trezor import storagedevice
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from trezor.enums import BackupType
|
||||
@ -165,7 +164,7 @@ def store_mnemonic_secret(
|
||||
needs_backup: bool = False,
|
||||
no_backup: bool = False,
|
||||
) -> None:
|
||||
trezorstoragedevice.set_version(common.STORAGE_VERSION_CURRENT)
|
||||
storagedevice.set_version(common.STORAGE_VERSION_CURRENT)
|
||||
common.set(_NAMESPACE, _MNEMONIC_SECRET, secret)
|
||||
common.set_uint8(_NAMESPACE, _BACKUP_TYPE, backup_type)
|
||||
common.set_true_or_delete(_NAMESPACE, _NO_BACKUP, no_backup)
|
||||
|
@ -1,2 +1,4 @@
|
||||
import trezorconfig as config # noqa: F401
|
||||
import trezorio as io # noqa: F401
|
||||
|
||||
import trezorstoragedevice as storagedevice # noqa: F401
|
||||
|
Loading…
Reference in New Issue
Block a user