From c91590426d868190681e80f3fd1abc88694d6fcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ioan=20Biz=C4=83u?= Date: Mon, 7 Oct 2024 13:23:49 +0200 Subject: [PATCH] feat(core): add nostr --- common/protob/messages-nostr.proto | 55 + common/protob/messages.proto | 7 +- core/.changelog.d/4160.added | 1 + core/src/all_modules.py | 6 + core/src/apps/bitcoin/keychain.py | 3 + core/src/apps/nostr/__init__.py | 5 + core/src/apps/nostr/get_pubkey.py | 20 + core/src/apps/nostr/sign_event.py | 35 + core/src/apps/workflow_handlers.py | 6 + core/src/trezor/enums/MessageType.py | 4 + core/src/trezor/enums/__init__.py | 4 + core/src/trezor/messages.py | 76 ++ core/src/trezor/wire/__init__.py | 1 + legacy/firmware/protob/Makefile | 3 +- python/src/trezorlib/cli/nostr.py | 82 ++ python/src/trezorlib/cli/trezorctl.py | 2 + python/src/trezorlib/mapping.py | 4 +- python/src/trezorlib/messages.py | 90 ++ python/src/trezorlib/nostr.py | 57 + rust/trezor-client/src/messages/generated.rs | 4 + .../src/protos/generated/messages.rs | 527 +++++---- .../src/protos/generated/messages_nostr.rs | 1054 +++++++++++++++++ tests/device_tests/nostr/__init__.py | 0 tests/device_tests/nostr/test_nostr.py | 102 ++ 24 files changed, 1896 insertions(+), 252 deletions(-) create mode 100644 common/protob/messages-nostr.proto create mode 100644 core/.changelog.d/4160.added create mode 100644 core/src/apps/nostr/__init__.py create mode 100644 core/src/apps/nostr/get_pubkey.py create mode 100644 core/src/apps/nostr/sign_event.py create mode 100644 python/src/trezorlib/cli/nostr.py create mode 100644 python/src/trezorlib/nostr.py create mode 100644 rust/trezor-client/src/protos/generated/messages_nostr.rs create mode 100644 tests/device_tests/nostr/__init__.py create mode 100644 tests/device_tests/nostr/test_nostr.py diff --git a/common/protob/messages-nostr.proto b/common/protob/messages-nostr.proto new file mode 100644 index 0000000000..dfc9ea251a --- /dev/null +++ b/common/protob/messages-nostr.proto @@ -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 +} diff --git a/common/protob/messages.proto b/common/protob/messages.proto index c6ec31dc63..5112c28e99 100644 --- a/common/protob/messages.proto +++ b/common/protob/messages.proto @@ -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]; diff --git a/core/.changelog.d/4160.added b/core/.changelog.d/4160.added new file mode 100644 index 0000000000..8b13ef64f9 --- /dev/null +++ b/core/.changelog.d/4160.added @@ -0,0 +1 @@ +Add Nostr support. diff --git a/core/src/all_modules.py b/core/src/all_modules.py index 05f3a3330a..ec663c1455 100644 --- a/core/src/all_modules.py +++ b/core/src/all_modules.py @@ -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 diff --git a/core/src/apps/bitcoin/keychain.py b/core/src/apps/bitcoin/keychain.py index c8d57f56b1..3390a0bd84 100644 --- a/core/src/apps/bitcoin/keychain.py +++ b/core/src/apps/bitcoin/keychain.py @@ -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, diff --git a/core/src/apps/nostr/__init__.py b/core/src/apps/nostr/__init__.py new file mode 100644 index 0000000000..dbdba83a1f --- /dev/null +++ b/core/src/apps/nostr/__init__.py @@ -0,0 +1,5 @@ +from apps.common.paths import PATTERN_BIP44 + +CURVE = "secp256k1" +SLIP44_ID = 1237 +PATTERN = PATTERN_BIP44 diff --git a/core/src/apps/nostr/get_pubkey.py b/core/src/apps/nostr/get_pubkey.py new file mode 100644 index 0000000000..00ec73ab56 --- /dev/null +++ b/core/src/apps/nostr/get_pubkey.py @@ -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) diff --git a/core/src/apps/nostr/sign_event.py b/core/src/apps/nostr/sign_event.py new file mode 100644 index 0000000000..4718526f1d --- /dev/null +++ b/core/src/apps/nostr/sign_event.py @@ -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) diff --git a/core/src/apps/workflow_handlers.py b/core/src/apps/workflow_handlers.py index b65c853c93..af8460791b 100644 --- a/core/src/apps/workflow_handlers.py +++ b/core/src/apps/workflow_handlers.py @@ -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" diff --git a/core/src/trezor/enums/MessageType.py b/core/src/trezor/enums/MessageType.py index ae32cd7f69..94641f9cbb 100644 --- a/core/src/trezor/enums/MessageType.py +++ b/core/src/trezor/enums/MessageType.py @@ -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 diff --git a/core/src/trezor/enums/__init__.py b/core/src/trezor/enums/__init__.py index 9d9fef3275..25dc6e5ad5 100644 --- a/core/src/trezor/enums/__init__.py +++ b/core/src/trezor/enums/__init__.py @@ -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 diff --git a/core/src/trezor/messages.py b/core/src/trezor/messages.py index 5d56c24113..97efa1caa3 100644 --- a/core/src/trezor/messages.py +++ b/core/src/trezor/messages.py @@ -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" diff --git a/core/src/trezor/wire/__init__.py b/core/src/trezor/wire/__init__.py index 2662a5610a..fc45ca9ba6 100644 --- a/core/src/trezor/wire/__init__.py +++ b/core/src/trezor/wire/__init__.py @@ -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: diff --git a/legacy/firmware/protob/Makefile b/legacy/firmware/protob/Makefile index b6782666b0..d3c33b6738 100644 --- a/legacy/firmware/protob/Makefile +++ b/legacy/firmware/protob/Makefile @@ -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 diff --git a/python/src/trezorlib/cli/nostr.py b/python/src/trezorlib/cli/nostr.py new file mode 100644 index 0000000000..864490bbad --- /dev/null +++ b/python/src/trezorlib/cli/nostr.py @@ -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 . + +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), + } diff --git a/python/src/trezorlib/cli/trezorctl.py b/python/src/trezorlib/cli/trezorctl.py index 60f8e8d309..d1f32a7c7f 100755 --- a/python/src/trezorlib/cli/trezorctl.py +++ b/python/src/trezorlib/cli/trezorctl.py @@ -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) diff --git a/python/src/trezorlib/mapping.py b/python/src/trezorlib/mapping.py index d50324d586..532277078f 100644 --- a/python/src/trezorlib/mapping.py +++ b/python/src/trezorlib/mapping.py @@ -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) diff --git a/python/src/trezorlib/messages.py b/python/src/trezorlib/messages.py index 705fc1c5ef..cf276a7525 100644 --- a/python/src/trezorlib/messages.py +++ b/python/src/trezorlib/messages.py @@ -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 = { diff --git a/python/src/trezorlib/nostr.py b/python/src/trezorlib/nostr.py new file mode 100644 index 0000000000..41c56047b4 --- /dev/null +++ b/python/src/trezorlib/nostr.py @@ -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 . + + +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"], + ) + ) diff --git a/rust/trezor-client/src/messages/generated.rs b/rust/trezor-client/src/messages/generated.rs index 83a0c4b0b7..9175a89062 100644 --- a/rust/trezor-client/src/messages/generated.rs +++ b/rust/trezor-client/src/messages/generated.rs @@ -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, diff --git a/rust/trezor-client/src/protos/generated/messages.rs b/rust/trezor-client/src/protos/generated/messages.rs index c8f4341b8a..b43dcd010e 100644 --- a/rust/trezor-client/src/protos/generated/messages.rs +++ b/rust/trezor-client/src/protos/generated/messages.rs @@ -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\ diff --git a/rust/trezor-client/src/protos/generated/messages_nostr.rs b/rust/trezor-client/src/protos/generated/messages_nostr.rs new file mode 100644 index 0000000000..a19730c997 --- /dev/null +++ b/rust/trezor-client/src/protos/generated/messages_nostr.rs @@ -0,0 +1,1054 @@ +// This file is generated by rust-protobuf 3.3.0. Do not edit +// .proto file is parsed by protoc 3.19.6 +// @generated + +// https://github.com/rust-lang/rust-clippy/issues/702 +#![allow(unknown_lints)] +#![allow(clippy::all)] + +#![allow(unused_attributes)] +#![cfg_attr(rustfmt, rustfmt::skip)] + +#![allow(box_pointers)] +#![allow(dead_code)] +#![allow(missing_docs)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(non_upper_case_globals)] +#![allow(trivial_casts)] +#![allow(unused_results)] +#![allow(unused_mut)] + +//! Generated file from `messages-nostr.proto` + +/// Generated files are compatible only with the same version +/// of protobuf runtime. +const _PROTOBUF_VERSION_CHECK: () = ::protobuf::VERSION_3_3_0; + +// @@protoc_insertion_point(message:hw.trezor.messages.nostr.NostrGetPubkey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NostrGetPubkey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.created_at) + pub created_at: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.kind) + pub kind: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.tags) + pub tags: ::std::vec::Vec<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrGetPubkey.content) + pub content: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrGetPubkey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NostrGetPubkey { + fn default() -> &'a NostrGetPubkey { + ::default_instance() + } +} + +impl NostrGetPubkey { + pub fn new() -> NostrGetPubkey { + ::std::default::Default::default() + } + + // optional uint32 created_at = 2; + + pub fn created_at(&self) -> u32 { + self.created_at.unwrap_or(0) + } + + pub fn clear_created_at(&mut self) { + self.created_at = ::std::option::Option::None; + } + + pub fn has_created_at(&self) -> bool { + self.created_at.is_some() + } + + // Param is passed by value, moved + pub fn set_created_at(&mut self, v: u32) { + self.created_at = ::std::option::Option::Some(v); + } + + // optional uint32 kind = 3; + + pub fn kind(&self) -> u32 { + self.kind.unwrap_or(0) + } + + pub fn clear_kind(&mut self) { + self.kind = ::std::option::Option::None; + } + + pub fn has_kind(&self) -> bool { + self.kind.is_some() + } + + // Param is passed by value, moved + pub fn set_kind(&mut self, v: u32) { + self.kind = ::std::option::Option::Some(v); + } + + // optional string content = 5; + + pub fn content(&self) -> &str { + match self.content.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_content(&mut self) { + self.content = ::std::option::Option::None; + } + + pub fn has_content(&self) -> bool { + self.content.is_some() + } + + // Param is passed by value, moved + pub fn set_content(&mut self, v: ::std::string::String) { + self.content = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_content(&mut self) -> &mut ::std::string::String { + if self.content.is_none() { + self.content = ::std::option::Option::Some(::std::string::String::new()); + } + self.content.as_mut().unwrap() + } + + // Take field + pub fn take_content(&mut self) -> ::std::string::String { + self.content.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &NostrGetPubkey| { &m.address_n }, + |m: &mut NostrGetPubkey| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "created_at", + |m: &NostrGetPubkey| { &m.created_at }, + |m: &mut NostrGetPubkey| { &mut m.created_at }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "kind", + |m: &NostrGetPubkey| { &m.kind }, + |m: &mut NostrGetPubkey| { &mut m.kind }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "tags", + |m: &NostrGetPubkey| { &m.tags }, + |m: &mut NostrGetPubkey| { &mut m.tags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "content", + |m: &NostrGetPubkey| { &m.content }, + |m: &mut NostrGetPubkey| { &mut m.content }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NostrGetPubkey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NostrGetPubkey { + const NAME: &'static str = "NostrGetPubkey"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.created_at = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.kind = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.tags.push(is.read_string()?); + }, + 42 => { + self.content = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.created_at { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.kind { + my_size += ::protobuf::rt::uint32_size(3, v); + } + for value in &self.tags { + my_size += ::protobuf::rt::string_size(4, &value); + }; + if let Some(v) = self.content.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.created_at { + os.write_uint32(2, v)?; + } + if let Some(v) = self.kind { + os.write_uint32(3, v)?; + } + for v in &self.tags { + os.write_string(4, &v)?; + }; + if let Some(v) = self.content.as_ref() { + os.write_string(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NostrGetPubkey { + NostrGetPubkey::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.created_at = ::std::option::Option::None; + self.kind = ::std::option::Option::None; + self.tags.clear(); + self.content = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NostrGetPubkey { + static instance: NostrGetPubkey = NostrGetPubkey { + address_n: ::std::vec::Vec::new(), + created_at: ::std::option::Option::None, + kind: ::std::option::Option::None, + tags: ::std::vec::Vec::new(), + content: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NostrGetPubkey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NostrGetPubkey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NostrGetPubkey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NostrGetPubkey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nostr.NostrPubkey) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NostrPubkey { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrPubkey.pubkey) + pub pubkey: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrPubkey.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NostrPubkey { + fn default() -> &'a NostrPubkey { + ::default_instance() + } +} + +impl NostrPubkey { + pub fn new() -> NostrPubkey { + ::std::default::Default::default() + } + + // required bytes pubkey = 1; + + pub fn pubkey(&self) -> &[u8] { + match self.pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pubkey(&mut self) { + self.pubkey = ::std::option::Option::None; + } + + pub fn has_pubkey(&self) -> bool { + self.pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_pubkey(&mut self, v: ::std::vec::Vec) { + self.pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.pubkey.is_none() { + self.pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_pubkey(&mut self) -> ::std::vec::Vec { + self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(1); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pubkey", + |m: &NostrPubkey| { &m.pubkey }, + |m: &mut NostrPubkey| { &mut m.pubkey }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NostrPubkey", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NostrPubkey { + const NAME: &'static str = "NostrPubkey"; + + fn is_initialized(&self) -> bool { + if self.pubkey.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.pubkey.as_ref() { + os.write_bytes(1, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NostrPubkey { + NostrPubkey::new() + } + + fn clear(&mut self) { + self.pubkey = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NostrPubkey { + static instance: NostrPubkey = NostrPubkey { + pubkey: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NostrPubkey { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NostrPubkey").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NostrPubkey { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NostrPubkey { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nostr.NostrSignEvent) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NostrSignEvent { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrSignEvent.address_n) + pub address_n: ::std::vec::Vec, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrSignEvent.created_at) + pub created_at: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrSignEvent.kind) + pub kind: ::std::option::Option, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrSignEvent.tags) + pub tags: ::std::vec::Vec<::std::string::String>, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrSignEvent.content) + pub content: ::std::option::Option<::std::string::String>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrSignEvent.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NostrSignEvent { + fn default() -> &'a NostrSignEvent { + ::default_instance() + } +} + +impl NostrSignEvent { + pub fn new() -> NostrSignEvent { + ::std::default::Default::default() + } + + // optional uint32 created_at = 2; + + pub fn created_at(&self) -> u32 { + self.created_at.unwrap_or(0) + } + + pub fn clear_created_at(&mut self) { + self.created_at = ::std::option::Option::None; + } + + pub fn has_created_at(&self) -> bool { + self.created_at.is_some() + } + + // Param is passed by value, moved + pub fn set_created_at(&mut self, v: u32) { + self.created_at = ::std::option::Option::Some(v); + } + + // optional uint32 kind = 3; + + pub fn kind(&self) -> u32 { + self.kind.unwrap_or(0) + } + + pub fn clear_kind(&mut self) { + self.kind = ::std::option::Option::None; + } + + pub fn has_kind(&self) -> bool { + self.kind.is_some() + } + + // Param is passed by value, moved + pub fn set_kind(&mut self, v: u32) { + self.kind = ::std::option::Option::Some(v); + } + + // optional string content = 5; + + pub fn content(&self) -> &str { + match self.content.as_ref() { + Some(v) => v, + None => "", + } + } + + pub fn clear_content(&mut self) { + self.content = ::std::option::Option::None; + } + + pub fn has_content(&self) -> bool { + self.content.is_some() + } + + // Param is passed by value, moved + pub fn set_content(&mut self, v: ::std::string::String) { + self.content = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_content(&mut self) -> &mut ::std::string::String { + if self.content.is_none() { + self.content = ::std::option::Option::Some(::std::string::String::new()); + } + self.content.as_mut().unwrap() + } + + // Take field + pub fn take_content(&mut self) -> ::std::string::String { + self.content.take().unwrap_or_else(|| ::std::string::String::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(5); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "address_n", + |m: &NostrSignEvent| { &m.address_n }, + |m: &mut NostrSignEvent| { &mut m.address_n }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "created_at", + |m: &NostrSignEvent| { &m.created_at }, + |m: &mut NostrSignEvent| { &mut m.created_at }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "kind", + |m: &NostrSignEvent| { &m.kind }, + |m: &mut NostrSignEvent| { &mut m.kind }, + )); + fields.push(::protobuf::reflect::rt::v2::make_vec_simpler_accessor::<_, _>( + "tags", + |m: &NostrSignEvent| { &m.tags }, + |m: &mut NostrSignEvent| { &mut m.tags }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "content", + |m: &NostrSignEvent| { &m.content }, + |m: &mut NostrSignEvent| { &mut m.content }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NostrSignEvent", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NostrSignEvent { + const NAME: &'static str = "NostrSignEvent"; + + fn is_initialized(&self) -> bool { + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + is.read_repeated_packed_uint32_into(&mut self.address_n)?; + }, + 8 => { + self.address_n.push(is.read_uint32()?); + }, + 16 => { + self.created_at = ::std::option::Option::Some(is.read_uint32()?); + }, + 24 => { + self.kind = ::std::option::Option::Some(is.read_uint32()?); + }, + 34 => { + self.tags.push(is.read_string()?); + }, + 42 => { + self.content = ::std::option::Option::Some(is.read_string()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + for value in &self.address_n { + my_size += ::protobuf::rt::uint32_size(1, *value); + }; + if let Some(v) = self.created_at { + my_size += ::protobuf::rt::uint32_size(2, v); + } + if let Some(v) = self.kind { + my_size += ::protobuf::rt::uint32_size(3, v); + } + for value in &self.tags { + my_size += ::protobuf::rt::string_size(4, &value); + }; + if let Some(v) = self.content.as_ref() { + my_size += ::protobuf::rt::string_size(5, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + for v in &self.address_n { + os.write_uint32(1, *v)?; + }; + if let Some(v) = self.created_at { + os.write_uint32(2, v)?; + } + if let Some(v) = self.kind { + os.write_uint32(3, v)?; + } + for v in &self.tags { + os.write_string(4, &v)?; + }; + if let Some(v) = self.content.as_ref() { + os.write_string(5, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NostrSignEvent { + NostrSignEvent::new() + } + + fn clear(&mut self) { + self.address_n.clear(); + self.created_at = ::std::option::Option::None; + self.kind = ::std::option::Option::None; + self.tags.clear(); + self.content = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NostrSignEvent { + static instance: NostrSignEvent = NostrSignEvent { + address_n: ::std::vec::Vec::new(), + created_at: ::std::option::Option::None, + kind: ::std::option::Option::None, + tags: ::std::vec::Vec::new(), + content: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NostrSignEvent { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NostrSignEvent").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NostrSignEvent { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NostrSignEvent { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +// @@protoc_insertion_point(message:hw.trezor.messages.nostr.NostrEventSignature) +#[derive(PartialEq,Clone,Default,Debug)] +pub struct NostrEventSignature { + // message fields + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrEventSignature.pubkey) + pub pubkey: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrEventSignature.id) + pub id: ::std::option::Option<::std::vec::Vec>, + // @@protoc_insertion_point(field:hw.trezor.messages.nostr.NostrEventSignature.signature) + pub signature: ::std::option::Option<::std::vec::Vec>, + // special fields + // @@protoc_insertion_point(special_field:hw.trezor.messages.nostr.NostrEventSignature.special_fields) + pub special_fields: ::protobuf::SpecialFields, +} + +impl<'a> ::std::default::Default for &'a NostrEventSignature { + fn default() -> &'a NostrEventSignature { + ::default_instance() + } +} + +impl NostrEventSignature { + pub fn new() -> NostrEventSignature { + ::std::default::Default::default() + } + + // required bytes pubkey = 1; + + pub fn pubkey(&self) -> &[u8] { + match self.pubkey.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_pubkey(&mut self) { + self.pubkey = ::std::option::Option::None; + } + + pub fn has_pubkey(&self) -> bool { + self.pubkey.is_some() + } + + // Param is passed by value, moved + pub fn set_pubkey(&mut self, v: ::std::vec::Vec) { + self.pubkey = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_pubkey(&mut self) -> &mut ::std::vec::Vec { + if self.pubkey.is_none() { + self.pubkey = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.pubkey.as_mut().unwrap() + } + + // Take field + pub fn take_pubkey(&mut self) -> ::std::vec::Vec { + self.pubkey.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes id = 2; + + pub fn id(&self) -> &[u8] { + match self.id.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_id(&mut self) { + self.id = ::std::option::Option::None; + } + + pub fn has_id(&self) -> bool { + self.id.is_some() + } + + // Param is passed by value, moved + pub fn set_id(&mut self, v: ::std::vec::Vec) { + self.id = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_id(&mut self) -> &mut ::std::vec::Vec { + if self.id.is_none() { + self.id = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.id.as_mut().unwrap() + } + + // Take field + pub fn take_id(&mut self) -> ::std::vec::Vec { + self.id.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + // required bytes signature = 3; + + pub fn signature(&self) -> &[u8] { + match self.signature.as_ref() { + Some(v) => v, + None => &[], + } + } + + pub fn clear_signature(&mut self) { + self.signature = ::std::option::Option::None; + } + + pub fn has_signature(&self) -> bool { + self.signature.is_some() + } + + // Param is passed by value, moved + pub fn set_signature(&mut self, v: ::std::vec::Vec) { + self.signature = ::std::option::Option::Some(v); + } + + // Mutable pointer to the field. + // If field is not initialized, it is initialized with default value first. + pub fn mut_signature(&mut self) -> &mut ::std::vec::Vec { + if self.signature.is_none() { + self.signature = ::std::option::Option::Some(::std::vec::Vec::new()); + } + self.signature.as_mut().unwrap() + } + + // Take field + pub fn take_signature(&mut self) -> ::std::vec::Vec { + self.signature.take().unwrap_or_else(|| ::std::vec::Vec::new()) + } + + fn generated_message_descriptor_data() -> ::protobuf::reflect::GeneratedMessageDescriptorData { + let mut fields = ::std::vec::Vec::with_capacity(3); + let mut oneofs = ::std::vec::Vec::with_capacity(0); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "pubkey", + |m: &NostrEventSignature| { &m.pubkey }, + |m: &mut NostrEventSignature| { &mut m.pubkey }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "id", + |m: &NostrEventSignature| { &m.id }, + |m: &mut NostrEventSignature| { &mut m.id }, + )); + fields.push(::protobuf::reflect::rt::v2::make_option_accessor::<_, _>( + "signature", + |m: &NostrEventSignature| { &m.signature }, + |m: &mut NostrEventSignature| { &mut m.signature }, + )); + ::protobuf::reflect::GeneratedMessageDescriptorData::new_2::( + "NostrEventSignature", + fields, + oneofs, + ) + } +} + +impl ::protobuf::Message for NostrEventSignature { + const NAME: &'static str = "NostrEventSignature"; + + fn is_initialized(&self) -> bool { + if self.pubkey.is_none() { + return false; + } + if self.id.is_none() { + return false; + } + if self.signature.is_none() { + return false; + } + true + } + + fn merge_from(&mut self, is: &mut ::protobuf::CodedInputStream<'_>) -> ::protobuf::Result<()> { + while let Some(tag) = is.read_raw_tag_or_eof()? { + match tag { + 10 => { + self.pubkey = ::std::option::Option::Some(is.read_bytes()?); + }, + 18 => { + self.id = ::std::option::Option::Some(is.read_bytes()?); + }, + 26 => { + self.signature = ::std::option::Option::Some(is.read_bytes()?); + }, + tag => { + ::protobuf::rt::read_unknown_or_skip_group(tag, is, self.special_fields.mut_unknown_fields())?; + }, + }; + } + ::std::result::Result::Ok(()) + } + + // Compute sizes of nested messages + #[allow(unused_variables)] + fn compute_size(&self) -> u64 { + let mut my_size = 0; + if let Some(v) = self.pubkey.as_ref() { + my_size += ::protobuf::rt::bytes_size(1, &v); + } + if let Some(v) = self.id.as_ref() { + my_size += ::protobuf::rt::bytes_size(2, &v); + } + if let Some(v) = self.signature.as_ref() { + my_size += ::protobuf::rt::bytes_size(3, &v); + } + my_size += ::protobuf::rt::unknown_fields_size(self.special_fields.unknown_fields()); + self.special_fields.cached_size().set(my_size as u32); + my_size + } + + fn write_to_with_cached_sizes(&self, os: &mut ::protobuf::CodedOutputStream<'_>) -> ::protobuf::Result<()> { + if let Some(v) = self.pubkey.as_ref() { + os.write_bytes(1, v)?; + } + if let Some(v) = self.id.as_ref() { + os.write_bytes(2, v)?; + } + if let Some(v) = self.signature.as_ref() { + os.write_bytes(3, v)?; + } + os.write_unknown_fields(self.special_fields.unknown_fields())?; + ::std::result::Result::Ok(()) + } + + fn special_fields(&self) -> &::protobuf::SpecialFields { + &self.special_fields + } + + fn mut_special_fields(&mut self) -> &mut ::protobuf::SpecialFields { + &mut self.special_fields + } + + fn new() -> NostrEventSignature { + NostrEventSignature::new() + } + + fn clear(&mut self) { + self.pubkey = ::std::option::Option::None; + self.id = ::std::option::Option::None; + self.signature = ::std::option::Option::None; + self.special_fields.clear(); + } + + fn default_instance() -> &'static NostrEventSignature { + static instance: NostrEventSignature = NostrEventSignature { + pubkey: ::std::option::Option::None, + id: ::std::option::Option::None, + signature: ::std::option::Option::None, + special_fields: ::protobuf::SpecialFields::new(), + }; + &instance + } +} + +impl ::protobuf::MessageFull for NostrEventSignature { + fn descriptor() -> ::protobuf::reflect::MessageDescriptor { + static descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::MessageDescriptor> = ::protobuf::rt::Lazy::new(); + descriptor.get(|| file_descriptor().message_by_package_relative_name("NostrEventSignature").unwrap()).clone() + } +} + +impl ::std::fmt::Display for NostrEventSignature { + fn fmt(&self, f: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { + ::protobuf::text_format::fmt(self, f) + } +} + +impl ::protobuf::reflect::ProtobufValue for NostrEventSignature { + type RuntimeType = ::protobuf::reflect::rt::RuntimeTypeMessage; +} + +static file_descriptor_proto_data: &'static [u8] = b"\ + \n\x14messages-nostr.proto\x12\x18hw.trezor.messages.nostr\x1a\roptions.\ + proto\"\x8e\x01\n\x0eNostrGetPubkey\x12\x1b\n\taddress_n\x18\x01\x20\x03\ + (\rR\x08addressN\x12\x1d\n\ncreated_at\x18\x02\x20\x01(\rR\tcreatedAt\ + \x12\x12\n\x04kind\x18\x03\x20\x01(\rR\x04kind\x12\x12\n\x04tags\x18\x04\ + \x20\x03(\tR\x04tags\x12\x18\n\x07content\x18\x05\x20\x01(\tR\x07content\ + \"%\n\x0bNostrPubkey\x12\x16\n\x06pubkey\x18\x01\x20\x02(\x0cR\x06pubkey\ + \"\x8e\x01\n\x0eNostrSignEvent\x12\x1b\n\taddress_n\x18\x01\x20\x03(\rR\ + \x08addressN\x12\x1d\n\ncreated_at\x18\x02\x20\x01(\rR\tcreatedAt\x12\ + \x12\n\x04kind\x18\x03\x20\x01(\rR\x04kind\x12\x12\n\x04tags\x18\x04\x20\ + \x03(\tR\x04tags\x12\x18\n\x07content\x18\x05\x20\x01(\tR\x07content\"[\ + \n\x13NostrEventSignature\x12\x16\n\x06pubkey\x18\x01\x20\x02(\x0cR\x06p\ + ubkey\x12\x0e\n\x02id\x18\x02\x20\x02(\x0cR\x02id\x12\x1c\n\tsignature\ + \x18\x03\x20\x02(\x0cR\tsignatureB=\n#com.satoshilabs.trezor.lib.protobu\ + fB\x12TrezorMessageNostr\x80\xa6\x1d\x01\ +"; + +/// `FileDescriptorProto` object which was a source for this generated file +fn file_descriptor_proto() -> &'static ::protobuf::descriptor::FileDescriptorProto { + static file_descriptor_proto_lazy: ::protobuf::rt::Lazy<::protobuf::descriptor::FileDescriptorProto> = ::protobuf::rt::Lazy::new(); + file_descriptor_proto_lazy.get(|| { + ::protobuf::Message::parse_from_bytes(file_descriptor_proto_data).unwrap() + }) +} + +/// `FileDescriptor` object which allows dynamic access to files +pub fn file_descriptor() -> &'static ::protobuf::reflect::FileDescriptor { + static generated_file_descriptor_lazy: ::protobuf::rt::Lazy<::protobuf::reflect::GeneratedFileDescriptor> = ::protobuf::rt::Lazy::new(); + static file_descriptor: ::protobuf::rt::Lazy<::protobuf::reflect::FileDescriptor> = ::protobuf::rt::Lazy::new(); + file_descriptor.get(|| { + let generated_file_descriptor = generated_file_descriptor_lazy.get(|| { + let mut deps = ::std::vec::Vec::with_capacity(1); + deps.push(super::options::file_descriptor().clone()); + let mut messages = ::std::vec::Vec::with_capacity(4); + messages.push(NostrGetPubkey::generated_message_descriptor_data()); + messages.push(NostrPubkey::generated_message_descriptor_data()); + messages.push(NostrSignEvent::generated_message_descriptor_data()); + messages.push(NostrEventSignature::generated_message_descriptor_data()); + let mut enums = ::std::vec::Vec::with_capacity(0); + ::protobuf::reflect::GeneratedFileDescriptor::new_generated( + file_descriptor_proto(), + deps, + messages, + enums, + ) + }); + ::protobuf::reflect::FileDescriptor::new_generated_2(generated_file_descriptor) + }) +} diff --git a/tests/device_tests/nostr/__init__.py b/tests/device_tests/nostr/__init__.py new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/device_tests/nostr/test_nostr.py b/tests/device_tests/nostr/test_nostr.py new file mode 100644 index 0000000000..b1dbcb9f4d --- /dev/null +++ b/tests/device_tests/nostr/test_nostr.py @@ -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 . + +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)