feat(core/sdbackup): manage SD backup from cli

Operations possible: check, refresh, wipe, copy.
Test coverage only on Unit test level atm.
WIP - many TODOs remaining, Device tests not yet done, more error handling necessary.
pull/3441/head
obrusvit 3 months ago
parent cbd0fdcd5d
commit 696005613b

@ -402,6 +402,39 @@ message RecoveryDevice {
}
}
/**
* Request: Manage SD card backup. Operations are:
* CHECK: get health status of the backup SD card (read-only operation)
* REFRESH: request renewal of the backup SD card to prolong lifetime (write operation)
* WIPE: request complete wipe of the backup SD card (write operation)
* COPY: request duplication of the backup SD card to another SD card (read-write operation)
* @auxstart
* @next: SdCardBackupHealth
* @next: Success
*/
message SdCardBackupManage {
required SdCardBackupManageOperationType operation = 1;
enum SdCardBackupManageOperationType {
CHECK = 0;
REFRESH = 1;
WIPE = 2;
COPY = 3;
}
}
/**
* Response: Health status of SD card backup.
* @auxend
*/
message SdCardBackupHealth {
required bool pt_is_mountable = 1;
required bool pt_has_correct_cap = 2;
required bool pt_readme_present = 3;
required bool pt_readme_content = 4;
required uint32 unalloc_seed_corrupt = 5;
}
/**
* Response: Device is waiting for user to enter word of the mnemonic
* Its position is shown only on device's internal display.

@ -373,4 +373,8 @@ enum MessageType {
MessageType_SolanaAddress = 903 [(wire_out) = true];
MessageType_SolanaSignTx = 904 [(wire_in) = true];
MessageType_SolanaTxSignature = 905 [(wire_out) = true];
// SD card backup
MessageType_SdCardBackupManage = 1000 [(bitcoin_only) = true, (wire_in) = true];
MessageType_SdCardBackupHealth = 1001 [(bitcoin_only) = true, (wire_out) = true];
}

@ -70,6 +70,9 @@ MP_DEFINE_EXCEPTION(NotMounted, FatFSError)
/// class NoFilesystem(FatFSError):
/// pass
MP_DEFINE_EXCEPTION(NoFilesystem, FatFSError)
/// class FileNotFound(FatFSError):
/// pass
MP_DEFINE_EXCEPTION(FileNotFound, FatFSError)
// to avoid collisions with POSIX errno values, we add 0xFF to FR_* error codes
#define FATFS_ERROR_CODE(n) (n + 0xFF)
@ -486,7 +489,11 @@ STATIC mp_obj_t mod_trezorio_fatfs_stat(mp_obj_t path) {
FILINFO info = {0};
FRESULT res = f_stat(_path.buf, &info);
if (res != FR_OK) {
FATFS_RAISE(FatFSError, res);
if (res == FR_NO_FILE) {
FATFS_RAISE(FileNotFound, FR_NO_FILE)
} else {
FATFS_RAISE(FatFSError, res);
}
}
return filinfo_to_tuple(&info);
}
@ -633,6 +640,7 @@ STATIC const mp_rom_map_elem_t mod_trezorio_fatfs_globals_table[] = {
{MP_ROM_QSTR(MP_QSTR_FatFSError), MP_ROM_PTR(&mp_type_FatFSError)},
{MP_ROM_QSTR(MP_QSTR_NotMounted), MP_ROM_PTR(&mp_type_NotMounted)},
{MP_ROM_QSTR(MP_QSTR_NoFilesystem), MP_ROM_PTR(&mp_type_NoFilesystem)},
{MP_ROM_QSTR(MP_QSTR_FileNotFound), MP_ROM_PTR(&mp_type_FileNotFound)},
{MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mod_trezorio_fatfs_open_obj)},
{MP_ROM_QSTR(MP_QSTR_listdir), MP_ROM_PTR(&mod_trezorio_fatfs_listdir_obj)},

@ -38,6 +38,11 @@ class NoFilesystem(FatFSError):
pass
# extmod/modtrezorio/modtrezorio-fatfs.h
class FileNotFound(FatFSError):
pass
# extmod/modtrezorio/modtrezorio-fatfs.h
class FatFSFile:
"""

@ -127,6 +127,8 @@ trezor.enums.RequestType
import trezor.enums.RequestType
trezor.enums.SafetyCheckLevel
import trezor.enums.SafetyCheckLevel
trezor.enums.SdCardBackupManageOperationType
import trezor.enums.SdCardBackupManageOperationType
trezor.enums.SdProtectOperationType
import trezor.enums.SdProtectOperationType
trezor.enums.WordRequestType
@ -351,6 +353,8 @@ apps.management.reset_device
import apps.management.reset_device
apps.management.reset_device.layout
import apps.management.reset_device.layout
apps.management.sd_backup_manage
import apps.management.sd_backup_manage
apps.management.sd_protect
import apps.management.sd_protect
apps.management.set_u2f_counter

@ -168,6 +168,14 @@ def is_trz_card() -> bool:
return iosd.get_manuf_id() == 39 and iosd.capacity() == 122_945_536
@with_sdcard
def get_serial_num() -> int:
iosd = io.sdcard # local_cache_attribute
if not iosd.is_present():
return 0
return iosd.get_serial_num()
@with_sdcard
async def show_sd_card_info() -> None:
from trezor.ui.layouts import show_success

@ -154,7 +154,7 @@ async def _backup_mnemonic_or_share(
async def sdcard_backup_seed(mnemonic_secret: bytes, backup_type: BackupType) -> None:
from storage.sd_seed_backup import is_backup_present, store_seed_on_sdcard
from storage.sd_seed_backup import is_backup_present_on_sdcard, store_seed_on_sdcard
from trezor.ui.layouts import confirm_action, show_success
from trezor.ui.layouts.sdcard_eject import make_user_eject_sdcard
@ -168,7 +168,7 @@ async def sdcard_backup_seed(mnemonic_secret: bytes, backup_type: BackupType) ->
action="This is not Trezor Card! Still continue?",
verb="Continue",
)
if is_backup_present():
if is_backup_present_on_sdcard():
await confirm_action(
"confirm_sdcard_backup_exists",
"Backup present",

@ -0,0 +1,146 @@
from typing import TYPE_CHECKING
from storage.device import is_initialized
from trezor.utils import USE_SD_CARD
from trezor.wire import NotInitialized, ProcessError
from trezor.enums import SdCardBackupManageOperationType
from trezor.ui.layouts import confirm_action
from apps.common.sdcard import ensure_sdcard
from trezor.messages import (
Success,
Failure,
)
if TYPE_CHECKING:
from trezor.messages import (
SdCardBackupManage,
SdCardBackupHealth,
)
# NOTE: this whole functionality is WIP
async def sd_backup_manage(
msg: SdCardBackupManage,
) -> Success | Failure | SdCardBackupHealth:
if not is_initialized():
raise NotInitialized("Device is not initialized")
if not USE_SD_CARD:
raise ProcessError("Device does not have SD card slot")
await ensure_sdcard(ensure_filesystem=False)
if msg.operation == SdCardBackupManageOperationType.CHECK:
print("sd_backup_manage: calling _check_health")
return await _check_health()
elif msg.operation == SdCardBackupManageOperationType.REFRESH:
return await _refresh()
elif msg.operation == SdCardBackupManageOperationType.WIPE:
return await _wipe()
elif msg.operation == SdCardBackupManageOperationType.COPY:
return await _copy()
else:
raise ProcessError("Unknown operation")
async def _check_health() -> SdCardBackupHealth:
from storage.device import get_backup_type, get_mnemonic_secret
from storage.sd_seed_backup import check_health_of_backup_sdcard
from trezor.enums import BackupType
print("_check_health: start")
await confirm_action(
"confirm_sd_backup_check",
"Check backup card",
action="Check action",
description="Checks health of the backup card.",
)
return check_health_of_backup_sdcard(
get_mnemonic_secret() if get_backup_type() == BackupType.Bip39 else None
)
async def _refresh() -> Success | Failure:
from storage.device import get_backup_type, get_mnemonic_secret
from trezor.ui.layouts.sdcard_eject import make_user_eject_sdcard
from trezor.enums import BackupType
from storage.sd_seed_backup import refresh_backup_sdcard
await confirm_action(
"confirm_sd_backup_refresh",
"Refresh backup card",
action="Refresh action",
description="Refreshes backup card.",
verb="REFRESH",
hold=True,
hold_danger=True,
)
success = refresh_backup_sdcard(
get_mnemonic_secret() if get_backup_type() == BackupType.Bip39 else None
)
await make_user_eject_sdcard()
return (
Success("SD backup card refreshed.")
if success
else Failure("SD backup card refresh failed.")
)
async def _wipe() -> Success:
from storage.sd_seed_backup import wipe_backup_sdcard
await confirm_action(
"confirm_sd_backup_wipe",
"Wipe backup card",
action="Wipe action",
description="Erase backup card. This action is irreversible.",
verb="WIPE",
hold=True,
hold_danger=True,
)
wipe_backup_sdcard()
return Success("SD backup card wiped.")
async def _copy() -> Success | Failure:
from storage.sd_seed_backup import store_seed_on_sdcard, recover_seed_from_sdcard
from trezor.ui.layouts.sdcard_eject import make_user_eject_sdcard
from trezor.ui.layouts import show_warning
from apps.common.sdcard import get_serial_num
# TODO do we allow copying sd cards with seed different than the one stored on the device?
await confirm_action(
"confirm_sd_backup_copy",
"Copy backup card",
action="Do you really want to copy the backup SD card?",
)
read_mnemonic, read_backup_type = recover_seed_from_sdcard()
if read_mnemonic is None or read_backup_type is None:
return Failure("SD backup card copy failed.")
sn = get_serial_num()
await make_user_eject_sdcard()
while True:
await ensure_sdcard(ensure_filesystem=False)
new_sn = get_serial_num()
if new_sn == sn:
await show_warning(
"warning_sd_backup_same_card", "Insert a different card."
)
elif new_sn == 0:
return Failure("SD backup card copy failed.")
else:
break
# NOTE: should we delegate `mkfs` to `store_seed_on_sdcard` ?
# TODO: code repetition with reset_device/__init__.py: sdcard_backup_seed(...)
await ensure_sdcard(ensure_filesystem=True, for_sd_backup=True)
store_seed_on_sdcard(read_mnemonic, read_backup_type)
await make_user_eject_sdcard()
return Success("SD card backup copy succeeded")

@ -59,6 +59,9 @@ def _find_message_handler_module(msg_type: int) -> str:
if utils.USE_SD_CARD and msg_type == MessageType.SdProtect:
return "apps.management.sd_protect"
if utils.USE_SD_CARD and msg_type == MessageType.SdCardBackupManage:
return "apps.management.sd_backup_manage"
if utils.USE_OPTIGA and msg_type == MessageType.AuthenticateDevice:
return "apps.management.authenticate_device"

@ -6,6 +6,7 @@ from trezor import io, utils
from trezor.enums import BackupType
from trezor.sdcard import with_filesystem, with_sdcard
from trezor.wire import DataError, ProcessError
from trezor.messages import SdCardBackupHealth
if TYPE_CHECKING:
from enum import IntEnum
@ -20,20 +21,25 @@ if utils.USE_SD_CARD:
SDBACKUP_BLOCK_START = sdcard.BACKUP_BLOCK_START # global_import_cache
SDBACKUP_N_WRITINGS = 100 # TODO arbitrary for now
SDBACKUP_N_VERIFY = 10
assert SDBACKUP_N_WRITINGS > SDBACKUP_N_VERIFY
assert SDBACKUP_N_WRITINGS >= SDBACKUP_N_VERIFY
SDBACKUP_MAGIC = b"TRZM"
SDBACKUP_VERSION = 0
README_PATH = "README.txt"
README_CONTENT = b"This is a Trezor backup SD card."
EXPECTED_FS_CAP_B = 33_550_336 # TODO a programmatic approach to get to this number
# TODO enum might be a part of protobuf message, depends on the product
class BackupMedium(IntEnum):
Words = 0
SDCard = 1
@with_filesystem
@with_sdcard
def store_seed_on_sdcard(mnemonic_secret: bytes, backup_type: BackupType) -> None:
_write_seed_unalloc(mnemonic_secret, backup_type)
if _verify_backup(mnemonic_secret, backup_type):
# FIXME _write_readme might raise, should handle here
_write_readme()
else:
raise ProcessError("SD card verification failed")
@ -45,28 +51,136 @@ def recover_seed_from_sdcard() -> tuple[bytes | None, BackupType | None]:
@with_sdcard
def is_backup_present() -> bool:
def is_backup_present_on_sdcard() -> bool:
decoded_mnemonic, decoded_backup_type = _read_seed_unalloc()
return decoded_mnemonic is not None and decoded_backup_type is not None
@with_sdcard
def check_health_of_backup_sdcard(mnemonic_secret: bytes | None) -> SdCardBackupHealth:
def pt_check(r: SdCardBackupHealth) -> None:
"""
Partition check:
1) is the partition valid?
-> if so:
2) is the size correct?
3) README still present with valid content?
4) canary (TODO) still present?
5) other files appeared? TODO
"""
try:
fatfs.mount()
r.pt_is_mountable = True
r.pt_has_correct_cap = fatfs.get_capacity() == EXPECTED_FS_CAP_B
try:
with fatfs.open(README_PATH, "r") as f:
read_data = bytearray(len(README_CONTENT))
f.read(read_data)
r.pt_readme_present = True
r.pt_readme_content = read_data == README_CONTENT
except fatfs.FileNotFound:
r.pt_readme_present = False
except fatfs.FatFSError:
r.pt_readme_content = False
except fatfs.NoFilesystem:
r.pt_is_mountable = False
def unalloc_check(r: SdCardBackupHealth) -> None:
"""
# Unallocated space check:
# 1) count the number of corrupted seed writings at unallocated space
"""
block_buffer = bytearray(SDCARD_BLOCK_SIZE_B)
# If secret is supplied (expected for BIP-39), verify backup block against seed currently stored on the device.
# If secret is not supplied (expected for SLIP-39), check that backup blocks have valid hashes.
if mnemonic_secret is None:
verify_func = lambda block_idx: _verify_backup_block_by_hash(
block_idx, block_buffer
)
else:
verify_func = lambda block_idx: _verify_backup_block_by_seed(
mnemonic_secret, BackupType.Bip39, block_idx, block_buffer
)
res.unalloc_seed_corrupt = sum(
1 for block_idx in _storage_blocks_gen() if not verify_func(block_idx)
)
res = SdCardBackupHealth(
pt_is_mountable=False,
pt_has_correct_cap=False,
pt_readme_present=False,
pt_readme_content=False,
unalloc_seed_corrupt=SDBACKUP_N_WRITINGS,
)
pt_check(res)
unalloc_check(res)
return res
@with_sdcard
def refresh_backup_sdcard(mnemonic_secret: bytes | None) -> bool:
# proceed only if backup is present
# this also means that refresh won't be possible on complete wiped SD card
decoded_mnemonic, decoded_backup_type = _read_seed_unalloc()
if decoded_mnemonic is None or decoded_backup_type is None:
return False
if mnemonic_secret is not None and mnemonic_secret != decoded_mnemonic:
# If secret is supplied (expected for BIP-39), we expect that the seed on the card corresponds to the one on the device.
return False
# If secrect is not supplied (expected for SLIP39) or the secret corresponds to the one decoded from card, refresh.
fatfs.mkfs(True)
store_seed_on_sdcard(decoded_mnemonic, decoded_backup_type)
return True
@with_sdcard
def wipe_backup_sdcard() -> None:
empty_block = bytes([0xFF] * SDCARD_BLOCK_SIZE_B)
# erase first 1MiB to erase filesystem partition table
for block_idx in range(2048 // SDCARD_BLOCK_SIZE_B):
sdcard.write(block_idx, empty_block)
# erase backup blocks
for block_idx in _storage_blocks_gen():
sdcard.write(block_idx, empty_block)
def _verify_backup(mnemonic_secret: bytes, backup_type: BackupType) -> bool:
# verify SDBACKUP_N_VERIFY blocks at random
from trezor.crypto import random
block_buffer = bytearray(SDCARD_BLOCK_SIZE_B)
all_backup_blocks = list(_storage_blocks_gen())
for _ in range(SDBACKUP_N_VERIFY):
block_idx = random.uniform(len(all_backup_blocks))
sdcard.read(all_backup_blocks[block_idx], block_buffer)
decoded_mnemonic, decoded_backup_type = _decode_backup_block(block_buffer)
if decoded_mnemonic is None or decoded_backup_type is None:
return False
if decoded_mnemonic != mnemonic_secret or decoded_backup_type != backup_type:
rand_idx = random.uniform(len(all_backup_blocks))
if not _verify_backup_block_by_seed(
mnemonic_secret, backup_type, all_backup_blocks[rand_idx], block_buffer
):
return False
return True
def _verify_backup_block_by_seed(
mnemonic_secret: bytes, backup_type: BackupType, block_idx: int, buf: bytearray
) -> bool:
sdcard.read(block_idx, buf)
decoded_mnemonic, decoded_backup_type = _decode_backup_block(buf)
if decoded_mnemonic is None or decoded_backup_type is None:
return False
if decoded_mnemonic != mnemonic_secret or decoded_backup_type != backup_type:
return False
return True
def _verify_backup_block_by_hash(block_idx: int, buf: bytearray) -> bool:
sdcard.read(block_idx, buf)
return _decode_backup_block(buf) != (None, None)
def _write_seed_unalloc(mnemonic_secret: bytes, backup_type: BackupType) -> None:
# TODO: should we re-raise if sdcard.write fails?
block_to_write = _encode_backup_block(mnemonic_secret, backup_type)
for block_idx in _storage_blocks_gen():
sdcard.write(block_idx, block_to_write)
@ -98,6 +212,13 @@ def _storage_blocks_gen() -> Generator[int, None, None]:
)
def _write_readme() -> None:
fatfs.mount()
with fatfs.open(README_PATH, "x") as f:
f.write(README_CONTENT)
fatfs.unmount()
# Backup Memory Block Layout:
# +----------------------+------------------------+--------------------+-------------------------------+
# | SDBACKUP_MAGIC (4B) | SDBACKUP_VERSION (2B) | BACKUP_TYPE (1B) | SEED_LENGTH (2B) |
@ -168,8 +289,3 @@ def _decode_backup_block(block: bytes) -> tuple[bytes | None, BackupType | None]
except (ValueError, EOFError):
raise DataError("Trying to decode invalid SD card block.")
def _write_readme() -> None:
with fatfs.open("README.txt", "w") as f:
f.write(b"This is a Trezor backup SD card.")

@ -95,6 +95,8 @@ DebugLinkEraseSdCard = 9005
DebugLinkInsertSdCard = 9006
DebugLinkWatchLayout = 9007
DebugLinkResetDebugEvents = 9008
SdCardBackupManage = 1000
SdCardBackupHealth = 1001
if not utils.BITCOIN_ONLY:
SetU2FCounter = 63
GetNextU2FCounter = 80

@ -0,0 +1,8 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
CHECK = 0
REFRESH = 1
WIPE = 2
COPY = 3

@ -262,6 +262,8 @@ if TYPE_CHECKING:
SolanaAddress = 903
SolanaSignTx = 904
SolanaTxSignature = 905
SdCardBackupManage = 1000
SdCardBackupHealth = 1001
class FailureType(IntEnum):
UnexpectedMessage = 1
@ -454,6 +456,12 @@ if TYPE_CHECKING:
ScrambledWords = 0
Matrix = 1
class SdCardBackupManageOperationType(IntEnum):
CHECK = 0
REFRESH = 1
WIPE = 2
COPY = 3
class WordRequestType(IntEnum):
Plain = 0
Matrix9 = 1

@ -55,6 +55,7 @@ if TYPE_CHECKING:
from trezor.enums import RecoveryDeviceType # noqa: F401
from trezor.enums import RequestType # noqa: F401
from trezor.enums import SafetyCheckLevel # noqa: F401
from trezor.enums import SdCardBackupManageOperationType # noqa: F401
from trezor.enums import SdProtectOperationType # noqa: F401
from trezor.enums import StellarAssetType # noqa: F401
from trezor.enums import StellarMemoType # noqa: F401
@ -2537,6 +2538,42 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["RecoveryDevice"]:
return isinstance(msg, cls)
class SdCardBackupManage(protobuf.MessageType):
operation: "SdCardBackupManageOperationType"
def __init__(
self,
*,
operation: "SdCardBackupManageOperationType",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["SdCardBackupManage"]:
return isinstance(msg, cls)
class SdCardBackupHealth(protobuf.MessageType):
pt_is_mountable: "bool"
pt_has_correct_cap: "bool"
pt_readme_present: "bool"
pt_readme_content: "bool"
unalloc_seed_corrupt: "int"
def __init__(
self,
*,
pt_is_mountable: "bool",
pt_has_correct_cap: "bool",
pt_readme_present: "bool",
pt_readme_content: "bool",
unalloc_seed_corrupt: "int",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["SdCardBackupHealth"]:
return isinstance(msg, cls)
class WordRequest(protobuf.MessageType):
type: "WordRequestType"

@ -4,57 +4,183 @@ from storage.sd_seed_backup import *
from trezor import io, sdcard
from trezor.enums import BackupType
EMPTY_BLOCK = bytes([0xFF] * io.sdcard.BLOCK_SIZE)
class TestStorageSdSeedBackup(unittest.TestCase):
# TODO add more tests, also for repairing the backup card
def erase_sdcard(portion: float = 1.0):
"""
Helper function to erase a portion of virtual SD card.
`portion` param is supplied in range [0.0; 1.0].
Assumption: virtual SD card is inserted.
"""
assert 0.0 <= portion and portion <= 1.0
assert io.sdcard.is_present()
with sdcard.filesystem(mounted=False):
try:
n_blocks = io.sdcard.capacity() // io.sdcard.BLOCK_SIZE
for i in range(int(portion * n_blocks)):
io.sdcard.write(i, EMPTY_BLOCK)
except Exception:
pass
# TODO: SLIP-39 tests
class TestStorageSdSeedBackup(unittest.TestCase):
def setUp(self):
io.sdcard_inserter.insert(1)
self.mnemonic = (
b"crane mesh that gain predict open dice defy lottery toddler coin upgrade"
)
def tearDown(self):
io.sdcard_inserter.eject()
def test_backup_and_restore(self):
io.sdcard_inserter.insert(1, capacity_bytes=64 * 1024 * 1024)
io.sdcard.power_on()
io.fatfs.mkfs(True)
io.fatfs.mount()
io.fatfs.unmount()
def tearDown(self):
erase_sdcard()
io.sdcard.power_off()
io.sdcard_inserter.eject()
def test_backup_and_restore_basic(self):
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
restored_mnemonic, restored_backup_type = recover_seed_from_sdcard()
self.assertEqual(restored_mnemonic, self.mnemonic)
self.assertEqual(restored_backup_type, BackupType.Bip39)
io.fatfs.unmount()
io.sdcard.power_off()
def test_backup_and_partlywipe_then_restore(self):
with sdcard.filesystem(mounted=True):
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
def test_backup_and_restore_from_party_wiped(self):
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
# wipe half of the card, restore must succeed
block_buffer = bytearray(SDCARD_BLOCK_SIZE_B)
with sdcard.filesystem(mounted=False):
for block_num in range((io.sdcard.capacity() // 2) // io.sdcard.BLOCK_SIZE):
io.sdcard.write(block_num, block_buffer)
with sdcard.filesystem(mounted=False):
restored_mnemonic, restored_backup_type = recover_seed_from_sdcard()
self.assertEqual(restored_mnemonic, self.mnemonic)
self.assertEqual(restored_backup_type, BackupType.Bip39)
erase_sdcard(portion=0.5)
restored_mnemonic, restored_backup_type = recover_seed_from_sdcard()
self.assertEqual(restored_mnemonic, self.mnemonic)
self.assertEqual(restored_backup_type, BackupType.Bip39)
# remove everything, restore fails
erase_sdcard(portion=1.0)
restored_mnemonic, restored_backup_type = recover_seed_from_sdcard()
self.assertEqual(restored_mnemonic, None)
self.assertEqual(restored_backup_type, None)
def test_is_backup_present_on_sdcard(self):
self.assertFalse(is_backup_present_on_sdcard())
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
self.assertTrue(is_backup_present_on_sdcard())
erase_sdcard(portion=0.9)
self.assertTrue(is_backup_present_on_sdcard())
def test_check_health_of_backup_sdcard(self):
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
# uncorrupted backup
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertTrue(health.pt_is_mountable)
self.assertTrue(health.pt_has_correct_cap)
self.assertTrue(health.pt_readme_present)
self.assertTrue(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 0)
# overwrite one seed backup
with sdcard.filesystem(mounted=False):
for block_num in range(io.sdcard.capacity() // io.sdcard.BLOCK_SIZE):
io.sdcard.write(block_num, block_buffer)
io.sdcard.write(SDBACKUP_BLOCK_START, EMPTY_BLOCK)
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertTrue(health.pt_is_mountable)
self.assertTrue(health.pt_has_correct_cap)
self.assertTrue(health.pt_readme_present)
self.assertTrue(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 1)
# change the informative file in FS
with sdcard.filesystem(mounted=True):
with fatfs.open(README_PATH, '+') as f:
f.write(b'abc')
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertTrue(health.pt_is_mountable)
self.assertTrue(health.pt_has_correct_cap)
self.assertTrue(health.pt_readme_present)
self.assertFalse(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 1)
# remove informative file from FS
with sdcard.filesystem(mounted=True):
fatfs.unlink(README_PATH)
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertTrue(health.pt_is_mountable)
self.assertTrue(health.pt_has_correct_cap)
self.assertFalse(health.pt_readme_present)
self.assertFalse(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 1)
# recreate FS over the whole card
with sdcard.filesystem(mounted=False):
restored_mnemonic, restored_backup_type = recover_seed_from_sdcard()
self.assertEqual(restored_mnemonic, None)
self.assertEqual(restored_backup_type, None)
fatfs.mkfs()
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertTrue(health.pt_is_mountable)
self.assertFalse(health.pt_has_correct_cap)
self.assertFalse(health.pt_readme_present)
self.assertFalse(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 1)
# erase a portion of the card to destory FS partition table
erase_sdcard(portion=0.1)
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertFalse(health.pt_is_mountable)
self.assertFalse(health.pt_has_correct_cap)
self.assertFalse(health.pt_readme_present)
self.assertFalse(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 1)
# erase the whole card
erase_sdcard(portion=1.0)
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertFalse(health.pt_is_mountable)
self.assertFalse(health.pt_has_correct_cap)
self.assertFalse(health.pt_readme_present)
self.assertFalse(health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, SDBACKUP_N_WRITINGS)
def test_refresh_backup_sdcard(self):
def assert_backup_health(flg: bool = True) -> None:
health = check_health_of_backup_sdcard(self.mnemonic)
self.assertEqual(flg, health.pt_is_mountable)
self.assertEqual(flg, health.pt_is_mountable)
self.assertEqual(flg, health.pt_has_correct_cap)
self.assertEqual(flg, health.pt_readme_present)
self.assertEqual(flg, health.pt_readme_content)
self.assertEqual(health.unalloc_seed_corrupt, 0)
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
assert_backup_health()
# damage the backup
erase_sdcard(portion=0.5)
assert_backup_health(False)
# trying to refresh with a different seed must fail
mnemonic_faulty = (
b"all all all all all all all all all all all all"
)
self.assertFalse(refresh_backup_sdcard(mnemonic_faulty))
assert_backup_health(False)
refresh_backup_sdcard(self.mnemonic)
assert_backup_health()
def test_wipe_backup_sdcard(self):
store_seed_on_sdcard(self.mnemonic, BackupType.Bip39)
self.assertTrue(is_backup_present_on_sdcard())
wipe_backup_sdcard()
self.assertFalse(is_backup_present_on_sdcard())
if __name__ == "__main__":

@ -0,0 +1,40 @@
from typing import TYPE_CHECKING, Optional
import click
from .. import messages, sd_backup
from . import with_client
if TYPE_CHECKING:
from ..client import TrezorClient
@click.group(name="sd-backup")
def cli() -> None:
"""SD backup management commands."""
@cli.command()
@with_client
def check(client: "TrezorClient") -> messages.SdCardBackupHealth:
"""Check health of SD backup."""
return sd_backup.check(client)
@cli.command()
@with_client
def refresh(client: "TrezorClient") -> messages.Success:
"""Refresh data on the SD backup card."""
return sd_backup.refresh(client)
@cli.command()
@with_client
def wipe(client: "TrezorClient") -> messages.Success:
"""Wipe the backup from SD card !!!CAUTION: IRREVERSIBLE OPERATION!!!"""
return sd_backup.wipe(client)
@cli.command()
@with_client
def copy(client: "TrezorClient") -> messages.Success | messages.Failure:
"""Copy a backup SD card to another SD card."""
return sd_backup.copy(client)

@ -45,6 +45,7 @@ from . import (
monero,
nem,
ripple,
sd_backup,
settings,
solana,
stellar,
@ -405,6 +406,7 @@ cli.add_command(cardano.cli)
cli.add_command(cosi.cli)
cli.add_command(crypto.cli)
cli.add_command(device.cli)
cli.add_command(sd_backup.cli)
cli.add_command(eos.cli)
cli.add_command(ethereum.cli)
cli.add_command(fido.cli)

@ -270,6 +270,8 @@ class MessageType(IntEnum):
SolanaAddress = 903
SolanaSignTx = 904
SolanaTxSignature = 905
SdCardBackupManage = 1000
SdCardBackupHealth = 1001
class FailureType(IntEnum):
@ -488,6 +490,13 @@ class RecoveryDeviceType(IntEnum):
Matrix = 1
class SdCardBackupManageOperationType(IntEnum):
CHECK = 0
REFRESH = 1
WIPE = 2
COPY = 3
class WordRequestType(IntEnum):
Plain = 0
Matrix9 = 1
@ -3686,6 +3695,46 @@ class RecoveryDevice(protobuf.MessageType):
self.dry_run = dry_run
class SdCardBackupManage(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 1000
FIELDS = {
1: protobuf.Field("operation", "SdCardBackupManageOperationType", repeated=False, required=True),
}
def __init__(
self,
*,
operation: "SdCardBackupManageOperationType",
) -> None:
self.operation = operation
class SdCardBackupHealth(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 1001
FIELDS = {
1: protobuf.Field("pt_is_mountable", "bool", repeated=False, required=True),
2: protobuf.Field("pt_has_correct_cap", "bool", repeated=False, required=True),
3: protobuf.Field("pt_readme_present", "bool", repeated=False, required=True),
4: protobuf.Field("pt_readme_content", "bool", repeated=False, required=True),
5: protobuf.Field("unalloc_seed_corrupt", "uint32", repeated=False, required=True),
}
def __init__(
self,
*,
pt_is_mountable: "bool",
pt_has_correct_cap: "bool",
pt_readme_present: "bool",
pt_readme_content: "bool",
unalloc_seed_corrupt: "int",
) -> None:
self.pt_is_mountable = pt_is_mountable
self.pt_has_correct_cap = pt_has_correct_cap
self.pt_readme_present = pt_readme_present
self.pt_readme_content = pt_readme_content
self.unalloc_seed_corrupt = unalloc_seed_corrupt
class WordRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 46
FIELDS = {

@ -0,0 +1,36 @@
from typing import TYPE_CHECKING
from . import messages
from .tools import expect, session
if TYPE_CHECKING:
from .client import TrezorClient
from .protobuf import MessageType
@expect(messages.SdCardBackupHealth)
@session
def check(client: "TrezorClient") -> "MessageType":
return client.call(
messages.SdCardBackupManage(operation=messages.SdCardBackupManageOperationType.CHECK)
)
@expect(messages.Success)
@session
def refresh(client: "TrezorClient") -> "MessageType":
return client.call(
messages.SdCardBackupManage(operation=messages.SdCardBackupManageOperationType.REFRESH)
)
@expect(messages.Success)
@session
def wipe(client: "TrezorClient") -> "MessageType":
return client.call(
messages.SdCardBackupManage(operation=messages.SdCardBackupManageOperationType.WIPE)
)
@expect(messages.Success)
@session
def copy(client: "TrezorClient") -> "MessageType":
return client.call(
messages.SdCardBackupManage(operation=messages.SdCardBackupManageOperationType.COPY)
)

@ -247,6 +247,8 @@ trezor_message_impl! {
SolanaAddress => MessageType_SolanaAddress,
SolanaSignTx => MessageType_SolanaSignTx,
SolanaTxSignature => MessageType_SolanaTxSignature,
SdCardBackupManage => MessageType_SdCardBackupManage,
SdCardBackupHealth => MessageType_SdCardBackupHealth,
}
#[cfg(feature = "stellar")]

@ -510,6 +510,10 @@ pub enum MessageType {
MessageType_SolanaSignTx = 904,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SolanaTxSignature)
MessageType_SolanaTxSignature = 905,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SdCardBackupManage)
MessageType_SdCardBackupManage = 1000,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_SdCardBackupHealth)
MessageType_SdCardBackupHealth = 1001,
}
impl ::protobuf::Enum for MessageType {
@ -762,6 +766,8 @@ impl ::protobuf::Enum for MessageType {
903 => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress),
904 => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx),
905 => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature),
1000 => ::std::option::Option::Some(MessageType::MessageType_SdCardBackupManage),
1001 => ::std::option::Option::Some(MessageType::MessageType_SdCardBackupHealth),
_ => ::std::option::Option::None
}
}
@ -1009,6 +1015,8 @@ impl ::protobuf::Enum for MessageType {
"MessageType_SolanaAddress" => ::std::option::Option::Some(MessageType::MessageType_SolanaAddress),
"MessageType_SolanaSignTx" => ::std::option::Option::Some(MessageType::MessageType_SolanaSignTx),
"MessageType_SolanaTxSignature" => ::std::option::Option::Some(MessageType::MessageType_SolanaTxSignature),
"MessageType_SdCardBackupManage" => ::std::option::Option::Some(MessageType::MessageType_SdCardBackupManage),
"MessageType_SdCardBackupHealth" => ::std::option::Option::Some(MessageType::MessageType_SdCardBackupHealth),
_ => ::std::option::Option::None
}
}
@ -1255,6 +1263,8 @@ impl ::protobuf::Enum for MessageType {
MessageType::MessageType_SolanaAddress,
MessageType::MessageType_SolanaSignTx,
MessageType::MessageType_SolanaTxSignature,
MessageType::MessageType_SdCardBackupManage,
MessageType::MessageType_SdCardBackupHealth,
];
}
@ -1507,6 +1517,8 @@ impl ::protobuf::EnumFull for MessageType {
MessageType::MessageType_SolanaAddress => 238,
MessageType::MessageType_SolanaSignTx => 239,
MessageType::MessageType_SolanaTxSignature => 240,
MessageType::MessageType_SdCardBackupManage => 241,
MessageType::MessageType_SdCardBackupHealth => 242,
};
Self::enum_descriptor().value_by_index(index)
}
@ -1556,7 +1568,7 @@ pub mod exts {
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\x20google/protobuf/de\
scriptor.proto*\xbdS\n\x0bMessageType\x12(\n\x16MessageType_Initialize\
scriptor.proto*\x9bT\n\x0bMessageType\x12(\n\x16MessageType_Initialize\
\x10\0\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\
\x10MessageType_Ping\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12\
%\n\x13MessageType_Success\x10\x02\x1a\x0c\x80\xa6\x1d\x01\xa8\xb5\x18\
@ -1828,30 +1840,32 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x07\x1a\x04\x90\xb5\x18\x01\x12$\n\x19MessageType_SolanaAddress\x10\x87\
\x07\x1a\x04\x98\xb5\x18\x01\x12#\n\x18MessageType_SolanaSignTx\x10\x88\
\x07\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_SolanaTxSignature\x10\
\x89\x07\x1a\x04\x98\xb5\x18\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\
\\\"\x04\x08r\x10z\"\x06\x08\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\
\xe0\x01\"\x06\x08\xac\x02\x10\xb0\x02\"\x06\x08\xb5\x02\x10\xb8\x02:<\n\
\x07wire_in\x18\xd2\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueO\
ptionsR\x06wireIn:>\n\x08wire_out\x18\xd3\x86\x03\x20\x01(\x08\x12!.goog\
le.protobuf.EnumValueOptionsR\x07wireOut:G\n\rwire_debug_in\x18\xd4\x86\
\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0bwireDebugIn:\
I\n\x0ewire_debug_out\x18\xd5\x86\x03\x20\x01(\x08\x12!.google.protobuf.\
EnumValueOptionsR\x0cwireDebugOut:@\n\twire_tiny\x18\xd6\x86\x03\x20\x01\
(\x08\x12!.google.protobuf.EnumValueOptionsR\x08wireTiny:L\n\x0fwire_boo\
tloader\x18\xd7\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptio\
nsR\x0ewireBootloader:C\n\x0bwire_no_fsm\x18\xd8\x86\x03\x20\x01(\x08\
\x12!.google.protobuf.EnumValueOptionsR\twireNoFsm:F\n\x0cbitcoin_only\
\x18\xe0\xd4\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0b\
bitcoinOnly:U\n\x17has_bitcoin_only_values\x18\xb9\x8e\x03\x20\x01(\x08\
\x12\x1c.google.protobuf.EnumOptionsR\x14hasBitcoinOnlyValues:T\n\x14exp\
erimental_message\x18\xa1\x96\x03\x20\x01(\x08\x12\x1f.google.protobuf.M\
essageOptionsR\x13experimentalMessage:>\n\twire_type\x18\xa2\x96\x03\x20\
\x01(\r\x12\x1f.google.protobuf.MessageOptionsR\x08wireType:N\n\x12exper\
imental_field\x18\x89\x9e\x03\x20\x01(\x08\x12\x1d.google.protobuf.Field\
OptionsR\x11experimentalField:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\
\x03\x20\x01(\x08\x12\x1c.google.protobuf.FileOptionsR\x14includeInBitco\
inOnlyB8\n#com.satoshilabs.trezor.lib.protobufB\rTrezorMessage\x80\xa6\
\x1d\x01\
\x89\x07\x1a\x04\x98\xb5\x18\x01\x12-\n\x1eMessageType_SdCardBackupManag\
e\x10\xe8\x07\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12-\n\x1eMessageT\
ype_SdCardBackupHealth\x10\xe9\x07\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\
\x01\x1a\x04\xc8\xf3\x18\x01\"\x04\x08Z\x10\\\"\x04\x08r\x10z\"\x06\x08\
\xdb\x01\x10\xdb\x01\"\x06\x08\xe0\x01\x10\xe0\x01\"\x06\x08\xac\x02\x10\
\xb0\x02\"\x06\x08\xb5\x02\x10\xb8\x02:<\n\x07wire_in\x18\xd2\x86\x03\
\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x06wireIn:>\n\x08wi\
re_out\x18\xd3\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOption\
sR\x07wireOut:G\n\rwire_debug_in\x18\xd4\x86\x03\x20\x01(\x08\x12!.googl\
e.protobuf.EnumValueOptionsR\x0bwireDebugIn:I\n\x0ewire_debug_out\x18\
\xd5\x86\x03\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0cwire\
DebugOut:@\n\twire_tiny\x18\xd6\x86\x03\x20\x01(\x08\x12!.google.protobu\
f.EnumValueOptionsR\x08wireTiny:L\n\x0fwire_bootloader\x18\xd7\x86\x03\
\x20\x01(\x08\x12!.google.protobuf.EnumValueOptionsR\x0ewireBootloader:C\
\n\x0bwire_no_fsm\x18\xd8\x86\x03\x20\x01(\x08\x12!.google.protobuf.Enum\
ValueOptionsR\twireNoFsm:F\n\x0cbitcoin_only\x18\xe0\xd4\x03\x20\x01(\
\x08\x12!.google.protobuf.EnumValueOptionsR\x0bbitcoinOnly:U\n\x17has_bi\
tcoin_only_values\x18\xb9\x8e\x03\x20\x01(\x08\x12\x1c.google.protobuf.E\
numOptionsR\x14hasBitcoinOnlyValues:T\n\x14experimental_message\x18\xa1\
\x96\x03\x20\x01(\x08\x12\x1f.google.protobuf.MessageOptionsR\x13experim\
entalMessage:>\n\twire_type\x18\xa2\x96\x03\x20\x01(\r\x12\x1f.google.pr\
otobuf.MessageOptionsR\x08wireType:N\n\x12experimental_field\x18\x89\x9e\
\x03\x20\x01(\x08\x12\x1d.google.protobuf.FieldOptionsR\x11experimentalF\
ield:U\n\x17include_in_bitcoin_only\x18\xe0\xd4\x03\x20\x01(\x08\x12\x1c\
.google.protobuf.FileOptionsR\x14includeInBitcoinOnlyB8\n#com.satoshilab\
s.trezor.lib.protobufB\rTrezorMessage\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file

@ -7346,6 +7346,532 @@ pub mod recovery_device {
}
}
// @@protoc_insertion_point(message:hw.trezor.messages.management.SdCardBackupManage)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupManage {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupManage.operation)
pub operation: ::std::option::Option<::protobuf::EnumOrUnknown<sd_card_backup_manage::SdCardBackupManageOperationType>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.management.SdCardBackupManage.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupManage {
fn default() -> &'a SdCardBackupManage {
<SdCardBackupManage as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupManage {
pub fn new() -> SdCardBackupManage {
::std::default::Default::default()
}
// required .hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType operation = 1;
pub fn operation(&self) -> sd_card_backup_manage::SdCardBackupManageOperationType {
match self.operation {
Some(e) => e.enum_value_or(sd_card_backup_manage::SdCardBackupManageOperationType::CHECK),
None => sd_card_backup_manage::SdCardBackupManageOperationType::CHECK,
}
}
pub fn clear_operation(&mut self) {
self.operation = ::std::option::Option::None;
}
pub fn has_operation(&self) -> bool {
self.operation.is_some()
}
// Param is passed by value, moved
pub fn set_operation(&mut self, v: sd_card_backup_manage::SdCardBackupManageOperationType) {
self.operation = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v));
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(1);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"operation",
|m: &SdCardBackupManage| { &m.operation },
|m: &mut SdCardBackupManage| { &mut m.operation },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupManage>(
"SdCardBackupManage",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupManage {
const NAME: &'static str = "SdCardBackupManage";
fn is_initialized(&self) -> bool {
if self.operation.is_none() {
return false;
}
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
8 => {
self.operation = ::std::option::Option::Some(is.read_enum_or_unknown()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.operation {
my_size += ::protobuf::rt::int32_size(1, v.value());
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.operation {
os.write_enum(1, ::protobuf::EnumOrUnknown::value(&v))?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupManage {
SdCardBackupManage::new()
}
fn clear(&mut self) {
self.operation = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupManage {
static instance: SdCardBackupManage = SdCardBackupManage {
operation: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupManage {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupManage").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupManage {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupManage {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
/// Nested message and enums of message `SdCardBackupManage`
pub mod sd_card_backup_manage {
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType)
pub enum SdCardBackupManageOperationType {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType.CHECK)
CHECK = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType.REFRESH)
REFRESH = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType.WIPE)
WIPE = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperationType.COPY)
COPY = 3,
}
impl ::protobuf::Enum for SdCardBackupManageOperationType {
const NAME: &'static str = "SdCardBackupManageOperationType";
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<SdCardBackupManageOperationType> {
match value {
0 => ::std::option::Option::Some(SdCardBackupManageOperationType::CHECK),
1 => ::std::option::Option::Some(SdCardBackupManageOperationType::REFRESH),
2 => ::std::option::Option::Some(SdCardBackupManageOperationType::WIPE),
3 => ::std::option::Option::Some(SdCardBackupManageOperationType::COPY),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<SdCardBackupManageOperationType> {
match str {
"CHECK" => ::std::option::Option::Some(SdCardBackupManageOperationType::CHECK),
"REFRESH" => ::std::option::Option::Some(SdCardBackupManageOperationType::REFRESH),
"WIPE" => ::std::option::Option::Some(SdCardBackupManageOperationType::WIPE),
"COPY" => ::std::option::Option::Some(SdCardBackupManageOperationType::COPY),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [SdCardBackupManageOperationType] = &[
SdCardBackupManageOperationType::CHECK,
SdCardBackupManageOperationType::REFRESH,
SdCardBackupManageOperationType::WIPE,
SdCardBackupManageOperationType::COPY,
];
}
impl ::protobuf::EnumFull for SdCardBackupManageOperationType {
fn enum_descriptor() -> ::protobuf::reflect::EnumDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::EnumDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| super::file_descriptor().enum_by_package_relative_name("SdCardBackupManage.SdCardBackupManageOperationType").unwrap()).clone()
}
fn descriptor(&self) -> ::protobuf::reflect::EnumValueDescriptor {
let index = *self as usize;
Self::enum_descriptor().value_by_index(index)
}
}
impl ::std::default::Default for SdCardBackupManageOperationType {
fn default() -> Self {
SdCardBackupManageOperationType::CHECK
}
}
impl SdCardBackupManageOperationType {
pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<SdCardBackupManageOperationType>("SdCardBackupManage.SdCardBackupManageOperationType")
}
}
}
// @@protoc_insertion_point(message:hw.trezor.messages.management.SdCardBackupHealth)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupHealth {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupHealth.pt_is_mountable)
pub pt_is_mountable: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupHealth.pt_has_correct_cap)
pub pt_has_correct_cap: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupHealth.pt_readme_present)
pub pt_readme_present: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupHealth.pt_readme_content)
pub pt_readme_content: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.SdCardBackupHealth.unalloc_seed_corrupt)
pub unalloc_seed_corrupt: ::std::option::Option<u32>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.management.SdCardBackupHealth.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupHealth {
fn default() -> &'a SdCardBackupHealth {
<SdCardBackupHealth as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupHealth {
pub fn new() -> SdCardBackupHealth {
::std::default::Default::default()
}
// required bool pt_is_mountable = 1;
pub fn pt_is_mountable(&self) -> bool {
self.pt_is_mountable.unwrap_or(false)
}
pub fn clear_pt_is_mountable(&mut self) {
self.pt_is_mountable = ::std::option::Option::None;
}
pub fn has_pt_is_mountable(&self) -> bool {
self.pt_is_mountable.is_some()
}
// Param is passed by value, moved
pub fn set_pt_is_mountable(&mut self, v: bool) {
self.pt_is_mountable = ::std::option::Option::Some(v);
}
// required bool pt_has_correct_cap = 2;
pub fn pt_has_correct_cap(&self) -> bool {
self.pt_has_correct_cap.unwrap_or(false)
}
pub fn clear_pt_has_correct_cap(&mut self) {
self.pt_has_correct_cap = ::std::option::Option::None;
}
pub fn has_pt_has_correct_cap(&self) -> bool {
self.pt_has_correct_cap.is_some()
}
// Param is passed by value, moved
pub fn set_pt_has_correct_cap(&mut self, v: bool) {
self.pt_has_correct_cap = ::std::option::Option::Some(v);
}
// required bool pt_readme_present = 3;
pub fn pt_readme_present(&self) -> bool {
self.pt_readme_present.unwrap_or(false)
}
pub fn clear_pt_readme_present(&mut self) {
self.pt_readme_present = ::std::option::Option::None;
}
pub fn has_pt_readme_present(&self) -> bool {
self.pt_readme_present.is_some()
}
// Param is passed by value, moved
pub fn set_pt_readme_present(&mut self, v: bool) {
self.pt_readme_present = ::std::option::Option::Some(v);
}
// required bool pt_readme_content = 4;
pub fn pt_readme_content(&self) -> bool {
self.pt_readme_content.unwrap_or(false)
}
pub fn clear_pt_readme_content(&mut self) {
self.pt_readme_content = ::std::option::Option::None;
}
pub fn has_pt_readme_content(&self) -> bool {
self.pt_readme_content.is_some()
}
// Param is passed by value, moved
pub fn set_pt_readme_content(&mut self, v: bool) {
self.pt_readme_content = ::std::option::Option::Some(v);
}
// required uint32 unalloc_seed_corrupt = 5;
pub fn unalloc_seed_corrupt(&self) -> u32 {
self.unalloc_seed_corrupt.unwrap_or(0)
}
pub fn clear_unalloc_seed_corrupt(&mut self) {
self.unalloc_seed_corrupt = ::std::option::Option::None;
}
pub fn has_unalloc_seed_corrupt(&self) -> bool {
self.unalloc_seed_corrupt.is_some()
}
// Param is passed by value, moved
pub fn set_unalloc_seed_corrupt(&mut self, v: u32) {
self.unalloc_seed_corrupt = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(5);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_is_mountable",
|m: &SdCardBackupHealth| { &m.pt_is_mountable },
|m: &mut SdCardBackupHealth| { &mut m.pt_is_mountable },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_has_correct_cap",
|m: &SdCardBackupHealth| { &m.pt_has_correct_cap },
|m: &mut SdCardBackupHealth| { &mut m.pt_has_correct_cap },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_readme_present",
|m: &SdCardBackupHealth| { &m.pt_readme_present },
|m: &mut SdCardBackupHealth| { &mut m.pt_readme_present },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_readme_content",
|m: &SdCardBackupHealth| { &m.pt_readme_content },
|m: &mut SdCardBackupHealth| { &mut m.pt_readme_content },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"unalloc_seed_corrupt",
|m: &SdCardBackupHealth| { &m.unalloc_seed_corrupt },
|m: &mut SdCardBackupHealth| { &mut m.unalloc_seed_corrupt },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupHealth>(
"SdCardBackupHealth",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupHealth {
const NAME: &'static str = "SdCardBackupHealth";
fn is_initialized(&self) -> bool {
if self.pt_is_mountable.is_none() {
return false;
}
if self.pt_has_correct_cap.is_none() {
return false;
}
if self.pt_readme_present.is_none() {
return false;
}
if self.pt_readme_content.is_none() {
return false;
}
if self.unalloc_seed_corrupt.is_none() {
return false;
}
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
8 => {
self.pt_is_mountable = ::std::option::Option::Some(is.read_bool()?);
},
16 => {
self.pt_has_correct_cap = ::std::option::Option::Some(is.read_bool()?);
},
24 => {
self.pt_readme_present = ::std::option::Option::Some(is.read_bool()?);
},
32 => {
self.pt_readme_content = ::std::option::Option::Some(is.read_bool()?);
},
40 => {
self.unalloc_seed_corrupt = ::std::option::Option::Some(is.read_uint32()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.pt_is_mountable {
my_size += 1 + 1;
}
if let Some(v) = self.pt_has_correct_cap {
my_size += 1 + 1;
}
if let Some(v) = self.pt_readme_present {
my_size += 1 + 1;
}
if let Some(v) = self.pt_readme_content {
my_size += 1 + 1;
}
if let Some(v) = self.unalloc_seed_corrupt {
my_size += ::protobuf::rt::uint32_size(5, v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.pt_is_mountable {
os.write_bool(1, v)?;
}
if let Some(v) = self.pt_has_correct_cap {
os.write_bool(2, v)?;
}
if let Some(v) = self.pt_readme_present {
os.write_bool(3, v)?;
}
if let Some(v) = self.pt_readme_content {
os.write_bool(4, v)?;
}
if let Some(v) = self.unalloc_seed_corrupt {
os.write_uint32(5, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupHealth {
SdCardBackupHealth::new()
}
fn clear(&mut self) {
self.pt_is_mountable = ::std::option::Option::None;
self.pt_has_correct_cap = ::std::option::Option::None;
self.pt_readme_present = ::std::option::Option::None;
self.pt_readme_content = ::std::option::Option::None;
self.unalloc_seed_corrupt = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupHealth {
static instance: SdCardBackupHealth = SdCardBackupHealth {
pt_is_mountable: ::std::option::Option::None,
pt_has_correct_cap: ::std::option::Option::None,
pt_readme_present: ::std::option::Option::None,
pt_readme_content: ::std::option::Option::None,
unalloc_seed_corrupt: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupHealth {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupHealth").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupHealth {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupHealth {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.management.WordRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct WordRequest {
@ -9818,32 +10344,42 @@ static file_descriptor_proto_data: &'static [u8] = b"\
anagement.RecoveryDevice.RecoveryDeviceTypeR\x04type\x12\x1f\n\x0bu2f_co\
unter\x18\t\x20\x01(\rR\nu2fCounter\x12\x17\n\x07dry_run\x18\n\x20\x01(\
\x08R\x06dryRun\"Z\n\x12RecoveryDeviceType\x12%\n!RecoveryDeviceType_Scr\
ambledWords\x10\0\x12\x1d\n\x19RecoveryDeviceType_Matrix\x10\x01\"\xc5\
\x01\n\x0bWordRequest\x12N\n\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.me\
ssages.management.WordRequest.WordRequestTypeR\x04type\"f\n\x0fWordReque\
stType\x12\x19\n\x15WordRequestType_Plain\x10\0\x12\x1b\n\x17WordRequest\
Type_Matrix9\x10\x01\x12\x1b\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\
\n\x07WordAck\x12\x12\n\x04word\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2F\
Counter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\
\x11GetNextU2FCounter\"1\n\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\
\x18\x01\x20\x02(\rR\nu2fCounter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14P\
reauthorizedRequest\"\x15\n\x13CancelAuthorization\"\xe5\x01\n\x12Reboot\
ToBootloader\x12o\n\x0cboot_command\x18\x01\x20\x01(\x0e2=.hw.trezor.mes\
sages.management.RebootToBootloader.BootCommand:\rSTOP_AND_WAITR\x0bboot\
Command\x12'\n\x0ffirmware_header\x18\x02\x20\x01(\x0cR\x0efirmwareHeade\
r\"5\n\x0bBootCommand\x12\x11\n\rSTOP_AND_WAIT\x10\0\x12\x13\n\x0fINSTAL\
L_UPGRADE\x10\x01\"\x10\n\x08GetNonce:\x04\x88\xb2\x19\x01\"#\n\x05Nonce\
\x12\x14\n\x05nonce\x18\x01\x20\x02(\x0cR\x05nonce:\x04\x88\xb2\x19\x01\
\";\n\nUnlockPath\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\
\x12\x10\n\x03mac\x18\x02\x20\x01(\x0cR\x03mac\"'\n\x13UnlockedPathReque\
st\x12\x10\n\x03mac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12ShowDeviceTu\
torial\"\x12\n\x10UnlockBootloader*>\n\nBackupType\x12\t\n\x05Bip39\x10\
\0\x12\x10\n\x0cSlip39_Basic\x10\x01\x12\x13\n\x0fSlip39_Advanced\x10\
\x02*G\n\x10SafetyCheckLevel\x12\n\n\x06Strict\x10\0\x12\x10\n\x0cPrompt\
Always\x10\x01\x12\x15\n\x11PromptTemporarily\x10\x02*0\n\x10HomescreenF\
ormat\x12\x08\n\x04Toif\x10\x01\x12\x08\n\x04Jpeg\x10\x02\x12\x08\n\x04T\
oiG\x10\x03BB\n#com.satoshilabs.trezor.lib.protobufB\x17TrezorMessageMan\
agement\x80\xa6\x1d\x01\
ambledWords\x10\0\x12\x1d\n\x19RecoveryDeviceType_Matrix\x10\x01\"\xd4\
\x01\n\x12SdCardBackupManage\x12o\n\toperation\x18\x01\x20\x02(\x0e2Q.hw\
.trezor.messages.management.SdCardBackupManage.SdCardBackupManageOperati\
onTypeR\toperation\"M\n\x1fSdCardBackupManageOperationType\x12\t\n\x05CH\
ECK\x10\0\x12\x0b\n\x07REFRESH\x10\x01\x12\x08\n\x04WIPE\x10\x02\x12\x08\
\n\x04COPY\x10\x03\"\xf3\x01\n\x12SdCardBackupHealth\x12&\n\x0fpt_is_mou\
ntable\x18\x01\x20\x02(\x08R\rptIsMountable\x12+\n\x12pt_has_correct_cap\
\x18\x02\x20\x02(\x08R\x0fptHasCorrectCap\x12*\n\x11pt_readme_present\
\x18\x03\x20\x02(\x08R\x0fptReadmePresent\x12*\n\x11pt_readme_content\
\x18\x04\x20\x02(\x08R\x0fptReadmeContent\x120\n\x14unalloc_seed_corrupt\
\x18\x05\x20\x02(\rR\x12unallocSeedCorrupt\"\xc5\x01\n\x0bWordRequest\
\x12N\n\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.messages.management.Wor\
dRequest.WordRequestTypeR\x04type\"f\n\x0fWordRequestType\x12\x19\n\x15W\
ordRequestType_Plain\x10\0\x12\x1b\n\x17WordRequestType_Matrix9\x10\x01\
\x12\x1b\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\n\x07WordAck\x12\x12\
\n\x04word\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2FCounter\x12\x1f\n\x0b\
u2f_counter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\x11GetNextU2FCounter\
\"1\n\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2\
fCounter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14PreauthorizedRequest\"\
\x15\n\x13CancelAuthorization\"\xe5\x01\n\x12RebootToBootloader\x12o\n\
\x0cboot_command\x18\x01\x20\x01(\x0e2=.hw.trezor.messages.management.Re\
bootToBootloader.BootCommand:\rSTOP_AND_WAITR\x0bbootCommand\x12'\n\x0ff\
irmware_header\x18\x02\x20\x01(\x0cR\x0efirmwareHeader\"5\n\x0bBootComma\
nd\x12\x11\n\rSTOP_AND_WAIT\x10\0\x12\x13\n\x0fINSTALL_UPGRADE\x10\x01\"\
\x10\n\x08GetNonce:\x04\x88\xb2\x19\x01\"#\n\x05Nonce\x12\x14\n\x05nonce\
\x18\x01\x20\x02(\x0cR\x05nonce:\x04\x88\xb2\x19\x01\";\n\nUnlockPath\
\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\x08addressN\x12\x10\n\x03mac\
\x18\x02\x20\x01(\x0cR\x03mac\"'\n\x13UnlockedPathRequest\x12\x10\n\x03m\
ac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12ShowDeviceTutorial\"\x12\n\
\x10UnlockBootloader*>\n\nBackupType\x12\t\n\x05Bip39\x10\0\x12\x10\n\
\x0cSlip39_Basic\x10\x01\x12\x13\n\x0fSlip39_Advanced\x10\x02*G\n\x10Saf\
etyCheckLevel\x12\n\n\x06Strict\x10\0\x12\x10\n\x0cPromptAlways\x10\x01\
\x12\x15\n\x11PromptTemporarily\x10\x02*0\n\x10HomescreenFormat\x12\x08\
\n\x04Toif\x10\x01\x12\x08\n\x04Jpeg\x10\x02\x12\x08\n\x04ToiG\x10\x03BB\
\n#com.satoshilabs.trezor.lib.protobufB\x17TrezorMessageManagement\x80\
\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file
@ -9862,7 +10398,7 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::messages::file_descriptor().clone());
let mut messages = ::std::vec::Vec::with_capacity(41);
let mut messages = ::std::vec::Vec::with_capacity(43);
messages.push(Initialize::generated_message_descriptor_data());
messages.push(GetFeatures::generated_message_descriptor_data());
messages.push(Features::generated_message_descriptor_data());
@ -9889,6 +10425,8 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(EntropyRequest::generated_message_descriptor_data());
messages.push(EntropyAck::generated_message_descriptor_data());
messages.push(RecoveryDevice::generated_message_descriptor_data());
messages.push(SdCardBackupManage::generated_message_descriptor_data());
messages.push(SdCardBackupHealth::generated_message_descriptor_data());
messages.push(WordRequest::generated_message_descriptor_data());
messages.push(WordAck::generated_message_descriptor_data());
messages.push(SetU2FCounter::generated_message_descriptor_data());
@ -9904,13 +10442,14 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(UnlockedPathRequest::generated_message_descriptor_data());
messages.push(ShowDeviceTutorial::generated_message_descriptor_data());
messages.push(UnlockBootloader::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(8);
let mut enums = ::std::vec::Vec::with_capacity(9);
enums.push(BackupType::generated_enum_descriptor_data());
enums.push(SafetyCheckLevel::generated_enum_descriptor_data());
enums.push(HomescreenFormat::generated_enum_descriptor_data());
enums.push(features::Capability::generated_enum_descriptor_data());
enums.push(sd_protect::SdProtectOperationType::generated_enum_descriptor_data());
enums.push(recovery_device::RecoveryDeviceType::generated_enum_descriptor_data());
enums.push(sd_card_backup_manage::SdCardBackupManageOperationType::generated_enum_descriptor_data());
enums.push(word_request::WordRequestType::generated_enum_descriptor_data());
enums.push(reboot_to_bootloader::BootCommand::generated_enum_descriptor_data());
::protobuf::reflect::GeneratedFileDescriptor::new_generated(

@ -0,0 +1,789 @@
// This file is generated by rust-protobuf 3.3.0. Do not edit
// .proto file is parsed by protoc 3.19.6
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![allow(unused_attributes)]
#![cfg_attr(rustfmt, rustfmt::skip)]
#![allow(box_pointers)]
#![allow(dead_code)]
#![allow(missing_docs)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(trivial_casts)]
#![allow(unused_results)]
#![allow(unused_mut)]
//! Generated file from `messages-sdbackup.proto`
/// Generated files are compatible only with the same version
/// of protobuf runtime.
const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0;
// @@protoc_insertion_point(message:hw.trezor.messages.sdbackup.SdCardBackupCheckHealthRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupCheckHealthRequest {
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.sdbackup.SdCardBackupCheckHealthRequest.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupCheckHealthRequest {
fn default() -> &'a SdCardBackupCheckHealthRequest {
<SdCardBackupCheckHealthRequest as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupCheckHealthRequest {
pub fn new() -> SdCardBackupCheckHealthRequest {
::std::default::Default::default()
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(0);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupCheckHealthRequest>(
"SdCardBackupCheckHealthRequest",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupCheckHealthRequest {
const NAME: &'static str = "SdCardBackupCheckHealthRequest";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupCheckHealthRequest {
SdCardBackupCheckHealthRequest::new()
}
fn clear(&mut self) {
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupCheckHealthRequest {
static instance: SdCardBackupCheckHealthRequest = SdCardBackupCheckHealthRequest {
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupCheckHealthRequest {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupCheckHealthRequest").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupCheckHealthRequest {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupCheckHealthRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.sdbackup.SdCardBackupHealth)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupHealth {
// message fields
// @@protoc_insertion_point(field:hw.trezor.messages.sdbackup.SdCardBackupHealth.pt_is_mountable)
pub pt_is_mountable: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.sdbackup.SdCardBackupHealth.pt_has_correct_cap)
pub pt_has_correct_cap: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.sdbackup.SdCardBackupHealth.pt_readme_present)
pub pt_readme_present: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.sdbackup.SdCardBackupHealth.pt_readme_content)
pub pt_readme_content: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.sdbackup.SdCardBackupHealth.unalloc_seed_corrupt)
pub unalloc_seed_corrupt: ::std::option::Option<u32>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.sdbackup.SdCardBackupHealth.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupHealth {
fn default() -> &'a SdCardBackupHealth {
<SdCardBackupHealth as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupHealth {
pub fn new() -> SdCardBackupHealth {
::std::default::Default::default()
}
// required bool pt_is_mountable = 1;
pub fn pt_is_mountable(&self) -> bool {
self.pt_is_mountable.unwrap_or(false)
}
pub fn clear_pt_is_mountable(&mut self) {
self.pt_is_mountable = ::std::option::Option::None;
}
pub fn has_pt_is_mountable(&self) -> bool {
self.pt_is_mountable.is_some()
}
// Param is passed by value, moved
pub fn set_pt_is_mountable(&mut self, v: bool) {
self.pt_is_mountable = ::std::option::Option::Some(v);
}
// required bool pt_has_correct_cap = 2;
pub fn pt_has_correct_cap(&self) -> bool {
self.pt_has_correct_cap.unwrap_or(false)
}
pub fn clear_pt_has_correct_cap(&mut self) {
self.pt_has_correct_cap = ::std::option::Option::None;
}
pub fn has_pt_has_correct_cap(&self) -> bool {
self.pt_has_correct_cap.is_some()
}
// Param is passed by value, moved
pub fn set_pt_has_correct_cap(&mut self, v: bool) {
self.pt_has_correct_cap = ::std::option::Option::Some(v);
}
// required bool pt_readme_present = 3;
pub fn pt_readme_present(&self) -> bool {
self.pt_readme_present.unwrap_or(false)
}
pub fn clear_pt_readme_present(&mut self) {
self.pt_readme_present = ::std::option::Option::None;
}
pub fn has_pt_readme_present(&self) -> bool {
self.pt_readme_present.is_some()
}
// Param is passed by value, moved
pub fn set_pt_readme_present(&mut self, v: bool) {
self.pt_readme_present = ::std::option::Option::Some(v);
}
// required bool pt_readme_content = 4;
pub fn pt_readme_content(&self) -> bool {
self.pt_readme_content.unwrap_or(false)
}
pub fn clear_pt_readme_content(&mut self) {
self.pt_readme_content = ::std::option::Option::None;
}
pub fn has_pt_readme_content(&self) -> bool {
self.pt_readme_content.is_some()
}
// Param is passed by value, moved
pub fn set_pt_readme_content(&mut self, v: bool) {
self.pt_readme_content = ::std::option::Option::Some(v);
}
// required uint32 unalloc_seed_corrupt = 5;
pub fn unalloc_seed_corrupt(&self) -> u32 {
self.unalloc_seed_corrupt.unwrap_or(0)
}
pub fn clear_unalloc_seed_corrupt(&mut self) {
self.unalloc_seed_corrupt = ::std::option::Option::None;
}
pub fn has_unalloc_seed_corrupt(&self) -> bool {
self.unalloc_seed_corrupt.is_some()
}
// Param is passed by value, moved
pub fn set_unalloc_seed_corrupt(&mut self, v: u32) {
self.unalloc_seed_corrupt = ::std::option::Option::Some(v);
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(5);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_is_mountable",
|m: &SdCardBackupHealth| { &m.pt_is_mountable },
|m: &mut SdCardBackupHealth| { &mut m.pt_is_mountable },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_has_correct_cap",
|m: &SdCardBackupHealth| { &m.pt_has_correct_cap },
|m: &mut SdCardBackupHealth| { &mut m.pt_has_correct_cap },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_readme_present",
|m: &SdCardBackupHealth| { &m.pt_readme_present },
|m: &mut SdCardBackupHealth| { &mut m.pt_readme_present },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"pt_readme_content",
|m: &SdCardBackupHealth| { &m.pt_readme_content },
|m: &mut SdCardBackupHealth| { &mut m.pt_readme_content },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"unalloc_seed_corrupt",
|m: &SdCardBackupHealth| { &m.unalloc_seed_corrupt },
|m: &mut SdCardBackupHealth| { &mut m.unalloc_seed_corrupt },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupHealth>(
"SdCardBackupHealth",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupHealth {
const NAME: &'static str = "SdCardBackupHealth";
fn is_initialized(&self) -> bool {
if self.pt_is_mountable.is_none() {
return false;
}
if self.pt_has_correct_cap.is_none() {
return false;
}
if self.pt_readme_present.is_none() {
return false;
}
if self.pt_readme_content.is_none() {
return false;
}
if self.unalloc_seed_corrupt.is_none() {
return false;
}
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
8 => {
self.pt_is_mountable = ::std::option::Option::Some(is.read_bool()?);
},
16 => {
self.pt_has_correct_cap = ::std::option::Option::Some(is.read_bool()?);
},
24 => {
self.pt_readme_present = ::std::option::Option::Some(is.read_bool()?);
},
32 => {
self.pt_readme_content = ::std::option::Option::Some(is.read_bool()?);
},
40 => {
self.unalloc_seed_corrupt = ::std::option::Option::Some(is.read_uint32()?);
},
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
if let Some(v) = self.pt_is_mountable {
my_size += 1 + 1;
}
if let Some(v) = self.pt_has_correct_cap {
my_size += 1 + 1;
}
if let Some(v) = self.pt_readme_present {
my_size += 1 + 1;
}
if let Some(v) = self.pt_readme_content {
my_size += 1 + 1;
}
if let Some(v) = self.unalloc_seed_corrupt {
my_size += ::protobuf::rt::uint32_size(5, v);
}
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
if let Some(v) = self.pt_is_mountable {
os.write_bool(1, v)?;
}
if let Some(v) = self.pt_has_correct_cap {
os.write_bool(2, v)?;
}
if let Some(v) = self.pt_readme_present {
os.write_bool(3, v)?;
}
if let Some(v) = self.pt_readme_content {
os.write_bool(4, v)?;
}
if let Some(v) = self.unalloc_seed_corrupt {
os.write_uint32(5, v)?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupHealth {
SdCardBackupHealth::new()
}
fn clear(&mut self) {
self.pt_is_mountable = ::std::option::Option::None;
self.pt_has_correct_cap = ::std::option::Option::None;
self.pt_readme_present = ::std::option::Option::None;
self.pt_readme_content = ::std::option::Option::None;
self.unalloc_seed_corrupt = ::std::option::Option::None;
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupHealth {
static instance: SdCardBackupHealth = SdCardBackupHealth {
pt_is_mountable: ::std::option::Option::None,
pt_has_correct_cap: ::std::option::Option::None,
pt_readme_present: ::std::option::Option::None,
pt_readme_content: ::std::option::Option::None,
unalloc_seed_corrupt: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupHealth {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupHealth").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupHealth {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupHealth {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.sdbackup.SdCardBackupRefreshRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupRefreshRequest {
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.sdbackup.SdCardBackupRefreshRequest.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupRefreshRequest {
fn default() -> &'a SdCardBackupRefreshRequest {
<SdCardBackupRefreshRequest as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupRefreshRequest {
pub fn new() -> SdCardBackupRefreshRequest {
::std::default::Default::default()
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(0);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupRefreshRequest>(
"SdCardBackupRefreshRequest",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupRefreshRequest {
const NAME: &'static str = "SdCardBackupRefreshRequest";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupRefreshRequest {
SdCardBackupRefreshRequest::new()
}
fn clear(&mut self) {
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupRefreshRequest {
static instance: SdCardBackupRefreshRequest = SdCardBackupRefreshRequest {
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupRefreshRequest {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupRefreshRequest").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupRefreshRequest {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupRefreshRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.sdbackup.SdCardBackupWipeRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupWipeRequest {
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.sdbackup.SdCardBackupWipeRequest.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupWipeRequest {
fn default() -> &'a SdCardBackupWipeRequest {
<SdCardBackupWipeRequest as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupWipeRequest {
pub fn new() -> SdCardBackupWipeRequest {
::std::default::Default::default()
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(0);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupWipeRequest>(
"SdCardBackupWipeRequest",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupWipeRequest {
const NAME: &'static str = "SdCardBackupWipeRequest";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupWipeRequest {
SdCardBackupWipeRequest::new()
}
fn clear(&mut self) {
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupWipeRequest {
static instance: SdCardBackupWipeRequest = SdCardBackupWipeRequest {
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupWipeRequest {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupWipeRequest").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupWipeRequest {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupWipeRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
// @@protoc_insertion_point(message:hw.trezor.messages.sdbackup.SdCardBackupCopyRequest)
#[derive(PartialEq,Clone,Default,Debug)]
pub struct SdCardBackupCopyRequest {
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.sdbackup.SdCardBackupCopyRequest.special_fields)
pub special_fields: ::protobuf::SpecialFields,
}
impl<'a> ::std::default::Default for &'a SdCardBackupCopyRequest {
fn default() -> &'a SdCardBackupCopyRequest {
<SdCardBackupCopyRequest as ::protobuf::Message>::default_instance()
}
}
impl SdCardBackupCopyRequest {
pub fn new() -> SdCardBackupCopyRequest {
::std::default::Default::default()
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(0);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<SdCardBackupCopyRequest>(
"SdCardBackupCopyRequest",
fields,
oneofs,
)
}
}
impl ::protobuf::Message for SdCardBackupCopyRequest {
const NAME: &'static str = "SdCardBackupCopyRequest";
fn is_initialized(&self) -> bool {
true
}
fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> {
while let Some(tag) = is.read_raw_tag_or_eof()? {
match tag {
tag => {
::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?;
},
};
}
::std::result::Result::Ok(())
}
// Compute sizes of nested messages
#[allow(unused_variables)]
fn compute_size(&self) -> u64 {
let mut my_size = 0;
my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields());
self.special_fields.cached_size().set(my_size as u32);
my_size
}
fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> {
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
fn special_fields(&self) -> &::protobuf::SpecialFields {
&self.special_fields
}
fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields {
&mut self.special_fields
}
fn new() -> SdCardBackupCopyRequest {
SdCardBackupCopyRequest::new()
}
fn clear(&mut self) {
self.special_fields.clear();
}
fn default_instance() -> &'static SdCardBackupCopyRequest {
static instance: SdCardBackupCopyRequest = SdCardBackupCopyRequest {
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
}
}
impl ::protobuf::MessageFull for SdCardBackupCopyRequest {
fn descriptor() -> ::protobuf::reflect::MessageDescriptor {
static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new();
descriptor.get(|| file_descriptor().message_by_package_relative_name("SdCardBackupCopyRequest").unwrap()).clone()
}
}
impl ::std::fmt::Display for SdCardBackupCopyRequest {
fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
::protobuf::text_format::fmt(self, f)
}
}
impl ::protobuf::reflect::ProtobufValue for SdCardBackupCopyRequest {
type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage<Self>;
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x17messages-sdbackup.proto\x12\x1bhw.trezor.messages.sdbackup\x1a\x0e\
messages.proto\"\x20\n\x1eSdCardBackupCheckHealthRequest\"\xf3\x01\n\x12\
SdCardBackupHealth\x12&\n\x0fpt_is_mountable\x18\x01\x20\x02(\x08R\rptIs\
Mountable\x12+\n\x12pt_has_correct_cap\x18\x02\x20\x02(\x08R\x0fptHasCor\
rectCap\x12*\n\x11pt_readme_present\x18\x03\x20\x02(\x08R\x0fptReadmePre\
sent\x12*\n\x11pt_readme_content\x18\x04\x20\x02(\x08R\x0fptReadmeConten\
t\x120\n\x14unalloc_seed_corrupt\x18\x05\x20\x02(\rR\x12unallocSeedCorru\
pt\"\x1c\n\x1aSdCardBackupRefreshRequest\"\x19\n\x17SdCardBackupWipeRequ\
est\"\x19\n\x17SdCardBackupCopyRequestB<\n#com.satoshilabs.trezor.lib.pr\
otobufB\x15TrezorMessageSdbackup\
";
/// `FileDescriptorProto` object which was a source for this generated file
fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto {
static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new();
file_descriptor_proto_lazy.get(|| {
::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap()
})
}
/// `FileDescriptor` object which allows dynamic access to files
pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new();
static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new();
file_descriptor.get(|| {
let generated_file_descriptor = generated_file_descriptor_lazy.get(|| {
let mut deps = ::std::vec::Vec::with_capacity(1);
deps.push(super::messages::file_descriptor().clone());
let mut messages = ::std::vec::Vec::with_capacity(5);
messages.push(SdCardBackupCheckHealthRequest::generated_message_descriptor_data());
messages.push(SdCardBackupHealth::generated_message_descriptor_data());
messages.push(SdCardBackupRefreshRequest::generated_message_descriptor_data());
messages.push(SdCardBackupWipeRequest::generated_message_descriptor_data());
messages.push(SdCardBackupCopyRequest::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(0);
::protobuf::reflect::GeneratedFileDescriptor::new_generated(
file_descriptor_proto(),
deps,
messages,
enums,
)
});
::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor)
})
}
Loading…
Cancel
Save