messages-common.proto 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. // This file originates from the SatoshiLabs Trezor `common` repository at:
  2. // https://github.com/trezor/trezor-common/blob/master/protob/messages-common.proto
  3. // dated 28.05.2019, commit 893fd219d4a01bcffa0cd9cfa631856371ec5aa9.
  4. syntax = "proto2";
  5. package hw.trezor.messages.common;
  6. /**
  7. * Response: Success of the previous request
  8. * @end
  9. */
  10. message Success {
  11. optional string message = 1; // human readable description of action or request-specific payload
  12. }
  13. /**
  14. * Response: Failure of the previous request
  15. * @end
  16. */
  17. message Failure {
  18. optional FailureType code = 1; // computer-readable definition of the error state
  19. optional string message = 2; // human-readable message of the error state
  20. enum FailureType {
  21. Failure_UnexpectedMessage = 1;
  22. Failure_ButtonExpected = 2;
  23. Failure_DataError = 3;
  24. Failure_ActionCancelled = 4;
  25. Failure_PinExpected = 5;
  26. Failure_PinCancelled = 6;
  27. Failure_PinInvalid = 7;
  28. Failure_InvalidSignature = 8;
  29. Failure_ProcessError = 9;
  30. Failure_NotEnoughFunds = 10;
  31. Failure_NotInitialized = 11;
  32. Failure_PinMismatch = 12;
  33. Failure_FirmwareError = 99;
  34. }
  35. }
  36. /**
  37. * Response: Device is waiting for HW button press.
  38. * @auxstart
  39. * @next ButtonAck
  40. */
  41. message ButtonRequest {
  42. optional ButtonRequestType code = 1;
  43. optional string data = 2;
  44. /**
  45. * Type of button request
  46. */
  47. enum ButtonRequestType {
  48. ButtonRequest_Other = 1;
  49. ButtonRequest_FeeOverThreshold = 2;
  50. ButtonRequest_ConfirmOutput = 3;
  51. ButtonRequest_ResetDevice = 4;
  52. ButtonRequest_ConfirmWord = 5;
  53. ButtonRequest_WipeDevice = 6;
  54. ButtonRequest_ProtectCall = 7;
  55. ButtonRequest_SignTx = 8;
  56. ButtonRequest_FirmwareCheck = 9;
  57. ButtonRequest_Address = 10;
  58. ButtonRequest_PublicKey = 11;
  59. ButtonRequest_MnemonicWordCount = 12;
  60. ButtonRequest_MnemonicInput = 13;
  61. ButtonRequest_PassphraseType = 14;
  62. ButtonRequest_UnknownDerivationPath = 15;
  63. }
  64. }
  65. /**
  66. * Request: Computer agrees to wait for HW button press
  67. * @auxend
  68. */
  69. message ButtonAck {
  70. }
  71. /**
  72. * Response: Device is asking computer to show PIN matrix and awaits PIN encoded using this matrix scheme
  73. * @auxstart
  74. * @next PinMatrixAck
  75. */
  76. message PinMatrixRequest {
  77. optional PinMatrixRequestType type = 1;
  78. /**
  79. * Type of PIN request
  80. */
  81. enum PinMatrixRequestType {
  82. PinMatrixRequestType_Current = 1;
  83. PinMatrixRequestType_NewFirst = 2;
  84. PinMatrixRequestType_NewSecond = 3;
  85. }
  86. }
  87. /**
  88. * Request: Computer responds with encoded PIN
  89. * @auxend
  90. */
  91. message PinMatrixAck {
  92. required string pin = 1; // matrix encoded PIN entered by user
  93. }
  94. /**
  95. * Response: Device awaits encryption passphrase
  96. * @auxstart
  97. * @next PassphraseAck
  98. */
  99. message PassphraseRequest {
  100. optional bool on_device = 1; // passphrase is being entered on the device
  101. }
  102. /**
  103. * Request: Send passphrase back
  104. * @next PassphraseStateRequest
  105. */
  106. message PassphraseAck {
  107. optional string passphrase = 1;
  108. optional bytes state = 2; // expected device state
  109. }
  110. /**
  111. * Response: Device awaits passphrase state
  112. * @next PassphraseStateAck
  113. */
  114. message PassphraseStateRequest {
  115. optional bytes state = 1; // actual device state
  116. }
  117. /**
  118. * Request: Send passphrase state back
  119. * @auxend
  120. */
  121. message PassphraseStateAck {
  122. }
  123. /**
  124. * Structure representing BIP32 (hierarchical deterministic) node
  125. * Used for imports of private key into the device and exporting public key out of device
  126. * @embed
  127. */
  128. message HDNodeType {
  129. required uint32 depth = 1;
  130. required uint32 fingerprint = 2;
  131. required uint32 child_num = 3;
  132. required bytes chain_code = 4;
  133. optional bytes private_key = 5;
  134. optional bytes public_key = 6;
  135. }