1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-12 09:28:10 +00:00

feat(core): add nostr

This commit is contained in:
Ioan Bizău 2024-10-07 13:23:49 +02:00 committed by obrusvit
parent 010fdda1e3
commit c91590426d
24 changed files with 1896 additions and 252 deletions

View File

@ -0,0 +1,55 @@
syntax = "proto2";
package hw.trezor.messages.nostr;
// Sugar for easier handling in Java
option java_package = "com.satoshilabs.trezor.lib.protobuf";
option java_outer_classname = "TrezorMessageNostr";
import "options.proto";
option (include_in_bitcoin_only) = true;
/**
* Request: Ask the device for the Nostr public key
* @start
* @next NostrMessageSignature
*/
message NostrGetPubkey {
repeated uint32 address_n = 1; // used to derive the key
optional uint32 created_at = 2;
optional uint32 kind = 3;
repeated string tags = 4;
optional string content = 5;
}
/**
* Response: Nostr pubkey
* @end
*/
message NostrPubkey {
required bytes pubkey = 1; // pubkey derived from the seed
}
/**
* Request: Ask device to sign event
* @start
* @next NostrEventSignature
* @next Failure
*/
message NostrSignEvent {
repeated uint32 address_n = 1; // used to derive the key
optional uint32 created_at = 2;
optional uint32 kind = 3;
repeated string tags = 4;
optional string content = 5;
}
/**
* Response: Computed event ID and signature
* @end
*/
message NostrEventSignature {
required bytes pubkey = 1; // pubkey used to sign the event
required bytes id = 2; // ID of the event
required bytes signature = 3; // signature of the event
}

View File

@ -77,7 +77,6 @@ enum MessageType {
MessageType_NextU2FCounter = 81 [(wire_out) = true];
// Deprecated messages, kept for protobuf compatibility.
// Both are marked wire_out so that we don't need to implement incoming handler for legacy
MessageType_Deprecated_PassphraseStateRequest = 77 [deprecated = true];
MessageType_Deprecated_PassphraseStateAck = 78 [deprecated = true];
@ -105,6 +104,12 @@ enum MessageType {
MessageType_OwnershipProof = 50 [(bitcoin_only) = true, (wire_out) = true];
MessageType_AuthorizeCoinJoin = 51 [(bitcoin_only) = true, (wire_in) = true];
// Nostr
MessageType_NostrGetPubkey = 2001 [(bitcoin_only) = true, (wire_in) = true];
MessageType_NostrPubkey = 2002 [(bitcoin_only) = true, (wire_out) = true];
MessageType_NostrSignEvent = 2003 [(bitcoin_only) = true, (wire_in) = true];
MessageType_NostrEventSignature = 2004 [(bitcoin_only) = true, (wire_out) = true];
// Crypto
MessageType_CipherKeyValue = 23 [(bitcoin_only) = true, (wire_in) = true];
MessageType_CipheredKeyValue = 48 [(bitcoin_only) = true, (wire_out) = true];

View File

@ -0,0 +1 @@
Add Nostr support.

View File

@ -415,6 +415,12 @@ apps.misc.get_firmware_hash
import apps.misc.get_firmware_hash
apps.misc.sign_identity
import apps.misc.sign_identity
apps.nostr
import apps.nostr
apps.nostr.get_pubkey
import apps.nostr.get_pubkey
apps.nostr.sign_event
import apps.nostr.sign_event
apps.workflow_handlers
import apps.workflow_handlers

View File

@ -91,6 +91,9 @@ SLIP44_BITCOIN = const(0)
# SLIP-44 coin type for all Testnet coins
SLIP44_TESTNET = const(1)
# SLIP-44 "coin type" for Nostr
SLIP44_NOSTR = const(1237)
def validate_path_against_script_type(
coin: coininfo.CoinInfo,

View File

@ -0,0 +1,5 @@
from apps.common.paths import PATTERN_BIP44
CURVE = "secp256k1"
SLIP44_ID = 1237
PATTERN = PATTERN_BIP44

View File

@ -0,0 +1,20 @@
from typing import TYPE_CHECKING
from apps.common.keychain import auto_keychain
if TYPE_CHECKING:
from trezor.messages import NostrGetPubkey, NostrPubkey
from apps.common.keychain import Keychain
@auto_keychain(__name__)
async def get_pubkey(msg: NostrGetPubkey, keychain: Keychain) -> NostrPubkey:
from trezor.messages import NostrPubkey
address_n = msg.address_n
node = keychain.derive(address_n)
pk = node.public_key()[-32:]
return NostrPubkey(pubkey=pk)

View File

@ -0,0 +1,35 @@
from typing import TYPE_CHECKING
from apps.common.keychain import auto_keychain
if TYPE_CHECKING:
from trezor.messages import NostrEventSignature, NostrSignEvent
from apps.common.keychain import Keychain
@auto_keychain(__name__)
async def sign_event(msg: NostrSignEvent, keychain: Keychain) -> NostrEventSignature:
from ubinascii import hexlify
from trezor.crypto.curve import secp256k1
from trezor.crypto.hashlib import sha256
from trezor.messages import NostrEventSignature
address_n = msg.address_n
created_at = msg.created_at
kind = msg.kind
tags = msg.tags
content = msg.content
node = keychain.derive(address_n)
pk = node.public_key()[-32:]
sk = node.private_key()
serialized_event = (
f'[0,"{hexlify(pk).decode()}",{created_at},{kind},{tags},"{content}"]'
)
event_id = sha256(serialized_event).digest()
signature = secp256k1.sign(sk, event_id)[-64:]
return NostrEventSignature(pubkey=pk, id=event_id, signature=signature)

View File

@ -106,6 +106,12 @@ def _find_message_handler_module(msg_type: int) -> str:
if msg_type == MessageType.GetFirmwareHash:
return "apps.misc.get_firmware_hash"
# nostr
if msg_type == MessageType.NostrGetPubkey:
return "apps.nostr.get_pubkey"
if msg_type == MessageType.NostrSignEvent:
return "apps.nostr.sign_event"
if not utils.BITCOIN_ONLY:
if msg_type == MessageType.SetU2FCounter:
return "apps.management.set_u2f_counter"

View File

@ -73,6 +73,10 @@ OwnershipId = 44
GetOwnershipProof = 49
OwnershipProof = 50
AuthorizeCoinJoin = 51
NostrGetPubkey = 2001
NostrPubkey = 2002
NostrSignEvent = 2003
NostrEventSignature = 2004
CipherKeyValue = 23
CipheredKeyValue = 48
SignIdentity = 53

View File

@ -423,6 +423,10 @@ if TYPE_CHECKING:
GetOwnershipProof = 49
OwnershipProof = 50
AuthorizeCoinJoin = 51
NostrGetPubkey = 2001
NostrPubkey = 2002
NostrSignEvent = 2003
NostrEventSignature = 2004
CipherKeyValue = 23
CipheredKeyValue = 48
SignIdentity = 53

View File

@ -5192,6 +5192,82 @@ if TYPE_CHECKING:
def is_type_of(cls, msg: Any) -> TypeGuard["NEMCosignatoryModification"]:
return isinstance(msg, cls)
class NostrGetPubkey(protobuf.MessageType):
address_n: "list[int]"
created_at: "int | None"
kind: "int | None"
tags: "list[str]"
content: "str | None"
def __init__(
self,
*,
address_n: "list[int] | None" = None,
tags: "list[str] | None" = None,
created_at: "int | None" = None,
kind: "int | None" = None,
content: "str | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["NostrGetPubkey"]:
return isinstance(msg, cls)
class NostrPubkey(protobuf.MessageType):
pubkey: "bytes"
def __init__(
self,
*,
pubkey: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["NostrPubkey"]:
return isinstance(msg, cls)
class NostrSignEvent(protobuf.MessageType):
address_n: "list[int]"
created_at: "int | None"
kind: "int | None"
tags: "list[str]"
content: "str | None"
def __init__(
self,
*,
address_n: "list[int] | None" = None,
tags: "list[str] | None" = None,
created_at: "int | None" = None,
kind: "int | None" = None,
content: "str | None" = None,
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["NostrSignEvent"]:
return isinstance(msg, cls)
class NostrEventSignature(protobuf.MessageType):
pubkey: "bytes"
id: "bytes"
signature: "bytes"
def __init__(
self,
*,
pubkey: "bytes",
id: "bytes",
signature: "bytes",
) -> None:
pass
@classmethod
def is_type_of(cls, msg: Any) -> TypeGuard["NostrEventSignature"]:
return isinstance(msg, cls)
class RippleGetAddress(protobuf.MessageType):
address_n: "list[int]"
show_display: "bool | None"

View File

@ -95,6 +95,7 @@ async def handle_session(iface: WireInterface) -> None:
except Exception as exc:
# Log and ignore. The session handler can only exit explicitly in the
# following finally block.
do_not_restart = True
if __debug__:
log.exception(__name__, exc)
finally:

View File

@ -12,7 +12,8 @@ SKIPPED_MESSAGES := Binance Cardano DebugMonero Eos Monero Ontology Ripple SdPro
Solana StellarClaimClaimableBalanceOp \
ChangeLanguage TranslationDataRequest TranslationDataAck \
SetBrightness DebugLinkOptigaSetSecMax \
BenchmarkListNames BenchmarkRun BenchmarkNames BenchmarkResult
BenchmarkListNames BenchmarkRun BenchmarkNames BenchmarkResult \
NostrGetPubkey NostrPubkey NostrSignEvent NostrEventSignature
ifeq ($(BITCOIN_ONLY), 1)
SKIPPED_MESSAGES += Ethereum NEM Stellar

View File

@ -0,0 +1,82 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2025 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import json
from typing import TYPE_CHECKING, Dict
import click
from .. import nostr, tools
from . import with_client
if TYPE_CHECKING:
from ..client import TrezorClient
@click.group(name="nostr")
def cli() -> None:
pass
@cli.command()
@click.option("-n", "--address", default="m/44'/1237'/0'/0/0", help="BIP-32 path")
@with_client
def get_pubkey(
client: "TrezorClient",
address: str,
) -> Dict[str, str]:
"""Derive the pubkey from the seed."""
address_n = tools.parse_path(address)
res = nostr.get_pubkey(
client,
address_n,
)
return {
"pubkey": res.pubkey.hex(),
}
@cli.command()
@click.option("-n", "--address", default="m/44'/1237'/0'/0/0", help="BIP-32 path")
@click.argument("event")
@with_client
def sign_event(
client: "TrezorClient",
address: str,
event: str,
) -> Dict[str, str]:
"""Sign an event using address of given path."""
event_json = json.loads(event)
address_n = tools.parse_path(address)
res = nostr.sign_event(
client,
address_n,
event,
)
event_json["id"] = res.id.hex()
event_json["pubkey"] = res.pubkey.hex()
event_json["sig"] = res.signature.hex()
return {
"signed_event": json.dumps(event_json),
}

View File

@ -44,6 +44,7 @@ from . import (
firmware,
monero,
nem,
nostr,
ripple,
settings,
solana,
@ -409,6 +410,7 @@ cli.add_command(ethereum.cli)
cli.add_command(fido.cli)
cli.add_command(monero.cli)
cli.add_command(nem.cli)
cli.add_command(nostr.cli)
cli.add_command(ripple.cli)
cli.add_command(settings.cli)
cli.add_command(solana.cli)

View File

@ -62,7 +62,9 @@ class ProtobufMapping:
"""
wire_type = self.class_to_type_override.get(type(msg), msg.MESSAGE_WIRE_TYPE)
if wire_type is None:
raise ValueError("Cannot encode class without wire type")
raise ValueError(
f'Cannot encode class "{type(msg).__name__}" without wire type'
)
buf = io.BytesIO()
protobuf.dump_message(buf, msg)

View File

@ -476,6 +476,10 @@ class MessageType(IntEnum):
GetOwnershipProof = 49
OwnershipProof = 50
AuthorizeCoinJoin = 51
NostrGetPubkey = 2001
NostrPubkey = 2002
NostrSignEvent = 2003
NostrEventSignature = 2004
CipherKeyValue = 23
CipheredKeyValue = 48
SignIdentity = 53
@ -6763,6 +6767,92 @@ class NEMCosignatoryModification(protobuf.MessageType):
self.public_key = public_key
class NostrGetPubkey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 2001
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
2: protobuf.Field("created_at", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("kind", "uint32", repeated=False, required=False, default=None),
4: protobuf.Field("tags", "string", repeated=True, required=False, default=None),
5: protobuf.Field("content", "string", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
address_n: Optional[Sequence["int"]] = None,
tags: Optional[Sequence["str"]] = None,
created_at: Optional["int"] = None,
kind: Optional["int"] = None,
content: Optional["str"] = None,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.tags: Sequence["str"] = tags if tags is not None else []
self.created_at = created_at
self.kind = kind
self.content = content
class NostrPubkey(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 2002
FIELDS = {
1: protobuf.Field("pubkey", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
pubkey: "bytes",
) -> None:
self.pubkey = pubkey
class NostrSignEvent(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 2003
FIELDS = {
1: protobuf.Field("address_n", "uint32", repeated=True, required=False, default=None),
2: protobuf.Field("created_at", "uint32", repeated=False, required=False, default=None),
3: protobuf.Field("kind", "uint32", repeated=False, required=False, default=None),
4: protobuf.Field("tags", "string", repeated=True, required=False, default=None),
5: protobuf.Field("content", "string", repeated=False, required=False, default=None),
}
def __init__(
self,
*,
address_n: Optional[Sequence["int"]] = None,
tags: Optional[Sequence["str"]] = None,
created_at: Optional["int"] = None,
kind: Optional["int"] = None,
content: Optional["str"] = None,
) -> None:
self.address_n: Sequence["int"] = address_n if address_n is not None else []
self.tags: Sequence["str"] = tags if tags is not None else []
self.created_at = created_at
self.kind = kind
self.content = content
class NostrEventSignature(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 2004
FIELDS = {
1: protobuf.Field("pubkey", "bytes", repeated=False, required=True),
2: protobuf.Field("id", "bytes", repeated=False, required=True),
3: protobuf.Field("signature", "bytes", repeated=False, required=True),
}
def __init__(
self,
*,
pubkey: "bytes",
id: "bytes",
signature: "bytes",
) -> None:
self.pubkey = pubkey
self.id = id
self.signature = signature
class RippleGetAddress(protobuf.MessageType):
MESSAGE_WIRE_TYPE = 400
FIELDS = {

View File

@ -0,0 +1,57 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2025 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import json
from typing import TYPE_CHECKING, AnyStr
from . import messages
from .tools import expect
if TYPE_CHECKING:
from .client import TrezorClient
from .protobuf import MessageType
from .tools import Address
@expect(messages.NostrPubkey)
def get_pubkey(
client: "TrezorClient",
n: "Address",
) -> "MessageType":
return client.call(
messages.NostrGetPubkey(
address_n=n,
)
)
@expect(messages.NostrEventSignature)
def sign_event(
client: "TrezorClient",
n: "Address",
event: AnyStr,
) -> "MessageType":
event_json = json.loads(event)
return client.call(
messages.NostrSignEvent(
address_n=n,
created_at=event_json["created_at"],
kind=event_json["kind"],
tags=event_json["tags"],
content=event_json["content"],
)
)

View File

@ -58,6 +58,10 @@ trezor_message_impl! {
FirmwareUpload => MessageType_FirmwareUpload,
FirmwareRequest => MessageType_FirmwareRequest,
ProdTestT1 => MessageType_ProdTestT1,
NostrGetPubkey => MessageType_NostrGetPubkey,
NostrPubkey => MessageType_NostrPubkey,
NostrSignEvent => MessageType_NostrSignEvent,
NostrEventSignature => MessageType_NostrEventSignature,
CipherKeyValue => MessageType_CipherKeyValue,
CipheredKeyValue => MessageType_CipheredKeyValue,
SignIdentity => MessageType_SignIdentity,

View File

@ -178,6 +178,14 @@ pub enum MessageType {
MessageType_OwnershipProof = 50,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_AuthorizeCoinJoin)
MessageType_AuthorizeCoinJoin = 51,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NostrGetPubkey)
MessageType_NostrGetPubkey = 2001,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NostrPubkey)
MessageType_NostrPubkey = 2002,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NostrSignEvent)
MessageType_NostrSignEvent = 2003,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_NostrEventSignature)
MessageType_NostrEventSignature = 2004,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipherKeyValue)
MessageType_CipherKeyValue = 23,
// @@protoc_insertion_point(enum_value:hw.trezor.messages.MessageType.MessageType_CipheredKeyValue)
@ -604,6 +612,10 @@ impl ::protobuf::Enum for MessageType {
49 => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof),
50 => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof),
51 => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin),
2001 => ::std::option::Option::Some(MessageType::MessageType_NostrGetPubkey),
2002 => ::std::option::Option::Some(MessageType::MessageType_NostrPubkey),
2003 => ::std::option::Option::Some(MessageType::MessageType_NostrSignEvent),
2004 => ::std::option::Option::Some(MessageType::MessageType_NostrEventSignature),
23 => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue),
48 => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue),
53 => ::std::option::Option::Some(MessageType::MessageType_SignIdentity),
@ -855,6 +867,10 @@ impl ::protobuf::Enum for MessageType {
"MessageType_GetOwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_GetOwnershipProof),
"MessageType_OwnershipProof" => ::std::option::Option::Some(MessageType::MessageType_OwnershipProof),
"MessageType_AuthorizeCoinJoin" => ::std::option::Option::Some(MessageType::MessageType_AuthorizeCoinJoin),
"MessageType_NostrGetPubkey" => ::std::option::Option::Some(MessageType::MessageType_NostrGetPubkey),
"MessageType_NostrPubkey" => ::std::option::Option::Some(MessageType::MessageType_NostrPubkey),
"MessageType_NostrSignEvent" => ::std::option::Option::Some(MessageType::MessageType_NostrSignEvent),
"MessageType_NostrEventSignature" => ::std::option::Option::Some(MessageType::MessageType_NostrEventSignature),
"MessageType_CipherKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipherKeyValue),
"MessageType_CipheredKeyValue" => ::std::option::Option::Some(MessageType::MessageType_CipheredKeyValue),
"MessageType_SignIdentity" => ::std::option::Option::Some(MessageType::MessageType_SignIdentity),
@ -1105,6 +1121,10 @@ impl ::protobuf::Enum for MessageType {
MessageType::MessageType_GetOwnershipProof,
MessageType::MessageType_OwnershipProof,
MessageType::MessageType_AuthorizeCoinJoin,
MessageType::MessageType_NostrGetPubkey,
MessageType::MessageType_NostrPubkey,
MessageType::MessageType_NostrSignEvent,
MessageType::MessageType_NostrEventSignature,
MessageType::MessageType_CipherKeyValue,
MessageType::MessageType_CipheredKeyValue,
MessageType::MessageType_SignIdentity,
@ -1361,176 +1381,180 @@ impl ::protobuf::EnumFull for MessageType {
MessageType::MessageType_GetOwnershipProof => 72,
MessageType::MessageType_OwnershipProof => 73,
MessageType::MessageType_AuthorizeCoinJoin => 74,
MessageType::MessageType_CipherKeyValue => 75,
MessageType::MessageType_CipheredKeyValue => 76,
MessageType::MessageType_SignIdentity => 77,
MessageType::MessageType_SignedIdentity => 78,
MessageType::MessageType_GetECDHSessionKey => 79,
MessageType::MessageType_ECDHSessionKey => 80,
MessageType::MessageType_DebugLinkDecision => 81,
MessageType::MessageType_DebugLinkGetState => 82,
MessageType::MessageType_DebugLinkState => 83,
MessageType::MessageType_DebugLinkStop => 84,
MessageType::MessageType_DebugLinkLog => 85,
MessageType::MessageType_DebugLinkMemoryRead => 86,
MessageType::MessageType_DebugLinkMemory => 87,
MessageType::MessageType_DebugLinkMemoryWrite => 88,
MessageType::MessageType_DebugLinkFlashErase => 89,
MessageType::MessageType_DebugLinkLayout => 90,
MessageType::MessageType_DebugLinkReseedRandom => 91,
MessageType::MessageType_DebugLinkRecordScreen => 92,
MessageType::MessageType_DebugLinkEraseSdCard => 93,
MessageType::MessageType_DebugLinkWatchLayout => 94,
MessageType::MessageType_DebugLinkResetDebugEvents => 95,
MessageType::MessageType_DebugLinkOptigaSetSecMax => 96,
MessageType::MessageType_EthereumGetPublicKey => 97,
MessageType::MessageType_EthereumPublicKey => 98,
MessageType::MessageType_EthereumGetAddress => 99,
MessageType::MessageType_EthereumAddress => 100,
MessageType::MessageType_EthereumSignTx => 101,
MessageType::MessageType_EthereumSignTxEIP1559 => 102,
MessageType::MessageType_EthereumTxRequest => 103,
MessageType::MessageType_EthereumTxAck => 104,
MessageType::MessageType_EthereumSignMessage => 105,
MessageType::MessageType_EthereumVerifyMessage => 106,
MessageType::MessageType_EthereumMessageSignature => 107,
MessageType::MessageType_EthereumSignTypedData => 108,
MessageType::MessageType_EthereumTypedDataStructRequest => 109,
MessageType::MessageType_EthereumTypedDataStructAck => 110,
MessageType::MessageType_EthereumTypedDataValueRequest => 111,
MessageType::MessageType_EthereumTypedDataValueAck => 112,
MessageType::MessageType_EthereumTypedDataSignature => 113,
MessageType::MessageType_EthereumSignTypedHash => 114,
MessageType::MessageType_NEMGetAddress => 115,
MessageType::MessageType_NEMAddress => 116,
MessageType::MessageType_NEMSignTx => 117,
MessageType::MessageType_NEMSignedTx => 118,
MessageType::MessageType_NEMDecryptMessage => 119,
MessageType::MessageType_NEMDecryptedMessage => 120,
MessageType::MessageType_TezosGetAddress => 121,
MessageType::MessageType_TezosAddress => 122,
MessageType::MessageType_TezosSignTx => 123,
MessageType::MessageType_TezosSignedTx => 124,
MessageType::MessageType_TezosGetPublicKey => 125,
MessageType::MessageType_TezosPublicKey => 126,
MessageType::MessageType_StellarSignTx => 127,
MessageType::MessageType_StellarTxOpRequest => 128,
MessageType::MessageType_StellarGetAddress => 129,
MessageType::MessageType_StellarAddress => 130,
MessageType::MessageType_StellarCreateAccountOp => 131,
MessageType::MessageType_StellarPaymentOp => 132,
MessageType::MessageType_StellarPathPaymentStrictReceiveOp => 133,
MessageType::MessageType_StellarManageSellOfferOp => 134,
MessageType::MessageType_StellarCreatePassiveSellOfferOp => 135,
MessageType::MessageType_StellarSetOptionsOp => 136,
MessageType::MessageType_StellarChangeTrustOp => 137,
MessageType::MessageType_StellarAllowTrustOp => 138,
MessageType::MessageType_StellarAccountMergeOp => 139,
MessageType::MessageType_StellarManageDataOp => 140,
MessageType::MessageType_StellarBumpSequenceOp => 141,
MessageType::MessageType_StellarManageBuyOfferOp => 142,
MessageType::MessageType_StellarPathPaymentStrictSendOp => 143,
MessageType::MessageType_StellarClaimClaimableBalanceOp => 144,
MessageType::MessageType_StellarSignedTx => 145,
MessageType::MessageType_CardanoGetPublicKey => 146,
MessageType::MessageType_CardanoPublicKey => 147,
MessageType::MessageType_CardanoGetAddress => 148,
MessageType::MessageType_CardanoAddress => 149,
MessageType::MessageType_CardanoTxItemAck => 150,
MessageType::MessageType_CardanoTxAuxiliaryDataSupplement => 151,
MessageType::MessageType_CardanoTxWitnessRequest => 152,
MessageType::MessageType_CardanoTxWitnessResponse => 153,
MessageType::MessageType_CardanoTxHostAck => 154,
MessageType::MessageType_CardanoTxBodyHash => 155,
MessageType::MessageType_CardanoSignTxFinished => 156,
MessageType::MessageType_CardanoSignTxInit => 157,
MessageType::MessageType_CardanoTxInput => 158,
MessageType::MessageType_CardanoTxOutput => 159,
MessageType::MessageType_CardanoAssetGroup => 160,
MessageType::MessageType_CardanoToken => 161,
MessageType::MessageType_CardanoTxCertificate => 162,
MessageType::MessageType_CardanoTxWithdrawal => 163,
MessageType::MessageType_CardanoTxAuxiliaryData => 164,
MessageType::MessageType_CardanoPoolOwner => 165,
MessageType::MessageType_CardanoPoolRelayParameters => 166,
MessageType::MessageType_CardanoGetNativeScriptHash => 167,
MessageType::MessageType_CardanoNativeScriptHash => 168,
MessageType::MessageType_CardanoTxMint => 169,
MessageType::MessageType_CardanoTxCollateralInput => 170,
MessageType::MessageType_CardanoTxRequiredSigner => 171,
MessageType::MessageType_CardanoTxInlineDatumChunk => 172,
MessageType::MessageType_CardanoTxReferenceScriptChunk => 173,
MessageType::MessageType_CardanoTxReferenceInput => 174,
MessageType::MessageType_RippleGetAddress => 175,
MessageType::MessageType_RippleAddress => 176,
MessageType::MessageType_RippleSignTx => 177,
MessageType::MessageType_RippleSignedTx => 178,
MessageType::MessageType_MoneroTransactionInitRequest => 179,
MessageType::MessageType_MoneroTransactionInitAck => 180,
MessageType::MessageType_MoneroTransactionSetInputRequest => 181,
MessageType::MessageType_MoneroTransactionSetInputAck => 182,
MessageType::MessageType_MoneroTransactionInputViniRequest => 183,
MessageType::MessageType_MoneroTransactionInputViniAck => 184,
MessageType::MessageType_MoneroTransactionAllInputsSetRequest => 185,
MessageType::MessageType_MoneroTransactionAllInputsSetAck => 186,
MessageType::MessageType_MoneroTransactionSetOutputRequest => 187,
MessageType::MessageType_MoneroTransactionSetOutputAck => 188,
MessageType::MessageType_MoneroTransactionAllOutSetRequest => 189,
MessageType::MessageType_MoneroTransactionAllOutSetAck => 190,
MessageType::MessageType_MoneroTransactionSignInputRequest => 191,
MessageType::MessageType_MoneroTransactionSignInputAck => 192,
MessageType::MessageType_MoneroTransactionFinalRequest => 193,
MessageType::MessageType_MoneroTransactionFinalAck => 194,
MessageType::MessageType_MoneroKeyImageExportInitRequest => 195,
MessageType::MessageType_MoneroKeyImageExportInitAck => 196,
MessageType::MessageType_MoneroKeyImageSyncStepRequest => 197,
MessageType::MessageType_MoneroKeyImageSyncStepAck => 198,
MessageType::MessageType_MoneroKeyImageSyncFinalRequest => 199,
MessageType::MessageType_MoneroKeyImageSyncFinalAck => 200,
MessageType::MessageType_MoneroGetAddress => 201,
MessageType::MessageType_MoneroAddress => 202,
MessageType::MessageType_MoneroGetWatchKey => 203,
MessageType::MessageType_MoneroWatchKey => 204,
MessageType::MessageType_DebugMoneroDiagRequest => 205,
MessageType::MessageType_DebugMoneroDiagAck => 206,
MessageType::MessageType_MoneroGetTxKeyRequest => 207,
MessageType::MessageType_MoneroGetTxKeyAck => 208,
MessageType::MessageType_MoneroLiveRefreshStartRequest => 209,
MessageType::MessageType_MoneroLiveRefreshStartAck => 210,
MessageType::MessageType_MoneroLiveRefreshStepRequest => 211,
MessageType::MessageType_MoneroLiveRefreshStepAck => 212,
MessageType::MessageType_MoneroLiveRefreshFinalRequest => 213,
MessageType::MessageType_MoneroLiveRefreshFinalAck => 214,
MessageType::MessageType_EosGetPublicKey => 215,
MessageType::MessageType_EosPublicKey => 216,
MessageType::MessageType_EosSignTx => 217,
MessageType::MessageType_EosTxActionRequest => 218,
MessageType::MessageType_EosTxActionAck => 219,
MessageType::MessageType_EosSignedTx => 220,
MessageType::MessageType_BinanceGetAddress => 221,
MessageType::MessageType_BinanceAddress => 222,
MessageType::MessageType_BinanceGetPublicKey => 223,
MessageType::MessageType_BinancePublicKey => 224,
MessageType::MessageType_BinanceSignTx => 225,
MessageType::MessageType_BinanceTxRequest => 226,
MessageType::MessageType_BinanceTransferMsg => 227,
MessageType::MessageType_BinanceOrderMsg => 228,
MessageType::MessageType_BinanceCancelMsg => 229,
MessageType::MessageType_BinanceSignedTx => 230,
MessageType::MessageType_WebAuthnListResidentCredentials => 231,
MessageType::MessageType_WebAuthnCredentials => 232,
MessageType::MessageType_WebAuthnAddResidentCredential => 233,
MessageType::MessageType_WebAuthnRemoveResidentCredential => 234,
MessageType::MessageType_SolanaGetPublicKey => 235,
MessageType::MessageType_SolanaPublicKey => 236,
MessageType::MessageType_SolanaGetAddress => 237,
MessageType::MessageType_SolanaAddress => 238,
MessageType::MessageType_SolanaSignTx => 239,
MessageType::MessageType_SolanaTxSignature => 240,
MessageType::MessageType_BenchmarkListNames => 241,
MessageType::MessageType_BenchmarkNames => 242,
MessageType::MessageType_BenchmarkRun => 243,
MessageType::MessageType_BenchmarkResult => 244,
MessageType::MessageType_NostrGetPubkey => 75,
MessageType::MessageType_NostrPubkey => 76,
MessageType::MessageType_NostrSignEvent => 77,
MessageType::MessageType_NostrEventSignature => 78,
MessageType::MessageType_CipherKeyValue => 79,
MessageType::MessageType_CipheredKeyValue => 80,
MessageType::MessageType_SignIdentity => 81,
MessageType::MessageType_SignedIdentity => 82,
MessageType::MessageType_GetECDHSessionKey => 83,
MessageType::MessageType_ECDHSessionKey => 84,
MessageType::MessageType_DebugLinkDecision => 85,
MessageType::MessageType_DebugLinkGetState => 86,
MessageType::MessageType_DebugLinkState => 87,
MessageType::MessageType_DebugLinkStop => 88,
MessageType::MessageType_DebugLinkLog => 89,
MessageType::MessageType_DebugLinkMemoryRead => 90,
MessageType::MessageType_DebugLinkMemory => 91,
MessageType::MessageType_DebugLinkMemoryWrite => 92,
MessageType::MessageType_DebugLinkFlashErase => 93,
MessageType::MessageType_DebugLinkLayout => 94,
MessageType::MessageType_DebugLinkReseedRandom => 95,
MessageType::MessageType_DebugLinkRecordScreen => 96,
MessageType::MessageType_DebugLinkEraseSdCard => 97,
MessageType::MessageType_DebugLinkWatchLayout => 98,
MessageType::MessageType_DebugLinkResetDebugEvents => 99,
MessageType::MessageType_DebugLinkOptigaSetSecMax => 100,
MessageType::MessageType_EthereumGetPublicKey => 101,
MessageType::MessageType_EthereumPublicKey => 102,
MessageType::MessageType_EthereumGetAddress => 103,
MessageType::MessageType_EthereumAddress => 104,
MessageType::MessageType_EthereumSignTx => 105,
MessageType::MessageType_EthereumSignTxEIP1559 => 106,
MessageType::MessageType_EthereumTxRequest => 107,
MessageType::MessageType_EthereumTxAck => 108,
MessageType::MessageType_EthereumSignMessage => 109,
MessageType::MessageType_EthereumVerifyMessage => 110,
MessageType::MessageType_EthereumMessageSignature => 111,
MessageType::MessageType_EthereumSignTypedData => 112,
MessageType::MessageType_EthereumTypedDataStructRequest => 113,
MessageType::MessageType_EthereumTypedDataStructAck => 114,
MessageType::MessageType_EthereumTypedDataValueRequest => 115,
MessageType::MessageType_EthereumTypedDataValueAck => 116,
MessageType::MessageType_EthereumTypedDataSignature => 117,
MessageType::MessageType_EthereumSignTypedHash => 118,
MessageType::MessageType_NEMGetAddress => 119,
MessageType::MessageType_NEMAddress => 120,
MessageType::MessageType_NEMSignTx => 121,
MessageType::MessageType_NEMSignedTx => 122,
MessageType::MessageType_NEMDecryptMessage => 123,
MessageType::MessageType_NEMDecryptedMessage => 124,
MessageType::MessageType_TezosGetAddress => 125,
MessageType::MessageType_TezosAddress => 126,
MessageType::MessageType_TezosSignTx => 127,
MessageType::MessageType_TezosSignedTx => 128,
MessageType::MessageType_TezosGetPublicKey => 129,
MessageType::MessageType_TezosPublicKey => 130,
MessageType::MessageType_StellarSignTx => 131,
MessageType::MessageType_StellarTxOpRequest => 132,
MessageType::MessageType_StellarGetAddress => 133,
MessageType::MessageType_StellarAddress => 134,
MessageType::MessageType_StellarCreateAccountOp => 135,
MessageType::MessageType_StellarPaymentOp => 136,
MessageType::MessageType_StellarPathPaymentStrictReceiveOp => 137,
MessageType::MessageType_StellarManageSellOfferOp => 138,
MessageType::MessageType_StellarCreatePassiveSellOfferOp => 139,
MessageType::MessageType_StellarSetOptionsOp => 140,
MessageType::MessageType_StellarChangeTrustOp => 141,
MessageType::MessageType_StellarAllowTrustOp => 142,
MessageType::MessageType_StellarAccountMergeOp => 143,
MessageType::MessageType_StellarManageDataOp => 144,
MessageType::MessageType_StellarBumpSequenceOp => 145,
MessageType::MessageType_StellarManageBuyOfferOp => 146,
MessageType::MessageType_StellarPathPaymentStrictSendOp => 147,
MessageType::MessageType_StellarClaimClaimableBalanceOp => 148,
MessageType::MessageType_StellarSignedTx => 149,
MessageType::MessageType_CardanoGetPublicKey => 150,
MessageType::MessageType_CardanoPublicKey => 151,
MessageType::MessageType_CardanoGetAddress => 152,
MessageType::MessageType_CardanoAddress => 153,
MessageType::MessageType_CardanoTxItemAck => 154,
MessageType::MessageType_CardanoTxAuxiliaryDataSupplement => 155,
MessageType::MessageType_CardanoTxWitnessRequest => 156,
MessageType::MessageType_CardanoTxWitnessResponse => 157,
MessageType::MessageType_CardanoTxHostAck => 158,
MessageType::MessageType_CardanoTxBodyHash => 159,
MessageType::MessageType_CardanoSignTxFinished => 160,
MessageType::MessageType_CardanoSignTxInit => 161,
MessageType::MessageType_CardanoTxInput => 162,
MessageType::MessageType_CardanoTxOutput => 163,
MessageType::MessageType_CardanoAssetGroup => 164,
MessageType::MessageType_CardanoToken => 165,
MessageType::MessageType_CardanoTxCertificate => 166,
MessageType::MessageType_CardanoTxWithdrawal => 167,
MessageType::MessageType_CardanoTxAuxiliaryData => 168,
MessageType::MessageType_CardanoPoolOwner => 169,
MessageType::MessageType_CardanoPoolRelayParameters => 170,
MessageType::MessageType_CardanoGetNativeScriptHash => 171,
MessageType::MessageType_CardanoNativeScriptHash => 172,
MessageType::MessageType_CardanoTxMint => 173,
MessageType::MessageType_CardanoTxCollateralInput => 174,
MessageType::MessageType_CardanoTxRequiredSigner => 175,
MessageType::MessageType_CardanoTxInlineDatumChunk => 176,
MessageType::MessageType_CardanoTxReferenceScriptChunk => 177,
MessageType::MessageType_CardanoTxReferenceInput => 178,
MessageType::MessageType_RippleGetAddress => 179,
MessageType::MessageType_RippleAddress => 180,
MessageType::MessageType_RippleSignTx => 181,
MessageType::MessageType_RippleSignedTx => 182,
MessageType::MessageType_MoneroTransactionInitRequest => 183,
MessageType::MessageType_MoneroTransactionInitAck => 184,
MessageType::MessageType_MoneroTransactionSetInputRequest => 185,
MessageType::MessageType_MoneroTransactionSetInputAck => 186,
MessageType::MessageType_MoneroTransactionInputViniRequest => 187,
MessageType::MessageType_MoneroTransactionInputViniAck => 188,
MessageType::MessageType_MoneroTransactionAllInputsSetRequest => 189,
MessageType::MessageType_MoneroTransactionAllInputsSetAck => 190,
MessageType::MessageType_MoneroTransactionSetOutputRequest => 191,
MessageType::MessageType_MoneroTransactionSetOutputAck => 192,
MessageType::MessageType_MoneroTransactionAllOutSetRequest => 193,
MessageType::MessageType_MoneroTransactionAllOutSetAck => 194,
MessageType::MessageType_MoneroTransactionSignInputRequest => 195,
MessageType::MessageType_MoneroTransactionSignInputAck => 196,
MessageType::MessageType_MoneroTransactionFinalRequest => 197,
MessageType::MessageType_MoneroTransactionFinalAck => 198,
MessageType::MessageType_MoneroKeyImageExportInitRequest => 199,
MessageType::MessageType_MoneroKeyImageExportInitAck => 200,
MessageType::MessageType_MoneroKeyImageSyncStepRequest => 201,
MessageType::MessageType_MoneroKeyImageSyncStepAck => 202,
MessageType::MessageType_MoneroKeyImageSyncFinalRequest => 203,
MessageType::MessageType_MoneroKeyImageSyncFinalAck => 204,
MessageType::MessageType_MoneroGetAddress => 205,
MessageType::MessageType_MoneroAddress => 206,
MessageType::MessageType_MoneroGetWatchKey => 207,
MessageType::MessageType_MoneroWatchKey => 208,
MessageType::MessageType_DebugMoneroDiagRequest => 209,
MessageType::MessageType_DebugMoneroDiagAck => 210,
MessageType::MessageType_MoneroGetTxKeyRequest => 211,
MessageType::MessageType_MoneroGetTxKeyAck => 212,
MessageType::MessageType_MoneroLiveRefreshStartRequest => 213,
MessageType::MessageType_MoneroLiveRefreshStartAck => 214,
MessageType::MessageType_MoneroLiveRefreshStepRequest => 215,
MessageType::MessageType_MoneroLiveRefreshStepAck => 216,
MessageType::MessageType_MoneroLiveRefreshFinalRequest => 217,
MessageType::MessageType_MoneroLiveRefreshFinalAck => 218,
MessageType::MessageType_EosGetPublicKey => 219,
MessageType::MessageType_EosPublicKey => 220,
MessageType::MessageType_EosSignTx => 221,
MessageType::MessageType_EosTxActionRequest => 222,
MessageType::MessageType_EosTxActionAck => 223,
MessageType::MessageType_EosSignedTx => 224,
MessageType::MessageType_BinanceGetAddress => 225,
MessageType::MessageType_BinanceAddress => 226,
MessageType::MessageType_BinanceGetPublicKey => 227,
MessageType::MessageType_BinancePublicKey => 228,
MessageType::MessageType_BinanceSignTx => 229,
MessageType::MessageType_BinanceTxRequest => 230,
MessageType::MessageType_BinanceTransferMsg => 231,
MessageType::MessageType_BinanceOrderMsg => 232,
MessageType::MessageType_BinanceCancelMsg => 233,
MessageType::MessageType_BinanceSignedTx => 234,
MessageType::MessageType_WebAuthnListResidentCredentials => 235,
MessageType::MessageType_WebAuthnCredentials => 236,
MessageType::MessageType_WebAuthnAddResidentCredential => 237,
MessageType::MessageType_WebAuthnRemoveResidentCredential => 238,
MessageType::MessageType_SolanaGetPublicKey => 239,
MessageType::MessageType_SolanaPublicKey => 240,
MessageType::MessageType_SolanaGetAddress => 241,
MessageType::MessageType_SolanaAddress => 242,
MessageType::MessageType_SolanaSignTx => 243,
MessageType::MessageType_SolanaTxSignature => 244,
MessageType::MessageType_BenchmarkListNames => 245,
MessageType::MessageType_BenchmarkNames => 246,
MessageType::MessageType_BenchmarkRun => 247,
MessageType::MessageType_BenchmarkResult => 248,
};
Self::enum_descriptor().value_by_index(index)
}
@ -1549,7 +1573,7 @@ impl MessageType {
}
static file_descriptor_proto_data: &'static [u8] = b"\
\n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\roptions.proto*\x89U\
\n\x0emessages.proto\x12\x12hw.trezor.messages\x1a\roptions.proto*\xb7V\
\n\x0bMessageType\x12(\n\x16MessageType_Initialize\x10\0\x1a\x0c\x80\xa6\
\x1d\x01\xb0\xb5\x18\x01\x90\xb5\x18\x01\x12\x1e\n\x10MessageType_Ping\
\x10\x01\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12%\n\x13MessageType_S\
@ -1638,84 +1662,89 @@ static file_descriptor_proto_data: &'static [u8] = b"\
\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetOwnershipProof\x10\
1\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_Ownershi\
pProof\x102\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageTyp\
e_AuthorizeCoinJoin\x103\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\
\x1aMessageType_CipherKeyValue\x10\x17\x1a\x08\x80\xa6\x1d\x01\x90\xb5\
\x18\x01\x12*\n\x1cMessageType_CipheredKeyValue\x100\x1a\x08\x80\xa6\x1d\
\x01\x98\xb5\x18\x01\x12&\n\x18MessageType_SignIdentity\x105\x1a\x08\x80\
\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_SignedIdentity\x106\
\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_GetECDHSe\
ssionKey\x10=\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageT\
ype_ECDHSessionKey\x10>\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x123\n\
\x1dMessageType_DebugLinkDecision\x10d\x1a\x10\xc0\xb5\x18\x01\xb0\xb5\
\x18\x01\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x1dMessageType_DebugLink\
GetState\x10e\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\xa0\xb5\x18\x01\
\x12(\n\x1aMessageType_DebugLinkState\x10f\x1a\x08\x80\xa6\x1d\x01\xa8\
\xb5\x18\x01\x12'\n\x19MessageType_DebugLinkStop\x10g\x1a\x08\x80\xa6\
\x1d\x01\xa0\xb5\x18\x01\x12&\n\x18MessageType_DebugLinkLog\x10h\x1a\x08\
\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12-\n\x1fMessageType_DebugLinkMemoryRe\
ad\x10n\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12)\n\x1bMessageType_De\
bugLinkMemory\x10o\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12.\n\x20Mes\
sageType_DebugLinkMemoryWrite\x10p\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\
\x01\x12-\n\x1fMessageType_DebugLinkFlashErase\x10q\x1a\x08\x80\xa6\x1d\
\x01\xa0\xb5\x18\x01\x12*\n\x1bMessageType_DebugLinkLayout\x10\xa9F\x1a\
\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x120\n!MessageType_DebugLinkReseedR\
andom\x10\xaaF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x120\n!MessageTyp\
e_DebugLinkRecordScreen\x10\xabF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\
\x12/\n\x20MessageType_DebugLinkEraseSdCard\x10\xadF\x1a\x08\x80\xa6\x1d\
\x01\xa0\xb5\x18\x01\x12/\n\x20MessageType_DebugLinkWatchLayout\x10\xaeF\
\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x124\n%MessageType_DebugLinkRes\
etDebugEvents\x10\xafF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x123\n$Me\
ssageType_DebugLinkOptigaSetSecMax\x10\xb0F\x1a\x08\x80\xa6\x1d\x01\xa0\
\xb5\x18\x01\x12+\n\x20MessageType_EthereumGetPublicKey\x10\xc2\x03\x1a\
\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_EthereumPublicKey\x10\xc3\x03\
\x1a\x04\x98\xb5\x18\x01\x12(\n\x1eMessageType_EthereumGetAddress\x108\
\x1a\x04\x90\xb5\x18\x01\x12%\n\x1bMessageType_EthereumAddress\x109\x1a\
\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EthereumSignTx\x10:\x1a\x04\
\x90\xb5\x18\x01\x12,\n!MessageType_EthereumSignTxEIP1559\x10\xc4\x03\
\x1a\x04\x90\xb5\x18\x01\x12'\n\x1dMessageType_EthereumTxRequest\x10;\
\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_EthereumTxAck\x10<\x1a\
\x04\x90\xb5\x18\x01\x12)\n\x1fMessageType_EthereumSignMessage\x10@\x1a\
\x04\x90\xb5\x18\x01\x12+\n!MessageType_EthereumVerifyMessage\x10A\x1a\
\x04\x90\xb5\x18\x01\x12.\n$MessageType_EthereumMessageSignature\x10B\
\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedData\x10\
\xd0\x03\x1a\x04\x90\xb5\x18\x01\x125\n*MessageType_EthereumTypedDataStr\
uctRequest\x10\xd1\x03\x1a\x04\x98\xb5\x18\x01\x121\n&MessageType_Ethere\
umTypedDataStructAck\x10\xd2\x03\x1a\x04\x90\xb5\x18\x01\x124\n)MessageT\
ype_EthereumTypedDataValueRequest\x10\xd3\x03\x1a\x04\x98\xb5\x18\x01\
\x120\n%MessageType_EthereumTypedDataValueAck\x10\xd4\x03\x1a\x04\x90\
\xb5\x18\x01\x121\n&MessageType_EthereumTypedDataSignature\x10\xd5\x03\
\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedHash\x10\
\xd6\x03\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_NEMGetAddress\x10\
C\x1a\x04\x90\xb5\x18\x01\x12\x20\n\x16MessageType_NEMAddress\x10D\x1a\
\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_NEMSignTx\x10E\x1a\x04\x90\
\xb5\x18\x01\x12!\n\x17MessageType_NEMSignedTx\x10F\x1a\x04\x98\xb5\x18\
\x01\x12'\n\x1dMessageType_NEMDecryptMessage\x10K\x1a\x04\x90\xb5\x18\
\x01\x12)\n\x1fMessageType_NEMDecryptedMessage\x10L\x1a\x04\x98\xb5\x18\
\x01\x12&\n\x1bMessageType_TezosGetAddress\x10\x96\x01\x1a\x04\x90\xb5\
\x18\x01\x12#\n\x18MessageType_TezosAddress\x10\x97\x01\x1a\x04\x98\xb5\
\x18\x01\x12\"\n\x17MessageType_TezosSignTx\x10\x98\x01\x1a\x04\x90\xb5\
\x18\x01\x12$\n\x19MessageType_TezosSignedTx\x10\x99\x01\x1a\x04\x98\xb5\
\x18\x01\x12(\n\x1dMessageType_TezosGetPublicKey\x10\x9a\x01\x1a\x04\x90\
\xb5\x18\x01\x12%\n\x1aMessageType_TezosPublicKey\x10\x9b\x01\x1a\x04\
\x98\xb5\x18\x01\x12$\n\x19MessageType_StellarSignTx\x10\xca\x01\x1a\x04\
\x90\xb5\x18\x01\x12)\n\x1eMessageType_StellarTxOpRequest\x10\xcb\x01\
\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_StellarGetAddress\x10\xcf\
\x01\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_StellarAddress\x10\
\xd0\x01\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_StellarCreateAccoun\
tOp\x10\xd2\x01\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_StellarPay\
mentOp\x10\xd3\x01\x1a\x04\x90\xb5\x18\x01\x128\n-MessageType_StellarPat\
hPaymentStrictReceiveOp\x10\xd4\x01\x1a\x04\x90\xb5\x18\x01\x12/\n$Messa\
geType_StellarManageSellOfferOp\x10\xd5\x01\x1a\x04\x90\xb5\x18\x01\x126\
\n+MessageType_StellarCreatePassiveSellOfferOp\x10\xd6\x01\x1a\x04\x90\
\xb5\x18\x01\x12*\n\x1fMessageType_StellarSetOptionsOp\x10\xd7\x01\x1a\
\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_StellarChangeTrustOp\x10\xd8\
\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarAllowTrustOp\
\x10\xd9\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_StellarAccountMe\
rgeOp\x10\xda\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarM\
anageDataOp\x10\xdc\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_Stell\
arBumpSequenceOp\x10\xdd\x01\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageType_\
StellarManageBuyOfferOp\x10\xde\x01\x1a\x04\x90\xb5\x18\x01\x125\n*Messa\
geType_StellarPathPaymentStrictSendOp\x10\xdf\x01\x1a\x04\x90\xb5\x18\
e_AuthorizeCoinJoin\x103\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12)\n\
\x1aMessageType_NostrGetPubkey\x10\xd1\x0f\x1a\x08\x80\xa6\x1d\x01\x90\
\xb5\x18\x01\x12&\n\x17MessageType_NostrPubkey\x10\xd2\x0f\x1a\x08\x80\
\xa6\x1d\x01\x98\xb5\x18\x01\x12)\n\x1aMessageType_NostrSignEvent\x10\
\xd3\x0f\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12.\n\x1fMessageType_N\
ostrEventSignature\x10\xd4\x0f\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\
\x12(\n\x1aMessageType_CipherKeyValue\x10\x17\x1a\x08\x80\xa6\x1d\x01\
\x90\xb5\x18\x01\x12*\n\x1cMessageType_CipheredKeyValue\x100\x1a\x08\x80\
\xa6\x1d\x01\x98\xb5\x18\x01\x12&\n\x18MessageType_SignIdentity\x105\x1a\
\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMessageType_SignedIdentit\
y\x106\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\x12+\n\x1dMessageType_Get\
ECDHSessionKey\x10=\x1a\x08\x80\xa6\x1d\x01\x90\xb5\x18\x01\x12(\n\x1aMe\
ssageType_ECDHSessionKey\x10>\x1a\x08\x80\xa6\x1d\x01\x98\xb5\x18\x01\
\x123\n\x1dMessageType_DebugLinkDecision\x10d\x1a\x10\xc0\xb5\x18\x01\
\xb0\xb5\x18\x01\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x1dMessageType_D\
ebugLinkGetState\x10e\x1a\x0c\x80\xa6\x1d\x01\xb0\xb5\x18\x01\xa0\xb5\
\x18\x01\x12(\n\x1aMessageType_DebugLinkState\x10f\x1a\x08\x80\xa6\x1d\
\x01\xa8\xb5\x18\x01\x12'\n\x19MessageType_DebugLinkStop\x10g\x1a\x08\
\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12&\n\x18MessageType_DebugLinkLog\x10h\
\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12-\n\x1fMessageType_DebugLink\
MemoryRead\x10n\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12)\n\x1bMessag\
eType_DebugLinkMemory\x10o\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x12.\
\n\x20MessageType_DebugLinkMemoryWrite\x10p\x1a\x08\x80\xa6\x1d\x01\xa0\
\xb5\x18\x01\x12-\n\x1fMessageType_DebugLinkFlashErase\x10q\x1a\x08\x80\
\xa6\x1d\x01\xa0\xb5\x18\x01\x12*\n\x1bMessageType_DebugLinkLayout\x10\
\xa9F\x1a\x08\x80\xa6\x1d\x01\xa8\xb5\x18\x01\x120\n!MessageType_DebugLi\
nkReseedRandom\x10\xaaF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x120\n!M\
essageType_DebugLinkRecordScreen\x10\xabF\x1a\x08\x80\xa6\x1d\x01\xa0\
\xb5\x18\x01\x12/\n\x20MessageType_DebugLinkEraseSdCard\x10\xadF\x1a\x08\
\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x12/\n\x20MessageType_DebugLinkWatchLay\
out\x10\xaeF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\x01\x124\n%MessageType_\
DebugLinkResetDebugEvents\x10\xafF\x1a\x08\x80\xa6\x1d\x01\xa0\xb5\x18\
\x01\x123\n$MessageType_DebugLinkOptigaSetSecMax\x10\xb0F\x1a\x08\x80\
\xa6\x1d\x01\xa0\xb5\x18\x01\x12+\n\x20MessageType_EthereumGetPublicKey\
\x10\xc2\x03\x1a\x04\x90\xb5\x18\x01\x12(\n\x1dMessageType_EthereumPubli\
cKey\x10\xc3\x03\x1a\x04\x98\xb5\x18\x01\x12(\n\x1eMessageType_EthereumG\
etAddress\x108\x1a\x04\x90\xb5\x18\x01\x12%\n\x1bMessageType_EthereumAdd\
ress\x109\x1a\x04\x98\xb5\x18\x01\x12$\n\x1aMessageType_EthereumSignTx\
\x10:\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_EthereumSignTxEIP1559\
\x10\xc4\x03\x1a\x04\x90\xb5\x18\x01\x12'\n\x1dMessageType_EthereumTxReq\
uest\x10;\x1a\x04\x98\xb5\x18\x01\x12#\n\x19MessageType_EthereumTxAck\
\x10<\x1a\x04\x90\xb5\x18\x01\x12)\n\x1fMessageType_EthereumSignMessage\
\x10@\x1a\x04\x90\xb5\x18\x01\x12+\n!MessageType_EthereumVerifyMessage\
\x10A\x1a\x04\x90\xb5\x18\x01\x12.\n$MessageType_EthereumMessageSignatur\
e\x10B\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedData\
\x10\xd0\x03\x1a\x04\x90\xb5\x18\x01\x125\n*MessageType_EthereumTypedDat\
aStructRequest\x10\xd1\x03\x1a\x04\x98\xb5\x18\x01\x121\n&MessageType_Et\
hereumTypedDataStructAck\x10\xd2\x03\x1a\x04\x90\xb5\x18\x01\x124\n)Mess\
ageType_EthereumTypedDataValueRequest\x10\xd3\x03\x1a\x04\x98\xb5\x18\
\x01\x120\n%MessageType_EthereumTypedDataValueAck\x10\xd4\x03\x1a\x04\
\x90\xb5\x18\x01\x121\n&MessageType_EthereumTypedDataSignature\x10\xd5\
\x03\x1a\x04\x98\xb5\x18\x01\x12,\n!MessageType_EthereumSignTypedHash\
\x10\xd6\x03\x1a\x04\x90\xb5\x18\x01\x12#\n\x19MessageType_NEMGetAddress\
\x10C\x1a\x04\x90\xb5\x18\x01\x12\x20\n\x16MessageType_NEMAddress\x10D\
\x1a\x04\x98\xb5\x18\x01\x12\x1f\n\x15MessageType_NEMSignTx\x10E\x1a\x04\
\x90\xb5\x18\x01\x12!\n\x17MessageType_NEMSignedTx\x10F\x1a\x04\x98\xb5\
\x18\x01\x12'\n\x1dMessageType_NEMDecryptMessage\x10K\x1a\x04\x90\xb5\
\x18\x01\x12)\n\x1fMessageType_NEMDecryptedMessage\x10L\x1a\x04\x98\xb5\
\x18\x01\x12&\n\x1bMessageType_TezosGetAddress\x10\x96\x01\x1a\x04\x90\
\xb5\x18\x01\x12#\n\x18MessageType_TezosAddress\x10\x97\x01\x1a\x04\x98\
\xb5\x18\x01\x12\"\n\x17MessageType_TezosSignTx\x10\x98\x01\x1a\x04\x90\
\xb5\x18\x01\x12$\n\x19MessageType_TezosSignedTx\x10\x99\x01\x1a\x04\x98\
\xb5\x18\x01\x12(\n\x1dMessageType_TezosGetPublicKey\x10\x9a\x01\x1a\x04\
\x90\xb5\x18\x01\x12%\n\x1aMessageType_TezosPublicKey\x10\x9b\x01\x1a\
\x04\x98\xb5\x18\x01\x12$\n\x19MessageType_StellarSignTx\x10\xca\x01\x1a\
\x04\x90\xb5\x18\x01\x12)\n\x1eMessageType_StellarTxOpRequest\x10\xcb\
\x01\x1a\x04\x98\xb5\x18\x01\x12(\n\x1dMessageType_StellarGetAddress\x10\
\xcf\x01\x1a\x04\x90\xb5\x18\x01\x12%\n\x1aMessageType_StellarAddress\
\x10\xd0\x01\x1a\x04\x98\xb5\x18\x01\x12-\n\"MessageType_StellarCreateAc\
countOp\x10\xd2\x01\x1a\x04\x90\xb5\x18\x01\x12'\n\x1cMessageType_Stella\
rPaymentOp\x10\xd3\x01\x1a\x04\x90\xb5\x18\x01\x128\n-MessageType_Stella\
rPathPaymentStrictReceiveOp\x10\xd4\x01\x1a\x04\x90\xb5\x18\x01\x12/\n$M\
essageType_StellarManageSellOfferOp\x10\xd5\x01\x1a\x04\x90\xb5\x18\x01\
\x126\n+MessageType_StellarCreatePassiveSellOfferOp\x10\xd6\x01\x1a\x04\
\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarSetOptionsOp\x10\xd7\x01\
\x1a\x04\x90\xb5\x18\x01\x12+\n\x20MessageType_StellarChangeTrustOp\x10\
\xd8\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_StellarAllowTrust\
Op\x10\xd9\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_StellarAccount\
MergeOp\x10\xda\x01\x1a\x04\x90\xb5\x18\x01\x12*\n\x1fMessageType_Stella\
rManageDataOp\x10\xdc\x01\x1a\x04\x90\xb5\x18\x01\x12,\n!MessageType_Ste\
llarBumpSequenceOp\x10\xdd\x01\x1a\x04\x90\xb5\x18\x01\x12.\n#MessageTyp\
e_StellarManageBuyOfferOp\x10\xde\x01\x1a\x04\x90\xb5\x18\x01\x125\n*Mes\
sageType_StellarPathPaymentStrictSendOp\x10\xdf\x01\x1a\x04\x90\xb5\x18\
\x01\x125\n*MessageType_StellarClaimClaimableBalanceOp\x10\xe1\x01\x1a\
\x04\x90\xb5\x18\x01\x12&\n\x1bMessageType_StellarSignedTx\x10\xe6\x01\
\x1a\x04\x98\xb5\x18\x01\x12*\n\x1fMessageType_CardanoGetPublicKey\x10\

File diff suppressed because it is too large Load Diff

View File

View File

@ -0,0 +1,102 @@
# This file is part of the Trezor project.
#
# Copyright (C) 2012-2025 SatoshiLabs and contributors
#
# This library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# as published by the Free Software Foundation.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the License along with this library.
# If not, see <https://www.gnu.org/licenses/lgpl-3.0.html>.
import json
import time
from hashlib import sha256
import pytest
from ecdsa import SECP256k1, VerifyingKey
from six import b
from trezorlib import nostr
from trezorlib.debuglink import TrezorClientDebugLink as Client
from trezorlib.tools import parse_path
# test data from NIP-06: https://github.com/nostr-protocol/nips/blob/master/06.md
LEAD_MONKEY_MNEMONIC = (
"leader monkey parrot ring guide accident before fence cannon height naive bean"
)
LEAD_MONKEY_PK = "17162c921dc4d2518f9a101db33695df1afb56ab82f5ff3e5da6eec3ca5cd917"
WHAT_BLEAK_MNEMONIC = "what bleak badge arrange retreat wolf trade produce cricket blur garlic valid proud rude strong choose busy staff weather area salt hollow arm fade"
WHAT_BLEAK_PK = "d41b22899549e1f3d335a31002cfd382174006e166d3e658e3a5eecdb6463573"
@pytest.mark.setup_client(mnemonic=LEAD_MONKEY_MNEMONIC)
def test_sign_event_lead_monkey(client: Client):
_test_sign_event(client, LEAD_MONKEY_PK)
@pytest.mark.setup_client(mnemonic=WHAT_BLEAK_MNEMONIC)
def test_sign_event_what_bleak(client: Client):
_test_sign_event(client, WHAT_BLEAK_PK)
@pytest.mark.setup_client(mnemonic=LEAD_MONKEY_MNEMONIC)
def test_get_pubkey_lead_monkey(client: Client):
_test_get_pubkey(client, LEAD_MONKEY_PK)
@pytest.mark.setup_client(mnemonic=WHAT_BLEAK_MNEMONIC)
def test_get_pubkey_what_bleak(client: Client):
_test_get_pubkey(client, WHAT_BLEAK_PK)
def _test_get_pubkey(client, expected_pk):
response = nostr.get_pubkey(
client,
n=parse_path("m/44'/1237'/0'/0/0"),
)
assert response.pubkey == bytes.fromhex(expected_pk)
def _test_sign_event(client, expected_pk):
created_at = int(time.time())
kind = 1
tags = []
content = "Hello, world!"
response = nostr.sign_event(
client,
event=json.dumps(
{"created_at": created_at, "kind": kind, "tags": tags, "content": content}
),
n=parse_path("m/44'/1237'/0'/0/0"),
)
assert response.pubkey == bytes.fromhex(expected_pk)
expected_id = sha256(
json.dumps(
[0, expected_pk, created_at, kind, tags, content], separators=(",", ":")
).encode("utf-8")
).digest()
assert response.id == expected_id
vk = VerifyingKey.from_string(
b("\x03") + bytes.fromhex(expected_pk),
curve=SECP256k1,
# this is a pretty silly way to tell VerifyingKey
# that we do not want the message to be hashed
# when verifying the signature!
hashfunc=lambda x: type("h", (), {"digest": lambda: x}),
)
assert vk.verify(response.signature, response.id)