Tweak feature flags.

ibz/20240524-repeated-backup-rename-fields
Ioan Bizău 4 weeks ago
parent 8fbd130374
commit 4c50fdc5e8

@ -78,7 +78,7 @@ message Features {
optional bool unlocked = 16; // is the device unlocked? called "pin_cached" previously
optional bool _passphrase_cached = 17 [deprecated=true]; // is passphrase already cached in session?
optional bool firmware_present = 18; // is valid firmware loaded?
optional bool needs_backup = 19; // does storage need backup? (equals to Storage.needs_backup)
optional BackupAvailability backup_availability = 19; // does storage need backup? is repeated backup unlocked?
optional uint32 flags = 20; // device flags (equals to Storage.flags)
optional string model = 21; // device hardware model
optional uint32 fw_major = 22; // reported firmware version if in bootloader mode
@ -88,7 +88,7 @@ message Features {
// optional bytes fw_vendor_keys = 26; // obsoleted, use fw_vendor
optional bool unfinished_backup = 27; // report unfinished backup (equals to Storage.unfinished_backup)
optional bool no_backup = 28; // report no backup (equals to Storage.no_backup)
optional RecoveryStatus recovery_status = 29; // whether or not we are in recovery mode and of what kind
optional RecoveryStatus recovery_status = 29; // whether or not we are in recovery mode
repeated Capability capabilities = 30; // list of supported capabilities
optional BackupType backup_type = 31; // type of device backup (BIP-39 / SLIP-39 basic / SLIP-39 advanced)
optional bool sd_card_present = 32; // is SD card present
@ -104,19 +104,25 @@ message Features {
optional HomescreenFormat homescreen_format = 42; // format of the homescreen, 1 = TOIf, 2 = jpg, 3 = TOIG
optional bool hide_passphrase_from_host = 43; // should we hide the passphrase when it comes from host?
optional string internal_model = 44; // internal model name
optional uint32 unit_color = 45; // color of the unit/device
optional bool unit_btconly = 46; // unit/device is intended as bitcoin only
optional uint32 homescreen_width = 47; // homescreen width in pixels
optional uint32 homescreen_height = 48; // homescreen height in pixels
optional uint32 unit_color = 45; // color of the unit/device
optional bool unit_btconly = 46; // unit/device is intended as bitcoin only
optional uint32 homescreen_width = 47; // homescreen width in pixels
optional uint32 homescreen_height = 48; // homescreen height in pixels
optional bool bootloader_locked = 49; // bootloader is locked
optional bool language_version_matches = 50 [default=true]; // translation blob version matches firmware version
optional uint32 unit_packaging = 51; // unit/device packaging version
optional uint32 unit_packaging = 51; // unit/device packaging version
optional RecoveryDevice.RecoveryKind recovery_kind = 52;
enum BackupAvailability {
NotAvailable = 0;
Required = 1;
Available = 2;
}
enum RecoveryStatus {
NoRecovery = 0;
InNormalRecovery = 1;
InDryRunRecovery = 2;
InUnlockRepeatedBackupRecovery = 3;
Nothing = 0;
Recovery = 1;
Backup = 2;
}
enum Capability {

@ -91,6 +91,8 @@ trezor.crypto.slip39
import trezor.crypto.slip39
trezor.enums.AmountUnit
import trezor.enums.AmountUnit
trezor.enums.BackupAvailability
import trezor.enums.BackupAvailability
trezor.enums.BackupType
import trezor.enums.BackupType
trezor.enums.BootCommand

@ -61,7 +61,12 @@ def _language_version_matches() -> bool | None:
def get_features() -> Features:
import storage.recovery as storage_recovery
from trezor import translations
from trezor.enums import Capability, RecoveryKind, RecoveryStatus
from trezor.enums import (
BackupAvailability,
Capability,
RecoveryKind,
RecoveryStatus,
)
from trezor.messages import Features
from trezor.ui import HEIGHT, WIDTH
@ -150,20 +155,28 @@ def get_features() -> Features:
if config.is_unlocked():
# passphrase_protection is private, see #1807
f.passphrase_protection = storage_device.is_passphrase_enabled()
f.needs_backup = storage_device.needs_backup()
if storage_device.needs_backup():
f.backup_availability = BackupAvailability.Required
elif storage_cache.get_bool(
storage_cache.APP_RECOVERY_REPEATED_BACKUP_UNLOCKED
):
f.backup_availability = BackupAvailability.Available
else:
f.backup_availability = BackupAvailability.NotAvailable
f.unfinished_backup = storage_device.unfinished_backup()
f.no_backup = storage_device.no_backup()
f.flags = storage_device.get_flags()
if storage_recovery.is_in_progress():
kind = storage_recovery.get_kind()
if kind == RecoveryKind.NormalRecovery:
f.recovery_status = RecoveryStatus.InNormalRecovery
f.recovery_status = RecoveryStatus.Recovery
elif kind == RecoveryKind.DryRun:
f.recovery_status = RecoveryStatus.InDryRunRecovery
f.recovery_status = RecoveryStatus.Recovery
elif kind == RecoveryKind.UnlockRepeatedBackup:
f.recovery_status = RecoveryStatus.InUnlockRepeatedBackupRecovery
f.recovery_status = RecoveryStatus.Backup
f.recovery_kind = kind
else:
f.recovery_status = RecoveryStatus.NoRecovery
f.recovery_status = RecoveryStatus.Nothing
f.backup_type = mnemonic.get_type()
# Only some models are capable of SD card

@ -1,6 +1,6 @@
def disable_repeated_backup():
import storage.cache as storage_cache
from apps import base
storage_cache.delete(storage_cache.APP_RECOVERY_REPEATED_BACKUP_UNLOCKED)

@ -0,0 +1,7 @@
# Automatically generated by pb2py
# fmt: off
# isort:skip_file
NotAvailable = 0
Required = 1
Available = 2

@ -2,7 +2,6 @@
# fmt: off
# isort:skip_file
NoRecovery = 0
InNormalRecovery = 1
InDryRunRecovery = 2
InUnlockRepeatedBackupRecovery = 3
Nothing = 0
Recovery = 1
Backup = 2

@ -436,11 +436,15 @@ if TYPE_CHECKING:
Jpeg = 2
ToiG = 3
class BackupAvailability(IntEnum):
NotAvailable = 0
Required = 1
Available = 2
class RecoveryStatus(IntEnum):
NoRecovery = 0
InNormalRecovery = 1
InDryRunRecovery = 2
InUnlockRepeatedBackupRecovery = 3
Nothing = 0
Recovery = 1
Backup = 2
class Capability(IntEnum):
Bitcoin = 1

@ -17,6 +17,7 @@ def __getattr__(name: str) -> Any:
if TYPE_CHECKING:
from typing import TypeGuard
from trezor.enums import AmountUnit # noqa: F401
from trezor.enums import BackupAvailability # noqa: F401
from trezor.enums import BackupType # noqa: F401
from trezor.enums import BinanceOrderSide # noqa: F401
from trezor.enums import BinanceOrderType # noqa: F401
@ -2133,7 +2134,7 @@ if TYPE_CHECKING:
imported: "bool | None"
unlocked: "bool | None"
firmware_present: "bool | None"
needs_backup: "bool | None"
backup_availability: "BackupAvailability | None"
flags: "int | None"
model: "str | None"
fw_major: "int | None"
@ -2165,6 +2166,7 @@ if TYPE_CHECKING:
bootloader_locked: "bool | None"
language_version_matches: "bool"
unit_packaging: "int | None"
recovery_kind: "RecoveryKind | None"
def __init__(
self,
@ -2186,7 +2188,7 @@ if TYPE_CHECKING:
imported: "bool | None" = None,
unlocked: "bool | None" = None,
firmware_present: "bool | None" = None,
needs_backup: "bool | None" = None,
backup_availability: "BackupAvailability | None" = None,
flags: "int | None" = None,
model: "str | None" = None,
fw_major: "int | None" = None,
@ -2217,6 +2219,7 @@ if TYPE_CHECKING:
bootloader_locked: "bool | None" = None,
language_version_matches: "bool | None" = None,
unit_packaging: "int | None" = None,
recovery_kind: "RecoveryKind | None" = None,
) -> None:
pass

@ -31,7 +31,7 @@ from trezor import log, loop, protobuf, utils, workflow
from trezor.enums import FailureType
from trezor.messages import Failure
from trezor.wire import codec_v1, context
from trezor.wire.errors import ActionCancelled, DataError, Error
from trezor.wire.errors import ActionCancelled, DataError, Error, UnexpectedMessage
# Import all errors into namespace, so that `wire.Error` is available from
# other packages.
@ -261,11 +261,12 @@ async def handle_session(
def find_handler(iface: WireInterface, msg_type: int) -> Handler:
import usb
from apps import workflow_handlers
handler = workflow_handlers.find_registered_handler(iface, msg_type)
if handler is None:
raise context.UnexpectedMessage(msg="Unexpected message")
raise UnexpectedMessage("Unexpected message")
if __debug__ and iface is usb.iface_debug:
# no filtering allowed for debuglink

@ -60,8 +60,11 @@ bool get_features(Features *resp) {
resp->has_imported = config_getImported(&(resp->imported));
resp->has_unlocked = true;
resp->unlocked = session_isUnlocked();
resp->has_needs_backup = true;
config_getNeedsBackup(&(resp->needs_backup));
resp->has_backup_availability = true;
bool needs_backup = false;
config_getNeedsBackup(&needs_backup);
resp->backup_availability = needs_backup ? BackupAvailability_Required
: BackupAvailability_NotAvailable;
resp->has_unfinished_backup = true;
config_getUnfinishedBackup(&(resp->unfinished_backup));
resp->has_no_backup = true;

@ -468,11 +468,16 @@ class HomescreenFormat(IntEnum):
ToiG = 3
class BackupAvailability(IntEnum):
NotAvailable = 0
Required = 1
Available = 2
class RecoveryStatus(IntEnum):
NoRecovery = 0
InNormalRecovery = 1
InDryRunRecovery = 2
InUnlockRepeatedBackupRecovery = 3
Nothing = 0
Recovery = 1
Backup = 2
class Capability(IntEnum):
@ -3239,7 +3244,7 @@ class Features(protobuf.MessageType):
16: protobuf.Field("unlocked", "bool", repeated=False, required=False, default=None),
17: protobuf.Field("_passphrase_cached", "bool", repeated=False, required=False, default=None),
18: protobuf.Field("firmware_present", "bool", repeated=False, required=False, default=None),
19: protobuf.Field("needs_backup", "bool", repeated=False, required=False, default=None),
19: protobuf.Field("backup_availability", "BackupAvailability", repeated=False, required=False, default=None),
20: protobuf.Field("flags", "uint32", repeated=False, required=False, default=None),
21: protobuf.Field("model", "string", repeated=False, required=False, default=None),
22: protobuf.Field("fw_major", "uint32", repeated=False, required=False, default=None),
@ -3271,6 +3276,7 @@ class Features(protobuf.MessageType):
49: protobuf.Field("bootloader_locked", "bool", repeated=False, required=False, default=None),
50: protobuf.Field("language_version_matches", "bool", repeated=False, required=False, default=True),
51: protobuf.Field("unit_packaging", "uint32", repeated=False, required=False, default=None),
52: protobuf.Field("recovery_kind", "RecoveryKind", repeated=False, required=False, default=None),
}
def __init__(
@ -3294,7 +3300,7 @@ class Features(protobuf.MessageType):
unlocked: Optional["bool"] = None,
_passphrase_cached: Optional["bool"] = None,
firmware_present: Optional["bool"] = None,
needs_backup: Optional["bool"] = None,
backup_availability: Optional["BackupAvailability"] = None,
flags: Optional["int"] = None,
model: Optional["str"] = None,
fw_major: Optional["int"] = None,
@ -3325,6 +3331,7 @@ class Features(protobuf.MessageType):
bootloader_locked: Optional["bool"] = None,
language_version_matches: Optional["bool"] = True,
unit_packaging: Optional["int"] = None,
recovery_kind: Optional["RecoveryKind"] = None,
) -> None:
self.capabilities: Sequence["Capability"] = capabilities if capabilities is not None else []
self.major_version = major_version
@ -3344,7 +3351,7 @@ class Features(protobuf.MessageType):
self.unlocked = unlocked
self._passphrase_cached = _passphrase_cached
self.firmware_present = firmware_present
self.needs_backup = needs_backup
self.backup_availability = backup_availability
self.flags = flags
self.model = model
self.fw_major = fw_major
@ -3375,6 +3382,7 @@ class Features(protobuf.MessageType):
self.bootloader_locked = bootloader_locked
self.language_version_matches = language_version_matches
self.unit_packaging = unit_packaging
self.recovery_kind = recovery_kind
class LockDevice(protobuf.MessageType):

@ -78,8 +78,7 @@ fn do_main() -> Result<(), trezor_client::Error> {
//optional bool pin_cached = 16; // is PIN already cached in session?
//optional bool passphrase_cached = 17; // is passphrase already cached in session?
//optional bool firmware_present = 18; // is valid firmware loaded?
//optional bool needs_backup = 19; // does storage need backup? (equals to
// Storage.needs_backup) optional uint32 flags = 20; // device flags (equals
//optional uint32 flags = 20; // device flags (equals
// to Storage.flags) optional string model = 21; // device hardware model
//optional uint32 fw_major = 22; // reported firmware version if in bootloader
// mode optional uint32 fw_minor = 23; // reported firmware version if in

@ -398,8 +398,8 @@ pub struct Features {
pub _passphrase_cached: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.firmware_present)
pub firmware_present: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.needs_backup)
pub needs_backup: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.backup_availability)
pub backup_availability: ::std::option::Option<::protobuf::EnumOrUnknown<features::BackupAvailability>>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.flags)
pub flags: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.model)
@ -462,6 +462,8 @@ pub struct Features {
pub language_version_matches: ::std::option::Option<bool>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.unit_packaging)
pub unit_packaging: ::std::option::Option<u32>,
// @@protoc_insertion_point(field:hw.trezor.messages.management.Features.recovery_kind)
pub recovery_kind: ::std::option::Option<::protobuf::EnumOrUnknown<recovery_device::RecoveryKind>>,
// special fields
// @@protoc_insertion_point(special_field:hw.trezor.messages.management.Features.special_fields)
pub special_fields: ::protobuf::SpecialFields,
@ -903,23 +905,26 @@ impl Features {
self.firmware_present = ::std::option::Option::Some(v);
}
// optional bool needs_backup = 19;
// optional .hw.trezor.messages.management.Features.BackupAvailability backup_availability = 19;
pub fn needs_backup(&self) -> bool {
self.needs_backup.unwrap_or(false)
pub fn backup_availability(&self) -> features::BackupAvailability {
match self.backup_availability {
Some(e) => e.enum_value_or(features::BackupAvailability::NotAvailable),
None => features::BackupAvailability::NotAvailable,
}
}
pub fn clear_needs_backup(&mut self) {
self.needs_backup = ::std::option::Option::None;
pub fn clear_backup_availability(&mut self) {
self.backup_availability = ::std::option::Option::None;
}
pub fn has_needs_backup(&self) -> bool {
self.needs_backup.is_some()
pub fn has_backup_availability(&self) -> bool {
self.backup_availability.is_some()
}
// Param is passed by value, moved
pub fn set_needs_backup(&mut self, v: bool) {
self.needs_backup = ::std::option::Option::Some(v);
pub fn set_backup_availability(&mut self, v: features::BackupAvailability) {
self.backup_availability = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v));
}
// optional uint32 flags = 20;
@ -1112,8 +1117,8 @@ impl Features {
pub fn recovery_status(&self) -> features::RecoveryStatus {
match self.recovery_status {
Some(e) => e.enum_value_or(features::RecoveryStatus::NoRecovery),
None => features::RecoveryStatus::NoRecovery,
Some(e) => e.enum_value_or(features::RecoveryStatus::Nothing),
None => features::RecoveryStatus::Nothing,
}
}
@ -1572,8 +1577,30 @@ impl Features {
self.unit_packaging = ::std::option::Option::Some(v);
}
// optional .hw.trezor.messages.management.RecoveryDevice.RecoveryKind recovery_kind = 52;
pub fn recovery_kind(&self) -> recovery_device::RecoveryKind {
match self.recovery_kind {
Some(e) => e.enum_value_or(recovery_device::RecoveryKind::NormalRecovery),
None => recovery_device::RecoveryKind::NormalRecovery,
}
}
pub fn clear_recovery_kind(&mut self) {
self.recovery_kind = ::std::option::Option::None;
}
pub fn has_recovery_kind(&self) -> bool {
self.recovery_kind.is_some()
}
// Param is passed by value, moved
pub fn set_recovery_kind(&mut self, v: recovery_device::RecoveryKind) {
self.recovery_kind = ::std::option::Option::Some(::protobuf::EnumOrUnknown::new(v));
}
fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData {
let mut fields = ::std::vec::Vec::with_capacity(49);
let mut fields = ::std::vec::Vec::with_capacity(50);
let mut oneofs = ::std::vec::Vec::with_capacity(0);
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"vendor",
@ -1661,9 +1688,9 @@ impl Features {
|m: &mut Features| { &mut m.firmware_present },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"needs_backup",
|m: &Features| { &m.needs_backup },
|m: &mut Features| { &mut m.needs_backup },
"backup_availability",
|m: &Features| { &m.backup_availability },
|m: &mut Features| { &mut m.backup_availability },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"flags",
@ -1820,6 +1847,11 @@ impl Features {
|m: &Features| { &m.unit_packaging },
|m: &mut Features| { &mut m.unit_packaging },
));
fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>(
"recovery_kind",
|m: &Features| { &m.recovery_kind },
|m: &mut Features| { &mut m.recovery_kind },
));
::protobuf::reflect::GeneratedMessageDescriptorData::new_2::<Features>(
"Features",
fields,
@ -1899,7 +1931,7 @@ impl ::protobuf::Message for Features {
self.firmware_present = ::std::option::Option::Some(is.read_bool()?);
},
152 => {
self.needs_backup = ::std::option::Option::Some(is.read_bool()?);
self.backup_availability = ::std::option::Option::Some(is.read_enum_or_unknown()?);
},
160 => {
self.flags = ::std::option::Option::Some(is.read_uint32()?);
@ -1997,6 +2029,9 @@ impl ::protobuf::Message for Features {
408 => {
self.unit_packaging = ::std::option::Option::Some(is.read_uint32()?);
},
416 => {
self.recovery_kind = ::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())?;
},
@ -2060,8 +2095,8 @@ impl ::protobuf::Message for Features {
if let Some(v) = self.firmware_present {
my_size += 2 + 1;
}
if let Some(v) = self.needs_backup {
my_size += 2 + 1;
if let Some(v) = self.backup_availability {
my_size += ::protobuf::rt::int32_size(19, v.value());
}
if let Some(v) = self.flags {
my_size += ::protobuf::rt::uint32_size(20, v);
@ -2156,6 +2191,9 @@ impl ::protobuf::Message for Features {
if let Some(v) = self.unit_packaging {
my_size += ::protobuf::rt::uint32_size(51, v);
}
if let Some(v) = self.recovery_kind {
my_size += ::protobuf::rt::int32_size(52, 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
@ -2213,8 +2251,8 @@ impl ::protobuf::Message for Features {
if let Some(v) = self.firmware_present {
os.write_bool(18, v)?;
}
if let Some(v) = self.needs_backup {
os.write_bool(19, v)?;
if let Some(v) = self.backup_availability {
os.write_enum(19, ::protobuf::EnumOrUnknown::value(&v))?;
}
if let Some(v) = self.flags {
os.write_uint32(20, v)?;
@ -2309,6 +2347,9 @@ impl ::protobuf::Message for Features {
if let Some(v) = self.unit_packaging {
os.write_uint32(51, v)?;
}
if let Some(v) = self.recovery_kind {
os.write_enum(52, ::protobuf::EnumOrUnknown::value(&v))?;
}
os.write_unknown_fields(self.special_fields.unknown_fields())?;
::std::result::Result::Ok(())
}
@ -2343,7 +2384,7 @@ impl ::protobuf::Message for Features {
self.unlocked = ::std::option::Option::None;
self._passphrase_cached = ::std::option::Option::None;
self.firmware_present = ::std::option::Option::None;
self.needs_backup = ::std::option::Option::None;
self.backup_availability = ::std::option::Option::None;
self.flags = ::std::option::Option::None;
self.model = ::std::option::Option::None;
self.fw_major = ::std::option::Option::None;
@ -2375,6 +2416,7 @@ impl ::protobuf::Message for Features {
self.bootloader_locked = ::std::option::Option::None;
self.language_version_matches = ::std::option::Option::None;
self.unit_packaging = ::std::option::Option::None;
self.recovery_kind = ::std::option::Option::None;
self.special_fields.clear();
}
@ -2397,7 +2439,7 @@ impl ::protobuf::Message for Features {
unlocked: ::std::option::Option::None,
_passphrase_cached: ::std::option::Option::None,
firmware_present: ::std::option::Option::None,
needs_backup: ::std::option::Option::None,
backup_availability: ::std::option::Option::None,
flags: ::std::option::Option::None,
model: ::std::option::Option::None,
fw_major: ::std::option::Option::None,
@ -2429,6 +2471,7 @@ impl ::protobuf::Message for Features {
bootloader_locked: ::std::option::Option::None,
language_version_matches: ::std::option::Option::None,
unit_packaging: ::std::option::Option::None,
recovery_kind: ::std::option::Option::None,
special_fields: ::protobuf::SpecialFields::new(),
};
&instance
@ -2454,17 +2497,82 @@ impl ::protobuf::reflect::ProtobufValue for Features {
/// Nested message and enums of message `Features`
pub mod features {
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.management.Features.BackupAvailability)
pub enum BackupAvailability {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.BackupAvailability.NotAvailable)
NotAvailable = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.BackupAvailability.Required)
Required = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.BackupAvailability.Available)
Available = 2,
}
impl ::protobuf::Enum for BackupAvailability {
const NAME: &'static str = "BackupAvailability";
fn value(&self) -> i32 {
*self as i32
}
fn from_i32(value: i32) -> ::std::option::Option<BackupAvailability> {
match value {
0 => ::std::option::Option::Some(BackupAvailability::NotAvailable),
1 => ::std::option::Option::Some(BackupAvailability::Required),
2 => ::std::option::Option::Some(BackupAvailability::Available),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<BackupAvailability> {
match str {
"NotAvailable" => ::std::option::Option::Some(BackupAvailability::NotAvailable),
"Required" => ::std::option::Option::Some(BackupAvailability::Required),
"Available" => ::std::option::Option::Some(BackupAvailability::Available),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [BackupAvailability] = &[
BackupAvailability::NotAvailable,
BackupAvailability::Required,
BackupAvailability::Available,
];
}
impl ::protobuf::EnumFull for BackupAvailability {
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("Features.BackupAvailability").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 BackupAvailability {
fn default() -> Self {
BackupAvailability::NotAvailable
}
}
impl BackupAvailability {
pub(in super) fn generated_enum_descriptor_data() -> ::protobuf::reflect::GeneratedEnumDescriptorData {
::protobuf::reflect::GeneratedEnumDescriptorData::new::<BackupAvailability>("Features.BackupAvailability")
}
}
#[derive(Clone,Copy,PartialEq,Eq,Debug,Hash)]
// @@protoc_insertion_point(enum:hw.trezor.messages.management.Features.RecoveryStatus)
pub enum RecoveryStatus {
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.NoRecovery)
NoRecovery = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.InNormalRecovery)
InNormalRecovery = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.InDryRunRecovery)
InDryRunRecovery = 2,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.InUnlockRepeatedBackupRecovery)
InUnlockRepeatedBackupRecovery = 3,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.Nothing)
Nothing = 0,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.Recovery)
Recovery = 1,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.management.Features.RecoveryStatus.Backup)
Backup = 2,
}
impl ::protobuf::Enum for RecoveryStatus {
@ -2476,29 +2584,26 @@ pub mod features {
fn from_i32(value: i32) -> ::std::option::Option<RecoveryStatus> {
match value {
0 => ::std::option::Option::Some(RecoveryStatus::NoRecovery),
1 => ::std::option::Option::Some(RecoveryStatus::InNormalRecovery),
2 => ::std::option::Option::Some(RecoveryStatus::InDryRunRecovery),
3 => ::std::option::Option::Some(RecoveryStatus::InUnlockRepeatedBackupRecovery),
0 => ::std::option::Option::Some(RecoveryStatus::Nothing),
1 => ::std::option::Option::Some(RecoveryStatus::Recovery),
2 => ::std::option::Option::Some(RecoveryStatus::Backup),
_ => ::std::option::Option::None
}
}
fn from_str(str: &str) -> ::std::option::Option<RecoveryStatus> {
match str {
"NoRecovery" => ::std::option::Option::Some(RecoveryStatus::NoRecovery),
"InNormalRecovery" => ::std::option::Option::Some(RecoveryStatus::InNormalRecovery),
"InDryRunRecovery" => ::std::option::Option::Some(RecoveryStatus::InDryRunRecovery),
"InUnlockRepeatedBackupRecovery" => ::std::option::Option::Some(RecoveryStatus::InUnlockRepeatedBackupRecovery),
"Nothing" => ::std::option::Option::Some(RecoveryStatus::Nothing),
"Recovery" => ::std::option::Option::Some(RecoveryStatus::Recovery),
"Backup" => ::std::option::Option::Some(RecoveryStatus::Backup),
_ => ::std::option::Option::None
}
}
const VALUES: &'static [RecoveryStatus] = &[
RecoveryStatus::NoRecovery,
RecoveryStatus::InNormalRecovery,
RecoveryStatus::InDryRunRecovery,
RecoveryStatus::InUnlockRepeatedBackupRecovery,
RecoveryStatus::Nothing,
RecoveryStatus::Recovery,
RecoveryStatus::Backup,
];
}
@ -2516,7 +2621,7 @@ pub mod features {
impl ::std::default::Default for RecoveryStatus {
fn default() -> Self {
RecoveryStatus::NoRecovery
RecoveryStatus::Nothing
}
}
@ -10742,7 +10847,7 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x0emessages.proto\"\x80\x01\n\nInitialize\x12\x1d\n\nsession_id\x18\x01\
\x20\x01(\x0cR\tsessionId\x12,\n\x10_skip_passphrase\x18\x02\x20\x01(\
\x08R\x0eSkipPassphraseB\x02\x18\x01\x12%\n\x0ederive_cardano\x18\x03\
\x20\x01(\x08R\rderiveCardano\"\r\n\x0bGetFeatures\"\xa8\x15\n\x08Featur\
\x20\x01(\x08R\rderiveCardano\"\r\n\x0bGetFeatures\"\xdf\x16\n\x08Featur\
es\x12\x16\n\x06vendor\x18\x01\x20\x01(\tR\x06vendor\x12#\n\rmajor_versi\
on\x18\x02\x20\x02(\rR\x0cmajorVersion\x12#\n\rminor_version\x18\x03\x20\
\x02(\rR\x0cminorVersion\x12#\n\rpatch_version\x18\x04\x20\x02(\rR\x0cpa\
@ -10757,17 +10862,18 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x18\x0f\x20\x01(\x08R\x08imported\x12\x1a\n\x08unlocked\x18\x10\x20\x01\
(\x08R\x08unlocked\x120\n\x12_passphrase_cached\x18\x11\x20\x01(\x08R\
\x10PassphraseCachedB\x02\x18\x01\x12)\n\x10firmware_present\x18\x12\x20\
\x01(\x08R\x0ffirmwarePresent\x12!\n\x0cneeds_backup\x18\x13\x20\x01(\
\x08R\x0bneedsBackup\x12\x14\n\x05flags\x18\x14\x20\x01(\rR\x05flags\x12\
\x14\n\x05model\x18\x15\x20\x01(\tR\x05model\x12\x19\n\x08fw_major\x18\
\x16\x20\x01(\rR\x07fwMajor\x12\x19\n\x08fw_minor\x18\x17\x20\x01(\rR\
\x07fwMinor\x12\x19\n\x08fw_patch\x18\x18\x20\x01(\rR\x07fwPatch\x12\x1b\
\n\tfw_vendor\x18\x19\x20\x01(\tR\x08fwVendor\x12+\n\x11unfinished_backu\
p\x18\x1b\x20\x01(\x08R\x10unfinishedBackup\x12\x1b\n\tno_backup\x18\x1c\
\x20\x01(\x08R\x08noBackup\x12_\n\x0frecovery_status\x18\x1d\x20\x01(\
\x0e26.hw.trezor.messages.management.Features.RecoveryStatusR\x0erecover\
yStatus\x12V\n\x0ccapabilities\x18\x1e\x20\x03(\x0e22.hw.trezor.messages\
.management.Features.CapabilityR\x0ccapabilities\x12J\n\x0bbackup_type\
\x01(\x08R\x0ffirmwarePresent\x12k\n\x13backup_availability\x18\x13\x20\
\x01(\x0e2:.hw.trezor.messages.management.Features.BackupAvailabilityR\
\x12backupAvailability\x12\x14\n\x05flags\x18\x14\x20\x01(\rR\x05flags\
\x12\x14\n\x05model\x18\x15\x20\x01(\tR\x05model\x12\x19\n\x08fw_major\
\x18\x16\x20\x01(\rR\x07fwMajor\x12\x19\n\x08fw_minor\x18\x17\x20\x01(\r\
R\x07fwMinor\x12\x19\n\x08fw_patch\x18\x18\x20\x01(\rR\x07fwPatch\x12\
\x1b\n\tfw_vendor\x18\x19\x20\x01(\tR\x08fwVendor\x12+\n\x11unfinished_b\
ackup\x18\x1b\x20\x01(\x08R\x10unfinishedBackup\x12\x1b\n\tno_backup\x18\
\x1c\x20\x01(\x08R\x08noBackup\x12_\n\x0frecovery_status\x18\x1d\x20\x01\
(\x0e26.hw.trezor.messages.management.Features.RecoveryStatusR\x0erecove\
ryStatus\x12V\n\x0ccapabilities\x18\x1e\x20\x03(\x0e22.hw.trezor.message\
s.management.Features.CapabilityR\x0ccapabilities\x12J\n\x0bbackup_type\
\x18\x1f\x20\x01(\x0e2).hw.trezor.messages.management.BackupTypeR\nbacku\
pType\x12&\n\x0fsd_card_present\x18\x20\x20\x01(\x08R\rsdCardPresent\x12\
#\n\rsd_protection\x18!\x20\x01(\x08R\x0csdProtection\x120\n\x14wipe_cod\
@ -10788,120 +10894,122 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\x180\x20\x01(\rR\x10homescreenHeight\x12+\n\x11bootloader_locked\x181\
\x20\x01(\x08R\x10bootloaderLocked\x12>\n\x18language_version_matches\
\x182\x20\x01(\x08:\x04trueR\x16languageVersionMatches\x12%\n\x0eunit_pa\
ckaging\x183\x20\x01(\rR\runitPackaging\"p\n\x0eRecoveryStatus\x12\x0e\n\
\nNoRecovery\x10\0\x12\x14\n\x10InNormalRecovery\x10\x01\x12\x14\n\x10In\
DryRunRecovery\x10\x02\x12\"\n\x1eInUnlockRepeatedBackupRecovery\x10\x03\
\"\x84\x04\n\nCapability\x12\x1c\n\x12Capability_Bitcoin\x10\x01\x1a\x04\
\x80\xa6\x1d\x01\x12\x1b\n\x17Capability_Bitcoin_like\x10\x02\x12\x16\n\
\x12Capability_Binance\x10\x03\x12\x16\n\x12Capability_Cardano\x10\x04\
\x12\x1b\n\x11Capability_Crypto\x10\x05\x1a\x04\x80\xa6\x1d\x01\x12\x12\
\n\x0eCapability_EOS\x10\x06\x12\x17\n\x13Capability_Ethereum\x10\x07\
\x12\x17\n\x0fCapability_Lisk\x10\x08\x1a\x02\x08\x01\x12\x15\n\x11Capab\
ility_Monero\x10\t\x12\x12\n\x0eCapability_NEM\x10\n\x12\x15\n\x11Capabi\
lity_Ripple\x10\x0b\x12\x16\n\x12Capability_Stellar\x10\x0c\x12\x14\n\
\x10Capability_Tezos\x10\r\x12\x12\n\x0eCapability_U2F\x10\x0e\x12\x1b\n\
\x11Capability_Shamir\x10\x0f\x1a\x04\x80\xa6\x1d\x01\x12!\n\x17Capabili\
ty_ShamirGroups\x10\x10\x1a\x04\x80\xa6\x1d\x01\x12$\n\x1aCapability_Pas\
sphraseEntry\x10\x11\x1a\x04\x80\xa6\x1d\x01\x12\x15\n\x11Capability_Sol\
ana\x10\x12\x12!\n\x17Capability_Translations\x10\x13\x1a\x04\x80\xa6\
\x1d\x01\x1a\x04\xc8\xf3\x18\x01\"\x0c\n\nLockDevice\"&\n\x07SetBusy\x12\
\x1b\n\texpiry_ms\x18\x01\x20\x01(\rR\x08expiryMs\"\x0c\n\nEndSession\"\
\x9b\x04\n\rApplySettings\x12\x1e\n\x08language\x18\x01\x20\x01(\tR\x08l\
anguageB\x02\x18\x01\x12\x14\n\x05label\x18\x02\x20\x01(\tR\x05label\x12\
%\n\x0euse_passphrase\x18\x03\x20\x01(\x08R\rusePassphrase\x12\x1e\n\nho\
mescreen\x18\x04\x20\x01(\x0cR\nhomescreen\x120\n\x12_passphrase_source\
\x18\x05\x20\x01(\rR\x10PassphraseSourceB\x02\x18\x01\x12+\n\x12auto_loc\
k_delay_ms\x18\x06\x20\x01(\rR\x0fautoLockDelayMs\x12)\n\x10display_rota\
tion\x18\x07\x20\x01(\rR\x0fdisplayRotation\x12=\n\x1bpassphrase_always_\
on_device\x18\x08\x20\x01(\x08R\x18passphraseAlwaysOnDevice\x12T\n\rsafe\
ty_checks\x18\t\x20\x01(\x0e2/.hw.trezor.messages.management.SafetyCheck\
LevelR\x0csafetyChecks\x123\n\x15experimental_features\x18\n\x20\x01(\
\x08R\x14experimentalFeatures\x129\n\x19hide_passphrase_from_host\x18\
\x0b\x20\x01(\x08R\x16hidePassphraseFromHost\"T\n\x0eChangeLanguage\x12\
\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\x12!\n\x0cshow_dis\
play\x18\x02\x20\x01(\x08R\x0bshowDisplay\"Z\n\x16TranslationDataRequest\
\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLength\x12\x1f\n\x0bd\
ata_offset\x18\x02\x20\x02(\rR\ndataOffset\"3\n\x12TranslationDataAck\
\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdataChunk\"\"\n\nApplyFlag\
s\x12\x14\n\x05flags\x18\x01\x20\x02(\rR\x05flags\"#\n\tChangePin\x12\
\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"(\n\x0eChangeWipeCode\
\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"\xaa\x01\n\tSdProt\
ect\x12]\n\toperation\x18\x01\x20\x02(\x0e2?.hw.trezor.messages.manageme\
nt.SdProtect.SdProtectOperationTypeR\toperation\">\n\x16SdProtectOperati\
onType\x12\x0b\n\x07DISABLE\x10\0\x12\n\n\x06ENABLE\x10\x01\x12\x0b\n\
\x07REFRESH\x10\x02\"O\n\x04Ping\x12\x1a\n\x07message\x18\x01\x20\x01(\t\
:\0R\x07message\x12+\n\x11button_protection\x18\x02\x20\x01(\x08R\x10but\
tonProtection\"\x08\n\x06Cancel\"\x20\n\nGetEntropy\x12\x12\n\x04size\
\x18\x01\x20\x02(\rR\x04size\"#\n\x07Entropy\x12\x18\n\x07entropy\x18\
\x01\x20\x02(\x0cR\x07entropy\"/\n\x0fGetFirmwareHash\x12\x1c\n\tchallen\
ge\x18\x01\x20\x01(\x0cR\tchallenge\"\"\n\x0cFirmwareHash\x12\x12\n\x04h\
ash\x18\x01\x20\x02(\x0cR\x04hash\"2\n\x12AuthenticateDevice\x12\x1c\n\t\
challenge\x18\x01\x20\x02(\x0cR\tchallenge\"U\n\x11AuthenticityProof\x12\
\"\n\x0ccertificates\x18\x01\x20\x03(\x0cR\x0ccertificates\x12\x1c\n\tsi\
gnature\x18\x02\x20\x02(\x0cR\tsignature\"\x0c\n\nWipeDevice\"\xad\x02\n\
\nLoadDevice\x12\x1c\n\tmnemonics\x18\x01\x20\x03(\tR\tmnemonics\x12\x10\
\n\x03pin\x18\x03\x20\x01(\tR\x03pin\x123\n\x15passphrase_protection\x18\
\x04\x20\x01(\x08R\x14passphraseProtection\x12\x1e\n\x08language\x18\x05\
\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x06\x20\x01\
(\tR\x05label\x12#\n\rskip_checksum\x18\x07\x20\x01(\x08R\x0cskipChecksu\
m\x12\x1f\n\x0bu2f_counter\x18\x08\x20\x01(\rR\nu2fCounter\x12!\n\x0cnee\
ds_backup\x18\t\x20\x01(\x08R\x0bneedsBackup\x12\x1b\n\tno_backup\x18\n\
\x20\x01(\x08R\x08noBackup\"\x99\x03\n\x0bResetDevice\x12%\n\x0edisplay_\
random\x18\x01\x20\x01(\x08R\rdisplayRandom\x12\x1f\n\x08strength\x18\
\x02\x20\x01(\r:\x03256R\x08strength\x123\n\x15passphrase_protection\x18\
\x03\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_protection\x18\
\x04\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\x05\x20\x01(\
\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x06\x20\x01(\tR\x05l\
abel\x12\x1f\n\x0bu2f_counter\x18\x07\x20\x01(\rR\nu2fCounter\x12\x1f\n\
\x0bskip_backup\x18\x08\x20\x01(\x08R\nskipBackup\x12\x1b\n\tno_backup\
\x18\t\x20\x01(\x08R\x08noBackup\x12Q\n\x0bbackup_type\x18\n\x20\x01(\
\x0e2).hw.trezor.messages.management.BackupType:\x05Bip39R\nbackupType\"\
\xe5\x01\n\x0cBackupDevice\x12'\n\x0fgroup_threshold\x18\x01\x20\x01(\rR\
\x0egroupThreshold\x12O\n\x06groups\x18\x02\x20\x03(\x0b27.hw.trezor.mes\
sages.management.BackupDevice.Slip39GroupR\x06groups\x1a[\n\x0bSlip39Gro\
up\x12)\n\x10member_threshold\x18\x01\x20\x02(\rR\x0fmemberThreshold\x12\
!\n\x0cmember_count\x18\x02\x20\x02(\rR\x0bmemberCount\"\x10\n\x0eEntrop\
yRequest\"&\n\nEntropyAck\x12\x18\n\x07entropy\x18\x01\x20\x02(\x0cR\x07\
entropy\"\xef\x04\n\x0eRecoveryDevice\x12\x1d\n\nword_count\x18\x01\x20\
\x01(\rR\twordCount\x123\n\x15passphrase_protection\x18\x02\x20\x01(\x08\
R\x14passphraseProtection\x12%\n\x0epin_protection\x18\x03\x20\x01(\x08R\
\rpinProtection\x12\x1e\n\x08language\x18\x04\x20\x01(\tR\x08languageB\
\x02\x18\x01\x12\x14\n\x05label\x18\x05\x20\x01(\tR\x05label\x12)\n\x10e\
nforce_wordlist\x18\x06\x20\x01(\x08R\x0fenforceWordlist\x12T\n\x04type\
\x18\x08\x20\x01(\x0e2@.hw.trezor.messages.management.RecoveryDevice.Rec\
overyDeviceTypeR\x04type\x12\x1f\n\x0bu2f_counter\x18\t\x20\x01(\rR\nu2f\
Counter\x12^\n\x04kind\x18\n\x20\x01(\x0e2:.hw.trezor.messages.managemen\
t.RecoveryDevice.RecoveryKind:\x0eNormalRecoveryR\x04kind\"Z\n\x12Recove\
ryDeviceType\x12%\n!RecoveryDeviceType_ScrambledWords\x10\0\x12\x1d\n\
\x19RecoveryDeviceType_Matrix\x10\x01\"H\n\x0cRecoveryKind\x12\x12\n\x0e\
NormalRecovery\x10\0\x12\n\n\x06DryRun\x10\x01\x12\x18\n\x14UnlockRepeat\
edBackup\x10\x02J\x04\x08\x07\x10\x08\"\xc5\x01\n\x0bWordRequest\x12N\n\
\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.messages.management.WordReques\
t.WordRequestTypeR\x04type\"f\n\x0fWordRequestType\x12\x19\n\x15WordRequ\
estType_Plain\x10\0\x12\x1b\n\x17WordRequestType_Matrix9\x10\x01\x12\x1b\
\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\n\x07WordAck\x12\x12\n\x04wo\
rd\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2FCounter\x12\x1f\n\x0bu2f_coun\
ter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\x11GetNextU2FCounter\"1\n\
\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2fCoun\
ter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14PreauthorizedRequest\"\x15\n\
\x13CancelAuthorization\"\x9a\x02\n\x12RebootToBootloader\x12o\n\x0cboot\
_command\x18\x01\x20\x01(\x0e2=.hw.trezor.messages.management.RebootToBo\
otloader.BootCommand:\rSTOP_AND_WAITR\x0bbootCommand\x12'\n\x0ffirmware_\
header\x18\x02\x20\x01(\x0cR\x0efirmwareHeader\x123\n\x14language_data_l\
ength\x18\x03\x20\x01(\r:\x010R\x12languageDataLength\"5\n\x0bBootComman\
d\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\
ckaging\x183\x20\x01(\rR\runitPackaging\x12_\n\rrecovery_kind\x184\x20\
\x01(\x0e2:.hw.trezor.messages.management.RecoveryDevice.RecoveryKindR\
\x0crecoveryKind\"C\n\x12BackupAvailability\x12\x10\n\x0cNotAvailable\
\x10\0\x12\x0c\n\x08Required\x10\x01\x12\r\n\tAvailable\x10\x02\"7\n\x0e\
RecoveryStatus\x12\x0b\n\x07Nothing\x10\0\x12\x0c\n\x08Recovery\x10\x01\
\x12\n\n\x06Backup\x10\x02\"\x84\x04\n\nCapability\x12\x1c\n\x12Capabili\
ty_Bitcoin\x10\x01\x1a\x04\x80\xa6\x1d\x01\x12\x1b\n\x17Capability_Bitco\
in_like\x10\x02\x12\x16\n\x12Capability_Binance\x10\x03\x12\x16\n\x12Cap\
ability_Cardano\x10\x04\x12\x1b\n\x11Capability_Crypto\x10\x05\x1a\x04\
\x80\xa6\x1d\x01\x12\x12\n\x0eCapability_EOS\x10\x06\x12\x17\n\x13Capabi\
lity_Ethereum\x10\x07\x12\x17\n\x0fCapability_Lisk\x10\x08\x1a\x02\x08\
\x01\x12\x15\n\x11Capability_Monero\x10\t\x12\x12\n\x0eCapability_NEM\
\x10\n\x12\x15\n\x11Capability_Ripple\x10\x0b\x12\x16\n\x12Capability_St\
ellar\x10\x0c\x12\x14\n\x10Capability_Tezos\x10\r\x12\x12\n\x0eCapabilit\
y_U2F\x10\x0e\x12\x1b\n\x11Capability_Shamir\x10\x0f\x1a\x04\x80\xa6\x1d\
\x01\x12!\n\x17Capability_ShamirGroups\x10\x10\x1a\x04\x80\xa6\x1d\x01\
\x12$\n\x1aCapability_PassphraseEntry\x10\x11\x1a\x04\x80\xa6\x1d\x01\
\x12\x15\n\x11Capability_Solana\x10\x12\x12!\n\x17Capability_Translation\
s\x10\x13\x1a\x04\x80\xa6\x1d\x01\x1a\x04\xc8\xf3\x18\x01\"\x0c\n\nLockD\
evice\"&\n\x07SetBusy\x12\x1b\n\texpiry_ms\x18\x01\x20\x01(\rR\x08expiry\
Ms\"\x0c\n\nEndSession\"\x9b\x04\n\rApplySettings\x12\x1e\n\x08language\
\x18\x01\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x02\
\x20\x01(\tR\x05label\x12%\n\x0euse_passphrase\x18\x03\x20\x01(\x08R\rus\
ePassphrase\x12\x1e\n\nhomescreen\x18\x04\x20\x01(\x0cR\nhomescreen\x120\
\n\x12_passphrase_source\x18\x05\x20\x01(\rR\x10PassphraseSourceB\x02\
\x18\x01\x12+\n\x12auto_lock_delay_ms\x18\x06\x20\x01(\rR\x0fautoLockDel\
ayMs\x12)\n\x10display_rotation\x18\x07\x20\x01(\rR\x0fdisplayRotation\
\x12=\n\x1bpassphrase_always_on_device\x18\x08\x20\x01(\x08R\x18passphra\
seAlwaysOnDevice\x12T\n\rsafety_checks\x18\t\x20\x01(\x0e2/.hw.trezor.me\
ssages.management.SafetyCheckLevelR\x0csafetyChecks\x123\n\x15experiment\
al_features\x18\n\x20\x01(\x08R\x14experimentalFeatures\x129\n\x19hide_p\
assphrase_from_host\x18\x0b\x20\x01(\x08R\x16hidePassphraseFromHost\"T\n\
\x0eChangeLanguage\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndataLen\
gth\x12!\n\x0cshow_display\x18\x02\x20\x01(\x08R\x0bshowDisplay\"Z\n\x16\
TranslationDataRequest\x12\x1f\n\x0bdata_length\x18\x01\x20\x02(\rR\ndat\
aLength\x12\x1f\n\x0bdata_offset\x18\x02\x20\x02(\rR\ndataOffset\"3\n\
\x12TranslationDataAck\x12\x1d\n\ndata_chunk\x18\x01\x20\x02(\x0cR\tdata\
Chunk\"\"\n\nApplyFlags\x12\x14\n\x05flags\x18\x01\x20\x02(\rR\x05flags\
\"#\n\tChangePin\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\"(\
\n\x0eChangeWipeCode\x12\x16\n\x06remove\x18\x01\x20\x01(\x08R\x06remove\
\"\xaa\x01\n\tSdProtect\x12]\n\toperation\x18\x01\x20\x02(\x0e2?.hw.trez\
or.messages.management.SdProtect.SdProtectOperationTypeR\toperation\">\n\
\x16SdProtectOperationType\x12\x0b\n\x07DISABLE\x10\0\x12\n\n\x06ENABLE\
\x10\x01\x12\x0b\n\x07REFRESH\x10\x02\"O\n\x04Ping\x12\x1a\n\x07message\
\x18\x01\x20\x01(\t:\0R\x07message\x12+\n\x11button_protection\x18\x02\
\x20\x01(\x08R\x10buttonProtection\"\x08\n\x06Cancel\"\x20\n\nGetEntropy\
\x12\x12\n\x04size\x18\x01\x20\x02(\rR\x04size\"#\n\x07Entropy\x12\x18\n\
\x07entropy\x18\x01\x20\x02(\x0cR\x07entropy\"/\n\x0fGetFirmwareHash\x12\
\x1c\n\tchallenge\x18\x01\x20\x01(\x0cR\tchallenge\"\"\n\x0cFirmwareHash\
\x12\x12\n\x04hash\x18\x01\x20\x02(\x0cR\x04hash\"2\n\x12AuthenticateDev\
ice\x12\x1c\n\tchallenge\x18\x01\x20\x02(\x0cR\tchallenge\"U\n\x11Authen\
ticityProof\x12\"\n\x0ccertificates\x18\x01\x20\x03(\x0cR\x0ccertificate\
s\x12\x1c\n\tsignature\x18\x02\x20\x02(\x0cR\tsignature\"\x0c\n\nWipeDev\
ice\"\xad\x02\n\nLoadDevice\x12\x1c\n\tmnemonics\x18\x01\x20\x03(\tR\tmn\
emonics\x12\x10\n\x03pin\x18\x03\x20\x01(\tR\x03pin\x123\n\x15passphrase\
_protection\x18\x04\x20\x01(\x08R\x14passphraseProtection\x12\x1e\n\x08l\
anguage\x18\x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\
\x18\x06\x20\x01(\tR\x05label\x12#\n\rskip_checksum\x18\x07\x20\x01(\x08\
R\x0cskipChecksum\x12\x1f\n\x0bu2f_counter\x18\x08\x20\x01(\rR\nu2fCount\
er\x12!\n\x0cneeds_backup\x18\t\x20\x01(\x08R\x0bneedsBackup\x12\x1b\n\t\
no_backup\x18\n\x20\x01(\x08R\x08noBackup\"\x99\x03\n\x0bResetDevice\x12\
%\n\x0edisplay_random\x18\x01\x20\x01(\x08R\rdisplayRandom\x12\x1f\n\x08\
strength\x18\x02\x20\x01(\r:\x03256R\x08strength\x123\n\x15passphrase_pr\
otection\x18\x03\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_pro\
tection\x18\x04\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\
\x05\x20\x01(\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x06\x20\
\x01(\tR\x05label\x12\x1f\n\x0bu2f_counter\x18\x07\x20\x01(\rR\nu2fCount\
er\x12\x1f\n\x0bskip_backup\x18\x08\x20\x01(\x08R\nskipBackup\x12\x1b\n\
\tno_backup\x18\t\x20\x01(\x08R\x08noBackup\x12Q\n\x0bbackup_type\x18\n\
\x20\x01(\x0e2).hw.trezor.messages.management.BackupType:\x05Bip39R\nbac\
kupType\"\xe5\x01\n\x0cBackupDevice\x12'\n\x0fgroup_threshold\x18\x01\
\x20\x01(\rR\x0egroupThreshold\x12O\n\x06groups\x18\x02\x20\x03(\x0b27.h\
w.trezor.messages.management.BackupDevice.Slip39GroupR\x06groups\x1a[\n\
\x0bSlip39Group\x12)\n\x10member_threshold\x18\x01\x20\x02(\rR\x0fmember\
Threshold\x12!\n\x0cmember_count\x18\x02\x20\x02(\rR\x0bmemberCount\"\
\x10\n\x0eEntropyRequest\"&\n\nEntropyAck\x12\x18\n\x07entropy\x18\x01\
\x20\x02(\x0cR\x07entropy\"\xef\x04\n\x0eRecoveryDevice\x12\x1d\n\nword_\
count\x18\x01\x20\x01(\rR\twordCount\x123\n\x15passphrase_protection\x18\
\x02\x20\x01(\x08R\x14passphraseProtection\x12%\n\x0epin_protection\x18\
\x03\x20\x01(\x08R\rpinProtection\x12\x1e\n\x08language\x18\x04\x20\x01(\
\tR\x08languageB\x02\x18\x01\x12\x14\n\x05label\x18\x05\x20\x01(\tR\x05l\
abel\x12)\n\x10enforce_wordlist\x18\x06\x20\x01(\x08R\x0fenforceWordlist\
\x12T\n\x04type\x18\x08\x20\x01(\x0e2@.hw.trezor.messages.management.Rec\
overyDevice.RecoveryDeviceTypeR\x04type\x12\x1f\n\x0bu2f_counter\x18\t\
\x20\x01(\rR\nu2fCounter\x12^\n\x04kind\x18\n\x20\x01(\x0e2:.hw.trezor.m\
essages.management.RecoveryDevice.RecoveryKind:\x0eNormalRecoveryR\x04ki\
nd\"Z\n\x12RecoveryDeviceType\x12%\n!RecoveryDeviceType_ScrambledWords\
\x10\0\x12\x1d\n\x19RecoveryDeviceType_Matrix\x10\x01\"H\n\x0cRecoveryKi\
nd\x12\x12\n\x0eNormalRecovery\x10\0\x12\n\n\x06DryRun\x10\x01\x12\x18\n\
\x14UnlockRepeatedBackup\x10\x02J\x04\x08\x07\x10\x08\"\xc5\x01\n\x0bWor\
dRequest\x12N\n\x04type\x18\x01\x20\x02(\x0e2:.hw.trezor.messages.manage\
ment.WordRequest.WordRequestTypeR\x04type\"f\n\x0fWordRequestType\x12\
\x19\n\x15WordRequestType_Plain\x10\0\x12\x1b\n\x17WordRequestType_Matri\
x9\x10\x01\x12\x1b\n\x17WordRequestType_Matrix6\x10\x02\"\x1d\n\x07WordA\
ck\x12\x12\n\x04word\x18\x01\x20\x02(\tR\x04word\"0\n\rSetU2FCounter\x12\
\x1f\n\x0bu2f_counter\x18\x01\x20\x02(\rR\nu2fCounter\"\x13\n\x11GetNext\
U2FCounter\"1\n\x0eNextU2FCounter\x12\x1f\n\x0bu2f_counter\x18\x01\x20\
\x02(\rR\nu2fCounter\"\x11\n\x0fDoPreauthorized\"\x16\n\x14Preauthorized\
Request\"\x15\n\x13CancelAuthorization\"\x9a\x02\n\x12RebootToBootloader\
\x12o\n\x0cboot_command\x18\x01\x20\x01(\x0e2=.hw.trezor.messages.manage\
ment.RebootToBootloader.BootCommand:\rSTOP_AND_WAITR\x0bbootCommand\x12'\
\n\x0ffirmware_header\x18\x02\x20\x01(\x0cR\x0efirmwareHeader\x123\n\x14\
language_data_length\x18\x03\x20\x01(\r:\x010R\x12languageDataLength\"5\
\n\x0bBootCommand\x12\x11\n\rSTOP_AND_WAIT\x10\0\x12\x13\n\x0fINSTALL_UP\
GRADE\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\x03mac\x18\x01\x20\x01(\x0cR\x03mac\"\x14\n\x12ShowDeviceTuto\
rial\"\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\x0cPromptAlway\
s\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\x17TrezorMessageManage\
ment\x80\xa6\x1d\x01\
";
/// `FileDescriptorProto` object which was a source for this generated file
@ -10966,10 +11074,11 @@ pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor {
messages.push(ShowDeviceTutorial::generated_message_descriptor_data());
messages.push(UnlockBootloader::generated_message_descriptor_data());
messages.push(backup_device::Slip39Group::generated_message_descriptor_data());
let mut enums = ::std::vec::Vec::with_capacity(10);
let mut enums = ::std::vec::Vec::with_capacity(11);
enums.push(BackupType::generated_enum_descriptor_data());
enums.push(SafetyCheckLevel::generated_enum_descriptor_data());
enums.push(HomescreenFormat::generated_enum_descriptor_data());
enums.push(features::BackupAvailability::generated_enum_descriptor_data());
enums.push(features::RecoveryStatus::generated_enum_descriptor_data());
enums.push(features::Capability::generated_enum_descriptor_data());
enums.push(sd_protect::SdProtectOperationType::generated_enum_descriptor_data());

@ -109,7 +109,7 @@ def test_backup_slip39_custom(
assert device_handler.result() == "Seed successfully backed up"
features = device_handler.features()
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.pin_protection is False
assert features.passphrase_protection is False
assert features.backup_type is messages.BackupType.Slip39_Basic

@ -47,7 +47,7 @@ def prepare_recovery_and_evaluate(
assert isinstance(device_handler.result(), messages.Success)
features = device_handler.features()
assert features.initialized is True
assert features.recovery_status == messages.RecoveryStatus.NoRecovery
assert features.recovery_status == messages.RecoveryStatus.Nothing
@pytest.mark.setup_client(uninitialized=True)

@ -95,9 +95,9 @@ def test_repeated_backup(
features = device_handler.features()
assert features.backup_type is messages.BackupType.Slip39_Basic
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.no_backup is False
assert features.recovery_status == messages.RecoveryStatus.NoRecovery
assert features.recovery_status == messages.RecoveryStatus.Nothing
# run recovery to unlock backup
device_handler.run(
@ -125,12 +125,9 @@ def test_repeated_backup(
features = device_handler.features()
assert features.backup_type is messages.BackupType.Slip39_Basic
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.Available
assert features.no_backup is False
assert (
features.recovery_status
== messages.RecoveryStatus.InUnlockRepeatedBackupRecovery
)
assert features.recovery_status == messages.RecoveryStatus.Backup
# at this point, the backup is unlocked...
@ -171,9 +168,9 @@ def test_repeated_backup(
features = device_handler.features()
assert features.backup_type is messages.BackupType.Slip39_Basic
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.no_backup is False
assert features.recovery_status == messages.RecoveryStatus.NoRecovery
assert features.recovery_status == messages.RecoveryStatus.Nothing
# try to unlock backup again...
device_handler.run(
@ -199,12 +196,9 @@ def test_repeated_backup(
features = device_handler.features()
assert features.backup_type is messages.BackupType.Slip39_Basic
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.Available
assert features.no_backup is False
assert (
features.recovery_status
== messages.RecoveryStatus.InUnlockRepeatedBackupRecovery
)
assert features.recovery_status == messages.RecoveryStatus.Backup
# but if we cancel the backup at this point...
reset.cancel_backup(debug)
@ -213,6 +207,6 @@ def test_repeated_backup(
features = device_handler.features()
assert features.backup_type is messages.BackupType.Slip39_Basic
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.no_backup is False
assert features.recovery_status == messages.RecoveryStatus.NoRecovery
assert features.recovery_status == messages.RecoveryStatus.Nothing

@ -72,7 +72,7 @@ def test_reset_bip39(device_handler: "BackgroundDeviceHandler"):
assert device_handler.result() == "Initialized"
features = device_handler.features()
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.pin_protection is False
assert features.passphrase_protection is False
assert features.backup_type is messages.BackupType.Bip39

@ -137,7 +137,7 @@ def test_reset_slip39_advanced(
features = device_handler.features()
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.pin_protection is False
assert features.passphrase_protection is False
assert features.backup_type is messages.BackupType.Slip39_Advanced

@ -115,7 +115,7 @@ def test_reset_slip39_basic(
assert device_handler.result() == "Initialized"
features = device_handler.features()
assert features.initialized is True
assert features.needs_backup is False
assert features.backup_availability == messages.BackupAvailability.NotAvailable
assert features.pin_protection is False
assert features.passphrase_protection is False
assert features.backup_type is messages.BackupType.Slip39_Basic

@ -20,7 +20,7 @@ from shamir_mnemonic import shamir
from trezorlib import device
from trezorlib.debuglink import TrezorClientDebugLink as Client
from trezorlib.messages import BackupType
from trezorlib.messages import BackupAvailability, BackupType
from ...common import WITH_MOCK_URANDOM
from ...input_flows import (
@ -85,7 +85,7 @@ def test_skip_backup_msg(client: Client, backup_type, backup_flow):
)
assert client.features.initialized is True
assert client.features.needs_backup is True
assert client.features.backup_availability == BackupAvailability.Required
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
assert client.features.backup_type is backup_type
@ -94,7 +94,7 @@ def test_skip_backup_msg(client: Client, backup_type, backup_flow):
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert client.features.unfinished_backup is False
assert client.features.backup_type is backup_type
@ -119,7 +119,7 @@ def test_skip_backup_manual(client: Client, backup_type: BackupType, backup_flow
)
assert client.features.initialized is True
assert client.features.needs_backup is True
assert client.features.backup_availability == BackupAvailability.Required
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
assert client.features.backup_type is backup_type
@ -128,7 +128,7 @@ def test_skip_backup_manual(client: Client, backup_type: BackupType, backup_flow
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert client.features.unfinished_backup is False
assert client.features.backup_type is backup_type

@ -53,7 +53,7 @@ def test_reset_device_skip_backup(client: Client):
# Check if device is properly initialized
ret = client.call_raw(messages.Initialize())
assert ret.initialized is True
assert ret.needs_backup is True
assert ret.backup_availability == messages.BackupAvailability.Required
assert ret.unfinished_backup is False
assert ret.no_backup is False
@ -120,7 +120,7 @@ def test_reset_device_skip_backup_break(client: Client):
# Check if device is properly initialized
ret = client.call_raw(messages.Initialize())
assert ret.initialized is True
assert ret.needs_backup is True
assert ret.backup_availability == messages.BackupAvailability.Required
assert ret.unfinished_backup is False
assert ret.no_backup is False
@ -131,7 +131,7 @@ def test_reset_device_skip_backup_break(client: Client):
ret = client.call_raw(messages.Initialize())
assert isinstance(ret, messages.Features)
assert ret.initialized is True
assert ret.needs_backup is False
assert ret.backup_availability == messages.BackupAvailability.NotAvailable
assert ret.unfinished_backup is True
assert ret.no_backup is False
@ -143,7 +143,7 @@ def test_reset_device_skip_backup_break(client: Client):
ret = client.call_raw(messages.Initialize())
assert isinstance(ret, messages.Features)
assert ret.initialized is True
assert ret.needs_backup is False
assert ret.backup_availability == messages.BackupAvailability.NotAvailable
assert ret.unfinished_backup is True
assert ret.no_backup is False

@ -80,7 +80,7 @@ def reset_device(client: Client, strength: int):
# Check if device is properly initialized
resp = client.call_raw(messages.Initialize())
assert resp.initialized is True
assert resp.needs_backup is False
assert resp.backup_availability == messages.BackupAvailability.NotAvailable
assert resp.pin_protection is False
assert resp.passphrase_protection is False
@ -177,7 +177,7 @@ def test_reset_device_256_pin(client: Client):
# Check if device is properly initialized
resp = client.call_raw(messages.Initialize())
assert resp.initialized is True
assert resp.needs_backup is False
assert resp.backup_availability == messages.BackupAvailability.NotAvailable
assert resp.pin_protection is True
assert resp.passphrase_protection is True

@ -57,7 +57,7 @@ def reset_device(client: Client, strength: int):
# Check if device is properly initialized
resp = client.call_raw(messages.Initialize())
assert resp.initialized is True
assert resp.needs_backup is False
assert resp.backup_availability == messages.BackupAvailability.NotAvailable
assert resp.pin_protection is False
assert resp.passphrase_protection is False
assert resp.backup_type is messages.BackupType.Bip39
@ -106,7 +106,7 @@ def test_reset_device_pin(client: Client):
# Check if device is properly initialized
resp = client.call_raw(messages.Initialize())
assert resp.initialized is True
assert resp.needs_backup is False
assert resp.backup_availability == messages.BackupAvailability.NotAvailable
assert resp.pin_protection is True
assert resp.passphrase_protection is True
@ -140,7 +140,7 @@ def test_reset_failed_check(client: Client):
# Check if device is properly initialized
resp = client.call_raw(messages.Initialize())
assert resp.initialized is True
assert resp.needs_backup is False
assert resp.backup_availability == messages.BackupAvailability.NotAvailable
assert resp.pin_protection is False
assert resp.passphrase_protection is False
assert resp.backup_type is messages.BackupType.Bip39

@ -55,7 +55,9 @@ def reset(client: Client, strength: int = 128, skip_backup: bool = False) -> str
# Check if device is properly initialized
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.pin_protection is False
assert client.features.passphrase_protection is False

@ -75,7 +75,9 @@ def reset(client: Client, strength: int = 128) -> list[str]:
# Check if device is properly initialized
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.pin_protection is False
assert client.features.passphrase_protection is False

@ -65,7 +65,9 @@ def reset(client: Client, strength: int = 128) -> list[str]:
# Check if device is properly initialized
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.pin_protection is False
assert client.features.passphrase_protection is False

@ -20,7 +20,7 @@ from shamir_mnemonic import shamir
from trezorlib import device
from trezorlib.debuglink import TrezorClientDebugLink as Client
from trezorlib.exceptions import TrezorFailure
from trezorlib.messages import BackupType
from trezorlib.messages import BackupAvailability, BackupType
from ...common import EXTERNAL_ENTROPY, WITH_MOCK_URANDOM, generate_entropy
from ...input_flows import InputFlowSlip39AdvancedResetRecovery
@ -58,7 +58,7 @@ def test_reset_device_slip39_advanced(client: Client):
# Check if device is properly initialized
assert client.features.initialized is True
assert client.features.needs_backup is False
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert client.features.pin_protection is False
assert client.features.passphrase_protection is False
assert client.features.backup_type is BackupType.Slip39_Advanced

@ -22,7 +22,7 @@ from shamir_mnemonic import MnemonicError, shamir
from trezorlib import device
from trezorlib.debuglink import TrezorClientDebugLink as Client
from trezorlib.exceptions import TrezorFailure
from trezorlib.messages import BackupType
from trezorlib.messages import BackupAvailability, BackupType
from ...common import EXTERNAL_ENTROPY, WITH_MOCK_URANDOM, generate_entropy
from ...input_flows import InputFlowSlip39BasicResetRecovery
@ -57,7 +57,7 @@ def reset_device(client: Client, strength: int):
# Check if device is properly initialized
assert client.features.initialized is True
assert client.features.needs_backup is False
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert client.features.pin_protection is False
assert client.features.passphrase_protection is False
assert client.features.backup_type is BackupType.Slip39_Basic

@ -40,7 +40,7 @@ from ..input_flows import (
@pytest.mark.skip_t1b1 # TODO we want this for t1 too
@pytest.mark.setup_client(needs_backup=True, mnemonic=MNEMONIC12)
def test_backup_bip39(client: Client):
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
with client:
IF = InputFlowBip39Backup(client)
@ -50,7 +50,9 @@ def test_backup_bip39(client: Client):
assert IF.mnemonic == MNEMONIC12
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
assert client.features.backup_type is messages.BackupType.Bip39
@ -65,7 +67,7 @@ def test_backup_slip39_basic(client: Client, click_info: bool):
if click_info and client.model is models.T2B1:
pytest.skip("click_info not implemented on T2B1")
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
with client:
IF = InputFlowSlip39BasicBackup(client, click_info)
@ -74,7 +76,9 @@ def test_backup_slip39_basic(client: Client, click_info: bool):
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
assert client.features.backup_type is messages.BackupType.Slip39_Basic
@ -93,7 +97,7 @@ def test_backup_slip39_advanced(client: Client, click_info: bool):
if click_info and client.model is models.T2B1:
pytest.skip("click_info not implemented on T2B1")
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
with client:
IF = InputFlowSlip39AdvancedBackup(client, click_info)
@ -102,7 +106,9 @@ def test_backup_slip39_advanced(client: Client, click_info: bool):
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
assert client.features.backup_type is messages.BackupType.Slip39_Advanced
@ -122,7 +128,7 @@ def test_backup_slip39_advanced(client: Client, click_info: bool):
ids=["1_of_1", "2_of_2", "3_of_5"],
)
def test_backup_slip39_custom(client: Client, share_threshold, share_count):
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
with client:
IF = InputFlowSlip39CustomBackup(client, share_count)
@ -133,7 +139,9 @@ def test_backup_slip39_custom(client: Client, share_threshold, share_count):
client.init_device()
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
@ -150,7 +158,9 @@ def test_no_backup_fails(client: Client):
client.ensure_unlocked()
assert client.features.initialized is True
assert client.features.no_backup is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
# backup attempt should fail because no_backup=True
with pytest.raises(TrezorFailure, match=r".*Seed already backed up"):
@ -162,7 +172,7 @@ def test_no_backup_fails(client: Client):
def test_interrupt_backup_fails(client: Client):
client.ensure_unlocked()
assert client.features.initialized is True
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
assert client.features.unfinished_backup is False
assert client.features.no_backup is False
@ -174,7 +184,9 @@ def test_interrupt_backup_fails(client: Client):
# check that device state is as expected
assert client.features.initialized is True
assert client.features.needs_backup is False
assert (
client.features.backup_availability == messages.BackupAvailability.NotAvailable
)
assert client.features.unfinished_backup is True
assert client.features.no_backup is False

@ -29,7 +29,7 @@ from ..input_flows import InputFlowSlip39BasicBackup, InputFlowSlip39BasicRecove
@pytest.mark.skip_t1b1
@WITH_MOCK_URANDOM
def test_repeated_backup(client: Client):
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
# initial device backup
mnemonics = []
@ -71,7 +71,7 @@ def test_repeated_backup(client: Client):
@pytest.mark.skip_t1b1
@WITH_MOCK_URANDOM
def test_repeated_backup_cancel(client: Client):
assert client.features.needs_backup is True
assert client.features.backup_availability == messages.BackupAvailability.Required
# initial device backup
mnemonics = []

@ -39,7 +39,7 @@ def test_abort(core_emulator: Emulator):
debug = device_handler.debuglink()
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
device_handler.run(device.recover, pin_protection=False)
@ -51,7 +51,7 @@ def test_abort(core_emulator: Emulator):
debug = _restart(device_handler, core_emulator)
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.InNormalRecovery
assert features.recovery_status == RecoveryStatus.Recovery
# no waiting for layout because layout doesn't change
assert "number of words" in debug.read_layout().text_content()
@ -67,7 +67,7 @@ def test_abort(core_emulator: Emulator):
assert layout.main_component() == "Homescreen"
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
@core_only
@ -77,7 +77,7 @@ def test_recovery_single_reset(core_emulator: Emulator):
features = device_handler.features()
assert features.initialized is False
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
device_handler.run(device.recover, pin_protection=False)
@ -87,7 +87,7 @@ def test_recovery_single_reset(core_emulator: Emulator):
debug = _restart(device_handler, core_emulator)
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.InNormalRecovery
assert features.recovery_status == RecoveryStatus.Recovery
# we need to enter the number of words again, that's a feature
recovery.select_number_of_words(debug, wait=False)
@ -96,7 +96,7 @@ def test_recovery_single_reset(core_emulator: Emulator):
features = device_handler.features()
assert features.initialized is True
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
@core_only
@ -114,7 +114,7 @@ def test_recovery_on_old_wallet(core_emulator: Emulator):
features = device_handler.features()
assert features.initialized is False
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
# enter recovery mode
device_handler.run(device.recover, pin_protection=False)
@ -124,7 +124,7 @@ def test_recovery_on_old_wallet(core_emulator: Emulator):
# restart to get into stand-alone recovery
debug = _restart(device_handler, core_emulator)
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.InNormalRecovery
assert features.recovery_status == RecoveryStatus.Recovery
# enter number of words
recovery.select_number_of_words(debug, wait=False)
@ -163,7 +163,7 @@ def test_recovery_on_old_wallet(core_emulator: Emulator):
# check that the recovery succeeded
features = device_handler.features()
assert features.initialized is True
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
@core_only
@ -187,7 +187,7 @@ def test_recovery_multiple_resets(core_emulator: Emulator):
features = device_handler.features()
assert features.initialized is False
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing
# start device and recovery
device_handler.run(device.recover, pin_protection=False)
@ -200,7 +200,7 @@ def test_recovery_multiple_resets(core_emulator: Emulator):
# restart
debug = _restart(device_handler, core_emulator)
features = device_handler.features()
assert features.recovery_status == RecoveryStatus.InNormalRecovery
assert features.recovery_status == RecoveryStatus.Recovery
# enter the number of words again, that's a feature!
recovery.select_number_of_words(debug, wait=False)
@ -212,4 +212,4 @@ def test_recovery_multiple_resets(core_emulator: Emulator):
features = device_handler.features()
assert features.initialized is True
assert features.recovery_status == RecoveryStatus.NoRecovery
assert features.recovery_status == RecoveryStatus.Nothing

@ -20,7 +20,7 @@ from typing import TYPE_CHECKING, List, Optional
import pytest
from trezorlib import btc, debuglink, device, exceptions, fido, models
from trezorlib.messages import BackupType, RecoveryStatus
from trezorlib.messages import BackupAvailability, BackupType, RecoveryStatus
from trezorlib.tools import H_
from ..common import MNEMONIC_SLIP39_BASIC_20_3of6, MNEMONIC_SLIP39_BASIC_20_3of6_SECRET
@ -193,7 +193,7 @@ def test_upgrade_reset(gen: str, tag: str):
assert not client.features.passphrase_protection
assert client.features.initialized
assert client.features.label == LABEL
assert not client.features.needs_backup
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert not client.features.unfinished_backup
assert not client.features.no_backup
@ -224,7 +224,7 @@ def test_upgrade_reset_skip_backup(gen: str, tag: str):
assert not client.features.passphrase_protection
assert client.features.initialized
assert client.features.label == LABEL
assert client.features.needs_backup
assert client.features.backup_availability == BackupAvailability.Required
assert not client.features.unfinished_backup
assert not client.features.no_backup
@ -256,7 +256,7 @@ def test_upgrade_reset_no_backup(gen: str, tag: str):
assert not client.features.passphrase_protection
assert client.features.initialized
assert client.features.label == LABEL
assert not client.features.needs_backup
assert client.features.backup_availability == BackupAvailability.NotAvailable
assert not client.features.unfinished_backup
assert client.features.no_backup
@ -287,7 +287,7 @@ def test_upgrade_shamir_recovery(gen: str, tag: Optional[str]):
with EmulatorWrapper(gen, tag) as emu, BackgroundDeviceHandler(
emu.client
) as device_handler:
assert emu.client.features.recovery_status == RecoveryStatus.NoRecovery
assert emu.client.features.recovery_status == RecoveryStatus.Nothing
emu.client.watch_layout(True)
debug = device_handler.debuglink()
@ -308,7 +308,7 @@ def test_upgrade_shamir_recovery(gen: str, tag: Optional[str]):
with EmulatorWrapper(gen, storage=storage) as emu:
assert device_id == emu.client.features.device_id
assert emu.client.features.recovery_status == RecoveryStatus.InNormalRecovery
assert emu.client.features.recovery_status == RecoveryStatus.Recovery
debug = emu.client.debug
emu.client.watch_layout(True)

Loading…
Cancel
Save