├── .clang-format ├── .dockerignore ├── .gitignore ├── .gitlab-ci.yml ├── .gitmodules ├── .pylintrc ├── .travis.yml ├── AUTHORS ├── COPYING ├── ChangeLog ├── Dockerfile ├── Makefile ├── Pipfile ├── Pipfile.lock ├── README.md ├── SConscript.boardloader ├── SConscript.bootloader ├── SConscript.firmware ├── SConscript.prodtest ├── SConscript.reflash ├── SConscript.unix ├── SConstruct ├── assets ├── 5390-200.png ├── background.png ├── bg.png ├── cancel.png ├── check.png ├── click-icon.png ├── cog.png ├── confirm.png ├── dontcopy.png ├── icon_tools.png ├── icon_update.png ├── icon_wipe.png ├── left.png ├── lock.png ├── receive.png ├── recovery-old.png ├── recovery.png ├── send.png ├── small-arrow.png ├── space.png ├── swipedown.png ├── trezor_lock.png ├── trezor_logo.png └── wrong.png ├── build-docker.sh ├── docker └── emulator │ ├── Dockerfile │ └── run.sh ├── docs ├── CONTRIBUTING.md ├── api.md ├── bootloader.md ├── build.md ├── coins │ └── README.md ├── emulator.jpg ├── emulator.md ├── git │ └── hooks │ │ └── pre-push ├── hardware.md ├── hardware │ ├── bom.txt │ ├── clock-tree.png │ ├── dev-board-bottom-before.jpg │ ├── dev-board-top-before.jpg │ ├── model-t-bottom-v10.jpg │ ├── model-t-bottom-v12.jpg │ ├── model-t-display-module-bottom.jpg │ ├── model-t-display-module-disassembled-bottom.jpg │ ├── model-t-display-module-disassembled-top.jpg │ ├── model-t-display-module-top.jpg │ ├── model-t-top-v10.jpg │ ├── model-t-top-v12.jpg │ ├── photo-front.jpg │ └── schematic.png ├── logo.png ├── memory.md ├── testing.md └── toif.md ├── embed ├── boardloader │ ├── main.c │ ├── memory.ld │ ├── startup.s │ └── version.h ├── bootloader │ ├── bootui.c │ ├── bootui.h │ ├── header.S │ ├── icon_cancel.h │ ├── icon_confirm.h │ ├── icon_done.h │ ├── icon_fail.h │ ├── icon_info.h │ ├── icon_install.h │ ├── icon_logo.h │ ├── icon_safeplace.h │ ├── icon_welcome.h │ ├── icon_wipe.h │ ├── main.c │ ├── memory.ld │ ├── messages.c │ ├── messages.h │ ├── nanopb │ ├── protob │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── messages.options │ │ ├── messages.pb.c │ │ ├── messages.pb.h │ │ ├── messages.proto │ │ ├── types.options │ │ ├── types.pb.c │ │ ├── types.pb.h │ │ └── types.proto │ ├── startup.s │ └── version.h ├── extmod │ ├── modtrezorconfig │ │ ├── modtrezorconfig.c │ │ └── norcow_config.h │ ├── modtrezorcrypto │ │ ├── crc.c │ │ ├── crc.h │ │ ├── modtrezorcrypto-aes.h │ │ ├── modtrezorcrypto-bip32.h │ │ ├── modtrezorcrypto-bip39.h │ │ ├── modtrezorcrypto-blake256.h │ │ ├── modtrezorcrypto-blake2b.h │ │ ├── modtrezorcrypto-blake2s.h │ │ ├── modtrezorcrypto-chacha20poly1305.h │ │ ├── modtrezorcrypto-crc.h │ │ ├── modtrezorcrypto-curve25519.h │ │ ├── modtrezorcrypto-ed25519.h │ │ ├── modtrezorcrypto-groestl.h │ │ ├── modtrezorcrypto-monero.h │ │ ├── modtrezorcrypto-nem.h │ │ ├── modtrezorcrypto-nist256p1.h │ │ ├── modtrezorcrypto-pbkdf2.h │ │ ├── modtrezorcrypto-random.h │ │ ├── modtrezorcrypto-rfc6979.h │ │ ├── modtrezorcrypto-ripemd160.h │ │ ├── modtrezorcrypto-secp256k1.h │ │ ├── modtrezorcrypto-secp256k1_zkp.h │ │ ├── modtrezorcrypto-sha1.h │ │ ├── modtrezorcrypto-sha256.h │ │ ├── modtrezorcrypto-sha3-256.h │ │ ├── modtrezorcrypto-sha3-512.h │ │ ├── modtrezorcrypto-sha512.h │ │ ├── modtrezorcrypto.c │ │ └── rand.c │ ├── modtrezorio │ │ ├── modtrezorio-flash.h │ │ ├── modtrezorio-hid.h │ │ ├── modtrezorio-poll.h │ │ ├── modtrezorio-sbu.h │ │ ├── modtrezorio-sdcard.h │ │ ├── modtrezorio-usb.h │ │ ├── modtrezorio-vcp.h │ │ ├── modtrezorio-webusb.h │ │ └── modtrezorio.c │ ├── modtrezorui │ │ ├── display-stm32_1.h │ │ ├── display-stm32_t.h │ │ ├── display-unix.h │ │ ├── display.c │ │ ├── display.h │ │ ├── font_bitmap.c │ │ ├── font_bitmap.h │ │ ├── font_roboto_bold_20.c │ │ ├── font_roboto_bold_20.h │ │ ├── font_roboto_regular_20.c │ │ ├── font_roboto_regular_20.h │ │ ├── font_robotomono_bold_20.c │ │ ├── font_robotomono_bold_20.h │ │ ├── font_robotomono_regular_20.c │ │ ├── font_robotomono_regular_20.h │ │ ├── inflate.c │ │ ├── inflate.h │ │ ├── loader.h │ │ ├── modtrezorui-display.h │ │ ├── modtrezorui.c │ │ └── qr-code-generator │ ├── modtrezorutils │ │ └── modtrezorutils.c │ └── trezorobj.h ├── firmware │ ├── bl_check.c │ ├── bl_check.h │ ├── bootloader.bin │ ├── bootloader_hashes.py │ ├── header.S │ ├── main.c │ ├── memory_1.ld │ ├── memory_T.ld │ ├── modutime.c │ ├── mpconfigport.h │ ├── mphalport.c │ ├── mphalport.h │ ├── nlrthumb.c │ ├── startup.s │ └── version.h ├── prodtest │ ├── header.S │ ├── main.c │ ├── memory.ld │ ├── startup.s │ └── version.h ├── reflash │ ├── header.S │ ├── main.c │ ├── memory.ld │ ├── startup.s │ └── version.h ├── trezorhal │ ├── common.c │ ├── common.h │ ├── flash.c │ ├── flash.h │ ├── image.c │ ├── image.h │ ├── lowlevel.c │ ├── lowlevel.h │ ├── mini_printf.c │ ├── mini_printf.h │ ├── mpu.c │ ├── mpu.h │ ├── rng.c │ ├── rng.h │ ├── sbu.c │ ├── sbu.h │ ├── sdcard.c │ ├── sdcard.h │ ├── secbool.h │ ├── stm32.c │ ├── stm32f4xx_hal_conf.h │ ├── systick.c │ ├── touch.c │ ├── touch.h │ ├── touch_1.h │ ├── touch_t.h │ ├── usb.c │ ├── usb.h │ ├── usb_hid-defs.h │ ├── usb_hid-impl.h │ ├── usb_vcp-defs.h │ ├── usb_vcp-impl.h │ ├── usb_webusb-defs.h │ ├── usb_webusb-impl.h │ ├── usbd_conf.c │ ├── usbd_conf.h │ ├── usbd_core.c │ ├── usbd_core.h │ ├── usbd_ctlreq.c │ ├── usbd_ctlreq.h │ ├── usbd_def.h │ ├── usbd_ioreq.c │ ├── usbd_ioreq.h │ ├── util.s │ └── vectortable.s ├── unix │ ├── background_1.jpg │ ├── background_T.jpg │ ├── background_raspi.jpg │ ├── common.c │ ├── common.h │ ├── flash.c │ ├── flash.h │ ├── main.c │ ├── mpconfigport.h │ ├── profile.c │ ├── profile.h │ ├── rng.c │ ├── rng.h │ ├── sbu.c │ ├── sbu.h │ ├── sdcard.c │ ├── sdcard.h │ ├── secbool.h │ ├── touch.c │ ├── touch.h │ ├── usb.c │ ├── usb.h │ ├── usb_hid-defs.h │ ├── usb_vcp-defs.h │ ├── usb_webusb-defs.h │ └── version.h └── vendorheader │ ├── generate.sh │ ├── vendor_satoshilabs.toif │ ├── vendor_unsafe.toif │ ├── vendorheader_satoshilabs_signed_prod.bin │ ├── vendorheader_satoshilabs_unsigned.bin │ ├── vendorheader_unsafe_signed_dev.bin │ ├── vendorheader_unsafe_signed_prod.bin │ └── vendorheader_unsafe_unsigned.bin ├── emu.sh ├── help.awk ├── mocks ├── __init__.py ├── gc.py ├── generated │ ├── .mock-generated │ ├── __init__.py │ ├── trezorconfig.py │ ├── trezorcrypto │ │ ├── .mock-generated │ │ ├── __init__.py │ │ ├── bip32.py │ │ ├── bip39.py │ │ ├── curve25519.py │ │ ├── ed25519.py │ │ ├── monero.py │ │ ├── nem.py │ │ ├── nist256p1.py │ │ ├── random.py │ │ └── secp256k1.py │ ├── trezorio.py │ ├── trezorui.py │ └── trezorutils.py ├── micropython.py ├── sys.py ├── typing.py ├── ubinascii.py ├── uctypes.py ├── uio.py ├── ustruct.py ├── utime.py └── utimeq.py ├── setup.cfg ├── shell.nix ├── site_scons └── site_tools │ └── micropython │ ├── __init__.py │ └── qstrdefs.py ├── src ├── .gitignore ├── apps │ ├── __init__.py │ ├── cardano │ │ ├── __init__.py │ │ ├── address.py │ │ ├── cbor.py │ │ ├── get_address.py │ │ ├── get_public_key.py │ │ ├── layout │ │ │ ├── __init__.py │ │ │ └── progress.py │ │ ├── seed.py │ │ └── sign_tx.py │ ├── common │ │ ├── __init__.py │ │ ├── address_type.py │ │ ├── cache.py │ │ ├── coininfo.py │ │ ├── coininfo.py.mako │ │ ├── coins.py │ │ ├── confirm.py │ │ ├── layout.py │ │ ├── mnemonic.py │ │ ├── paths.py │ │ ├── request_passphrase.py │ │ ├── request_pin.py │ │ ├── seed.py │ │ ├── signverify.py │ │ ├── storage.py │ │ └── writers.py │ ├── debug │ │ └── __init__.py │ ├── ethereum │ │ ├── __init__.py │ │ ├── address.py │ │ ├── get_address.py │ │ ├── get_public_key.py │ │ ├── layout.py │ │ ├── networks.py │ │ ├── networks.py.mako │ │ ├── sign_message.py │ │ ├── sign_tx.py │ │ ├── tokens.py │ │ ├── tokens.py.mako │ │ └── verify_message.py │ ├── homescreen │ │ ├── __init__.py │ │ ├── homescreen.py │ │ └── res │ │ │ └── bg.toif │ ├── lisk │ │ ├── __init__.py │ │ ├── get_address.py │ │ ├── get_public_key.py │ │ ├── helpers.py │ │ ├── layout.py │ │ ├── sign_message.py │ │ ├── sign_tx.py │ │ └── verify_message.py │ ├── management │ │ ├── __init__.py │ │ ├── apply_flags.py │ │ ├── apply_settings.py │ │ ├── backup_device.py │ │ ├── change_pin.py │ │ ├── load_device.py │ │ ├── recovery_device.py │ │ ├── res │ │ │ └── small-arrow.toig │ │ ├── reset_device.py │ │ ├── set_u2f_counter.py │ │ └── wipe_device.py │ ├── monero │ │ ├── README.md │ │ ├── __init__.py │ │ ├── diag.py │ │ ├── get_address.py │ │ ├── get_tx_keys.py │ │ ├── get_watch_only.py │ │ ├── key_image_sync.py │ │ ├── layout │ │ │ ├── common.py │ │ │ └── confirms.py │ │ ├── live_refresh.py │ │ ├── misc.py │ │ ├── sign_tx.py │ │ ├── signing │ │ │ ├── __init__.py │ │ │ ├── offloading_keys.py │ │ │ ├── state.py │ │ │ ├── step_01_init_transaction.py │ │ │ ├── step_02_set_input.py │ │ │ ├── step_03_inputs_permutation.py │ │ │ ├── step_04_input_vini.py │ │ │ ├── step_05_all_inputs_set.py │ │ │ ├── step_06_set_output.py │ │ │ ├── step_07_all_outputs_set.py │ │ │ ├── step_09_sign_input.py │ │ │ └── step_10_sign_final.py │ │ └── xmr │ │ │ ├── __init__.py │ │ │ ├── addresses.py │ │ │ ├── bulletproof.py │ │ │ ├── credentials.py │ │ │ ├── crypto │ │ │ ├── __init__.py │ │ │ └── chacha_poly.py │ │ │ ├── keccak_hasher.py │ │ │ ├── key_image.py │ │ │ ├── mlsag.py │ │ │ ├── mlsag_hasher.py │ │ │ ├── monero.py │ │ │ ├── networks.py │ │ │ ├── range_signatures.py │ │ │ ├── serialize │ │ │ ├── __init__.py │ │ │ ├── base_types.py │ │ │ ├── int_serialize.py │ │ │ ├── message_types.py │ │ │ └── readwriter.py │ │ │ ├── serialize_messages │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── ct_keys.py │ │ │ ├── tx_ecdh.py │ │ │ ├── tx_prefix.py │ │ │ └── tx_rsig_bulletproof.py │ │ │ └── types.py │ ├── nem │ │ ├── README.md │ │ ├── __init__.py │ │ ├── get_address.py │ │ ├── helpers.py │ │ ├── layout.py │ │ ├── mosaic │ │ │ ├── __init__.py │ │ │ ├── helpers.py │ │ │ ├── layout.py │ │ │ ├── nem_mosaics.py │ │ │ ├── nem_mosaics.py.mako │ │ │ └── serialize.py │ │ ├── multisig │ │ │ ├── __init__.py │ │ │ ├── layout.py │ │ │ └── serialize.py │ │ ├── namespace │ │ │ ├── __init__.py │ │ │ ├── layout.py │ │ │ └── serialize.py │ │ ├── sign_tx.py │ │ ├── transfer │ │ │ ├── __init__.py │ │ │ ├── layout.py │ │ │ └── serialize.py │ │ ├── validators.py │ │ └── writers.py │ ├── ripple │ │ ├── README.md │ │ ├── __init__.py │ │ ├── base58_ripple.py │ │ ├── get_address.py │ │ ├── helpers.py │ │ ├── layout.py │ │ ├── serialize.py │ │ └── sign_tx.py │ ├── stellar │ │ ├── README.md │ │ ├── __init__.py │ │ ├── consts.py │ │ ├── get_address.py │ │ ├── helpers.py │ │ ├── layout.py │ │ ├── operations │ │ │ ├── __init__.py │ │ │ ├── layout.py │ │ │ └── serialize.py │ │ ├── sign_tx.py │ │ └── writers.py │ ├── tezos │ │ ├── README.md │ │ ├── __init__.py │ │ ├── get_address.py │ │ ├── get_public_key.py │ │ ├── helpers.py │ │ ├── layout.py │ │ └── sign_tx.py │ ├── wallet │ │ ├── __init__.py │ │ ├── cipher_key_value.py │ │ ├── get_address.py │ │ ├── get_ecdh_session_key.py │ │ ├── get_entropy.py │ │ ├── get_public_key.py │ │ ├── sign_identity.py │ │ ├── sign_message.py │ │ ├── sign_tx │ │ │ ├── __init__.py │ │ │ ├── addresses.py │ │ │ ├── decred.py │ │ │ ├── helpers.py │ │ │ ├── layout.py │ │ │ ├── multisig.py │ │ │ ├── omni.py │ │ │ ├── progress.py │ │ │ ├── scripts.py │ │ │ ├── segwit_bip143.py │ │ │ ├── signing.py │ │ │ ├── tx_weight.py │ │ │ ├── writers.py │ │ │ └── zcash.py │ │ └── verify_message.py │ └── webauthn │ │ ├── __init__.py │ │ ├── knownapps.py │ │ └── res │ │ ├── icon_bitbucket.toif │ │ ├── icon_bitfinex.toif │ │ ├── icon_dashlane.toif │ │ ├── icon_dropbox.toif │ │ ├── icon_duo.toif │ │ ├── icon_fastmail.toif │ │ ├── icon_fedora.toif │ │ ├── icon_gandi.toif │ │ ├── icon_github.toif │ │ ├── icon_gitlab.toif │ │ ├── icon_google.toif │ │ ├── icon_keeper.toif │ │ ├── icon_lastpass.toif │ │ ├── icon_slush_pool.toif │ │ ├── icon_stripe.toif │ │ └── icon_webauthn.toif ├── boot.py ├── main.py ├── protobuf.py ├── trezor │ ├── __init__.py │ ├── crypto │ │ ├── __init__.py │ │ ├── base32.py │ │ ├── base58.py │ │ ├── bech32.py │ │ ├── cashaddr.py │ │ ├── curve.py │ │ ├── der.py │ │ ├── hashlib.py │ │ ├── hmac.py │ │ ├── rlp.py │ │ └── scripts.py │ ├── log.py │ ├── loop.py │ ├── messages │ │ ├── Address.py │ │ ├── ApplyFlags.py │ │ ├── ApplySettings.py │ │ ├── BackupDevice.py │ │ ├── ButtonAck.py │ │ ├── ButtonRequest.py │ │ ├── ButtonRequestType.py │ │ ├── Cancel.py │ │ ├── CardanoAddress.py │ │ ├── CardanoGetAddress.py │ │ ├── CardanoGetPublicKey.py │ │ ├── CardanoPublicKey.py │ │ ├── CardanoSignTx.py │ │ ├── CardanoSignedTx.py │ │ ├── CardanoTxAck.py │ │ ├── CardanoTxInputType.py │ │ ├── CardanoTxOutputType.py │ │ ├── CardanoTxRequest.py │ │ ├── ChangePin.py │ │ ├── CipherKeyValue.py │ │ ├── CipheredKeyValue.py │ │ ├── ClearSession.py │ │ ├── CosiCommit.py │ │ ├── CosiCommitment.py │ │ ├── CosiSign.py │ │ ├── CosiSignature.py │ │ ├── DebugLinkDecision.py │ │ ├── DebugLinkFlashErase.py │ │ ├── DebugLinkGetState.py │ │ ├── DebugLinkLog.py │ │ ├── DebugLinkMemory.py │ │ ├── DebugLinkMemoryRead.py │ │ ├── DebugLinkMemoryWrite.py │ │ ├── DebugLinkState.py │ │ ├── DebugLinkStop.py │ │ ├── DebugMoneroDiagAck.py │ │ ├── DebugMoneroDiagRequest.py │ │ ├── ECDHSessionKey.py │ │ ├── Entropy.py │ │ ├── EntropyAck.py │ │ ├── EntropyRequest.py │ │ ├── EthereumAddress.py │ │ ├── EthereumGetAddress.py │ │ ├── EthereumGetPublicKey.py │ │ ├── EthereumMessageSignature.py │ │ ├── EthereumPublicKey.py │ │ ├── EthereumSignMessage.py │ │ ├── EthereumSignTx.py │ │ ├── EthereumTxAck.py │ │ ├── EthereumTxRequest.py │ │ ├── EthereumVerifyMessage.py │ │ ├── Failure.py │ │ ├── FailureType.py │ │ ├── Features.py │ │ ├── GetAddress.py │ │ ├── GetECDHSessionKey.py │ │ ├── GetEntropy.py │ │ ├── GetFeatures.py │ │ ├── GetPublicKey.py │ │ ├── HDNodePathType.py │ │ ├── HDNodeType.py │ │ ├── IdentityType.py │ │ ├── Initialize.py │ │ ├── InputScriptType.py │ │ ├── LiskAddress.py │ │ ├── LiskDelegateType.py │ │ ├── LiskGetAddress.py │ │ ├── LiskGetPublicKey.py │ │ ├── LiskMessageSignature.py │ │ ├── LiskMultisignatureType.py │ │ ├── LiskPublicKey.py │ │ ├── LiskSignMessage.py │ │ ├── LiskSignTx.py │ │ ├── LiskSignatureType.py │ │ ├── LiskSignedTx.py │ │ ├── LiskTransactionAsset.py │ │ ├── LiskTransactionCommon.py │ │ ├── LiskTransactionType.py │ │ ├── LiskVerifyMessage.py │ │ ├── LoadDevice.py │ │ ├── MessageSignature.py │ │ ├── MessageType.py │ │ ├── MoneroAccountPublicAddress.py │ │ ├── MoneroAddress.py │ │ ├── MoneroExportedKeyImage.py │ │ ├── MoneroGetAddress.py │ │ ├── MoneroGetTxKeyAck.py │ │ ├── MoneroGetTxKeyRequest.py │ │ ├── MoneroGetWatchKey.py │ │ ├── MoneroKeyImageExportInitAck.py │ │ ├── MoneroKeyImageExportInitRequest.py │ │ ├── MoneroKeyImageSyncFinalAck.py │ │ ├── MoneroKeyImageSyncFinalRequest.py │ │ ├── MoneroKeyImageSyncStepAck.py │ │ ├── MoneroKeyImageSyncStepRequest.py │ │ ├── MoneroLiveRefreshFinalAck.py │ │ ├── MoneroLiveRefreshFinalRequest.py │ │ ├── MoneroLiveRefreshStartAck.py │ │ ├── MoneroLiveRefreshStartRequest.py │ │ ├── MoneroLiveRefreshStepAck.py │ │ ├── MoneroLiveRefreshStepRequest.py │ │ ├── MoneroMultisigKLRki.py │ │ ├── MoneroOutputEntry.py │ │ ├── MoneroRctKeyPublic.py │ │ ├── MoneroRingCtSig.py │ │ ├── MoneroSubAddressIndicesList.py │ │ ├── MoneroTransactionAllInputsSetAck.py │ │ ├── MoneroTransactionAllInputsSetRequest.py │ │ ├── MoneroTransactionAllOutSetAck.py │ │ ├── MoneroTransactionAllOutSetRequest.py │ │ ├── MoneroTransactionData.py │ │ ├── MoneroTransactionDestinationEntry.py │ │ ├── MoneroTransactionFinalAck.py │ │ ├── MoneroTransactionFinalRequest.py │ │ ├── MoneroTransactionInitAck.py │ │ ├── MoneroTransactionInitRequest.py │ │ ├── MoneroTransactionInputViniAck.py │ │ ├── MoneroTransactionInputViniRequest.py │ │ ├── MoneroTransactionInputsPermutationAck.py │ │ ├── MoneroTransactionInputsPermutationRequest.py │ │ ├── MoneroTransactionRsigData.py │ │ ├── MoneroTransactionSetInputAck.py │ │ ├── MoneroTransactionSetInputRequest.py │ │ ├── MoneroTransactionSetOutputAck.py │ │ ├── MoneroTransactionSetOutputRequest.py │ │ ├── MoneroTransactionSignInputAck.py │ │ ├── MoneroTransactionSignInputRequest.py │ │ ├── MoneroTransactionSourceEntry.py │ │ ├── MoneroTransferDetails.py │ │ ├── MoneroWatchKey.py │ │ ├── MultisigRedeemScriptType.py │ │ ├── NEMAddress.py │ │ ├── NEMAggregateModification.py │ │ ├── NEMCosignatoryModification.py │ │ ├── NEMDecryptMessage.py │ │ ├── NEMDecryptedMessage.py │ │ ├── NEMGetAddress.py │ │ ├── NEMImportanceTransfer.py │ │ ├── NEMImportanceTransferMode.py │ │ ├── NEMModificationType.py │ │ ├── NEMMosaic.py │ │ ├── NEMMosaicCreation.py │ │ ├── NEMMosaicDefinition.py │ │ ├── NEMMosaicLevy.py │ │ ├── NEMMosaicSupplyChange.py │ │ ├── NEMProvisionNamespace.py │ │ ├── NEMSignTx.py │ │ ├── NEMSignedTx.py │ │ ├── NEMSupplyChangeType.py │ │ ├── NEMTransactionCommon.py │ │ ├── NEMTransfer.py │ │ ├── OutputScriptType.py │ │ ├── PassphraseAck.py │ │ ├── PassphraseRequest.py │ │ ├── PassphraseSourceType.py │ │ ├── PassphraseStateAck.py │ │ ├── PassphraseStateRequest.py │ │ ├── PinMatrixAck.py │ │ ├── PinMatrixRequest.py │ │ ├── PinMatrixRequestType.py │ │ ├── Ping.py │ │ ├── PublicKey.py │ │ ├── RecoveryDevice.py │ │ ├── RecoveryDeviceType.py │ │ ├── RequestType.py │ │ ├── ResetDevice.py │ │ ├── RippleAddress.py │ │ ├── RippleGetAddress.py │ │ ├── RipplePayment.py │ │ ├── RippleSignTx.py │ │ ├── RippleSignedTx.py │ │ ├── SetU2FCounter.py │ │ ├── SignIdentity.py │ │ ├── SignMessage.py │ │ ├── SignTx.py │ │ ├── SignedIdentity.py │ │ ├── StellarAccountMergeOp.py │ │ ├── StellarAddress.py │ │ ├── StellarAllowTrustOp.py │ │ ├── StellarAssetType.py │ │ ├── StellarBumpSequenceOp.py │ │ ├── StellarChangeTrustOp.py │ │ ├── StellarCreateAccountOp.py │ │ ├── StellarCreatePassiveOfferOp.py │ │ ├── StellarGetAddress.py │ │ ├── StellarManageDataOp.py │ │ ├── StellarManageOfferOp.py │ │ ├── StellarPathPaymentOp.py │ │ ├── StellarPaymentOp.py │ │ ├── StellarSetOptionsOp.py │ │ ├── StellarSignTx.py │ │ ├── StellarSignedTx.py │ │ ├── StellarTxOpRequest.py │ │ ├── Success.py │ │ ├── TezosAddress.py │ │ ├── TezosContractID.py │ │ ├── TezosContractType.py │ │ ├── TezosDelegationOp.py │ │ ├── TezosGetAddress.py │ │ ├── TezosGetPublicKey.py │ │ ├── TezosOriginationOp.py │ │ ├── TezosPublicKey.py │ │ ├── TezosRevealOp.py │ │ ├── TezosSignTx.py │ │ ├── TezosSignedTx.py │ │ ├── TezosTransactionOp.py │ │ ├── TransactionType.py │ │ ├── TxAck.py │ │ ├── TxInputType.py │ │ ├── TxOutputBinType.py │ │ ├── TxOutputType.py │ │ ├── TxRequest.py │ │ ├── TxRequestDetailsType.py │ │ ├── TxRequestSerializedType.py │ │ ├── VerifyMessage.py │ │ ├── WipeDevice.py │ │ ├── WordAck.py │ │ ├── WordRequest.py │ │ ├── WordRequestType.py │ │ └── __init__.py │ ├── pin.py │ ├── res │ │ ├── .gitignore │ │ ├── __init__.py │ │ ├── cancel.toig │ │ ├── check.toig │ │ ├── click.toig │ │ ├── confirm.toig │ │ ├── header_icons │ │ │ ├── cog.toig │ │ │ ├── nocopy.toig │ │ │ ├── receive.toig │ │ │ ├── recovery.toig │ │ │ ├── reset.toig │ │ │ ├── send.toig │ │ │ ├── wipe.toig │ │ │ └── wrong.toig │ │ ├── left.toig │ │ ├── lock.toig │ │ ├── pin_close.toig │ │ ├── recovery.toig │ │ ├── space.toig │ │ └── swipe.toig │ ├── ui │ │ ├── __init__.py │ │ ├── button.py │ │ ├── confirm.py │ │ ├── container.py │ │ ├── entry_select.py │ │ ├── loader.py │ │ ├── mnemonic.py │ │ ├── num_pad.py │ │ ├── passphrase.py │ │ ├── pin.py │ │ ├── qr.py │ │ ├── scroll.py │ │ ├── style.py │ │ ├── swipe.py │ │ ├── text.py │ │ └── word_select.py │ ├── utils.py │ ├── wire │ │ ├── __init__.py │ │ ├── codec_v1.py │ │ └── errors.py │ └── workflow.py └── usb.py ├── src1 ├── main.py └── usb.py ├── src_game ├── game_2048.py ├── main.py └── trezor ├── tests ├── check_coverage.sh ├── common.py ├── production_tests │ └── main.py ├── run_tests.sh ├── run_tests_device_emu.sh ├── run_tests_device_emu_monero.sh ├── test_apps.cardano.address.py ├── test_apps.cardano.cbor.py ├── test_apps.cardano.get_public_key.py ├── test_apps.common.coins.py ├── test_apps.common.paths.py ├── test_apps.common.seed.py ├── test_apps.common.storage.py ├── test_apps.ethereum.address.py ├── test_apps.ethereum.layout.py ├── test_apps.ethereum.tokens.py ├── test_apps.lisk.address.py ├── test_apps.monero.address.py ├── test_apps.monero.bulletproof.py ├── test_apps.monero.crypto.py ├── test_apps.monero.serializer.py ├── test_apps.nem.address.py ├── test_apps.nem.hdnode.py ├── test_apps.nem.mosaic.py ├── test_apps.nem.mosaic_creation.py ├── test_apps.nem.mosaic_supply_change.py ├── test_apps.nem.multisig.aggregate_modification.py ├── test_apps.nem.multisig.py ├── test_apps.nem.namespace.py ├── test_apps.nem.transfer.py ├── test_apps.ripple.address.py ├── test_apps.ripple.serializer.py ├── test_apps.stellar.address.py ├── test_apps.tezos.address.py ├── test_apps.tezos.encode.py ├── test_apps.wallet.address.py ├── test_apps.wallet.address_grs.py ├── test_apps.wallet.segwit.bip143.native_p2wpkh.py ├── test_apps.wallet.segwit.bip143.p2wpkh_in_p2sh.py ├── test_apps.wallet.segwit.signtx.native_p2wpkh.py ├── test_apps.wallet.segwit.signtx.native_p2wpkh_grs.py ├── test_apps.wallet.segwit.signtx.p2wpkh_in_p2sh.py ├── test_apps.wallet.segwit.signtx.p2wpkh_in_p2sh_grs.py ├── test_apps.wallet.signtx.fee_threshold.py ├── test_apps.wallet.signtx.omni.py ├── test_apps.wallet.signtx.py ├── test_apps.wallet.signtx.scripts.py ├── test_apps.wallet.signtx_grs.py ├── test_apps.wallet.txweight.py ├── test_apps.wallet.zcash.zip143.py ├── test_apps.wallet.zcash.zip243.py ├── test_trezor.config.py ├── test_trezor.crypto.aes.py ├── test_trezor.crypto.base32.py ├── test_trezor.crypto.base58.py ├── test_trezor.crypto.bech32.py ├── test_trezor.crypto.bip32.py ├── test_trezor.crypto.bip39.py ├── test_trezor.crypto.cashaddr.py ├── test_trezor.crypto.chacha20poly1305.py ├── test_trezor.crypto.crc.py ├── test_trezor.crypto.curve.curve25519.py ├── test_trezor.crypto.curve.ed25519.py ├── test_trezor.crypto.curve.ed25519_cosi.py ├── test_trezor.crypto.curve.nist256p1.py ├── test_trezor.crypto.curve.secp256k1.py ├── test_trezor.crypto.der.py ├── test_trezor.crypto.hashlib.blake256.py ├── test_trezor.crypto.hashlib.blake2b.py ├── test_trezor.crypto.hashlib.blake2s.py ├── test_trezor.crypto.hashlib.groestl512.py ├── test_trezor.crypto.hashlib.ripemd160.py ├── test_trezor.crypto.hashlib.sha1.py ├── test_trezor.crypto.hashlib.sha256.py ├── test_trezor.crypto.hashlib.sha3_256.py ├── test_trezor.crypto.hashlib.sha3_512.py ├── test_trezor.crypto.hashlib.sha512.py ├── test_trezor.crypto.hmac.py ├── test_trezor.crypto.pbkdf2.py ├── test_trezor.crypto.random.py ├── test_trezor.crypto.rfc6979.py ├── test_trezor.crypto.rlp.py ├── test_trezor.io.py ├── test_trezor.ui.display.py ├── test_trezor.utils.py ├── test_trezor.wire.codec_v1.py ├── unittest.py └── utest.py ├── tools ├── binctl ├── build_mocks ├── build_protobuf ├── build_templates ├── build_vendorheader ├── clang-format-check ├── codegen │ ├── gen_cert_bundle.py │ ├── gen_font.py │ ├── gen_keys.py │ ├── gen_loader.py │ └── get_trezor_keys.py ├── combine_firmware ├── hid-bridge │ ├── 50-hid-bridge.rules │ ├── README.md │ ├── hid-bridge │ ├── hid_interface.py │ ├── logger.py │ ├── udp_interface.py │ └── uhid.py ├── keyctl ├── keyctl-coordinator ├── keyctl-proxy ├── png2toi ├── res_collect └── toi2png ├── travis-install-libsodium.sh └── vendor └── flamegraph ├── flamegraph.pl └── stackcollapse-perf.pl /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | _attic/ 2 | build 3 | build-docker 4 | docs 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .cache/ 2 | *.pyc 3 | .sconsign.dblite 4 | .vscode/ 5 | .mypy_cache/ 6 | __pycache__/ 7 | _attic/ 8 | build/ 9 | build-docker/ 10 | emu.config 11 | compile_commands.json 12 | tests/trezor_monero_tests{,.log} 13 | -------------------------------------------------------------------------------- /.gitlab-ci.yml: -------------------------------------------------------------------------------- 1 | image: docker:latest 2 | 3 | services: 4 | - docker:dind 5 | 6 | build and push emulator image: 7 | when: manual 8 | before_script: 9 | - docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD 10 | script: 11 | - docker build -t ${CI_REGISTRY_IMAGE}/trezor-emulator:latest -f ./docker/emulator/Dockerfile . 12 | - docker push ${CI_REGISTRY_IMAGE}/trezor-emulator:latest 13 | 14 | build master: 15 | stage: build 16 | script: 17 | - ./build-docker.sh HEAD local 18 | only: 19 | - master 20 | artifacts: 21 | expire_in: 1 week 22 | paths: 23 | - build-docker/boardloader/boardloader.bin 24 | - build-docker/bootloader/bootloader.bin 25 | - build-docker/firmware/firmware.bin 26 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "vendor/trezor-crypto"] 2 | path = vendor/trezor-crypto 3 | url = https://github.com/trezor/trezor-crypto.git 4 | [submodule "vendor/micropython"] 5 | path = vendor/micropython 6 | url = https://github.com/trezor/micropython.git 7 | [submodule "vendor/trezor-common"] 8 | path = vendor/trezor-common 9 | url = https://github.com/trezor/trezor-common.git 10 | [submodule "vendor/nanopb"] 11 | path = vendor/nanopb 12 | url = https://github.com/nanopb/nanopb.git 13 | [submodule "vendor/trezor-storage"] 14 | path = vendor/trezor-storage 15 | url = https://github.com/trezor/trezor-storage.git 16 | [submodule "vendor/QR-Code-generator"] 17 | path = vendor/QR-Code-generator 18 | url = https://github.com/nayuki/QR-Code-generator.git 19 | [submodule "vendor/secp256k1-zkp"] 20 | path = vendor/secp256k1-zkp 21 | url = https://github.com/ElementsProject/secp256k1-zkp.git 22 | branch = secp256k1-zkp 23 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | init-hook='sys.path.append("mocks"); 3 | 4 | [MESSAGES CONTROL] 5 | disable=C0111,C0103,C0413,W0603,W0703 -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Developers: 2 | 3 | Pavol Rusnak 4 | Jan Pochyla 5 | Marek Palatinus 6 | Peter Jensen 7 | Tomas Susanka 8 | Karel Bilek 9 | 10 | Contributors: 11 | 12 | mcudev 13 | Jochen Hoenicke 14 | Saleem Rashid 15 | Arthur Gautier 16 | -------------------------------------------------------------------------------- /Pipfile: -------------------------------------------------------------------------------- 1 | [[source]] 2 | url = "https://pypi.org/simple" 3 | name = "pypi" 4 | verify_ssl = true 5 | 6 | [packages] 7 | trezor = {git = "https://github.com/trezor/python-trezor", editable = true, ref = "master"} 8 | protobuf = "==3.4.0" 9 | 10 | # python-trezor tests 11 | pytest = "*" 12 | mock = "*" 13 | 14 | # make style 15 | isort = "*" 16 | flake8 = "*" 17 | black = "*" 18 | 19 | # trezor-common cointool 20 | click = ">=6" 21 | "ed25519" = ">=1.4" 22 | requests = ">=2.19" 23 | munch = ">=2.3.2" 24 | termcolor = ">=0.1.2" 25 | Pillow = ">=5.2.0" 26 | Mako = ">=1.0.7" 27 | 28 | # monero 29 | monero_agent = {version = ">=2.0.1", extras = ["tcry", "dev"]} 30 | py_trezor_crypto_ph4 = {version = ">=0.1.1"} 31 | 32 | [dev-packages] 33 | scan-build = "*" 34 | 35 | [pipenv] 36 | allow_prereleases = true 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Deprecated 2 | 3 | We've moved to monorepo [trezor-firmware](https://github.com/trezor/trezor-firmware). Please file all issues and Pull Requests there. 4 | 5 | ---- 6 | 7 | # TREZOR Core 8 | 9 | ![TREZOR Logo](docs/logo.png) 10 | 11 | [![Build Status](https://travis-ci.org/trezor/trezor-core.svg?branch=master)](https://travis-ci.org/trezor/trezor-core) 12 | [![Gitter](https://badges.gitter.im/trezor/community.svg)](https://gitter.im/trezor/community) 13 | 14 | This is the source code for 2nd generation of TREZOR called TREZOR model T. 15 | 16 | It runs both inside of the device and also in the TREZOR Emulator. 17 | 18 | ![emulator](docs/emulator.jpg) 19 | 20 | ## Documentation 21 | 22 | * [API](docs/api.md) 23 | * [Build instructions](docs/build.md) 24 | * [Emulator](docs/emulator.md) 25 | * [Testing](docs/testing.md) 26 | * [Bootloader](docs/bootloader.md) 27 | * [Hardware](docs/hardware.md) 28 | * [Memory Layout](docs/memory.md) 29 | * [TOIF Image Format](docs/toif.md) 30 | -------------------------------------------------------------------------------- /SConstruct: -------------------------------------------------------------------------------- 1 | # pylint: disable=E0602 2 | 3 | SConscript('SConscript.boardloader', variant_dir='build/boardloader', duplicate=False) 4 | SConscript('SConscript.bootloader', variant_dir='build/bootloader', duplicate=False) 5 | SConscript('SConscript.reflash', variant_dir='build/reflash', duplicate=False) 6 | SConscript('SConscript.prodtest', variant_dir='build/prodtest', duplicate=False) 7 | SConscript('SConscript.firmware', variant_dir='build/firmware', duplicate=False) 8 | SConscript('SConscript.unix', variant_dir='build/unix', duplicate=False) 9 | -------------------------------------------------------------------------------- /assets/5390-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/5390-200.png -------------------------------------------------------------------------------- /assets/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/background.png -------------------------------------------------------------------------------- /assets/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/bg.png -------------------------------------------------------------------------------- /assets/cancel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/cancel.png -------------------------------------------------------------------------------- /assets/check.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/check.png -------------------------------------------------------------------------------- /assets/click-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/click-icon.png -------------------------------------------------------------------------------- /assets/cog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/cog.png -------------------------------------------------------------------------------- /assets/confirm.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/confirm.png -------------------------------------------------------------------------------- /assets/dontcopy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/dontcopy.png -------------------------------------------------------------------------------- /assets/icon_tools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/icon_tools.png -------------------------------------------------------------------------------- /assets/icon_update.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/icon_update.png -------------------------------------------------------------------------------- /assets/icon_wipe.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/icon_wipe.png -------------------------------------------------------------------------------- /assets/left.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/left.png -------------------------------------------------------------------------------- /assets/lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/lock.png -------------------------------------------------------------------------------- /assets/receive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/receive.png -------------------------------------------------------------------------------- /assets/recovery-old.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/recovery-old.png -------------------------------------------------------------------------------- /assets/recovery.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/recovery.png -------------------------------------------------------------------------------- /assets/send.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/send.png -------------------------------------------------------------------------------- /assets/small-arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/small-arrow.png -------------------------------------------------------------------------------- /assets/space.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/space.png -------------------------------------------------------------------------------- /assets/swipedown.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/swipedown.png -------------------------------------------------------------------------------- /assets/trezor_lock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/trezor_lock.png -------------------------------------------------------------------------------- /assets/trezor_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/trezor_logo.png -------------------------------------------------------------------------------- /assets/wrong.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/assets/wrong.png -------------------------------------------------------------------------------- /build-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | if [ "$1" = "--gcc_source" ]; then 5 | TOOLCHAIN_FLAVOR=src 6 | shift 7 | else 8 | TOOLCHAIN_FLAVOR=linux 9 | fi 10 | 11 | IMAGE=trezor-core-build.$TOOLCHAIN_FLAVOR 12 | TAG=${1:-master} 13 | REPOSITORY=${2:-trezor} 14 | PRODUCTION=${PRODUCTION:-0} 15 | 16 | if [ "$REPOSITORY" = "local" ]; then 17 | REPOSITORY=file:///local/ 18 | else 19 | REPOSITORY=https://github.com/$REPOSITORY/trezor-core.git 20 | fi 21 | 22 | docker build -t $IMAGE --build-arg TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR . 23 | 24 | mkdir -p $(pwd)/build-docker 25 | docker run -t -v $(pwd):/local -v $(pwd)/build-docker:/build:z --user="$(stat -c "%u:%g" .)" $IMAGE /bin/sh -c "\ 26 | cd /tmp && \ 27 | git clone $REPOSITORY trezor-core && \ 28 | cd trezor-core && \ 29 | ln -s /build build && 30 | git checkout $TAG && \ 31 | git submodule update --init --recursive && \ 32 | PRODUCTION=$PRODUCTION make clean vendor build_boardloader build_bootloader build_firmware" 33 | -------------------------------------------------------------------------------- /docker/emulator/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7.1-stretch 2 | 3 | WORKDIR /trezor-emulator 4 | 5 | COPY ./ /trezor-emulator 6 | RUN make vendor 7 | 8 | RUN apt-get update 9 | RUN apt-get install libusb-1.0-0 10 | 11 | RUN pip3 install scons trezor 12 | RUN make build_unix_noui 13 | 14 | ENTRYPOINT ["emulator/run.sh"] 15 | EXPOSE 21324/udp 21325 16 | -------------------------------------------------------------------------------- /docker/emulator/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | cd "$(dirname "$0")" 3 | cd .. 4 | 5 | export TREZOR_UDP_IP=0.0.0.0 6 | 7 | source emu.sh 8 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contribute to Trezor Core 2 | 3 | Please read the general instructions you can find on our [wiki](https://wiki.trezor.io/Developers_guide:Contributing). 4 | 5 | In this repository your Pull request should follow these criteria: 6 | 7 | - The code is properly tested. 8 | - Tests must pass on [CI](https://travis-ci.org/trezor/trezor-core). 9 | - The code is properly formatted. The make command `make style_check` checks if it is so and you can use `make style` to make it happen. 10 | - Commits must have concise commit messages, the imperative mood is preferred ([rationale](https://gist.github.com/robertpainsi/b632364184e70900af4ab688decf6f53)). 11 | - Multiple commits per PR are allowed, but please do not use reverts etc. - use interactive rebase. 12 | Do not use merge (e.g. merge trezor/master into...). Again, use rebase. 13 | -------------------------------------------------------------------------------- /docs/api.md: -------------------------------------------------------------------------------- 1 | # TREZOR Core API 2 | 3 | Syntax used below is a valid Python function declaration with type hints 4 | defined in [PEP 0484](https://www.python.org/dev/peps/pep-0484/). 5 | -------------------------------------------------------------------------------- /docs/emulator.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/emulator.jpg -------------------------------------------------------------------------------- /docs/emulator.md: -------------------------------------------------------------------------------- 1 | # Emulator 2 | 3 | ![emulator](emulator.jpg) 4 | 5 | 1. [build](build.md) the emulator 6 | 2. run `emu.sh` 7 | 3. to use [bridge](https://github.com/trezor/trezord-go) with the emulator support, start it with `trezord -e 21324` 8 | 9 | ## Profiles 10 | 11 | To run emulator with different flash and sdcard files set the environment 12 | variable **TREZOR_PROFILE** like so: 13 | 14 | ```sh 15 | TREZOR_PROFILE=foobar ./emu.sh 16 | ``` 17 | 18 | This will create a profile directory in your home ``` ~/.trezoremu/foobar``` 19 | containing emulator run files. 20 | 21 | Alternatively you can set a full path like so: 22 | 23 | ```sh 24 | TREZOR_PROFILE=/var/tmp/foobar ./emu.sh 25 | ``` 26 | 27 | When the **TREZOR_PROFILE** is not set the default is ```/var/tmp``` . 28 | -------------------------------------------------------------------------------- /docs/git/hooks/pre-push: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Runs a simple check before pushing. In particular, this checks 4 | # if templates were regenerated and style is correct. 5 | # Put this file to `.git/hooks/`. 6 | 7 | echo "Running pre-push git hook." 8 | 9 | # Runs check for common simple errors before pushing 10 | if ! make templates_check &> /dev/null 11 | then 12 | echo >&2 "Templates not updated, run 'make templates'. Not pushing." 13 | exit 1 14 | fi 15 | 16 | if ! make style_check &> /dev/null 17 | then 18 | echo >&2 "Style invalid, run style make commands. Not pushing." 19 | exit 2 20 | fi 21 | 22 | echo "pre-push hook passed. Pushing." 23 | -------------------------------------------------------------------------------- /docs/hardware/clock-tree.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/clock-tree.png -------------------------------------------------------------------------------- /docs/hardware/dev-board-bottom-before.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/dev-board-bottom-before.jpg -------------------------------------------------------------------------------- /docs/hardware/dev-board-top-before.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/dev-board-top-before.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-bottom-v10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-bottom-v10.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-bottom-v12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-bottom-v12.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-display-module-bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-display-module-bottom.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-display-module-disassembled-bottom.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-display-module-disassembled-bottom.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-display-module-disassembled-top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-display-module-disassembled-top.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-display-module-top.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-display-module-top.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-top-v10.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-top-v10.jpg -------------------------------------------------------------------------------- /docs/hardware/model-t-top-v12.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/model-t-top-v12.jpg -------------------------------------------------------------------------------- /docs/hardware/photo-front.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/photo-front.jpg -------------------------------------------------------------------------------- /docs/hardware/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/hardware/schematic.png -------------------------------------------------------------------------------- /docs/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/docs/logo.png -------------------------------------------------------------------------------- /embed/boardloader/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_MAJOR 2 2 | #define VERSION_MINOR 0 3 | #define VERSION_PATCH 2 4 | #define VERSION_BUILD 0 5 | -------------------------------------------------------------------------------- /embed/bootloader/icon_cancel.h: -------------------------------------------------------------------------------- 1 | // clang-format off 2 | static const uint8_t toi_icon_cancel[] = { 3 | // magic 4 | 'T', 'O', 'I', 'g', 5 | // width (16-bit), height (16-bit) 6 | 0x10, 0x00, 0x10, 0x00, 7 | // compressed data length (32-bit) 8 | 0x52, 0x00, 0x00, 0x00, 9 | // compressed data 10 | 0x45, 0x4d, 0xc1, 0x09, 0x80, 0x30, 0x10, 0x4b, 0xeb, 0x02, 0x5d, 0x40, 0xb8, 0x01, 0x2c, 0xb8, 0xff, 0x47, 0x70, 0x81, 0xa2, 0x0b, 0x74, 0x10, 0x7b, 0xc4, 0x48, 0x5b, 0x0c, 0x1c, 0x09, 0xe1, 0x92, 0x60, 0x4b, 0x40, 0x38, 0x11, 0xeb, 0x0d, 0x64, 0xb7, 0x4c, 0xb7, 0x58, 0x79, 0x1f, 0xe4, 0xb5, 0x92, 0x8f, 0xce, 0xab, 0x74, 0x2c, 0x14, 0x9a, 0x21, 0x7f, 0xac, 0xdf, 0x20, 0xd7, 0xd3, 0xcf, 0xc3, 0x57, 0x56, 0x70, 0x9b, 0xb9, 0xd2, 0x7b, 0xda, 0xec, 0x5d, 0xfa, 0xce, 0x8e, 0xb1, 0xfb, 0x02, 11 | }; 12 | -------------------------------------------------------------------------------- /embed/bootloader/icon_confirm.h: -------------------------------------------------------------------------------- 1 | // clang-format off 2 | static const uint8_t toi_icon_confirm[] = { 3 | // magic 4 | 'T', 'O', 'I', 'g', 5 | // width (16-bit), height (16-bit) 6 | 0x14, 0x00, 0x10, 0x00, 7 | // compressed data length (32-bit) 8 | 0x69, 0x00, 0x00, 0x00, 9 | // compressed data 10 | 0x63, 0x60, 0x80, 0x80, 0xa9, 0x50, 0x9a, 0x81, 0xf3, 0x7f, 0x00, 0x94, 0xd5, 0xff, 0xff, 0x2b, 0x84, 0xc1, 0xf1, 0xff, 0xff, 0x2f, 0x08, 0xab, 0xfe, 0xff, 0xff, 0x0d, 0x60, 0x06, 0xfb, 0xff, 0xff, 0xbf, 0x19, 0x18, 0x58, 0x26, 0x30, 0x30, 0xe4, 0x83, 0x85, 0xfc, 0x7f, 0x32, 0xb0, 0x01, 0x85, 0x04, 0x18, 0x58, 0xfe, 0xff, 0x6f, 0xcc, 0xfb, 0xff, 0x7f, 0x23, 0x03, 0x03, 0x17, 0x90, 0xff, 0x1e, 0x24, 0xc4, 0xc0, 0xb8, 0xff, 0x3f, 0x10, 0x6c, 0x02, 0xe9, 0x93, 0x06, 0x32, 0x7e, 0x2b, 0x80, 0x58, 0x20, 0xc1, 0x43, 0x10, 0x53, 0xb5, 0xff, 0xff, 0x31, 0x80, 0xb0, 0x98, 0xf6, 0x1f, 0x86, 0xb9, 0xc3, 0xca, 0x01, 0x4c, 0x01, 0x00, 11 | }; 12 | -------------------------------------------------------------------------------- /embed/bootloader/nanopb: -------------------------------------------------------------------------------- 1 | ../../vendor/nanopb -------------------------------------------------------------------------------- /embed/bootloader/protob/.gitignore: -------------------------------------------------------------------------------- 1 | *.pb 2 | -------------------------------------------------------------------------------- /embed/bootloader/protob/Makefile: -------------------------------------------------------------------------------- 1 | all: messages.pb.c types.pb.c 2 | 3 | %.pb.c: %.pb %.options 4 | ../../../vendor/nanopb/generator/nanopb_generator.py $< -T 5 | 6 | %.pb: %.proto 7 | protoc -I/usr/include -I. $< -o $@ 8 | 9 | clean: 10 | rm -f *.pb *.o *.pb.c *.pb.h 11 | -------------------------------------------------------------------------------- /embed/bootloader/protob/messages.options: -------------------------------------------------------------------------------- 1 | Features.vendor max_size:33 2 | Features.device_id max_size:25 3 | Features.language max_size:17 4 | Features.label max_size:33 5 | Features.revision max_size:20 6 | Features.bootloader_hash max_size:32 7 | Features.model max_size:17 8 | Features.fw_vendor max_size:256 9 | Features.fw_vendor_keys max_size:32 10 | 11 | Ping.message max_size:256 12 | 13 | Success.message max_size:256 14 | 15 | Failure.message max_size:256 16 | 17 | ButtonRequest.data max_size:256 18 | 19 | FirmwareUpload.hash max_size:32 20 | -------------------------------------------------------------------------------- /embed/bootloader/protob/types.options: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/bootloader/protob/types.options -------------------------------------------------------------------------------- /embed/bootloader/protob/types.pb.c: -------------------------------------------------------------------------------- 1 | /* Automatically generated nanopb constant definitions */ 2 | /* Generated by nanopb-0.4.0-dev */ 3 | 4 | #include "types.pb.h" 5 | 6 | /* @@protoc_insertion_point(includes) */ 7 | #if PB_PROTO_HEADER_VERSION != 30 8 | #error Regenerate this file with the current version of nanopb generator. 9 | #endif 10 | 11 | 12 | 13 | 14 | 15 | 16 | /* @@protoc_insertion_point(eof) */ 17 | -------------------------------------------------------------------------------- /embed/bootloader/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_MAJOR 2 2 | #define VERSION_MINOR 0 3 | #define VERSION_PATCH 3 4 | #define VERSION_BUILD 0 5 | #define VERSION_UINT32 \ 6 | (VERSION_MAJOR | (VERSION_MINOR << 8) | (VERSION_PATCH << 16) | \ 7 | (VERSION_BUILD << 24)) 8 | 9 | #define FIX_VERSION_MAJOR 2 10 | #define FIX_VERSION_MINOR 0 11 | #define FIX_VERSION_PATCH 0 12 | #define FIX_VERSION_BUILD 0 13 | 14 | #define VERSION_MONOTONIC 1 15 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorcrypto/rand.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the TREZOR project, https://trezor.io/ 3 | * 4 | * Copyright (c) SatoshiLabs 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "rand.h" 21 | #include "rng.h" 22 | 23 | uint32_t random32(void) { return rng_get(); } 24 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/font_bitmap.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern const uint8_t* const Font_Bitmap; 4 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/font_roboto_bold_20.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern const uint8_t* const Font_Roboto_Bold_20[126 + 1 - 32]; 4 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/font_roboto_regular_20.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern const uint8_t* const Font_Roboto_Regular_20[126 + 1 - 32]; 4 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/font_robotomono_bold_20.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern const uint8_t* const Font_RobotoMono_Bold_20[126 + 1 - 32]; 4 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/font_robotomono_regular_20.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern const uint8_t* const Font_RobotoMono_Regular_20[126 + 1 - 32]; 4 | -------------------------------------------------------------------------------- /embed/extmod/modtrezorui/qr-code-generator: -------------------------------------------------------------------------------- 1 | ../../../vendor/QR-Code-generator/c -------------------------------------------------------------------------------- /embed/firmware/bl_check.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the TREZOR project, https://trezor.io/ 3 | * 4 | * Copyright (c) SatoshiLabs 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __BL_CHECK_H__ 21 | #define __BL_CHECK_H__ 22 | 23 | void check_and_replace_bootloader(void); 24 | 25 | #endif 26 | -------------------------------------------------------------------------------- /embed/firmware/bootloader.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/firmware/bootloader.bin -------------------------------------------------------------------------------- /embed/firmware/bootloader_hashes.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import glob 3 | import pyblake2 4 | 5 | ALIGNED_SIZE = 128 * 1024 6 | 7 | files = glob.glob("bootloader*.bin") 8 | 9 | for fn in sorted(files): 10 | data = open(fn, "rb").read() 11 | if len(data) > ALIGNED_SIZE: 12 | raise ValueError(fn, "too big") 13 | data_00 = data + b"\x00" * (ALIGNED_SIZE - len(data)) 14 | data_ff = data + b"\xff" * (ALIGNED_SIZE - len(data)) 15 | h_00 = pyblake2.blake2s(data=data_00).digest() 16 | h_ff = pyblake2.blake2s(data=data_ff).digest() 17 | h_00 = "".join(["\\x%02x" % i for i in h_00]) 18 | h_ff = "".join(["\\x%02x" % i for i in h_ff]) 19 | print(" // %s (padded with 0x00)\n if (0 == memcmp(hash, \"%s\", 32)) return sectrue;" % (fn, h_00)) 20 | print(" // %s (padded with 0xff)\n if (0 == memcmp(hash, \"%s\", 32)) return sectrue;" % (fn, h_ff)) 21 | -------------------------------------------------------------------------------- /embed/firmware/mphalport.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the TREZOR project, https://trezor.io/ 3 | * 4 | * Copyright (c) SatoshiLabs 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "lib/utils/interrupt_char.h" 21 | 22 | static inline mp_uint_t mp_hal_ticks_cpu(void) { return 0; } 23 | 24 | void mp_hal_set_vcp_iface(int iface_num); 25 | -------------------------------------------------------------------------------- /embed/firmware/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_MAJOR 2 2 | #define VERSION_MINOR 1 3 | #define VERSION_PATCH 0 4 | #define VERSION_BUILD 0 5 | 6 | #define FIX_VERSION_MAJOR 2 7 | #define FIX_VERSION_MINOR 1 8 | #define FIX_VERSION_PATCH 0 9 | #define FIX_VERSION_BUILD 0 10 | -------------------------------------------------------------------------------- /embed/prodtest/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_MAJOR 0 2 | #define VERSION_MINOR 1 3 | #define VERSION_PATCH 0 4 | #define VERSION_BUILD 0 5 | 6 | #define FIX_VERSION_MAJOR 0 7 | #define FIX_VERSION_MINOR 1 8 | #define FIX_VERSION_PATCH 0 9 | #define FIX_VERSION_BUILD 0 10 | -------------------------------------------------------------------------------- /embed/reflash/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_MAJOR 0 2 | #define VERSION_MINOR 1 3 | #define VERSION_PATCH 0 4 | #define VERSION_BUILD 0 5 | 6 | #define FIX_VERSION_MAJOR 0 7 | #define FIX_VERSION_MINOR 1 8 | #define FIX_VERSION_PATCH 0 9 | #define FIX_VERSION_BUILD 0 10 | -------------------------------------------------------------------------------- /embed/trezorhal/mpu.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the TREZOR project, https://trezor.io/ 3 | * 4 | * Copyright (c) SatoshiLabs 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #ifndef __MPU_H__ 21 | #define __MPU_H__ 22 | 23 | void mpu_config_off(void); 24 | void mpu_config_bootloader(void); 25 | void mpu_config_firmware(void); 26 | 27 | #endif 28 | -------------------------------------------------------------------------------- /embed/unix/background_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/unix/background_1.jpg -------------------------------------------------------------------------------- /embed/unix/background_T.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/unix/background_T.jpg -------------------------------------------------------------------------------- /embed/unix/background_raspi.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/unix/background_raspi.jpg -------------------------------------------------------------------------------- /embed/unix/flash.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/flash.h -------------------------------------------------------------------------------- /embed/unix/rng.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/rng.h -------------------------------------------------------------------------------- /embed/unix/sbu.c: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the TREZOR project, https://trezor.io/ 3 | * 4 | * Copyright (c) SatoshiLabs 5 | * 6 | * This program is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * This program is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with this program. If not, see . 18 | */ 19 | 20 | #include "sbu.h" 21 | 22 | void sbu_init(void) {} 23 | 24 | void sbu_set(secbool sbu1, secbool sbu2) {} 25 | -------------------------------------------------------------------------------- /embed/unix/sbu.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/sbu.h -------------------------------------------------------------------------------- /embed/unix/sdcard.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/sdcard.h -------------------------------------------------------------------------------- /embed/unix/secbool.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/secbool.h -------------------------------------------------------------------------------- /embed/unix/touch.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/touch.h -------------------------------------------------------------------------------- /embed/unix/usb.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/usb.h -------------------------------------------------------------------------------- /embed/unix/usb_hid-defs.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/usb_hid-defs.h -------------------------------------------------------------------------------- /embed/unix/usb_vcp-defs.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/usb_vcp-defs.h -------------------------------------------------------------------------------- /embed/unix/usb_webusb-defs.h: -------------------------------------------------------------------------------- 1 | ../trezorhal/usb_webusb-defs.h -------------------------------------------------------------------------------- /embed/unix/version.h: -------------------------------------------------------------------------------- 1 | ../firmware/version.h -------------------------------------------------------------------------------- /embed/vendorheader/vendor_satoshilabs.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendor_satoshilabs.toif -------------------------------------------------------------------------------- /embed/vendorheader/vendor_unsafe.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendor_unsafe.toif -------------------------------------------------------------------------------- /embed/vendorheader/vendorheader_satoshilabs_signed_prod.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendorheader_satoshilabs_signed_prod.bin -------------------------------------------------------------------------------- /embed/vendorheader/vendorheader_satoshilabs_unsigned.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendorheader_satoshilabs_unsigned.bin -------------------------------------------------------------------------------- /embed/vendorheader/vendorheader_unsafe_signed_dev.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendorheader_unsafe_signed_dev.bin -------------------------------------------------------------------------------- /embed/vendorheader/vendorheader_unsafe_signed_prod.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendorheader_unsafe_signed_prod.bin -------------------------------------------------------------------------------- /embed/vendorheader/vendorheader_unsafe_unsigned.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/embed/vendorheader/vendorheader_unsafe_unsigned.bin -------------------------------------------------------------------------------- /help.awk: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env awk 2 | BEGIN { 3 | FS = ":.*?## " 4 | first = 1 5 | COLOR_BROWN = "\033[33m" 6 | COLOR_DARKGREEN = "\033[36m" 7 | COLOR_RESET = "\033[0m" 8 | } /^[a-zA-Z0-9_-]+:.*?## / { 9 | printf COLOR_DARKGREEN 10 | printf " make %-20s", $1 11 | printf COLOR_RESET 12 | printf " %s\n", $2 13 | } /^##(.*)/ { 14 | if (!first) 15 | printf "\n" 16 | printf "%s%s\n", COLOR_BROWN, substr($0, 4) 17 | first = 0 18 | } 19 | -------------------------------------------------------------------------------- /mocks/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/__init__.py -------------------------------------------------------------------------------- /mocks/gc.py: -------------------------------------------------------------------------------- 1 | def enable() -> None: ... 2 | def disable() -> None: ... 3 | def collect() -> None: ... 4 | def mem_alloc() -> int: ... 5 | def mem_free() -> int: ... 6 | -------------------------------------------------------------------------------- /mocks/generated/.mock-generated: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/generated/.mock-generated -------------------------------------------------------------------------------- /mocks/generated/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/generated/__init__.py -------------------------------------------------------------------------------- /mocks/generated/trezorcrypto/.mock-generated: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/mocks/generated/trezorcrypto/.mock-generated -------------------------------------------------------------------------------- /mocks/generated/trezorcrypto/curve25519.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | # extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h 4 | def generate_secret() -> bytes: 5 | ''' 6 | Generate secret key. 7 | ''' 8 | 9 | # extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h 10 | def publickey(secret_key: bytes) -> bytes: 11 | ''' 12 | Computes public key from secret key. 13 | ''' 14 | 15 | # extmod/modtrezorcrypto/modtrezorcrypto-curve25519.h 16 | def multiply(secret_key: bytes, public_key: bytes) -> bytes: 17 | ''' 18 | Multiplies point defined by public_key with scalar defined by secret_key. 19 | Useful for ECDH. 20 | ''' 21 | -------------------------------------------------------------------------------- /mocks/generated/trezorcrypto/nem.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | # extmod/modtrezorcrypto/modtrezorcrypto-nem.h 4 | def validate_address(address: str, network: int) -> bool: 5 | ''' 6 | Validate a NEM address 7 | ''' 8 | 9 | # extmod/modtrezorcrypto/modtrezorcrypto-nem.h 10 | def compute_address(public_key: bytes, network: int) -> str: 11 | ''' 12 | Compute a NEM address from a public key 13 | ''' 14 | -------------------------------------------------------------------------------- /mocks/generated/trezorcrypto/random.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | # extmod/modtrezorcrypto/modtrezorcrypto-random.h 4 | def uniform(n: int) -> int: 5 | ''' 6 | Compute uniform random number from interval 0 ... n - 1. 7 | ''' 8 | 9 | # extmod/modtrezorcrypto/modtrezorcrypto-random.h 10 | def bytes(len: int) -> bytes: 11 | ''' 12 | Generate random bytes sequence of length len. 13 | ''' 14 | 15 | # extmod/modtrezorcrypto/modtrezorcrypto-random.h 16 | def shuffle(data: list) -> None: 17 | ''' 18 | Shuffles items of given list (in-place). 19 | ''' 20 | -------------------------------------------------------------------------------- /mocks/micropython.py: -------------------------------------------------------------------------------- 1 | def const(c): 2 | return c 3 | def mem_current() -> int: ... 4 | def mem_total() -> int: ... 5 | def mem_peak() -> int: ... 6 | -------------------------------------------------------------------------------- /mocks/sys.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | def exit(retval: Any = ...) -> None: 4 | raise SystemExit() 5 | 6 | def print_exception(exc: BaseException) -> None: ... 7 | 8 | path = ... # type: List[str] 9 | argv = ... # type: List[str] 10 | version = ... # type: str 11 | version_info = ... # type: Tuple[int, int, int] 12 | implementation = ... # type: Tuple[str, Tuple[int, int, int]] 13 | platform = ... # type: str 14 | byteorder = ... # type: str 15 | maxsize = ... # type: int 16 | modules = ... # type: Dict[str, Any] 17 | -------------------------------------------------------------------------------- /mocks/ubinascii.py: -------------------------------------------------------------------------------- 1 | def hexlify(data: bytes, sep: bytes = ...) -> bytes: ... 2 | def unhexlify(data: bytes) -> bytes: ... 3 | def a2b_base64(data: bytes) -> bytes: ... 4 | def b2a_base64(data: bytes) -> bytes: ... 5 | def crc32(data: bytes, crc: int = ...) -> int: ... 6 | -------------------------------------------------------------------------------- /mocks/uctypes.py: -------------------------------------------------------------------------------- 1 | ARRAY = ... # type: int 2 | NATIVE = ... # type: int 3 | LITTLE_ENDIAN = ... # type: int 4 | BIG_ENDIAN = ... # type: int 5 | VOID = ... # type: int 6 | UINT8 = ... # type: int 7 | INT8 = ... # type: int 8 | UINT16 = ... # type: int 9 | INT16 = ... # type: int 10 | UINT32 = ... # type: int 11 | INT32 = ... # type: int 12 | UINT64 = ... # type: int 13 | INT64 = ... # type: int 14 | BFUINT8 = ... # type: int 15 | BFINT8 = ... # type: int 16 | BFUINT16 = ... # type: int 17 | BFINT16 = ... # type: int 18 | BFUINT32 = ... # type: int 19 | BFINT32 = ... # type: int 20 | BF_POS = ... # type: int 21 | BF_LEN = ... # type: int 22 | FLOAT32 = ... # type: int 23 | 24 | class struct: 25 | def __init__(self, addr: int, descriptor: dict, layout_type: int = ...) -> None: ... 26 | 27 | def sizeof(struct: struct) -> int: ... 28 | def addressof(obj: bytes) -> int: ... 29 | def bytes_at(addr: int, size: int) -> bytes: ... 30 | def bytearray_at(addr, size) -> bytearray: ... 31 | -------------------------------------------------------------------------------- /mocks/uio.py: -------------------------------------------------------------------------------- 1 | class FileIO: ... 2 | 3 | class StringIO: 4 | def __init__(self, _: Union[int, str]) -> None: ... 5 | 6 | class BytesIO: 7 | def __init__(self, _: Union[int, bytes]) -> None: ... 8 | def getvalue(self) -> bytes: ... 9 | 10 | def open(name: str, mode: str = ...) -> FileIO: 11 | pass 12 | -------------------------------------------------------------------------------- /mocks/ustruct.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | def calcsize(fmt: str) -> int: ... 4 | def pack(fmt: str, *args: Any) -> bytes: ... 5 | def pack_into(fmt: str, buffer: bytearray, offset: int, *args: Any) -> None: ... 6 | def unpack(fmt: str, data: bytes) -> Tuple: ... 7 | def unpack_from(fmt: str, data: bytes, offset: int = ...) -> Tuple: ... 8 | -------------------------------------------------------------------------------- /mocks/utime.py: -------------------------------------------------------------------------------- 1 | def sleep(s: int) -> None: ... 2 | def sleep_ms(ms: int) -> None: ... 3 | def sleep_us(us: int) -> None: ... 4 | def ticks_ms() -> int: ... 5 | def ticks_us() -> int: ... 6 | def ticks_cpu() -> int: ... 7 | def ticks_add(ticks_in: int, delta_in: int) -> int: ... 8 | def ticks_diff(old: int, new: int) -> int: ... 9 | -------------------------------------------------------------------------------- /mocks/utimeq.py: -------------------------------------------------------------------------------- 1 | from typing import * 2 | 3 | class utimeq: 4 | def __init__(self, max_queue_size: int) -> None: ... 5 | def push(self, time: int, callback: Any, value: Any) -> None: ... 6 | def pop(self, entry: List[Any]) -> None: ... 7 | def peektime(self) -> int: ... 8 | def discard(self, callback: Any) -> None: ... 9 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | with import {}; 2 | 3 | let 4 | myPython = python3.withPackages(ps: [ps.trezor ps.pytest ps.flake8 ps.isort ps.black ps.Mako ps.munch ps.Pyro4 ps.pillow]); 5 | in 6 | stdenv.mkDerivation { 7 | name = "trezor-core-dev"; 8 | buildInputs = [ myPython protobuf scons gnumake gcc gcc-arm-embedded pkgconfig SDL2 SDL2_image autoflake clang-tools ]; 9 | } 10 | -------------------------------------------------------------------------------- /site_scons/site_tools/micropython/qstrdefs.py: -------------------------------------------------------------------------------- 1 | import re 2 | import sys 3 | 4 | QSTR_BLACKLIST = set(['NULL', 'number_of']) 5 | 6 | 7 | def process(source, target): 8 | re_qstr = re.compile(r'MP_QSTR_[_a-zA-Z0-9]+') 9 | for line in source: 10 | for match in re_qstr.findall(line): 11 | name = match.replace('MP_QSTR_', '') 12 | if name not in QSTR_BLACKLIST: 13 | target.write('Q(%s)\n' % name) 14 | 15 | 16 | if __name__ == '__main__': 17 | process(sys.stdin, sys.stdout) 18 | -------------------------------------------------------------------------------- /src/.gitignore: -------------------------------------------------------------------------------- 1 | trezor.config 2 | perf.* 3 | -------------------------------------------------------------------------------- /src/apps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/__init__.py -------------------------------------------------------------------------------- /src/apps/cardano/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519" 7 | SEED_NAMESPACE = [HARDENED | 44, HARDENED | 1815] 8 | 9 | 10 | def boot(): 11 | wire.add(MessageType.CardanoGetAddress, __name__, "get_address") 12 | wire.add(MessageType.CardanoGetPublicKey, __name__, "get_public_key") 13 | wire.add(MessageType.CardanoSignTx, __name__, "sign_tx") 14 | -------------------------------------------------------------------------------- /src/apps/cardano/layout/progress.py: -------------------------------------------------------------------------------- 1 | from trezor import ui 2 | 3 | _progress = 0 4 | _steps = 0 5 | 6 | 7 | def init(total_steps, text): 8 | global _progress, _steps 9 | _progress = 0 10 | _steps = total_steps 11 | report_init(text) 12 | report() 13 | 14 | 15 | def advance(): 16 | global _progress 17 | _progress += 1 18 | report() 19 | 20 | 21 | def report_init(text): 22 | ui.display.clear() 23 | ui.header(text) 24 | 25 | 26 | def report(): 27 | p = int(1000 * _progress / _steps) 28 | ui.display.loader(p, 18, ui.WHITE, ui.BG) 29 | -------------------------------------------------------------------------------- /src/apps/common/__init__.py: -------------------------------------------------------------------------------- 1 | from micropython import const 2 | 3 | HARDENED = const(0x80000000) 4 | -------------------------------------------------------------------------------- /src/apps/common/coins.py: -------------------------------------------------------------------------------- 1 | from apps.common.coininfo import COINS 2 | 3 | 4 | def by_shortcut(shortcut): 5 | for c in COINS: 6 | if c.coin_shortcut == shortcut: 7 | return c 8 | raise ValueError('Unknown coin shortcut "%s"' % shortcut) 9 | 10 | 11 | def by_name(name): 12 | for c in COINS: 13 | if c.coin_name == name: 14 | return c 15 | raise ValueError('Unknown coin name "%s"' % name) 16 | 17 | 18 | def by_slip44(slip44): 19 | for c in COINS: 20 | if c.slip44 == slip44: 21 | return c 22 | raise ValueError("Unknown coin slip44 index %d" % slip44) 23 | -------------------------------------------------------------------------------- /src/apps/common/signverify.py: -------------------------------------------------------------------------------- 1 | from ubinascii import hexlify 2 | 3 | from trezor.crypto.hashlib import blake256, sha256 4 | from trezor.utils import HashWriter 5 | 6 | from apps.wallet.sign_tx.writers import write_varint 7 | 8 | 9 | def message_digest(coin, message): 10 | if coin.decred: 11 | h = HashWriter(blake256()) 12 | else: 13 | h = HashWriter(sha256()) 14 | write_varint(h, len(coin.signed_message_header)) 15 | h.extend(coin.signed_message_header) 16 | write_varint(h, len(message)) 17 | h.extend(message) 18 | ret = h.get_digest() 19 | if coin.sign_hash_double: 20 | ret = sha256(ret).digest() 21 | return ret 22 | 23 | 24 | def split_message(message): 25 | try: 26 | m = bytes(message).decode() 27 | words = m.split(" ") 28 | except UnicodeError: 29 | m = "hex(%s)" % hexlify(message).decode() 30 | words = [m] 31 | return words 32 | -------------------------------------------------------------------------------- /src/apps/ethereum/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | from apps.ethereum.networks import all_slip44_ids_hardened 6 | 7 | CURVE = "secp256k1" 8 | 9 | 10 | def boot(): 11 | ns = [] 12 | for i in all_slip44_ids_hardened(): 13 | ns.append([CURVE, HARDENED | 44, i]) 14 | wire.add(MessageType.EthereumGetAddress, __name__, "get_address", ns) 15 | wire.add(MessageType.EthereumGetPublicKey, __name__, "get_public_key", ns) 16 | wire.add(MessageType.EthereumSignTx, __name__, "sign_tx", ns) 17 | wire.add(MessageType.EthereumSignMessage, __name__, "sign_message", ns) 18 | wire.add(MessageType.EthereumVerifyMessage, __name__, "verify_message") 19 | -------------------------------------------------------------------------------- /src/apps/ethereum/tokens.py.mako: -------------------------------------------------------------------------------- 1 | # generated from tokens.py.mako 2 | # do not edit manually! 3 | 4 | 5 | def token_by_chain_address(chain_id, address): 6 | for token in tokens: 7 | if chain_id == token[0] and address == token[1]: 8 | return token 9 | return UNKNOWN_TOKEN 10 | 11 | 12 | UNKNOWN_TOKEN = (None, None, None, None) 13 | 14 | 15 | # fmt: off 16 | tokens = [ 17 | % for t in supported_on("trezor2", erc20): 18 | (${t.chain_id}, ${black_repr(t.address_bytes)}, ${black_repr(t.symbol)}, ${t.decimals}), # ${t.chain} / ${t.name.strip()} 19 | % endfor 20 | ] 21 | # fmt: on 22 | -------------------------------------------------------------------------------- /src/apps/homescreen/res/bg.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/homescreen/res/bg.toif -------------------------------------------------------------------------------- /src/apps/lisk/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 134]] 11 | wire.add(MessageType.LiskGetPublicKey, __name__, "get_public_key", ns) 12 | wire.add(MessageType.LiskGetAddress, __name__, "get_address", ns) 13 | wire.add(MessageType.LiskSignTx, __name__, "sign_tx", ns) 14 | wire.add(MessageType.LiskSignMessage, __name__, "sign_message", ns) 15 | wire.add(MessageType.LiskVerifyMessage, __name__, "verify_message") 16 | -------------------------------------------------------------------------------- /src/apps/lisk/get_address.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.LiskAddress import LiskAddress 2 | 3 | from .helpers import get_address_from_public_key, validate_full_path 4 | 5 | from apps.common import paths 6 | from apps.common.layout import address_n_to_str, show_address, show_qr 7 | from apps.lisk import CURVE 8 | 9 | 10 | async def get_address(ctx, msg, keychain): 11 | await paths.validate_path(ctx, validate_full_path, keychain, msg.address_n, CURVE) 12 | 13 | node = keychain.derive(msg.address_n, CURVE) 14 | pubkey = node.public_key() 15 | pubkey = pubkey[1:] # skip ed25519 pubkey marker 16 | address = get_address_from_public_key(pubkey) 17 | 18 | if msg.show_display: 19 | desc = address_n_to_str(msg.address_n) 20 | while True: 21 | if await show_address(ctx, address, desc=desc): 22 | break 23 | if await show_qr(ctx, address, desc=desc): 24 | break 25 | 26 | return LiskAddress(address=address) 27 | -------------------------------------------------------------------------------- /src/apps/lisk/get_public_key.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.LiskPublicKey import LiskPublicKey 2 | 3 | from apps.common import layout, paths 4 | from apps.lisk import CURVE 5 | from apps.lisk.helpers import validate_full_path 6 | 7 | 8 | async def get_public_key(ctx, msg, keychain): 9 | await paths.validate_path(ctx, validate_full_path, keychain, msg.address_n, CURVE) 10 | 11 | node = keychain.derive(msg.address_n, CURVE) 12 | pubkey = node.public_key() 13 | pubkey = pubkey[1:] # skip ed25519 pubkey marker 14 | 15 | if msg.show_display: 16 | await layout.show_pubkey(ctx, pubkey) 17 | 18 | return LiskPublicKey(public_key=pubkey) 19 | -------------------------------------------------------------------------------- /src/apps/lisk/verify_message.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.crypto.curve import ed25519 3 | from trezor.messages.Success import Success 4 | 5 | from .helpers import get_address_from_public_key 6 | from .sign_message import message_digest 7 | 8 | from apps.wallet.verify_message import require_confirm_verify_message 9 | 10 | 11 | async def verify_message(ctx, msg): 12 | digest = message_digest(msg.message) 13 | verified = ed25519.verify(msg.public_key, msg.signature, digest) 14 | if not verified: 15 | raise wire.ProcessError("Invalid signature") 16 | 17 | address = get_address_from_public_key(msg.public_key) 18 | await require_confirm_verify_message(ctx, address, msg.message) 19 | 20 | return Success(message="Message verified") 21 | -------------------------------------------------------------------------------- /src/apps/management/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | 5 | def boot(): 6 | # only enable LoadDevice in debug builds 7 | if __debug__: 8 | wire.add(MessageType.LoadDevice, __name__, "load_device") 9 | wire.add(MessageType.ResetDevice, __name__, "reset_device") 10 | wire.add(MessageType.BackupDevice, __name__, "backup_device") 11 | wire.add(MessageType.WipeDevice, __name__, "wipe_device") 12 | wire.add(MessageType.RecoveryDevice, __name__, "recovery_device") 13 | wire.add(MessageType.ApplySettings, __name__, "apply_settings") 14 | wire.add(MessageType.ApplyFlags, __name__, "apply_flags") 15 | wire.add(MessageType.ChangePin, __name__, "change_pin") 16 | wire.add(MessageType.SetU2FCounter, __name__, "set_u2f_counter") 17 | -------------------------------------------------------------------------------- /src/apps/management/apply_flags.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.Success import Success 2 | 3 | from apps.common import storage 4 | 5 | 6 | async def apply_flags(ctx, msg): 7 | storage.set_flags(msg.flags) 8 | return Success(message="Flags applied") 9 | -------------------------------------------------------------------------------- /src/apps/management/res/small-arrow.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/management/res/small-arrow.toig -------------------------------------------------------------------------------- /src/apps/management/set_u2f_counter.py: -------------------------------------------------------------------------------- 1 | from trezor import ui, wire 2 | from trezor.messages import ButtonRequestType 3 | from trezor.messages.Success import Success 4 | from trezor.ui.text import Text 5 | 6 | from apps.common import storage 7 | from apps.common.confirm import require_confirm 8 | 9 | 10 | async def set_u2f_counter(ctx, msg): 11 | if msg.u2f_counter is None: 12 | raise wire.ProcessError("No value provided") 13 | 14 | text = Text("Set U2F counter", ui.ICON_CONFIG) 15 | text.normal("Do you really want to", "set the U2F counter") 16 | text.bold("to %d?" % msg.u2f_counter) 17 | await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) 18 | 19 | storage.set_u2f_counter(msg.u2f_counter) 20 | 21 | return Success(message="U2F counter set") 22 | -------------------------------------------------------------------------------- /src/apps/management/wipe_device.py: -------------------------------------------------------------------------------- 1 | from trezor import ui 2 | from trezor.messages import ButtonRequestType 3 | from trezor.messages.Success import Success 4 | from trezor.ui.text import Text 5 | 6 | from apps.common import storage 7 | from apps.common.confirm import require_hold_to_confirm 8 | 9 | 10 | async def wipe_device(ctx, msg): 11 | 12 | text = Text("Wipe device", ui.ICON_WIPE, icon_color=ui.RED) 13 | text.normal("Do you really want to", "wipe the device?", "") 14 | text.bold("All data will be lost.") 15 | 16 | await require_hold_to_confirm( 17 | ctx, 18 | text, 19 | code=ButtonRequestType.WipeDevice, 20 | button_style=ui.BTN_CANCEL, 21 | loader_style=ui.LDR_DANGER, 22 | ) 23 | 24 | storage.wipe() 25 | 26 | return Success(message="Device wiped") 27 | -------------------------------------------------------------------------------- /src/apps/monero/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 128]] 11 | wire.add(MessageType.MoneroGetAddress, __name__, "get_address", ns) 12 | wire.add(MessageType.MoneroGetWatchKey, __name__, "get_watch_only", ns) 13 | wire.add(MessageType.MoneroTransactionInitRequest, __name__, "sign_tx", ns) 14 | wire.add( 15 | MessageType.MoneroKeyImageExportInitRequest, __name__, "key_image_sync", ns 16 | ) 17 | wire.add(MessageType.MoneroGetTxKeyRequest, __name__, "get_tx_keys", ns) 18 | wire.add(MessageType.MoneroLiveRefreshStartRequest, __name__, "live_refresh", ns) 19 | 20 | if __debug__ and hasattr(MessageType, "DebugMoneroDiagRequest"): 21 | wire.add(MessageType.DebugMoneroDiagRequest, __name__, "diag") 22 | -------------------------------------------------------------------------------- /src/apps/monero/get_address.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.MoneroAddress import MoneroAddress 2 | 3 | from apps.common import paths 4 | from apps.common.layout import address_n_to_str, show_address, show_qr 5 | from apps.monero import CURVE, misc 6 | 7 | 8 | async def get_address(ctx, msg, keychain): 9 | await paths.validate_path( 10 | ctx, misc.validate_full_path, keychain, msg.address_n, CURVE 11 | ) 12 | 13 | creds = misc.get_creds(keychain, msg.address_n, msg.network_type) 14 | 15 | if msg.show_display: 16 | desc = address_n_to_str(msg.address_n) 17 | while True: 18 | if await show_address(ctx, creds.address.decode(), desc=desc): 19 | break 20 | if await show_qr(ctx, creds.address.decode(), desc=desc): 21 | break 22 | 23 | return MoneroAddress(address=creds.address) 24 | -------------------------------------------------------------------------------- /src/apps/monero/get_watch_only.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.MoneroGetWatchKey import MoneroGetWatchKey 2 | from trezor.messages.MoneroWatchKey import MoneroWatchKey 3 | 4 | from apps.common import paths 5 | from apps.monero import CURVE, misc 6 | from apps.monero.layout import confirms 7 | from apps.monero.xmr import crypto 8 | 9 | 10 | async def get_watch_only(ctx, msg: MoneroGetWatchKey, keychain): 11 | await paths.validate_path( 12 | ctx, misc.validate_full_path, keychain, msg.address_n, CURVE 13 | ) 14 | 15 | await confirms.require_confirm_watchkey(ctx) 16 | 17 | creds = misc.get_creds(keychain, msg.address_n, msg.network_type) 18 | address = creds.address 19 | watch_key = crypto.encodeint(creds.view_key_private) 20 | 21 | return MoneroWatchKey(watch_key=watch_key, address=address) 22 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/monero/xmr/__init__.py -------------------------------------------------------------------------------- /src/apps/monero/xmr/keccak_hasher.py: -------------------------------------------------------------------------------- 1 | from trezor.utils import HashWriter 2 | 3 | from apps.monero.xmr import crypto 4 | from apps.monero.xmr.serialize import int_serialize 5 | 6 | 7 | class KeccakXmrArchive: 8 | def __init__(self, ctx=None): 9 | self.kwriter = get_keccak_writer(ctx) 10 | 11 | def get_digest(self): 12 | return self.kwriter.get_digest() 13 | 14 | def buffer(self, buf): 15 | return self.kwriter.write(buf) 16 | 17 | def uvarint(self, i): 18 | int_serialize.dump_uvarint(self.kwriter, i) 19 | 20 | def uint(self, i, width): 21 | int_serialize.dump_uint(self.kwriter, i, width) 22 | 23 | 24 | def get_keccak_writer(ctx=None): 25 | if ctx is None: 26 | ctx = crypto.get_keccak() 27 | return HashWriter(ctx) 28 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize/__init__.py: -------------------------------------------------------------------------------- 1 | import gc 2 | 3 | 4 | def parse_msg(buf: bytes, msg_type): 5 | from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter 6 | 7 | reader = MemoryReaderWriter(memoryview(buf)) 8 | return msg_type.load(reader) 9 | 10 | 11 | def dump_msg(msg, preallocate: int = None, prefix: bytes = None) -> bytes: 12 | from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter 13 | 14 | writer = MemoryReaderWriter(preallocate=preallocate) 15 | if prefix: 16 | writer.write(prefix) 17 | msg_type = msg.__class__ 18 | msg_type.dump(writer, msg) 19 | 20 | return writer.get_buffer() 21 | 22 | 23 | def dump_msg_gc(msg, preallocate: int = None, prefix: bytes = None) -> bytes: 24 | buf = dump_msg(msg, preallocate, prefix) 25 | del msg 26 | gc.collect() 27 | return buf 28 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize/base_types.py: -------------------------------------------------------------------------------- 1 | from apps.monero.xmr.serialize.int_serialize import ( 2 | dump_uint, 3 | dump_uvarint, 4 | load_uint, 5 | load_uvarint, 6 | ) 7 | 8 | 9 | class XmrType: 10 | pass 11 | 12 | 13 | class UVarintType(XmrType): 14 | @staticmethod 15 | def load(reader) -> int: 16 | return load_uvarint(reader) 17 | 18 | @staticmethod 19 | def dump(writer, n: int): 20 | return dump_uvarint(writer, n) 21 | 22 | 23 | class IntType(XmrType): 24 | WIDTH = 0 25 | 26 | @classmethod 27 | def load(cls, reader) -> int: 28 | return load_uint(reader, cls.WIDTH) 29 | 30 | @classmethod 31 | def dump(cls, writer, n: int): 32 | return dump_uint(writer, n, cls.WIDTH) 33 | 34 | 35 | class UInt8(IntType): 36 | WIDTH = 1 37 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize_messages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/monero/xmr/serialize_messages/__init__.py -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize_messages/base.py: -------------------------------------------------------------------------------- 1 | from micropython import const 2 | 3 | from apps.monero.xmr.serialize.message_types import BlobType 4 | 5 | _c0 = const(0) 6 | _c1 = const(1) 7 | _c32 = const(32) 8 | _c64 = const(64) 9 | 10 | # 11 | # cryptonote_basic.h 12 | # 13 | 14 | 15 | class Hash(BlobType): 16 | __slots__ = ("data",) 17 | DATA_ATTR = "data" 18 | FIX_SIZE = _c1 19 | SIZE = _c32 20 | 21 | 22 | class ECKey(BlobType): 23 | __slots__ = ("bytes",) 24 | DATA_ATTR = "bytes" 25 | FIX_SIZE = _c1 26 | SIZE = _c32 27 | 28 | 29 | ECPoint = Hash 30 | ECPublicKey = ECPoint 31 | KeyImage = ECPoint 32 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize_messages/ct_keys.py: -------------------------------------------------------------------------------- 1 | from micropython import const 2 | 3 | from apps.monero.xmr.serialize.message_types import ContainerType, MessageType 4 | from apps.monero.xmr.serialize_messages.base import ECKey 5 | 6 | _c0 = const(0) 7 | 8 | 9 | class KeyV(ContainerType): 10 | FIX_SIZE = _c0 11 | ELEM_TYPE = ECKey 12 | 13 | 14 | class KeyM(ContainerType): 15 | FIX_SIZE = _c0 16 | ELEM_TYPE = KeyV 17 | 18 | 19 | class CtKey(MessageType): 20 | __slots__ = ("dest", "mask") 21 | 22 | @classmethod 23 | def f_specs(cls): 24 | return (("dest", ECKey), ("mask", ECKey)) 25 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize_messages/tx_ecdh.py: -------------------------------------------------------------------------------- 1 | from apps.monero.xmr.serialize.message_types import MessageType 2 | 3 | 4 | class EcdhTuple(MessageType): 5 | __slots__ = ("mask", "amount") 6 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/serialize_messages/tx_rsig_bulletproof.py: -------------------------------------------------------------------------------- 1 | from apps.monero.xmr.serialize.message_types import MessageType 2 | from apps.monero.xmr.serialize_messages.base import ECKey 3 | from apps.monero.xmr.serialize_messages.ct_keys import KeyV 4 | 5 | 6 | class Bulletproof(MessageType): 7 | @classmethod 8 | def f_specs(cls): 9 | return ( 10 | ("A", ECKey), 11 | ("S", ECKey), 12 | ("T1", ECKey), 13 | ("T2", ECKey), 14 | ("taux", ECKey), 15 | ("mu", ECKey), 16 | ("L", KeyV), 17 | ("R", KeyV), 18 | ("a", ECKey), 19 | ("b", ECKey), 20 | ("t", ECKey), 21 | ) 22 | -------------------------------------------------------------------------------- /src/apps/monero/xmr/types.py: -------------------------------------------------------------------------------- 1 | if False: 2 | from trezor.crypto import monero as tcry 3 | from typing import * # noqa: F401 4 | 5 | Ge25519 = tcry.ge25519 6 | Sc25519 = tcry.bignum256modm 7 | -------------------------------------------------------------------------------- /src/apps/nem/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519-keccak" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 43], [CURVE, HARDENED | 44, HARDENED | 1]] 11 | wire.add(MessageType.NEMGetAddress, __name__, "get_address", ns) 12 | wire.add(MessageType.NEMSignTx, __name__, "sign_tx", ns) 13 | -------------------------------------------------------------------------------- /src/apps/nem/mosaic/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.NEMMosaicCreation import NEMMosaicCreation 2 | from trezor.messages.NEMMosaicSupplyChange import NEMMosaicSupplyChange 3 | from trezor.messages.NEMTransactionCommon import NEMTransactionCommon 4 | 5 | from . import layout, serialize 6 | 7 | 8 | async def mosaic_creation( 9 | ctx, public_key: bytes, common: NEMTransactionCommon, creation: NEMMosaicCreation 10 | ) -> bytearray: 11 | await layout.ask_mosaic_creation(ctx, common, creation) 12 | return serialize.serialize_mosaic_creation(common, creation, public_key) 13 | 14 | 15 | async def supply_change( 16 | ctx, public_key: bytes, common: NEMTransactionCommon, change: NEMMosaicSupplyChange 17 | ) -> bytearray: 18 | await layout.ask_supply_change(ctx, common, change) 19 | return serialize.serialize_mosaic_supply_change(common, change, public_key) 20 | -------------------------------------------------------------------------------- /src/apps/nem/mosaic/helpers.py: -------------------------------------------------------------------------------- 1 | from .nem_mosaics import mosaics 2 | 3 | 4 | def get_mosaic_definition(namespace_name: str, mosaic_name: str, network: int) -> dict: 5 | for m in mosaics: 6 | if namespace_name == m["namespace"] and mosaic_name == m["mosaic"]: 7 | if ("networks" not in m) or (network in m["networks"]): 8 | return m 9 | return None 10 | 11 | 12 | def is_nem_xem_mosaic(namespace_name: str, mosaic_name: str) -> bool: 13 | if namespace_name == "nem" and mosaic_name == "xem": 14 | return True 15 | return False 16 | -------------------------------------------------------------------------------- /src/apps/nem/mosaic/nem_mosaics.py.mako: -------------------------------------------------------------------------------- 1 | # generated from nem_mosaics.py.mako 2 | # do not edit manually! 3 | <% 4 | ATTRIBUTES = ( 5 | "name", 6 | "ticker", 7 | "namespace", 8 | "mosaic", 9 | "divisibility", 10 | "levy", 11 | "fee", 12 | "levy_namespace", 13 | "levy_mosaic", 14 | "networks", 15 | ) 16 | %>\ 17 | 18 | mosaics = [ 19 | % for m in supported_on("trezor2", nem): 20 | <% m.ticker = " " + m.ticker %>\ 21 | { 22 | % for attr in ATTRIBUTES: 23 | % if attr in m: 24 | "${attr}": ${black_repr(m[attr])}, 25 | % endif 26 | % endfor 27 | }, 28 | % endfor 29 | ] 30 | -------------------------------------------------------------------------------- /src/apps/nem/namespace/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.NEMProvisionNamespace import NEMProvisionNamespace 2 | from trezor.messages.NEMTransactionCommon import NEMTransactionCommon 3 | 4 | from . import layout, serialize 5 | 6 | 7 | async def namespace( 8 | ctx, 9 | public_key: bytes, 10 | common: NEMTransactionCommon, 11 | namespace: NEMProvisionNamespace, 12 | ) -> bytearray: 13 | await layout.ask_provision_namespace(ctx, common, namespace) 14 | return serialize.serialize_provision_namespace(common, namespace, public_key) 15 | -------------------------------------------------------------------------------- /src/apps/nem/writers.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.NEMTransactionCommon import NEMTransactionCommon 2 | 3 | from apps.common.writers import write_bytes, write_uint32_le, write_uint64_le 4 | 5 | 6 | def serialize_tx_common( 7 | common: NEMTransactionCommon, 8 | public_key: bytearray, 9 | transaction_type: int, 10 | version: int = None, 11 | ) -> bytearray: 12 | w = bytearray() 13 | 14 | write_uint32_le(w, transaction_type) 15 | if version is None: 16 | version = common.network << 24 | 1 17 | write_uint32_le(w, version) 18 | write_uint32_le(w, common.timestamp) 19 | 20 | write_bytes_with_len(w, public_key) 21 | write_uint64_le(w, common.fee) 22 | write_uint32_le(w, common.deadline) 23 | 24 | return w 25 | 26 | 27 | def write_bytes_with_len(w, buf: bytes): 28 | write_uint32_le(w, len(buf)) 29 | write_bytes(w, buf) 30 | -------------------------------------------------------------------------------- /src/apps/ripple/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "secp256k1" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 144]] 11 | wire.add(MessageType.RippleGetAddress, __name__, "get_address", ns) 12 | wire.add(MessageType.RippleSignTx, __name__, "sign_tx", ns) 13 | -------------------------------------------------------------------------------- /src/apps/ripple/get_address.py: -------------------------------------------------------------------------------- 1 | from trezor.messages.RippleAddress import RippleAddress 2 | from trezor.messages.RippleGetAddress import RippleGetAddress 3 | 4 | from apps.common import paths 5 | from apps.common.layout import address_n_to_str, show_address, show_qr 6 | from apps.ripple import CURVE, helpers 7 | 8 | 9 | async def get_address(ctx, msg: RippleGetAddress, keychain): 10 | await paths.validate_path( 11 | ctx, helpers.validate_full_path, keychain, msg.address_n, CURVE 12 | ) 13 | 14 | node = keychain.derive(msg.address_n) 15 | pubkey = node.public_key() 16 | address = helpers.address_from_public_key(pubkey) 17 | 18 | if msg.show_display: 19 | desc = address_n_to_str(msg.address_n) 20 | while True: 21 | if await show_address(ctx, address, desc=desc): 22 | break 23 | if await show_qr(ctx, address.upper(), desc=desc): 24 | break 25 | 26 | return RippleAddress(address=address) 27 | -------------------------------------------------------------------------------- /src/apps/stellar/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 148]] 11 | wire.add(MessageType.StellarGetAddress, __name__, "get_address", ns) 12 | wire.add(MessageType.StellarSignTx, __name__, "sign_tx", ns) 13 | -------------------------------------------------------------------------------- /src/apps/stellar/writers.py: -------------------------------------------------------------------------------- 1 | from .helpers import public_key_from_address 2 | 3 | from apps.common.writers import write_bytes, write_uint32_be, write_uint64_be 4 | 5 | write_uint32 = write_uint32_be 6 | write_uint64 = write_uint64_be 7 | 8 | 9 | def write_string(w, s: str): 10 | buf = s.encode() 11 | write_uint32(w, len(buf)) 12 | write_bytes(w, buf) 13 | # if len isn't a multiple of 4, add padding bytes 14 | reminder = len(buf) % 4 15 | if reminder: 16 | write_bytes(w, bytes([0] * (4 - reminder))) 17 | 18 | 19 | def write_bool(w, val: bool): 20 | if val: 21 | write_uint32(w, 1) 22 | else: 23 | write_uint32(w, 0) 24 | 25 | 26 | def write_pubkey(w, address: str): 27 | # first 4 bytes of an address are the type, there's only one type (0) 28 | write_uint32(w, 0) 29 | write_bytes(w, public_key_from_address(address)) 30 | -------------------------------------------------------------------------------- /src/apps/tezos/README.md: -------------------------------------------------------------------------------- 1 | # Tezos 2 | 3 | Tezos documentation can be found [here](http://tezos.gitlab.io). 4 | 5 | ## Operations 6 | 7 | Tezos allows users to use multiple curves for private key derivation, but we support 8 | only `ed25519` (because it is the most used one) where addresses are prefixed with `tz1`, 9 | public keys with `edpk` and signatures with `edsig`. Other curves might be added later on. 10 | 11 | Trezor supports basic Tezos user operations - reveal, transaction, origination, delegation. 12 | When the account creates first operation in lifetime, reveal has to be bundled 13 | with this operation to reveal account's public key. 14 | 15 | #### Operations Explorer 16 | 17 | [TzScan](http://tzscan.io) 18 | 19 | ## Tests 20 | 21 | Unit tests are located in the `tests` directory, device tests are in the python-trezor repository. 22 | -------------------------------------------------------------------------------- /src/apps/tezos/__init__.py: -------------------------------------------------------------------------------- 1 | from trezor import wire 2 | from trezor.messages import MessageType 3 | 4 | from apps.common import HARDENED 5 | 6 | CURVE = "ed25519" 7 | 8 | 9 | def boot(): 10 | ns = [[CURVE, HARDENED | 44, HARDENED | 1729]] 11 | wire.add(MessageType.TezosGetAddress, __name__, "get_address", ns) 12 | wire.add(MessageType.TezosSignTx, __name__, "sign_tx", ns) 13 | wire.add(MessageType.TezosGetPublicKey, __name__, "get_public_key", ns) 14 | -------------------------------------------------------------------------------- /src/apps/wallet/get_entropy.py: -------------------------------------------------------------------------------- 1 | from trezor.crypto import random 2 | from trezor.messages import ButtonRequestType 3 | from trezor.messages.Entropy import Entropy 4 | from trezor.ui.text import Text 5 | 6 | from apps.common.confirm import require_confirm 7 | 8 | 9 | async def get_entropy(ctx, msg): 10 | text = Text("Confirm entropy") 11 | text.bold("Do you really want", "to send entropy?") 12 | text.normal("Continue only if you", "know what you are doing!") 13 | await require_confirm(ctx, text, code=ButtonRequestType.ProtectCall) 14 | 15 | size = min(msg.size, 1024) 16 | entropy = random.bytes(size) 17 | 18 | return Entropy(entropy=entropy) 19 | -------------------------------------------------------------------------------- /src/apps/wallet/sign_tx/omni.py: -------------------------------------------------------------------------------- 1 | from ustruct import unpack 2 | 3 | from trezor.utils import format_amount 4 | 5 | currencies = {1: "OMNI", 2: "tOMNI", 3: "MAID", 31: "USDT"} 6 | 7 | 8 | def is_valid(data: bytes) -> bool: 9 | return len(data) >= 8 and data[:4] == b"omni" 10 | 11 | 12 | def parse(data: bytes) -> bool: 13 | if not is_valid(data): 14 | return None 15 | tx_version, tx_type = unpack(">HH", data[4:8]) 16 | if tx_version == 0 and tx_type == 0 and len(data) == 20: # OMNI simple send 17 | currency, amount = unpack(">IQ", data[8:20]) 18 | return "Simple send of %s %s" % ( 19 | format_amount(amount, 8), 20 | currencies.get(currency, "UNKN"), 21 | ) 22 | else: 23 | # unknown OMNI transaction 24 | return "Unknown transaction" 25 | -------------------------------------------------------------------------------- /src/apps/wallet/sign_tx/progress.py: -------------------------------------------------------------------------------- 1 | from trezor import ui 2 | 3 | _progress = 0 4 | _steps = 0 5 | 6 | 7 | def init(inputs, outputs): 8 | global _progress, _steps 9 | _progress = 0 10 | _steps = inputs + inputs + outputs + inputs 11 | report_init() 12 | report() 13 | 14 | 15 | def advance(): 16 | global _progress 17 | _progress += 1 18 | report() 19 | 20 | 21 | def report_init(): 22 | ui.display.clear() 23 | ui.header("Signing transaction") 24 | 25 | 26 | def report(): 27 | p = int(1000 * _progress / _steps) 28 | ui.display.loader(p, 18, ui.WHITE, ui.BG) 29 | -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_bitbucket.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_bitbucket.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_bitfinex.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_bitfinex.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_dashlane.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_dashlane.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_dropbox.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_dropbox.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_duo.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_duo.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_fastmail.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_fastmail.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_fedora.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_fedora.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_gandi.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_gandi.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_github.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_github.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_gitlab.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_gitlab.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_google.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_google.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_keeper.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_keeper.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_lastpass.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_lastpass.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_slush_pool.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_slush_pool.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_stripe.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_stripe.toif -------------------------------------------------------------------------------- /src/apps/webauthn/res/icon_webauthn.toif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/apps/webauthn/res/icon_webauthn.toif -------------------------------------------------------------------------------- /src/trezor/__init__.py: -------------------------------------------------------------------------------- 1 | import trezorconfig as config # noqa: F401 2 | import trezorio as io # noqa: F401 3 | -------------------------------------------------------------------------------- /src/trezor/crypto/__init__.py: -------------------------------------------------------------------------------- 1 | from gc import collect 2 | 3 | from trezorcrypto import ( # noqa: F401 4 | aes, 5 | bip32, 6 | bip39, 7 | chacha20poly1305, 8 | crc, 9 | monero, 10 | nem, 11 | pbkdf2, 12 | random, 13 | rfc6979, 14 | ) 15 | 16 | 17 | class SecureContext: 18 | def __init__(self): 19 | pass 20 | 21 | def __enter__(self): 22 | return self 23 | 24 | def __exit__(self, exc_type, exc_value, traceback): 25 | for k in self.__dict__: 26 | o = getattr(self, k) 27 | if hasattr(o, "__del__"): 28 | o.__del__() 29 | collect() 30 | -------------------------------------------------------------------------------- /src/trezor/crypto/curve.py: -------------------------------------------------------------------------------- 1 | from trezorcrypto import ( # noqa: F401 2 | curve25519, 3 | ed25519, 4 | nist256p1, 5 | secp256k1, 6 | secp256k1_zkp, 7 | ) 8 | -------------------------------------------------------------------------------- /src/trezor/crypto/der.py: -------------------------------------------------------------------------------- 1 | def encode_length(l: int) -> bytes: 2 | if l < 0x80: 3 | return bytes([l]) 4 | elif l <= 0xFF: 5 | return bytes([0x81, l]) 6 | elif l <= 0xFFFF: 7 | return bytes([0x82, l & 0xFF, l >> 8]) 8 | else: 9 | raise ValueError 10 | 11 | 12 | def encode_int(i: bytes) -> bytes: 13 | i = i.lstrip(b"\x00") 14 | if i[0] >= 0x80: 15 | i = b"\x00" + i 16 | return b"\x02" + encode_length(len(i)) + i 17 | 18 | 19 | def encode_seq(seq: tuple) -> bytes: 20 | res = b"" 21 | for i in seq: 22 | res += encode_int(i) 23 | return b"\x30" + encode_length(len(res)) + res 24 | -------------------------------------------------------------------------------- /src/trezor/crypto/hashlib.py: -------------------------------------------------------------------------------- 1 | from trezorcrypto import ( # noqa: F401 2 | blake2b, 3 | blake2s, 4 | blake256, 5 | groestl512, 6 | ripemd160, 7 | sha1, 8 | sha3_256, 9 | sha3_512, 10 | sha256, 11 | sha512, 12 | ) 13 | -------------------------------------------------------------------------------- /src/trezor/crypto/scripts.py: -------------------------------------------------------------------------------- 1 | from trezor.crypto.hashlib import blake256, ripemd160, sha256 2 | 3 | 4 | def sha256_ripemd160_digest(b: bytes) -> bytes: 5 | h = sha256(b).digest() 6 | h = ripemd160(h).digest() 7 | return h 8 | 9 | 10 | def blake256_ripemd160_digest(b: bytes) -> bytes: 11 | h = blake256(b).digest() 12 | h = ripemd160(h).digest() 13 | return h 14 | -------------------------------------------------------------------------------- /src/trezor/messages/Address.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Address(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 30 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/ApplyFlags.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ApplyFlags(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 28 8 | 9 | def __init__( 10 | self, 11 | flags: int = None, 12 | ) -> None: 13 | self.flags = flags 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('flags', p.UVarintType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/BackupDevice.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class BackupDevice(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 34 8 | -------------------------------------------------------------------------------- /src/trezor/messages/ButtonAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ButtonAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 27 8 | -------------------------------------------------------------------------------- /src/trezor/messages/ButtonRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ButtonRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 26 8 | 9 | def __init__( 10 | self, 11 | code: int = None, 12 | data: str = None, 13 | ) -> None: 14 | self.code = code 15 | self.data = data 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('code', p.UVarintType, 0), 21 | 2: ('data', p.UnicodeType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/ButtonRequestType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | Other = 1 4 | FeeOverThreshold = 2 5 | ConfirmOutput = 3 6 | ResetDevice = 4 7 | ConfirmWord = 5 8 | WipeDevice = 6 9 | ProtectCall = 7 10 | SignTx = 8 11 | FirmwareCheck = 9 12 | Address = 10 13 | PublicKey = 11 14 | MnemonicWordCount = 12 15 | MnemonicInput = 13 16 | PassphraseType = 14 17 | UnknownDerivationPath = 15 18 | -------------------------------------------------------------------------------- /src/trezor/messages/Cancel.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Cancel(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 20 8 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CardanoAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 308 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class CardanoGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 307 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoGetPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class CardanoGetPublicKey(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 305 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .HDNodeType import HDNodeType 6 | 7 | 8 | class CardanoPublicKey(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 306 10 | 11 | def __init__( 12 | self, 13 | xpub: str = None, 14 | node: HDNodeType = None, 15 | ) -> None: 16 | self.xpub = xpub 17 | self.node = node 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('xpub', p.UnicodeType, 0), 23 | 2: ('node', HDNodeType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CardanoSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 310 8 | 9 | def __init__( 10 | self, 11 | tx_hash: bytes = None, 12 | tx_body: bytes = None, 13 | ) -> None: 14 | self.tx_hash = tx_hash 15 | self.tx_body = tx_body 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('tx_hash', p.BytesType, 0), 21 | 2: ('tx_body', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoTxAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CardanoTxAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 309 8 | 9 | def __init__( 10 | self, 11 | transaction: bytes = None, 12 | ) -> None: 13 | self.transaction = transaction 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('transaction', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoTxOutputType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class CardanoTxOutputType(p.MessageType): 13 | 14 | def __init__( 15 | self, 16 | address: str = None, 17 | address_n: List[int] = None, 18 | amount: int = None, 19 | ) -> None: 20 | self.address = address 21 | self.address_n = address_n if address_n is not None else [] 22 | self.amount = amount 23 | 24 | @classmethod 25 | def get_fields(cls): 26 | return { 27 | 1: ('address', p.UnicodeType, 0), 28 | 2: ('address_n', p.UVarintType, p.FLAG_REPEATED), 29 | 3: ('amount', p.UVarintType, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/CardanoTxRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CardanoTxRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 304 8 | 9 | def __init__( 10 | self, 11 | tx_index: int = None, 12 | tx_hash: bytes = None, 13 | tx_body: bytes = None, 14 | ) -> None: 15 | self.tx_index = tx_index 16 | self.tx_hash = tx_hash 17 | self.tx_body = tx_body 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('tx_index', p.UVarintType, 0), 23 | 2: ('tx_hash', p.BytesType, 0), 24 | 3: ('tx_body', p.BytesType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/ChangePin.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ChangePin(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 4 8 | 9 | def __init__( 10 | self, 11 | remove: bool = None, 12 | ) -> None: 13 | self.remove = remove 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('remove', p.BoolType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/CipheredKeyValue.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CipheredKeyValue(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 48 8 | 9 | def __init__( 10 | self, 11 | value: bytes = None, 12 | ) -> None: 13 | self.value = value 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('value', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/ClearSession.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ClearSession(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 24 8 | -------------------------------------------------------------------------------- /src/trezor/messages/CosiCommit.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class CosiCommit(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 71 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | data: bytes = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.data = data 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('data', p.BytesType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/CosiCommitment.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CosiCommitment(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 72 8 | 9 | def __init__( 10 | self, 11 | commitment: bytes = None, 12 | pubkey: bytes = None, 13 | ) -> None: 14 | self.commitment = commitment 15 | self.pubkey = pubkey 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('commitment', p.BytesType, 0), 21 | 2: ('pubkey', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/CosiSignature.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class CosiSignature(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 74 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | ) -> None: 13 | self.signature = signature 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('signature', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkDecision.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkDecision(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 100 8 | 9 | def __init__( 10 | self, 11 | yes_no: bool = None, 12 | up_down: bool = None, 13 | input: str = None, 14 | ) -> None: 15 | self.yes_no = yes_no 16 | self.up_down = up_down 17 | self.input = input 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('yes_no', p.BoolType, 0), 23 | 2: ('up_down', p.BoolType, 0), 24 | 3: ('input', p.UnicodeType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkFlashErase.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkFlashErase(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 113 8 | 9 | def __init__( 10 | self, 11 | sector: int = None, 12 | ) -> None: 13 | self.sector = sector 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('sector', p.UVarintType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkGetState.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkGetState(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 101 8 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkLog.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkLog(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 104 8 | 9 | def __init__( 10 | self, 11 | level: int = None, 12 | bucket: str = None, 13 | text: str = None, 14 | ) -> None: 15 | self.level = level 16 | self.bucket = bucket 17 | self.text = text 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('level', p.UVarintType, 0), 23 | 2: ('bucket', p.UnicodeType, 0), 24 | 3: ('text', p.UnicodeType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkMemory.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkMemory(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 111 8 | 9 | def __init__( 10 | self, 11 | memory: bytes = None, 12 | ) -> None: 13 | self.memory = memory 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('memory', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkMemoryRead.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkMemoryRead(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 110 8 | 9 | def __init__( 10 | self, 11 | address: int = None, 12 | length: int = None, 13 | ) -> None: 14 | self.address = address 15 | self.length = length 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('address', p.UVarintType, 0), 21 | 2: ('length', p.UVarintType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkMemoryWrite.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkMemoryWrite(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 112 8 | 9 | def __init__( 10 | self, 11 | address: int = None, 12 | memory: bytes = None, 13 | flash: bool = None, 14 | ) -> None: 15 | self.address = address 16 | self.memory = memory 17 | self.flash = flash 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('address', p.UVarintType, 0), 23 | 2: ('memory', p.BytesType, 0), 24 | 3: ('flash', p.BoolType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/DebugLinkStop.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class DebugLinkStop(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 103 8 | -------------------------------------------------------------------------------- /src/trezor/messages/ECDHSessionKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class ECDHSessionKey(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 62 8 | 9 | def __init__( 10 | self, 11 | session_key: bytes = None, 12 | ) -> None: 13 | self.session_key = session_key 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('session_key', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/Entropy.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Entropy(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 10 8 | 9 | def __init__( 10 | self, 11 | entropy: bytes = None, 12 | ) -> None: 13 | self.entropy = entropy 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('entropy', p.BytesType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/EntropyAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EntropyAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 36 8 | 9 | def __init__( 10 | self, 11 | entropy: bytes = None, 12 | ) -> None: 13 | self.entropy = entropy 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('entropy', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/EntropyRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EntropyRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 35 8 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EthereumAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 57 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 2: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class EthereumGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 56 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumGetPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class EthereumGetPublicKey(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 450 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumMessageSignature.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EthereumMessageSignature(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 66 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | address: str = None, 13 | ) -> None: 14 | self.signature = signature 15 | self.address = address 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 2: ('signature', p.BytesType, 0), 21 | 3: ('address', p.UnicodeType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .HDNodeType import HDNodeType 6 | 7 | 8 | class EthereumPublicKey(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 451 10 | 11 | def __init__( 12 | self, 13 | node: HDNodeType = None, 14 | xpub: str = None, 15 | ) -> None: 16 | self.node = node 17 | self.xpub = xpub 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('node', HDNodeType, 0), 23 | 2: ('xpub', p.UnicodeType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumSignMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class EthereumSignMessage(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 64 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | message: bytes = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.message = message 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('message', p.BytesType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumTxAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EthereumTxAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 60 8 | 9 | def __init__( 10 | self, 11 | data_chunk: bytes = None, 12 | ) -> None: 13 | self.data_chunk = data_chunk 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('data_chunk', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumTxRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EthereumTxRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 59 8 | 9 | def __init__( 10 | self, 11 | data_length: int = None, 12 | signature_v: int = None, 13 | signature_r: bytes = None, 14 | signature_s: bytes = None, 15 | ) -> None: 16 | self.data_length = data_length 17 | self.signature_v = signature_v 18 | self.signature_r = signature_r 19 | self.signature_s = signature_s 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('data_length', p.UVarintType, 0), 25 | 2: ('signature_v', p.UVarintType, 0), 26 | 3: ('signature_r', p.BytesType, 0), 27 | 4: ('signature_s', p.BytesType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/EthereumVerifyMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class EthereumVerifyMessage(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 65 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | message: bytes = None, 13 | address: str = None, 14 | ) -> None: 15 | self.signature = signature 16 | self.message = message 17 | self.address = address 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 2: ('signature', p.BytesType, 0), 23 | 3: ('message', p.BytesType, 0), 24 | 4: ('address', p.UnicodeType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/Failure.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Failure(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 3 8 | 9 | def __init__( 10 | self, 11 | code: int = None, 12 | message: str = None, 13 | ) -> None: 14 | self.code = code 15 | self.message = message 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('code', p.UVarintType, 0), 21 | 2: ('message', p.UnicodeType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/FailureType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | UnexpectedMessage = 1 4 | ButtonExpected = 2 5 | DataError = 3 6 | ActionCancelled = 4 7 | PinExpected = 5 8 | PinCancelled = 6 9 | PinInvalid = 7 10 | InvalidSignature = 8 11 | ProcessError = 9 12 | NotEnoughFunds = 10 13 | NotInitialized = 11 14 | PinMismatch = 12 15 | FirmwareError = 99 16 | -------------------------------------------------------------------------------- /src/trezor/messages/GetECDHSessionKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .IdentityType import IdentityType 6 | 7 | 8 | class GetECDHSessionKey(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 61 10 | 11 | def __init__( 12 | self, 13 | identity: IdentityType = None, 14 | peer_public_key: bytes = None, 15 | ecdsa_curve_name: str = None, 16 | ) -> None: 17 | self.identity = identity 18 | self.peer_public_key = peer_public_key 19 | self.ecdsa_curve_name = ecdsa_curve_name 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('identity', IdentityType, 0), 25 | 2: ('peer_public_key', p.BytesType, 0), 26 | 3: ('ecdsa_curve_name', p.UnicodeType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/GetEntropy.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class GetEntropy(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 9 8 | 9 | def __init__( 10 | self, 11 | size: int = None, 12 | ) -> None: 13 | self.size = size 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('size', p.UVarintType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/GetFeatures.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class GetFeatures(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 55 8 | -------------------------------------------------------------------------------- /src/trezor/messages/HDNodePathType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .HDNodeType import HDNodeType 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class HDNodePathType(p.MessageType): 15 | 16 | def __init__( 17 | self, 18 | node: HDNodeType = None, 19 | address_n: List[int] = None, 20 | ) -> None: 21 | self.node = node 22 | self.address_n = address_n if address_n is not None else [] 23 | 24 | @classmethod 25 | def get_fields(cls): 26 | return { 27 | 1: ('node', HDNodeType, 0), # required 28 | 2: ('address_n', p.UVarintType, p.FLAG_REPEATED), 29 | } 30 | -------------------------------------------------------------------------------- /src/trezor/messages/IdentityType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class IdentityType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | proto: str = None, 11 | user: str = None, 12 | host: str = None, 13 | port: str = None, 14 | path: str = None, 15 | index: int = None, 16 | ) -> None: 17 | self.proto = proto 18 | self.user = user 19 | self.host = host 20 | self.port = port 21 | self.path = path 22 | self.index = index 23 | 24 | @classmethod 25 | def get_fields(cls): 26 | return { 27 | 1: ('proto', p.UnicodeType, 0), 28 | 2: ('user', p.UnicodeType, 0), 29 | 3: ('host', p.UnicodeType, 0), 30 | 4: ('port', p.UnicodeType, 0), 31 | 5: ('path', p.UnicodeType, 0), 32 | 6: ('index', p.UVarintType, 0), # default=0 33 | } 34 | -------------------------------------------------------------------------------- /src/trezor/messages/Initialize.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Initialize(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 0 8 | 9 | def __init__( 10 | self, 11 | state: bytes = None, 12 | skip_passphrase: bool = None, 13 | ) -> None: 14 | self.state = state 15 | self.skip_passphrase = skip_passphrase 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('state', p.BytesType, 0), 21 | 2: ('skip_passphrase', p.BoolType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/InputScriptType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | SPENDADDRESS = 0 4 | SPENDMULTISIG = 1 5 | EXTERNAL = 2 6 | SPENDWITNESS = 3 7 | SPENDP2SHWITNESS = 4 8 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 115 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskDelegateType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskDelegateType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | username: str = None, 11 | ) -> None: 12 | self.username = username 13 | 14 | @classmethod 15 | def get_fields(cls): 16 | return { 17 | 1: ('username', p.UnicodeType, 0), 18 | } 19 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class LiskGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 114 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskGetPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class LiskGetPublicKey(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 121 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskMessageSignature.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskMessageSignature(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 119 8 | 9 | def __init__( 10 | self, 11 | public_key: bytes = None, 12 | signature: bytes = None, 13 | ) -> None: 14 | self.public_key = public_key 15 | self.signature = signature 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('public_key', p.BytesType, 0), 21 | 2: ('signature', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskMultisignatureType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class LiskMultisignatureType(p.MessageType): 13 | 14 | def __init__( 15 | self, 16 | min: int = None, 17 | life_time: int = None, 18 | keys_group: List[str] = None, 19 | ) -> None: 20 | self.min = min 21 | self.life_time = life_time 22 | self.keys_group = keys_group if keys_group is not None else [] 23 | 24 | @classmethod 25 | def get_fields(cls): 26 | return { 27 | 1: ('min', p.UVarintType, 0), 28 | 2: ('life_time', p.UVarintType, 0), 29 | 3: ('keys_group', p.UnicodeType, p.FLAG_REPEATED), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskPublicKey(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 122 8 | 9 | def __init__( 10 | self, 11 | public_key: bytes = None, 12 | ) -> None: 13 | self.public_key = public_key 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('public_key', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskSignMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class LiskSignMessage(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 118 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | message: bytes = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.message = message 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('message', p.BytesType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskSignTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .LiskTransactionCommon import LiskTransactionCommon 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class LiskSignTx(p.MessageType): 15 | MESSAGE_WIRE_TYPE = 116 16 | 17 | def __init__( 18 | self, 19 | address_n: List[int] = None, 20 | transaction: LiskTransactionCommon = None, 21 | ) -> None: 22 | self.address_n = address_n if address_n is not None else [] 23 | self.transaction = transaction 24 | 25 | @classmethod 26 | def get_fields(cls): 27 | return { 28 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 29 | 2: ('transaction', LiskTransactionCommon, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskSignatureType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskSignatureType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | public_key: bytes = None, 11 | ) -> None: 12 | self.public_key = public_key 13 | 14 | @classmethod 15 | def get_fields(cls): 16 | return { 17 | 1: ('public_key', p.BytesType, 0), 18 | } 19 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 117 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | ) -> None: 13 | self.signature = signature 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('signature', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskTransactionType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | Transfer = 0 4 | RegisterSecondPassphrase = 1 5 | RegisterDelegate = 2 6 | CastVotes = 3 7 | RegisterMultisignatureAccount = 4 8 | CreateDapp = 5 9 | TransferIntoDapp = 6 10 | TransferOutOfDapp = 7 11 | -------------------------------------------------------------------------------- /src/trezor/messages/LiskVerifyMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class LiskVerifyMessage(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 120 8 | 9 | def __init__( 10 | self, 11 | public_key: bytes = None, 12 | signature: bytes = None, 13 | message: bytes = None, 14 | ) -> None: 15 | self.public_key = public_key 16 | self.signature = signature 17 | self.message = message 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('public_key', p.BytesType, 0), 23 | 2: ('signature', p.BytesType, 0), 24 | 3: ('message', p.BytesType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/MessageSignature.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MessageSignature(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 40 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | signature: bytes = None, 13 | ) -> None: 14 | self.address = address 15 | self.signature = signature 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('address', p.UnicodeType, 0), 21 | 2: ('signature', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroAccountPublicAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroAccountPublicAddress(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | spend_public_key: bytes = None, 11 | view_public_key: bytes = None, 12 | ) -> None: 13 | self.spend_public_key = spend_public_key 14 | self.view_public_key = view_public_key 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('spend_public_key', p.BytesType, 0), 20 | 2: ('view_public_key', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 541 8 | 9 | def __init__( 10 | self, 11 | address: bytes = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroExportedKeyImage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroExportedKeyImage(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | iv: bytes = None, 11 | blob: bytes = None, 12 | ) -> None: 13 | self.iv = iv 14 | self.blob = blob 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('iv', p.BytesType, 0), 20 | 3: ('blob', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroGetTxKeyAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroGetTxKeyAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 551 8 | 9 | def __init__( 10 | self, 11 | salt: bytes = None, 12 | tx_keys: bytes = None, 13 | tx_derivations: bytes = None, 14 | ) -> None: 15 | self.salt = salt 16 | self.tx_keys = tx_keys 17 | self.tx_derivations = tx_derivations 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('salt', p.BytesType, 0), 23 | 2: ('tx_keys', p.BytesType, 0), 24 | 3: ('tx_derivations', p.BytesType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroGetWatchKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class MoneroGetWatchKey(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 542 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | network_type: int = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.network_type = network_type 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('network_type', p.UVarintType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroKeyImageExportInitAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroKeyImageExportInitAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 531 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroKeyImageSyncFinalAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroKeyImageSyncFinalAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 535 8 | 9 | def __init__( 10 | self, 11 | enc_key: bytes = None, 12 | ) -> None: 13 | self.enc_key = enc_key 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('enc_key', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroKeyImageSyncFinalRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroKeyImageSyncFinalRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 534 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroKeyImageSyncStepAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroExportedKeyImage import MoneroExportedKeyImage 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class MoneroKeyImageSyncStepAck(p.MessageType): 15 | MESSAGE_WIRE_TYPE = 533 16 | 17 | def __init__( 18 | self, 19 | kis: List[MoneroExportedKeyImage] = None, 20 | ) -> None: 21 | self.kis = kis if kis is not None else [] 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('kis', MoneroExportedKeyImage, p.FLAG_REPEATED), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroKeyImageSyncStepRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroTransferDetails import MoneroTransferDetails 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class MoneroKeyImageSyncStepRequest(p.MessageType): 15 | MESSAGE_WIRE_TYPE = 532 16 | 17 | def __init__( 18 | self, 19 | tdis: List[MoneroTransferDetails] = None, 20 | ) -> None: 21 | self.tdis = tdis if tdis is not None else [] 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('tdis', MoneroTransferDetails, p.FLAG_REPEATED), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroLiveRefreshFinalAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroLiveRefreshFinalAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 557 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroLiveRefreshFinalRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroLiveRefreshFinalRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 556 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroLiveRefreshStartAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroLiveRefreshStartAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 553 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroLiveRefreshStartRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class MoneroLiveRefreshStartRequest(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 552 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | network_type: int = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.network_type = network_type 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('network_type', p.UVarintType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroLiveRefreshStepAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroLiveRefreshStepAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 555 8 | 9 | def __init__( 10 | self, 11 | salt: bytes = None, 12 | key_image: bytes = None, 13 | ) -> None: 14 | self.salt = salt 15 | self.key_image = key_image 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('salt', p.BytesType, 0), 21 | 2: ('key_image', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroMultisigKLRki.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroMultisigKLRki(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | K: bytes = None, 11 | L: bytes = None, 12 | R: bytes = None, 13 | ki: bytes = None, 14 | ) -> None: 15 | self.K = K 16 | self.L = L 17 | self.R = R 18 | self.ki = ki 19 | 20 | @classmethod 21 | def get_fields(cls): 22 | return { 23 | 1: ('K', p.BytesType, 0), 24 | 2: ('L', p.BytesType, 0), 25 | 3: ('R', p.BytesType, 0), 26 | 4: ('ki', p.BytesType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroOutputEntry.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroRctKeyPublic import MoneroRctKeyPublic 6 | 7 | 8 | class MoneroOutputEntry(p.MessageType): 9 | 10 | def __init__( 11 | self, 12 | idx: int = None, 13 | key: MoneroRctKeyPublic = None, 14 | ) -> None: 15 | self.idx = idx 16 | self.key = key 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('idx', p.UVarintType, 0), 22 | 2: ('key', MoneroRctKeyPublic, 0), 23 | } 24 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroRctKeyPublic.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroRctKeyPublic(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | dest: bytes = None, 11 | commitment: bytes = None, 12 | ) -> None: 13 | self.dest = dest 14 | self.commitment = commitment 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('dest', p.BytesType, 0), 20 | 2: ('commitment', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroRingCtSig.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroRingCtSig(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | txn_fee: int = None, 11 | message: bytes = None, 12 | rv_type: int = None, 13 | ) -> None: 14 | self.txn_fee = txn_fee 15 | self.message = message 16 | self.rv_type = rv_type 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('txn_fee', p.UVarintType, 0), 22 | 2: ('message', p.BytesType, 0), 23 | 3: ('rv_type', p.UVarintType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroSubAddressIndicesList.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class MoneroSubAddressIndicesList(p.MessageType): 13 | 14 | def __init__( 15 | self, 16 | account: int = None, 17 | minor_indices: List[int] = None, 18 | ) -> None: 19 | self.account = account 20 | self.minor_indices = minor_indices if minor_indices is not None else [] 21 | 22 | @classmethod 23 | def get_fields(cls): 24 | return { 25 | 1: ('account', p.UVarintType, 0), 26 | 2: ('minor_indices', p.UVarintType, p.FLAG_REPEATED), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionAllInputsSetAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroTransactionRsigData import MoneroTransactionRsigData 6 | 7 | 8 | class MoneroTransactionAllInputsSetAck(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 510 10 | 11 | def __init__( 12 | self, 13 | rsig_data: MoneroTransactionRsigData = None, 14 | ) -> None: 15 | self.rsig_data = rsig_data 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('rsig_data', MoneroTransactionRsigData, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionAllInputsSetRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionAllInputsSetRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 509 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionAllOutSetAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroRingCtSig import MoneroRingCtSig 6 | 7 | 8 | class MoneroTransactionAllOutSetAck(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 514 10 | 11 | def __init__( 12 | self, 13 | extra: bytes = None, 14 | tx_prefix_hash: bytes = None, 15 | rv: MoneroRingCtSig = None, 16 | full_message_hash: bytes = None, 17 | ) -> None: 18 | self.extra = extra 19 | self.tx_prefix_hash = tx_prefix_hash 20 | self.rv = rv 21 | self.full_message_hash = full_message_hash 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('extra', p.BytesType, 0), 27 | 2: ('tx_prefix_hash', p.BytesType, 0), 28 | 4: ('rv', MoneroRingCtSig, 0), 29 | 5: ('full_message_hash', p.BytesType, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionAllOutSetRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroTransactionRsigData import MoneroTransactionRsigData 6 | 7 | 8 | class MoneroTransactionAllOutSetRequest(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 513 10 | 11 | def __init__( 12 | self, 13 | rsig_data: MoneroTransactionRsigData = None, 14 | ) -> None: 15 | self.rsig_data = rsig_data 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('rsig_data', MoneroTransactionRsigData, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionFinalAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionFinalAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 518 8 | 9 | def __init__( 10 | self, 11 | cout_key: bytes = None, 12 | salt: bytes = None, 13 | rand_mult: bytes = None, 14 | tx_enc_keys: bytes = None, 15 | ) -> None: 16 | self.cout_key = cout_key 17 | self.salt = salt 18 | self.rand_mult = rand_mult 19 | self.tx_enc_keys = tx_enc_keys 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('cout_key', p.BytesType, 0), 25 | 2: ('salt', p.BytesType, 0), 26 | 3: ('rand_mult', p.BytesType, 0), 27 | 4: ('tx_enc_keys', p.BytesType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionFinalRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionFinalRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 517 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionInitAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroTransactionRsigData import MoneroTransactionRsigData 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class MoneroTransactionInitAck(p.MessageType): 15 | MESSAGE_WIRE_TYPE = 502 16 | 17 | def __init__( 18 | self, 19 | hmacs: List[bytes] = None, 20 | rsig_data: MoneroTransactionRsigData = None, 21 | ) -> None: 22 | self.hmacs = hmacs if hmacs is not None else [] 23 | self.rsig_data = rsig_data 24 | 25 | @classmethod 26 | def get_fields(cls): 27 | return { 28 | 1: ('hmacs', p.BytesType, p.FLAG_REPEATED), 29 | 2: ('rsig_data', MoneroTransactionRsigData, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionInputViniAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionInputViniAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 508 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionInputsPermutationAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionInputsPermutationAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 506 8 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionInputsPermutationRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class MoneroTransactionInputsPermutationRequest(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 505 14 | 15 | def __init__( 16 | self, 17 | perm: List[int] = None, 18 | ) -> None: 19 | self.perm = perm if perm is not None else [] 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('perm', p.UVarintType, p.FLAG_REPEATED), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionSetInputRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .MoneroTransactionSourceEntry import MoneroTransactionSourceEntry 6 | 7 | 8 | class MoneroTransactionSetInputRequest(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 503 10 | 11 | def __init__( 12 | self, 13 | src_entr: MoneroTransactionSourceEntry = None, 14 | ) -> None: 15 | self.src_entr = src_entr 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('src_entr', MoneroTransactionSourceEntry, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroTransactionSignInputAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroTransactionSignInputAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 516 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | pseudo_out: bytes = None, 13 | ) -> None: 14 | self.signature = signature 15 | self.pseudo_out = pseudo_out 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('signature', p.BytesType, 0), 21 | 2: ('pseudo_out', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/MoneroWatchKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class MoneroWatchKey(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 543 8 | 9 | def __init__( 10 | self, 11 | watch_key: bytes = None, 12 | address: bytes = None, 13 | ) -> None: 14 | self.watch_key = watch_key 15 | self.address = address 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('watch_key', p.BytesType, 0), 21 | 2: ('address', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 68 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMAggregateModification.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .NEMCosignatoryModification import NEMCosignatoryModification 6 | 7 | if __debug__: 8 | try: 9 | from typing import List 10 | except ImportError: 11 | List = None # type: ignore 12 | 13 | 14 | class NEMAggregateModification(p.MessageType): 15 | 16 | def __init__( 17 | self, 18 | modifications: List[NEMCosignatoryModification] = None, 19 | relative_change: int = None, 20 | ) -> None: 21 | self.modifications = modifications if modifications is not None else [] 22 | self.relative_change = relative_change 23 | 24 | @classmethod 25 | def get_fields(cls): 26 | return { 27 | 1: ('modifications', NEMCosignatoryModification, p.FLAG_REPEATED), 28 | 2: ('relative_change', p.SVarintType, 0), 29 | } 30 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMCosignatoryModification.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMCosignatoryModification(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | type: int = None, 11 | public_key: bytes = None, 12 | ) -> None: 13 | self.type = type 14 | self.public_key = public_key 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('type', p.UVarintType, 0), 20 | 2: ('public_key', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMDecryptedMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMDecryptedMessage(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 76 8 | 9 | def __init__( 10 | self, 11 | payload: bytes = None, 12 | ) -> None: 13 | self.payload = payload 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('payload', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class NEMGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 67 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | network: int = None, 19 | show_display: bool = None, 20 | ) -> None: 21 | self.address_n = address_n if address_n is not None else [] 22 | self.network = network 23 | self.show_display = show_display 24 | 25 | @classmethod 26 | def get_fields(cls): 27 | return { 28 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 29 | 2: ('network', p.UVarintType, 0), 30 | 3: ('show_display', p.BoolType, 0), 31 | } 32 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMImportanceTransfer.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMImportanceTransfer(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | mode: int = None, 11 | public_key: bytes = None, 12 | ) -> None: 13 | self.mode = mode 14 | self.public_key = public_key 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('mode', p.UVarintType, 0), 20 | 2: ('public_key', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMImportanceTransferMode.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | ImportanceTransfer_Activate = 1 4 | ImportanceTransfer_Deactivate = 2 5 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMModificationType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | CosignatoryModification_Add = 1 4 | CosignatoryModification_Delete = 2 5 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMMosaic.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMMosaic(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | namespace: str = None, 11 | mosaic: str = None, 12 | quantity: int = None, 13 | ) -> None: 14 | self.namespace = namespace 15 | self.mosaic = mosaic 16 | self.quantity = quantity 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('namespace', p.UnicodeType, 0), 22 | 2: ('mosaic', p.UnicodeType, 0), 23 | 3: ('quantity', p.UVarintType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMMosaicCreation.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .NEMMosaicDefinition import NEMMosaicDefinition 6 | 7 | 8 | class NEMMosaicCreation(p.MessageType): 9 | 10 | def __init__( 11 | self, 12 | definition: NEMMosaicDefinition = None, 13 | sink: str = None, 14 | fee: int = None, 15 | ) -> None: 16 | self.definition = definition 17 | self.sink = sink 18 | self.fee = fee 19 | 20 | @classmethod 21 | def get_fields(cls): 22 | return { 23 | 1: ('definition', NEMMosaicDefinition, 0), 24 | 2: ('sink', p.UnicodeType, 0), 25 | 3: ('fee', p.UVarintType, 0), 26 | } 27 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMMosaicLevy.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | MosaicLevy_Absolute = 1 4 | MosaicLevy_Percentile = 2 5 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMMosaicSupplyChange.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMMosaicSupplyChange(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | namespace: str = None, 11 | mosaic: str = None, 12 | type: int = None, 13 | delta: int = None, 14 | ) -> None: 15 | self.namespace = namespace 16 | self.mosaic = mosaic 17 | self.type = type 18 | self.delta = delta 19 | 20 | @classmethod 21 | def get_fields(cls): 22 | return { 23 | 1: ('namespace', p.UnicodeType, 0), 24 | 2: ('mosaic', p.UnicodeType, 0), 25 | 3: ('type', p.UVarintType, 0), 26 | 4: ('delta', p.UVarintType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMProvisionNamespace.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMProvisionNamespace(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | namespace: str = None, 11 | parent: str = None, 12 | sink: str = None, 13 | fee: int = None, 14 | ) -> None: 15 | self.namespace = namespace 16 | self.parent = parent 17 | self.sink = sink 18 | self.fee = fee 19 | 20 | @classmethod 21 | def get_fields(cls): 22 | return { 23 | 1: ('namespace', p.UnicodeType, 0), 24 | 2: ('parent', p.UnicodeType, 0), 25 | 3: ('sink', p.UnicodeType, 0), 26 | 4: ('fee', p.UVarintType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class NEMSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 70 8 | 9 | def __init__( 10 | self, 11 | data: bytes = None, 12 | signature: bytes = None, 13 | ) -> None: 14 | self.data = data 15 | self.signature = signature 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('data', p.BytesType, 0), 21 | 2: ('signature', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/NEMSupplyChangeType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | SupplyChange_Increase = 1 4 | SupplyChange_Decrease = 2 5 | -------------------------------------------------------------------------------- /src/trezor/messages/OutputScriptType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | PAYTOADDRESS = 0 4 | PAYTOSCRIPTHASH = 1 5 | PAYTOMULTISIG = 2 6 | PAYTOOPRETURN = 3 7 | PAYTOWITNESS = 4 8 | PAYTOP2SHWITNESS = 5 9 | -------------------------------------------------------------------------------- /src/trezor/messages/PassphraseAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PassphraseAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 42 8 | 9 | def __init__( 10 | self, 11 | passphrase: str = None, 12 | state: bytes = None, 13 | ) -> None: 14 | self.passphrase = passphrase 15 | self.state = state 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('passphrase', p.UnicodeType, 0), 21 | 2: ('state', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/PassphraseRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PassphraseRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 41 8 | 9 | def __init__( 10 | self, 11 | on_device: bool = None, 12 | ) -> None: 13 | self.on_device = on_device 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('on_device', p.BoolType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/PassphraseSourceType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | ASK = 0 4 | DEVICE = 1 5 | HOST = 2 6 | -------------------------------------------------------------------------------- /src/trezor/messages/PassphraseStateAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PassphraseStateAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 78 8 | -------------------------------------------------------------------------------- /src/trezor/messages/PassphraseStateRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PassphraseStateRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 77 8 | 9 | def __init__( 10 | self, 11 | state: bytes = None, 12 | ) -> None: 13 | self.state = state 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('state', p.BytesType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/PinMatrixAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PinMatrixAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 19 8 | 9 | def __init__( 10 | self, 11 | pin: str = None, 12 | ) -> None: 13 | self.pin = pin 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('pin', p.UnicodeType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/PinMatrixRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class PinMatrixRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 18 8 | 9 | def __init__( 10 | self, 11 | type: int = None, 12 | ) -> None: 13 | self.type = type 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('type', p.UVarintType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/PinMatrixRequestType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | Current = 1 4 | NewFirst = 2 5 | NewSecond = 3 6 | -------------------------------------------------------------------------------- /src/trezor/messages/Ping.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Ping(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 1 8 | 9 | def __init__( 10 | self, 11 | message: str = None, 12 | button_protection: bool = None, 13 | pin_protection: bool = None, 14 | passphrase_protection: bool = None, 15 | ) -> None: 16 | self.message = message 17 | self.button_protection = button_protection 18 | self.pin_protection = pin_protection 19 | self.passphrase_protection = passphrase_protection 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('message', p.UnicodeType, 0), 25 | 2: ('button_protection', p.BoolType, 0), 26 | 3: ('pin_protection', p.BoolType, 0), 27 | 4: ('passphrase_protection', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/PublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .HDNodeType import HDNodeType 6 | 7 | 8 | class PublicKey(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 12 10 | 11 | def __init__( 12 | self, 13 | node: HDNodeType = None, 14 | xpub: str = None, 15 | ) -> None: 16 | self.node = node 17 | self.xpub = xpub 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('node', HDNodeType, 0), 23 | 2: ('xpub', p.UnicodeType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/RecoveryDeviceType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | ScrambledWords = 0 4 | Matrix = 1 5 | -------------------------------------------------------------------------------- /src/trezor/messages/RequestType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | TXINPUT = 0 4 | TXOUTPUT = 1 5 | TXMETA = 2 6 | TXFINISHED = 3 7 | TXEXTRADATA = 4 8 | -------------------------------------------------------------------------------- /src/trezor/messages/RippleAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class RippleAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 401 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/RippleGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class RippleGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 400 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/RipplePayment.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class RipplePayment(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | amount: int = None, 11 | destination: str = None, 12 | destination_tag: int = None, 13 | ) -> None: 14 | self.amount = amount 15 | self.destination = destination 16 | self.destination_tag = destination_tag 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('amount', p.UVarintType, 0), 22 | 2: ('destination', p.UnicodeType, 0), 23 | 3: ('destination_tag', p.UVarintType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/RippleSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class RippleSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 403 8 | 9 | def __init__( 10 | self, 11 | signature: bytes = None, 12 | serialized_tx: bytes = None, 13 | ) -> None: 14 | self.signature = signature 15 | self.serialized_tx = serialized_tx 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('signature', p.BytesType, 0), 21 | 2: ('serialized_tx', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/SetU2FCounter.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class SetU2FCounter(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 63 8 | 9 | def __init__( 10 | self, 11 | u2f_counter: int = None, 12 | ) -> None: 13 | self.u2f_counter = u2f_counter 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('u2f_counter', p.UVarintType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/SignIdentity.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .IdentityType import IdentityType 6 | 7 | 8 | class SignIdentity(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 53 10 | 11 | def __init__( 12 | self, 13 | identity: IdentityType = None, 14 | challenge_hidden: bytes = None, 15 | challenge_visual: str = None, 16 | ecdsa_curve_name: str = None, 17 | ) -> None: 18 | self.identity = identity 19 | self.challenge_hidden = challenge_hidden 20 | self.challenge_visual = challenge_visual 21 | self.ecdsa_curve_name = ecdsa_curve_name 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('identity', IdentityType, 0), 27 | 2: ('challenge_hidden', p.BytesType, 0), 28 | 3: ('challenge_visual', p.UnicodeType, 0), 29 | 4: ('ecdsa_curve_name', p.UnicodeType, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/SignedIdentity.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class SignedIdentity(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 54 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | public_key: bytes = None, 13 | signature: bytes = None, 14 | ) -> None: 15 | self.address = address 16 | self.public_key = public_key 17 | self.signature = signature 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('address', p.UnicodeType, 0), 23 | 2: ('public_key', p.BytesType, 0), 24 | 3: ('signature', p.BytesType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarAccountMergeOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarAccountMergeOp(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 218 8 | 9 | def __init__( 10 | self, 11 | source_account: str = None, 12 | destination_account: str = None, 13 | ) -> None: 14 | self.source_account = source_account 15 | self.destination_account = destination_account 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('source_account', p.UnicodeType, 0), 21 | 2: ('destination_account', p.UnicodeType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 208 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarAssetType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarAssetType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | type: int = None, 11 | code: str = None, 12 | issuer: str = None, 13 | ) -> None: 14 | self.type = type 15 | self.code = code 16 | self.issuer = issuer 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('type', p.UVarintType, 0), 22 | 2: ('code', p.UnicodeType, 0), 23 | 3: ('issuer', p.UnicodeType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarBumpSequenceOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarBumpSequenceOp(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 221 8 | 9 | def __init__( 10 | self, 11 | source_account: str = None, 12 | bump_to: int = None, 13 | ) -> None: 14 | self.source_account = source_account 15 | self.bump_to = bump_to 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('source_account', p.UnicodeType, 0), 21 | 2: ('bump_to', p.UVarintType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarChangeTrustOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .StellarAssetType import StellarAssetType 6 | 7 | 8 | class StellarChangeTrustOp(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 216 10 | 11 | def __init__( 12 | self, 13 | source_account: str = None, 14 | asset: StellarAssetType = None, 15 | limit: int = None, 16 | ) -> None: 17 | self.source_account = source_account 18 | self.asset = asset 19 | self.limit = limit 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('source_account', p.UnicodeType, 0), 25 | 2: ('asset', StellarAssetType, 0), 26 | 3: ('limit', p.UVarintType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarCreateAccountOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarCreateAccountOp(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 210 8 | 9 | def __init__( 10 | self, 11 | source_account: str = None, 12 | new_account: str = None, 13 | starting_balance: int = None, 14 | ) -> None: 15 | self.source_account = source_account 16 | self.new_account = new_account 17 | self.starting_balance = starting_balance 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('source_account', p.UnicodeType, 0), 23 | 2: ('new_account', p.UnicodeType, 0), 24 | 3: ('starting_balance', p.SVarintType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class StellarGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 207 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarManageDataOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarManageDataOp(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 220 8 | 9 | def __init__( 10 | self, 11 | source_account: str = None, 12 | key: str = None, 13 | value: bytes = None, 14 | ) -> None: 15 | self.source_account = source_account 16 | self.key = key 17 | self.value = value 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('source_account', p.UnicodeType, 0), 23 | 2: ('key', p.UnicodeType, 0), 24 | 3: ('value', p.BytesType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarPaymentOp.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .StellarAssetType import StellarAssetType 6 | 7 | 8 | class StellarPaymentOp(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 211 10 | 11 | def __init__( 12 | self, 13 | source_account: str = None, 14 | destination_account: str = None, 15 | asset: StellarAssetType = None, 16 | amount: int = None, 17 | ) -> None: 18 | self.source_account = source_account 19 | self.destination_account = destination_account 20 | self.asset = asset 21 | self.amount = amount 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('source_account', p.UnicodeType, 0), 27 | 2: ('destination_account', p.UnicodeType, 0), 28 | 3: ('asset', StellarAssetType, 0), 29 | 4: ('amount', p.SVarintType, 0), 30 | } 31 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 230 8 | 9 | def __init__( 10 | self, 11 | public_key: bytes = None, 12 | signature: bytes = None, 13 | ) -> None: 14 | self.public_key = public_key 15 | self.signature = signature 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('public_key', p.BytesType, 0), 21 | 2: ('signature', p.BytesType, 0), 22 | } 23 | -------------------------------------------------------------------------------- /src/trezor/messages/StellarTxOpRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class StellarTxOpRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 203 8 | -------------------------------------------------------------------------------- /src/trezor/messages/Success.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class Success(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 2 8 | 9 | def __init__( 10 | self, 11 | message: str = None, 12 | ) -> None: 13 | self.message = message 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('message', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TezosAddress(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 151 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | ) -> None: 13 | self.address = address 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('address', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosContractID.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TezosContractID(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | tag: int = None, 11 | hash: bytes = None, 12 | ) -> None: 13 | self.tag = tag 14 | self.hash = hash 15 | 16 | @classmethod 17 | def get_fields(cls): 18 | return { 19 | 1: ('tag', p.UVarintType, 0), 20 | 2: ('hash', p.BytesType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosContractType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | Implicit = 0 4 | Originated = 1 5 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosGetAddress.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class TezosGetAddress(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 150 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosGetPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | if __debug__: 6 | try: 7 | from typing import List 8 | except ImportError: 9 | List = None # type: ignore 10 | 11 | 12 | class TezosGetPublicKey(p.MessageType): 13 | MESSAGE_WIRE_TYPE = 154 14 | 15 | def __init__( 16 | self, 17 | address_n: List[int] = None, 18 | show_display: bool = None, 19 | ) -> None: 20 | self.address_n = address_n if address_n is not None else [] 21 | self.show_display = show_display 22 | 23 | @classmethod 24 | def get_fields(cls): 25 | return { 26 | 1: ('address_n', p.UVarintType, p.FLAG_REPEATED), 27 | 2: ('show_display', p.BoolType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosPublicKey.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TezosPublicKey(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 155 8 | 9 | def __init__( 10 | self, 11 | public_key: str = None, 12 | ) -> None: 13 | self.public_key = public_key 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('public_key', p.UnicodeType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/TezosSignedTx.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TezosSignedTx(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 153 8 | 9 | def __init__( 10 | self, 11 | signature: str = None, 12 | sig_op_contents: bytes = None, 13 | operation_hash: str = None, 14 | ) -> None: 15 | self.signature = signature 16 | self.sig_op_contents = sig_op_contents 17 | self.operation_hash = operation_hash 18 | 19 | @classmethod 20 | def get_fields(cls): 21 | return { 22 | 1: ('signature', p.UnicodeType, 0), 23 | 2: ('sig_op_contents', p.BytesType, 0), 24 | 3: ('operation_hash', p.UnicodeType, 0), 25 | } 26 | -------------------------------------------------------------------------------- /src/trezor/messages/TxAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .TransactionType import TransactionType 6 | 7 | 8 | class TxAck(p.MessageType): 9 | MESSAGE_WIRE_TYPE = 22 10 | 11 | def __init__( 12 | self, 13 | tx: TransactionType = None, 14 | ) -> None: 15 | self.tx = tx 16 | 17 | @classmethod 18 | def get_fields(cls): 19 | return { 20 | 1: ('tx', TransactionType, 0), 21 | } 22 | -------------------------------------------------------------------------------- /src/trezor/messages/TxOutputBinType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TxOutputBinType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | amount: int = None, 11 | script_pubkey: bytes = None, 12 | decred_script_version: int = None, 13 | ) -> None: 14 | self.amount = amount 15 | self.script_pubkey = script_pubkey 16 | self.decred_script_version = decred_script_version 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('amount', p.UVarintType, 0), # required 22 | 2: ('script_pubkey', p.BytesType, 0), # required 23 | 3: ('decred_script_version', p.UVarintType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/TxRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | from .TxRequestDetailsType import TxRequestDetailsType 6 | from .TxRequestSerializedType import TxRequestSerializedType 7 | 8 | 9 | class TxRequest(p.MessageType): 10 | MESSAGE_WIRE_TYPE = 21 11 | 12 | def __init__( 13 | self, 14 | request_type: int = None, 15 | details: TxRequestDetailsType = None, 16 | serialized: TxRequestSerializedType = None, 17 | ) -> None: 18 | self.request_type = request_type 19 | self.details = details 20 | self.serialized = serialized 21 | 22 | @classmethod 23 | def get_fields(cls): 24 | return { 25 | 1: ('request_type', p.UVarintType, 0), 26 | 2: ('details', TxRequestDetailsType, 0), 27 | 3: ('serialized', TxRequestSerializedType, 0), 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/TxRequestDetailsType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TxRequestDetailsType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | request_index: int = None, 11 | tx_hash: bytes = None, 12 | extra_data_len: int = None, 13 | extra_data_offset: int = None, 14 | ) -> None: 15 | self.request_index = request_index 16 | self.tx_hash = tx_hash 17 | self.extra_data_len = extra_data_len 18 | self.extra_data_offset = extra_data_offset 19 | 20 | @classmethod 21 | def get_fields(cls): 22 | return { 23 | 1: ('request_index', p.UVarintType, 0), 24 | 2: ('tx_hash', p.BytesType, 0), 25 | 3: ('extra_data_len', p.UVarintType, 0), 26 | 4: ('extra_data_offset', p.UVarintType, 0), 27 | } 28 | -------------------------------------------------------------------------------- /src/trezor/messages/TxRequestSerializedType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class TxRequestSerializedType(p.MessageType): 7 | 8 | def __init__( 9 | self, 10 | signature_index: int = None, 11 | signature: bytes = None, 12 | serialized_tx: bytes = None, 13 | ) -> None: 14 | self.signature_index = signature_index 15 | self.signature = signature 16 | self.serialized_tx = serialized_tx 17 | 18 | @classmethod 19 | def get_fields(cls): 20 | return { 21 | 1: ('signature_index', p.UVarintType, 0), 22 | 2: ('signature', p.BytesType, 0), 23 | 3: ('serialized_tx', p.BytesType, 0), 24 | } 25 | -------------------------------------------------------------------------------- /src/trezor/messages/VerifyMessage.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class VerifyMessage(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 39 8 | 9 | def __init__( 10 | self, 11 | address: str = None, 12 | signature: bytes = None, 13 | message: bytes = None, 14 | coin_name: str = None, 15 | ) -> None: 16 | self.address = address 17 | self.signature = signature 18 | self.message = message 19 | self.coin_name = coin_name 20 | 21 | @classmethod 22 | def get_fields(cls): 23 | return { 24 | 1: ('address', p.UnicodeType, 0), 25 | 2: ('signature', p.BytesType, 0), 26 | 3: ('message', p.BytesType, 0), 27 | 4: ('coin_name', p.UnicodeType, 0), # default=Bitcoin 28 | } 29 | -------------------------------------------------------------------------------- /src/trezor/messages/WipeDevice.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class WipeDevice(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 5 8 | -------------------------------------------------------------------------------- /src/trezor/messages/WordAck.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class WordAck(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 47 8 | 9 | def __init__( 10 | self, 11 | word: str = None, 12 | ) -> None: 13 | self.word = word 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('word', p.UnicodeType, 0), # required 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/WordRequest.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | import protobuf as p 4 | 5 | 6 | class WordRequest(p.MessageType): 7 | MESSAGE_WIRE_TYPE = 46 8 | 9 | def __init__( 10 | self, 11 | type: int = None, 12 | ) -> None: 13 | self.type = type 14 | 15 | @classmethod 16 | def get_fields(cls): 17 | return { 18 | 1: ('type', p.UVarintType, 0), 19 | } 20 | -------------------------------------------------------------------------------- /src/trezor/messages/WordRequestType.py: -------------------------------------------------------------------------------- 1 | # Automatically generated by pb2py 2 | # fmt: off 3 | Plain = 0 4 | Matrix9 = 1 5 | Matrix6 = 2 6 | -------------------------------------------------------------------------------- /src/trezor/res/.gitignore: -------------------------------------------------------------------------------- 1 | resources.py 2 | -------------------------------------------------------------------------------- /src/trezor/res/__init__.py: -------------------------------------------------------------------------------- 1 | try: 2 | from .resources import resdata 3 | except ImportError: 4 | resdata = None 5 | 6 | 7 | def load(name): 8 | """ 9 | Loads resource of a given name as bytes. 10 | """ 11 | return resdata[name] 12 | 13 | 14 | def gettext(message): 15 | """ 16 | Returns localized string. This function is aliased to _. 17 | """ 18 | return message 19 | 20 | 21 | _ = gettext 22 | -------------------------------------------------------------------------------- /src/trezor/res/cancel.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/cancel.toig -------------------------------------------------------------------------------- /src/trezor/res/check.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/check.toig -------------------------------------------------------------------------------- /src/trezor/res/click.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/click.toig -------------------------------------------------------------------------------- /src/trezor/res/confirm.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/confirm.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/cog.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/cog.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/nocopy.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/nocopy.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/receive.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/receive.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/recovery.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/recovery.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/reset.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/reset.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/send.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/send.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/wipe.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/wipe.toig -------------------------------------------------------------------------------- /src/trezor/res/header_icons/wrong.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/header_icons/wrong.toig -------------------------------------------------------------------------------- /src/trezor/res/left.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/left.toig -------------------------------------------------------------------------------- /src/trezor/res/lock.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/lock.toig -------------------------------------------------------------------------------- /src/trezor/res/pin_close.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/pin_close.toig -------------------------------------------------------------------------------- /src/trezor/res/recovery.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/recovery.toig -------------------------------------------------------------------------------- /src/trezor/res/space.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/space.toig -------------------------------------------------------------------------------- /src/trezor/res/swipe.toig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/trezor/trezor-core/18c3a6a5bd45923380312b064be96155f5a7377d/src/trezor/res/swipe.toig -------------------------------------------------------------------------------- /src/trezor/ui/container.py: -------------------------------------------------------------------------------- 1 | from trezor.ui import Widget 2 | 3 | 4 | class Container(Widget): 5 | def __init__(self, *children): 6 | self.children = children 7 | 8 | def taint(self): 9 | super().taint() 10 | for child in self.children: 11 | child.taint() 12 | 13 | def render(self): 14 | for child in self.children: 15 | child.render() 16 | 17 | def touch(self, event, pos): 18 | for child in self.children: 19 | result = child.touch(event, pos) 20 | if result is not None: 21 | return result 22 | -------------------------------------------------------------------------------- /src/trezor/ui/qr.py: -------------------------------------------------------------------------------- 1 | from trezor import ui 2 | 3 | 4 | class Qr(ui.Widget): 5 | def __init__(self, data, pos, scale): 6 | self.data = data 7 | self.pos = pos 8 | self.scale = scale 9 | 10 | def render(self): 11 | ui.display.qrcode(self.pos[0], self.pos[1], self.data, self.scale) 12 | -------------------------------------------------------------------------------- /src1/main.py: -------------------------------------------------------------------------------- 1 | import usb 2 | 3 | usb.bus.open() 4 | 5 | import trezorio as io 6 | from trezorui import Display 7 | 8 | d = Display() 9 | 10 | d.clear() 11 | d.backlight(255) 12 | 13 | i = 0 14 | 15 | while True: 16 | d.print('Loop %d\n' % i) 17 | i += 1 18 | r = [0, 0] 19 | if io.poll([io.TOUCH], r, 1000000): 20 | print('TOUCH', r) 21 | else: 22 | print('NOTOUCH') 23 | -------------------------------------------------------------------------------- /src1/usb.py: -------------------------------------------------------------------------------- 1 | import trezorio as io 2 | 3 | iface_wire = io.WebUSB( 4 | iface_num=0, 5 | ep_in=0x81, 6 | ep_out=0x01, 7 | ) 8 | 9 | iface_vcp = io.VCP( 10 | iface_num=2, 11 | data_iface_num=3, 12 | ep_in=0x83, 13 | ep_out=0x03, 14 | ep_cmd=0x84, 15 | ) 16 | 17 | bus = io.USB( 18 | vendor_id=0x1209, 19 | product_id=0x53C1, 20 | release_num=0x0100, 21 | manufacturer="SatoshiLabs", 22 | product="TREZOR", 23 | interface="TREZOR Interface", 24 | serial_number="1234", 25 | usb21_landing=False, 26 | ) 27 | 28 | bus.add(iface_wire) 29 | bus.add(iface_vcp) 30 | -------------------------------------------------------------------------------- /src_game/main.py: -------------------------------------------------------------------------------- 1 | import game_2048 2 | -------------------------------------------------------------------------------- /src_game/trezor: -------------------------------------------------------------------------------- 1 | ../src/trezor -------------------------------------------------------------------------------- /tests/check_coverage.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | find ../mocks -name '*.py' | sort | while read module; do 3 | module=$(echo $module | sed 's:^\.\./mocks/::') 4 | base=$(basename $module) 5 | # skip __init__.py 6 | if [[ $base == "__init__.py" ]]; then 7 | continue 8 | fi 9 | # skip everything outside of trezor 10 | if [[ $module != trezor* ]]; then 11 | continue 12 | fi 13 | # skip classes (uppercase modules) 14 | if [[ $base == [ABCDEFGHIJKLMNOPQRSTUVWXYZ]* ]]; then 15 | continue 16 | fi 17 | module=$(echo $module | sed -e 's:\.py$::' -e 's:/:.:g') 18 | 19 | if [ -r test_$module.py ]; then 20 | echo "OK $module" 21 | else 22 | echo "MISS $module" 23 | missing=$(expr $missing + 1) 24 | fi 25 | 26 | done 27 | -------------------------------------------------------------------------------- /tests/common.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | sys.path.append('../src') 4 | 5 | from ubinascii import hexlify, unhexlify # noqa: F401 6 | 7 | import unittest # noqa: F401 8 | -------------------------------------------------------------------------------- /tests/run_tests_device_emu.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | MICROPYTHON=../build/unix/micropython 4 | PYOPT=0 5 | 6 | # run emulator 7 | cd ../src 8 | $MICROPYTHON -O$PYOPT main.py >/dev/null & 9 | upy_pid=$! 10 | sleep 1 11 | 12 | export TREZOR_PATH=udp:127.0.0.1:21324 13 | 14 | # run tests 15 | cd .. 16 | error=0 17 | if ! pytest "$@"; then 18 | error=1 19 | fi 20 | kill $upy_pid 21 | exit $error 22 | -------------------------------------------------------------------------------- /tests/test_apps.common.coins.py: -------------------------------------------------------------------------------- 1 | from common import * 2 | 3 | from apps.common import coins 4 | 5 | 6 | class TestCoins(unittest.TestCase): 7 | 8 | def test_coins(self): 9 | ref = [ 10 | ('BTC', 'Bitcoin', 0), 11 | ('NMC', 'Namecoin', 52), 12 | ('LTC', 'Litecoin', 48), 13 | ('DASH', 'Dash', 76), 14 | ('ZEC', 'Zcash', 7352), 15 | ('TAZ', 'Zcash Testnet', 7461), 16 | ] 17 | for s, n, a in ref: 18 | c1 = coins.by_shortcut(s) 19 | c2 = coins.by_name(n) 20 | self.assertEqual(c1, c2) 21 | self.assertEqual(c1.address_type, a) 22 | 23 | def test_failure(self): 24 | with self.assertRaises(ValueError): 25 | coins.by_shortcut('XXX') 26 | with self.assertRaises(ValueError): 27 | coins.by_name('XXXXX') 28 | 29 | 30 | if __name__ == '__main__': 31 | unittest.main() 32 | -------------------------------------------------------------------------------- /tests/test_apps.common.storage.py: -------------------------------------------------------------------------------- 1 | from common import * 2 | from trezor.pin import pin_to_int 3 | from trezor import config 4 | from apps.common import storage 5 | 6 | 7 | class TestConfig(unittest.TestCase): 8 | 9 | def test_counter(self): 10 | config.init() 11 | config.wipe() 12 | for i in range(150): 13 | self.assertEqual(storage.next_u2f_counter(), i) 14 | storage.set_u2f_counter(350) 15 | for i in range(351, 500): 16 | self.assertEqual(storage.next_u2f_counter(), i) 17 | storage.set_u2f_counter(0) 18 | self.assertEqual(storage.next_u2f_counter(), 1) 19 | storage.set_u2f_counter(None) 20 | self.assertEqual(storage.next_u2f_counter(), 0) 21 | 22 | 23 | if __name__ == '__main__': 24 | unittest.main() 25 | -------------------------------------------------------------------------------- /tests/test_apps.wallet.signtx.scripts.py: -------------------------------------------------------------------------------- 1 | from common import * 2 | 3 | from apps.wallet.sign_tx.scripts import script_replay_protection_bip115 4 | 5 | class TestSigntxScripts(unittest.TestCase): 6 | # pylint: disable=C0301 7 | 8 | def test_script_replay_protection_bip115(self): 9 | vectors=[ 10 | ('206ec9b310745775c20cbe5bae8751daeb7f086cf913399d4f7634ef2a0000000003122005b4', '6ec9b310745775c20cbe5bae8751daeb7f086cf913399d4f7634ef2a00000000', 335890), 11 | ('20caaa71b60cf893c1604b38e5af1bdc322dbb31818239088647272d1400000000030e2005b4', 'caaa71b60cf893c1604b38e5af1bdc322dbb31818239088647272d1400000000', 335886), 12 | ] 13 | for out, hsh, height in vectors: 14 | hsh = unhexlify(hsh) 15 | res = hexlify(script_replay_protection_bip115(hsh, height)).decode() 16 | self.assertEqual(out, res) 17 | 18 | 19 | if __name__ == '__main__': 20 | unittest.main() 21 | -------------------------------------------------------------------------------- /tests/test_trezor.crypto.crc.py: -------------------------------------------------------------------------------- 1 | from common import * 2 | 3 | from trezor.crypto import crc 4 | 5 | 6 | class TestCryptoCrc(unittest.TestCase): 7 | 8 | vectors_crc32 = [ 9 | ('123456789', 0xCBF43926), 10 | (unhexlify('0000000000000000000000000000000000000000000000000000000000000000'), 0x190A55AD), 11 | (unhexlify('FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF'), 0xFF6CAB0B), 12 | (unhexlify('000102030405060708090A0B0C0D0E0F101112131415161718191A1B1C1D1E1F'), 0x91267E8A), 13 | ('The quick brown fox jumps over the lazy dog', 0x414FA339), 14 | ] 15 | 16 | def test_crc32(self): 17 | for i, o in self.vectors_crc32: 18 | self.assertEqual(crc.crc32(i), o) 19 | 20 | 21 | if __name__ == '__main__': 22 | unittest.main() 23 | -------------------------------------------------------------------------------- /tests/test_trezor.utils.py: -------------------------------------------------------------------------------- 1 | from common import * 2 | 3 | from trezor import utils 4 | 5 | 6 | class TestUtils(unittest.TestCase): 7 | 8 | def test_chunks(self): 9 | c = list(utils.chunks(range(100), 7)) 10 | for i in range(15): 11 | # need to check start, stop, step attrs until https://github.com/micropython/micropython/issues/2600 is resolved 12 | self.assertEqual(c[i].start, i * 7) 13 | self.assertEqual(c[i].stop, 100 if (i == 14) else (i + 1) * 7) 14 | self.assertEqual(c[i].step, 1) 15 | 16 | 17 | if __name__ == '__main__': 18 | unittest.main() 19 | -------------------------------------------------------------------------------- /tools/build_templates: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | CWD=`dirname "$0"` 5 | RENDER="$CWD/../vendor/trezor-common/tools/cointool.py render" 6 | 7 | FIND_TEMPLATES="find $CWD/../src -name *.mako" 8 | 9 | check_results() { 10 | CHECK_FAIL=0 11 | for filename in $($FIND_TEMPLATES); do 12 | TMP=`mktemp` 13 | TARGET="${filename%%.mako}" 14 | $RENDER "$filename" -o $TMP 15 | if ! diff -u "$TARGET" "$TMP"; then 16 | CHECK_FAIL=1 17 | fi 18 | done 19 | exit $CHECK_FAIL 20 | } 21 | 22 | if [ "$1" = "--check" ]; then 23 | check_results 24 | else 25 | $FIND_TEMPLATES | xargs $RENDER 26 | fi 27 | -------------------------------------------------------------------------------- /tools/clang-format-check: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | error=0 3 | for f in $*; do 4 | changes=$(clang-format -output-replacements-xml "$f" | grep -c '^ 0: 9 | t = TrezorClient(devices[0]) 10 | else: 11 | raise Exception("No TREZOR found") 12 | 13 | for i in [0, 1, 2]: 14 | path = "m/10018'/%d'" % i 15 | pk = t.get_public_node( 16 | t.expand_path(path), ecdsa_curve_name="ed25519", show_display=True 17 | ) 18 | print(path, "=>", binascii.hexlify(pk.node.public_key).decode()) 19 | -------------------------------------------------------------------------------- /tools/combine_firmware: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import sys 3 | 4 | 5 | def pairwise(iterable): 6 | a = iter(iterable) 7 | return zip(a, a) 8 | 9 | 10 | files = sys.argv[1:] 11 | files = list(pairwise(files)) 12 | 13 | offset = int(files[0][0], 16) 14 | 15 | out = bytearray() 16 | 17 | for addr, fn in files: 18 | addr = int(addr, 16) - offset 19 | data = open(fn, "rb").read() 20 | if len(out) < addr: 21 | out += b"\x00" * (addr - len(out)) 22 | if len(out) != addr: 23 | raise Exception("Alignment failed") 24 | out += data 25 | 26 | sys.stdout.buffer.write(out) 27 | -------------------------------------------------------------------------------- /tools/hid-bridge/50-hid-bridge.rules: -------------------------------------------------------------------------------- 1 | KERNELS=="uhid", KERNEL=="hidraw*", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" 2 | KERNEL=="uhid", MODE="0660", MODE="0660", GROUP="plugdev", TAG+="uaccess", TAG+="udev-acl" 3 | -------------------------------------------------------------------------------- /tools/hid-bridge/README.md: -------------------------------------------------------------------------------- 1 | # hid-bridge 2 | 3 | Creates a virtual hid device which can be controlled by a user driver via a UDP port. 4 | 5 | ## Installation 6 | 7 | You need Python 3.5 or higher. 8 | 9 | The uhid driver is required. If it is build as a module and not loaded, load it by `modprobe uhid`. 10 | 11 | You must have read/write permission to the `/dev/uhid/` device as same as to the newly created `/dev/hidraw*` device. This may be accomplished by copying `50-hid-bridge.rules` into `/dev/udev/rules.d/`. You may need to reload the driver. 12 | 13 | ## Usage 14 | 15 | Run [TREZOR emulator](https://github.com/trezor/trezor-core/blob/master/docs/emulator.md) and `./hid-bridge`. 16 | 17 | ## Known issues 18 | 19 | Does not work with Firefox. Firefox closes hid devices on the lost of the focus. 20 | 21 | Does not work with the emulator in the debug mode sice emulator doesn't start hid interface. 22 | -------------------------------------------------------------------------------- /tools/hid-bridge/logger.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | log_level = "None" 4 | log_timestamps = False 5 | 6 | 7 | def __get_timestamp(): 8 | return str(datetime.datetime.now()) 9 | 10 | 11 | def __log_message(message): 12 | if log_timestamps == True: 13 | print("{}\t{}".format(__get_timestamp(), message)) 14 | else: 15 | print(message) 16 | 17 | 18 | def log_uhid_event(event_name, params=None): 19 | if log_level == "uhid-event": 20 | if params: 21 | __log_message("{}\t{}".format(event_name, params)) 22 | else: 23 | __log_message(event_name) 24 | 25 | 26 | def log_hid_packet(packet_name, payload): 27 | if log_level == "hid-packet": 28 | __log_message("{}\t{}".format(packet_name, payload)) 29 | 30 | 31 | def log_raw(direction, payload): 32 | if log_level == "raw": 33 | __log_message("{}\t{}".format(direction, payload)) 34 | -------------------------------------------------------------------------------- /travis-install-libsodium.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # libsodium-dev replacement 3 | # 4 | # The purpose of this file is to install libsodium in 5 | # the Travis CI environment. Outside this environment, 6 | # you would probably not want to install it like this. 7 | 8 | set -e 9 | export LIBSODIUM_VER="1.0.16" 10 | 11 | # check if libsodium is already installed 12 | if [ ! -d "$HOME/libsodium/lib" ]; then 13 | wget "https://github.com/jedisct1/libsodium/releases/download/${LIBSODIUM_VER}/libsodium-${LIBSODIUM_VER}.tar.gz" 14 | tar xvfz "libsodium-${LIBSODIUM_VER}.tar.gz" 15 | cd "libsodium-${LIBSODIUM_VER}" 16 | ./configure --prefix=$HOME/libsodium 17 | make 18 | make install 19 | else 20 | echo 'Using cached directory.' 21 | fi 22 | --------------------------------------------------------------------------------