mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
common: add SafetyCheckLevel to Features
This commit is contained in:
parent
163ccedb39
commit
9f066e877d
@ -14,6 +14,14 @@ enum BackupType {
|
|||||||
Slip39_Advanced = 2; // also called "Super Shamir" or "Shamir with Groups", see SLIP-0039#two-level-scheme
|
Slip39_Advanced = 2; // also called "Super Shamir" or "Shamir with Groups", see SLIP-0039#two-level-scheme
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Level of safety checks for unsafe actions like spending from invalid path namespace or setting high transaction fee.
|
||||||
|
*/
|
||||||
|
enum SafetyCheckLevel {
|
||||||
|
Strict = 0; // disallow unsafe actions
|
||||||
|
Prompt = 1; // ask user before unsafe action
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request: Reset device to default state and ask for device details
|
* Request: Reset device to default state and ask for device details
|
||||||
* @start
|
* @start
|
||||||
@ -90,6 +98,7 @@ message Features {
|
|||||||
optional bool wipe_code_protection = 34; // is wipe code protection enabled
|
optional bool wipe_code_protection = 34; // is wipe code protection enabled
|
||||||
optional bytes session_id = 35;
|
optional bytes session_id = 35;
|
||||||
optional bool passphrase_always_on_device = 36; // device enforces passphrase entry on Trezor
|
optional bool passphrase_always_on_device = 36; // device enforces passphrase entry on Trezor
|
||||||
|
optional SafetyCheckLevel safety_checks = 37; // safety check level, set to Prompt to limit path namespace enforcement
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -126,11 +135,6 @@ message ApplySettings {
|
|||||||
optional uint32 display_rotation = 7; // in degrees from North
|
optional uint32 display_rotation = 7; // in degrees from North
|
||||||
optional bool passphrase_always_on_device = 8; // do not prompt for passphrase, enforce device entry
|
optional bool passphrase_always_on_device = 8; // do not prompt for passphrase, enforce device entry
|
||||||
optional SafetyCheckLevel safety_checks = 9; // Safety check level, set to Prompt to limit path namespace enforcement
|
optional SafetyCheckLevel safety_checks = 9; // Safety check level, set to Prompt to limit path namespace enforcement
|
||||||
|
|
||||||
enum SafetyCheckLevel {
|
|
||||||
Strict = 0;
|
|
||||||
Prompt = 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -8,6 +8,7 @@ if __debug__:
|
|||||||
from typing_extensions import Literal # noqa: F401
|
from typing_extensions import Literal # noqa: F401
|
||||||
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
||||||
EnumTypeBackupType = Literal[0, 1, 2]
|
EnumTypeBackupType = Literal[0, 1, 2]
|
||||||
|
EnumTypeSafetyCheckLevel = Literal[0, 1]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ class Features(p.MessageType):
|
|||||||
wipe_code_protection: bool = None,
|
wipe_code_protection: bool = None,
|
||||||
session_id: bytes = None,
|
session_id: bytes = None,
|
||||||
passphrase_always_on_device: bool = None,
|
passphrase_always_on_device: bool = None,
|
||||||
|
safety_checks: EnumTypeSafetyCheckLevel = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.vendor = vendor
|
self.vendor = vendor
|
||||||
self.major_version = major_version
|
self.major_version = major_version
|
||||||
@ -86,6 +88,7 @@ class Features(p.MessageType):
|
|||||||
self.wipe_code_protection = wipe_code_protection
|
self.wipe_code_protection = wipe_code_protection
|
||||||
self.session_id = session_id
|
self.session_id = session_id
|
||||||
self.passphrase_always_on_device = passphrase_always_on_device
|
self.passphrase_always_on_device = passphrase_always_on_device
|
||||||
|
self.safety_checks = safety_checks
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_fields(cls) -> Dict:
|
def get_fields(cls) -> Dict:
|
||||||
@ -124,4 +127,5 @@ class Features(p.MessageType):
|
|||||||
34: ('wipe_code_protection', p.BoolType, 0),
|
34: ('wipe_code_protection', p.BoolType, 0),
|
||||||
35: ('session_id', p.BytesType, 0),
|
35: ('session_id', p.BytesType, 0),
|
||||||
36: ('passphrase_always_on_device', p.BoolType, 0),
|
36: ('passphrase_always_on_device', p.BoolType, 0),
|
||||||
|
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1)), 0),
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ if __debug__:
|
|||||||
from typing_extensions import Literal # noqa: F401
|
from typing_extensions import Literal # noqa: F401
|
||||||
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]
|
||||||
EnumTypeBackupType = Literal[0, 1, 2]
|
EnumTypeBackupType = Literal[0, 1, 2]
|
||||||
|
EnumTypeSafetyCheckLevel = Literal[0, 1]
|
||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -51,6 +52,7 @@ class Features(p.MessageType):
|
|||||||
wipe_code_protection: bool = None,
|
wipe_code_protection: bool = None,
|
||||||
session_id: bytes = None,
|
session_id: bytes = None,
|
||||||
passphrase_always_on_device: bool = None,
|
passphrase_always_on_device: bool = None,
|
||||||
|
safety_checks: EnumTypeSafetyCheckLevel = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self.vendor = vendor
|
self.vendor = vendor
|
||||||
self.major_version = major_version
|
self.major_version = major_version
|
||||||
@ -86,6 +88,7 @@ class Features(p.MessageType):
|
|||||||
self.wipe_code_protection = wipe_code_protection
|
self.wipe_code_protection = wipe_code_protection
|
||||||
self.session_id = session_id
|
self.session_id = session_id
|
||||||
self.passphrase_always_on_device = passphrase_always_on_device
|
self.passphrase_always_on_device = passphrase_always_on_device
|
||||||
|
self.safety_checks = safety_checks
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_fields(cls) -> Dict:
|
def get_fields(cls) -> Dict:
|
||||||
@ -124,4 +127,5 @@ class Features(p.MessageType):
|
|||||||
34: ('wipe_code_protection', p.BoolType, 0),
|
34: ('wipe_code_protection', p.BoolType, 0),
|
||||||
35: ('session_id', p.BytesType, 0),
|
35: ('session_id', p.BytesType, 0),
|
||||||
36: ('passphrase_always_on_device', p.BoolType, 0),
|
36: ('passphrase_always_on_device', p.BoolType, 0),
|
||||||
|
37: ('safety_checks', p.EnumType("SafetyCheckLevel", (0, 1)), 0),
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user