1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 21:22:10 +00:00

feat(common): Add UnlockPath message.

[no changelog]
This commit is contained in:
Andrew Kozlik 2022-06-03 11:38:22 +02:00 committed by Andrew Kozlik
parent c53177fe89
commit 9d89c3cb1b
9 changed files with 100 additions and 1 deletions

View File

@ -607,3 +607,4 @@ message AuthorizeCoinJoin {
optional InputScriptType script_type = 7 [default=SPENDADDRESS]; // used to distinguish between various address formats (non-segwit, segwit, etc.)
optional AmountUnit amount_unit = 8 [default=BITCOIN]; // show amounts in
}

View File

@ -429,6 +429,7 @@ message DoPreauthorized {
* @start
* @next SignTx
* @next GetOwnershipProof
* @next GetPublicKey
*/
message PreauthorizedRequest {
}
@ -468,3 +469,25 @@ message Nonce {
required bytes nonce = 1; // a 32-byte random value generated by Trezor
}
/**
* Request: Ask device to unlock a subtree of the keychain.
* @start
* @next UnlockedPathRequest
* @next Failure
*/
message UnlockPath {
repeated uint32 address_n = 1; // prefix of the BIP-32 path leading to the account (m / purpose')
optional bytes mac = 2; // the MAC returned by UnlockedPathRequest
}
/**
* Request: Device awaits an operation.
* @start
* @next SignTx
* @next GetPublicKey
* @next GetAddress
*/
message UnlockedPathRequest {
optional bytes mac = 1; // authentication code for future UnlockPath calls
}

View File

@ -118,6 +118,8 @@ enum MessageType {
MessageType_GetFirmwareHash = 88 [(bitcoin_only) = true, (wire_in) = true];
MessageType_FirmwareHash = 89 [(bitcoin_only) = true, (wire_out) = true];
reserved 90 to 92;
MessageType_UnlockPath = 93 [(bitcoin_only) = true, (wire_in) = true];
MessageType_UnlockedPathRequest = 94 [(bitcoin_only) = true, (wire_out) = true];
MessageType_SetU2FCounter = 63 [(wire_in) = true];
MessageType_GetNextU2FCounter = 80 [(wire_in) = true];

View File

@ -44,6 +44,8 @@ CancelAuthorization = 86
RebootToBootloader = 87
GetFirmwareHash = 88
FirmwareHash = 89
UnlockPath = 93
UnlockedPathRequest = 94
FirmwareErase = 6
FirmwareUpload = 7
FirmwareRequest = 8

View File

@ -61,6 +61,8 @@ if TYPE_CHECKING:
RebootToBootloader = 87
GetFirmwareHash = 88
FirmwareHash = 89
UnlockPath = 93
UnlockedPathRequest = 94
SetU2FCounter = 63
GetNextU2FCounter = 80
NextU2FCounter = 81

View File

@ -2520,6 +2520,36 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["Nonce"]:
return isinstance(msg, cls)
class UnlockPath(protobuf.MessageType):
address_n: "list[int]"
mac: "bytes | None"
def __init__(
self,
*,
address_n: "list[int] | None" = None,
mac: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["UnlockPath"]:
return isinstance(msg, cls)
class UnlockedPathRequest(protobuf.MessageType):
mac: "bytes | None"
def __init__(
self,
*,
mac: "bytes | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: protobuf.MessageType) -> TypeGuard["UnlockedPathRequest"]:
return isinstance(msg, cls)
class DebugLinkDecision(protobuf.MessageType):
button: "DebugButton | None"
swipe: "DebugSwipeDirection | None"

View File

@ -5,7 +5,7 @@ endif
SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdProtect Tezos WebAuthn \
DebugLinkRecordScreen DebugLinkEraseSdCard DebugLinkWatchLayout \
GetOwnershipProof OwnershipProof GetOwnershipId OwnershipId AuthorizeCoinJoin DoPreauthorized \
CancelAuthorization DebugLinkLayout GetNonce SetBusy \
CancelAuthorization DebugLinkLayout GetNonce SetBusy UnlockPath \
TxAckInput TxAckOutput TxAckPrev TxAckPaymentRequest \
EthereumSignTypedData EthereumTypedDataStructRequest EthereumTypedDataStructAck \
EthereumTypedDataValueRequest EthereumTypedDataValueAck

View File

@ -38,3 +38,9 @@ Nonce.nonce max_size:32
GetFirmwareHash.challenge max_size:32
FirmwareHash.hash max_size:32
UnlockPath.address_n max_count:8
UnlockPath.mac max_size:32
UnlockedPathRequest.mac max_size:32

View File

@ -69,6 +69,8 @@ class MessageType(IntEnum):
RebootToBootloader = 87
GetFirmwareHash = 88
FirmwareHash = 89
UnlockPath = 93
UnlockedPathRequest = 94
SetU2FCounter = 63
GetNextU2FCounter = 80
NextU2FCounter = 81
@ -3585,6 +3587,37 @@ class Nonce(protobuf.MessageType):
self.nonce = nonce
class UnlockPath(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 93
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False),
2: protobuf.Field("mac", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
address_n: Optional[Sequence["int"]] = None,
mac: Optional["bytes"] = None,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.mac = mac
class UnlockedPathRequest(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 94
FIELDS = {
1: protobuf.Field("mac", "bytes", repeated=False, required=False),
}
def __init__(
self,
*,
mac: Optional["bytes"] = None,
) -> None:
self.mac = mac
class DebugLinkDecision(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 100
FIELDS = {