mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-22 07:28:10 +00:00
common: rename Features.features to Features.capabilities
This commit is contained in:
parent
41428ab2df
commit
1a71c7a3e8
@ -58,24 +58,24 @@ message Features {
|
||||
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 bool recovery_mode = 29; // is recovery mode in progress
|
||||
repeated Feature features = 30; // list of supported features
|
||||
enum Feature {
|
||||
Feature_Bitcoin = 1;
|
||||
Feature_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
|
||||
Feature_Binance = 3;
|
||||
Feature_Cardano = 4;
|
||||
Feature_Crypto = 5; // generic crypto operations for GPG, SSH, etc.
|
||||
Feature_EOS = 6;
|
||||
Feature_Ethereum = 7;
|
||||
Feature_Lisk = 8;
|
||||
Feature_Monero = 9;
|
||||
Feature_NEM = 10;
|
||||
Feature_Ripple = 11;
|
||||
Feature_Stellar = 12;
|
||||
Feature_Tezos = 13;
|
||||
Feature_U2F = 14;
|
||||
Feature_Shamir = 15;
|
||||
Feature_ShamirGroups = 16;
|
||||
repeated Capability capabilities = 30; // list of supported capabilities
|
||||
enum Capability {
|
||||
Capability_Bitcoin = 1;
|
||||
Capability_Bitcoin_like = 2; // Altcoins based on the Bitcoin source code
|
||||
Capability_Binance = 3;
|
||||
Capability_Cardano = 4;
|
||||
Capability_Crypto = 5; // generic crypto operations for GPG, SSH, etc.
|
||||
Capability_EOS = 6;
|
||||
Capability_Ethereum = 7;
|
||||
Capability_Lisk = 8;
|
||||
Capability_Monero = 9;
|
||||
Capability_NEM = 10;
|
||||
Capability_Ripple = 11;
|
||||
Capability_Stellar = 12;
|
||||
Capability_Tezos = 13;
|
||||
Capability_U2F = 14;
|
||||
Capability_Shamir = 15;
|
||||
Capability_ShamirGroups = 16;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
from trezor import config, utils, wire
|
||||
from trezor.messages import Feature, MessageType
|
||||
from trezor.messages import Capability, MessageType
|
||||
from trezor.messages.Features import Features
|
||||
from trezor.messages.Success import Success
|
||||
from trezor.wire import register
|
||||
@ -37,30 +37,30 @@ def get_features() -> Features:
|
||||
f.flags = storage.device.get_flags()
|
||||
f.recovery_mode = storage.recovery.is_in_progress()
|
||||
if utils.BITCOIN_ONLY:
|
||||
f.features = [
|
||||
Feature.Bitcoin,
|
||||
Feature.Crypto,
|
||||
Feature.Shamir,
|
||||
Feature.ShamirGroups,
|
||||
f.capabilities = [
|
||||
Capability.Bitcoin,
|
||||
Capability.Crypto,
|
||||
Capability.Shamir,
|
||||
Capability.ShamirGroups,
|
||||
]
|
||||
else:
|
||||
f.features = [
|
||||
Feature.Bitcoin,
|
||||
Feature.Bitcoin_like,
|
||||
Feature.Binance,
|
||||
Feature.Cardano,
|
||||
Feature.Crypto,
|
||||
Feature.EOS,
|
||||
Feature.Ethereum,
|
||||
Feature.Lisk,
|
||||
Feature.Monero,
|
||||
Feature.NEM,
|
||||
Feature.Ripple,
|
||||
Feature.Stellar,
|
||||
Feature.Tezos,
|
||||
Feature.U2F,
|
||||
Feature.Shamir,
|
||||
Feature.ShamirGroups,
|
||||
f.capabilities = [
|
||||
Capability.Bitcoin,
|
||||
Capability.Bitcoin_like,
|
||||
Capability.Binance,
|
||||
Capability.Cardano,
|
||||
Capability.Crypto,
|
||||
Capability.EOS,
|
||||
Capability.Ethereum,
|
||||
Capability.Lisk,
|
||||
Capability.Monero,
|
||||
Capability.NEM,
|
||||
Capability.Ripple,
|
||||
Capability.Stellar,
|
||||
Capability.Tezos,
|
||||
Capability.U2F,
|
||||
Capability.Shamir,
|
||||
Capability.ShamirGroups,
|
||||
]
|
||||
return f
|
||||
|
||||
|
@ -6,10 +6,10 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List, Optional
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
except ImportError:
|
||||
Dict, List, Optional = None, None, None # type: ignore
|
||||
EnumTypeFeature = None # type: ignore
|
||||
EnumTypeCapability = None # type: ignore
|
||||
|
||||
|
||||
class Features(p.MessageType):
|
||||
@ -45,7 +45,7 @@ class Features(p.MessageType):
|
||||
unfinished_backup: bool = None,
|
||||
no_backup: bool = None,
|
||||
recovery_mode: bool = None,
|
||||
features: List[EnumTypeFeature] = None,
|
||||
capabilities: List[EnumTypeCapability] = None,
|
||||
) -> None:
|
||||
self.vendor = vendor
|
||||
self.major_version = major_version
|
||||
@ -75,7 +75,7 @@ class Features(p.MessageType):
|
||||
self.unfinished_backup = unfinished_backup
|
||||
self.no_backup = no_backup
|
||||
self.recovery_mode = recovery_mode
|
||||
self.features = features if features is not None else []
|
||||
self.capabilities = capabilities if capabilities is not None else []
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
@ -108,5 +108,5 @@ class Features(p.MessageType):
|
||||
27: ('unfinished_backup', p.BoolType, 0),
|
||||
28: ('no_backup', p.BoolType, 0),
|
||||
29: ('recovery_mode', p.BoolType, 0),
|
||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||
}
|
||||
|
@ -84,19 +84,19 @@ void fsm_msgGetFeatures(const GetFeatures *msg) {
|
||||
strlcpy(resp->model, "1", sizeof(resp->model));
|
||||
|
||||
#if BITCOIN_ONLY
|
||||
resp->features_count = 2;
|
||||
resp->features[0] = Feature_Feature_Bitcoin;
|
||||
resp->features[1] = Feature_Feature_Crypto;
|
||||
resp->capabilities_count = 2;
|
||||
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||
resp->capabilities[1] = Capability_Capability_Crypto;
|
||||
#else
|
||||
resp->features_count = 8;
|
||||
resp->features[0] = Feature_Feature_Bitcoin;
|
||||
resp->features[1] = Feature_Feature_Bitcoin_like;
|
||||
resp->features[2] = Feature_Feature_Crypto;
|
||||
resp->features[3] = Feature_Feature_Ethereum;
|
||||
resp->features[4] = Feature_Feature_Lisk;
|
||||
resp->features[5] = Feature_Feature_NEM;
|
||||
resp->features[6] = Feature_Feature_Stellar;
|
||||
resp->features[7] = Feature_Feature_U2F;
|
||||
resp->capabilities_count = 8;
|
||||
resp->capabilities[0] = Capability_Capability_Bitcoin;
|
||||
resp->capabilities[1] = Capability_Capability_Bitcoin_like;
|
||||
resp->capabilities[2] = Capability_Capability_Crypto;
|
||||
resp->capabilities[3] = Capability_Capability_Ethereum;
|
||||
resp->capabilities[4] = Capability_Capability_Lisk;
|
||||
resp->capabilities[5] = Capability_Capability_NEM;
|
||||
resp->capabilities[6] = Capability_Capability_Stellar;
|
||||
resp->capabilities[7] = Capability_Capability_U2F;
|
||||
#endif
|
||||
|
||||
msg_write(MessageType_MessageType_Features, resp);
|
||||
|
@ -9,7 +9,7 @@ Features.bootloader_hash max_size:32
|
||||
Features.model max_size:17
|
||||
Features.fw_vendor max_size:256
|
||||
Features.fw_vendor_keys max_size:32
|
||||
Features.features max_count:32
|
||||
Features.capabilities max_count:32
|
||||
|
||||
ApplySettings.language max_size:17
|
||||
ApplySettings.label max_size:33
|
||||
|
@ -6,10 +6,10 @@ if __debug__:
|
||||
try:
|
||||
from typing import Dict, List, Optional
|
||||
from typing_extensions import Literal # noqa: F401
|
||||
EnumTypeFeature = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
EnumTypeCapability = Literal[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
|
||||
except ImportError:
|
||||
Dict, List, Optional = None, None, None # type: ignore
|
||||
EnumTypeFeature = None # type: ignore
|
||||
EnumTypeCapability = None # type: ignore
|
||||
|
||||
|
||||
class Features(p.MessageType):
|
||||
@ -45,7 +45,7 @@ class Features(p.MessageType):
|
||||
unfinished_backup: bool = None,
|
||||
no_backup: bool = None,
|
||||
recovery_mode: bool = None,
|
||||
features: List[EnumTypeFeature] = None,
|
||||
capabilities: List[EnumTypeCapability] = None,
|
||||
) -> None:
|
||||
self.vendor = vendor
|
||||
self.major_version = major_version
|
||||
@ -75,7 +75,7 @@ class Features(p.MessageType):
|
||||
self.unfinished_backup = unfinished_backup
|
||||
self.no_backup = no_backup
|
||||
self.recovery_mode = recovery_mode
|
||||
self.features = features if features is not None else []
|
||||
self.capabilities = capabilities if capabilities is not None else []
|
||||
|
||||
@classmethod
|
||||
def get_fields(cls) -> Dict:
|
||||
@ -108,5 +108,5 @@ class Features(p.MessageType):
|
||||
27: ('unfinished_backup', p.BoolType, 0),
|
||||
28: ('no_backup', p.BoolType, 0),
|
||||
29: ('recovery_mode', p.BoolType, 0),
|
||||
30: ('features', p.EnumType("Feature", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||
30: ('capabilities', p.EnumType("Capability", (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)), p.FLAG_REPEATED),
|
||||
}
|
||||
|
@ -254,8 +254,8 @@ from . import BinanceOrderSide
|
||||
from . import BinanceOrderType
|
||||
from . import BinanceTimeInForce
|
||||
from . import ButtonRequestType
|
||||
from . import Capability
|
||||
from . import FailureType
|
||||
from . import Feature
|
||||
from . import InputScriptType
|
||||
from . import LiskTransactionType
|
||||
from . import MessageType
|
||||
|
@ -69,17 +69,17 @@ do_rebuild() {
|
||||
# TODO: make this less hackish
|
||||
# maybe introduce attribute "altcoin" in protobuf?
|
||||
if [ "$APPLY_BITCOIN_ONLY" == "TRUE" ]; then
|
||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/Feature.py
|
||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/Capability.py
|
||||
sed -i "3ifrom trezor import utils\n" "$DESTDIR"/MessageType.py
|
||||
sed -i "/^EthereumGetPublicKey/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/MessageType.py
|
||||
for altcoin in Ethereum NEM Lisk Tezos Stellar Cardano Ripple Monero DebugMonero Eos Binance; do
|
||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/Feature.py
|
||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/Capability.py
|
||||
sed -i "s:^$altcoin: $altcoin:" "$DESTDIR"/MessageType.py
|
||||
done
|
||||
sed -i "/^Bitcoin_like/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
||||
sed -i "/^EOS/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Feature.py
|
||||
sed -i "/^Bitcoin_like/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Capability.py
|
||||
sed -i "/^EOS/iif not utils.BITCOIN_ONLY:" "$DESTDIR"/Capability.py
|
||||
for feature in Bitcoin_like EOS U2F; do
|
||||
sed -i "s:^$feature: $feature:" "$DESTDIR"/Feature.py
|
||||
sed -i "s:^$feature: $feature:" "$DESTDIR"/Capability.py
|
||||
done
|
||||
fi
|
||||
# ENDTODO
|
||||
|
Loading…
Reference in New Issue
Block a user