diff --git a/core/SConscript.firmware b/core/SConscript.firmware index 93ce77eb3d..43d23d0972 100644 --- a/core/SConscript.firmware +++ b/core/SConscript.firmware @@ -662,9 +662,10 @@ if FROZEN: SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/NEM*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Nostr*.py')) + if PYOPT == '0': + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Nostr*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/ripple/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Ripple*.py')) diff --git a/core/SConscript.unix b/core/SConscript.unix index 00227af2dd..4e50b0d59c 100644 --- a/core/SConscript.unix +++ b/core/SConscript.unix @@ -721,9 +721,10 @@ if FROZEN: SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nem/*/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/NEM*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*/*.py')) - SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Nostr*.py')) + if PYOPT == '0': + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/nostr/*/*.py')) + SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Nostr*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'apps/ripple/*.py')) SOURCE_PY.extend(Glob(SOURCE_PY_DIR + 'trezor/enums/Ripple*.py')) diff --git a/core/src/apps/nostr/__init__.py b/core/src/apps/nostr/__init__.py index 98377d3a9c..cd0a89a447 100644 --- a/core/src/apps/nostr/__init__.py +++ b/core/src/apps/nostr/__init__.py @@ -1,3 +1,8 @@ +if not __debug__: + from trezor import utils + + utils.halt("Disabled in production mode") + from apps.common.paths import PATTERN_BIP44 CURVE = "secp256k1" diff --git a/core/src/apps/workflow_handlers.py b/core/src/apps/workflow_handlers.py index af8460791b..c7ff7ba477 100644 --- a/core/src/apps/workflow_handlers.py +++ b/core/src/apps/workflow_handlers.py @@ -106,11 +106,15 @@ 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" + # When promoting the Nostr app to production-level + # and removing the "if" guard don't forget to also remove + # the corresponding guards (PYOPT == '0') in Sconscript.* + if __debug__: + # 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: