signatory.proto 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. syntax = "proto3";
  2. package signatory;
  3. service Signatory {
  4. rpc BlindSign(BlindedMessages) returns (BlindSignResponse);
  5. rpc VerifyProofs(Proofs) returns (BooleanResponse);
  6. // returns all the keysets for the mint
  7. rpc Keysets(EmptyRequest) returns (KeysResponse);
  8. // rotates the keysets
  9. rpc RotateKeyset(RotationRequest) returns (KeyRotationResponse);
  10. }
  11. enum Operation {
  12. OPERATION_UNSPECIFIED = 0;
  13. OPERATION_MINT = 1;
  14. OPERATION_MELT = 2;
  15. OPERATION_SWAP = 3;
  16. }
  17. message BlindSignResponse {
  18. Error error = 1;
  19. BlindSignatures sigs = 2;
  20. }
  21. message BlindedMessages {
  22. repeated BlindedMessage blinded_messages = 1;
  23. Operation operation = 2;
  24. string correlation_id = 3;
  25. }
  26. // Represents a blinded message
  27. message BlindedMessage {
  28. uint64 amount = 1;
  29. string keyset_id = 2;
  30. bytes blinded_secret = 3;
  31. }
  32. message BooleanResponse {
  33. Error error = 1;
  34. bool success = 2;
  35. }
  36. message KeyRotationResponse {
  37. Error error = 1;
  38. KeySet keyset = 2;
  39. }
  40. message KeysResponse {
  41. Error error = 1;
  42. SignatoryKeysets keysets = 2;
  43. }
  44. message SignatoryKeysets {
  45. bytes pubkey = 1;
  46. repeated KeySet keysets = 2;
  47. }
  48. message KeySet {
  49. string id = 1;
  50. CurrencyUnit unit = 2;
  51. bool active = 3;
  52. uint64 input_fee_ppk = 4;
  53. Keys keys = 5;
  54. }
  55. message Keys {
  56. map<uint64, bytes> keys = 1;
  57. }
  58. message RotationRequest {
  59. CurrencyUnit unit = 1;
  60. uint64 input_fee_ppk = 2;
  61. uint32 max_order = 3;
  62. }
  63. enum CurrencyUnitType {
  64. CURRENCY_UNIT_TYPE_UNSPECIFIED = 0;
  65. CURRENCY_UNIT_TYPE_SAT = 1;
  66. CURRENCY_UNIT_TYPE_MSAT = 2;
  67. CURRENCY_UNIT_TYPE_USD = 3;
  68. CURRENCY_UNIT_TYPE_EUR = 4;
  69. CURRENCY_UNIT_TYPE_AUTH = 5;
  70. }
  71. message CurrencyUnit {
  72. oneof currency_unit {
  73. CurrencyUnitType unit = 1;
  74. string custom_unit = 2;
  75. }
  76. }
  77. message Proofs {
  78. repeated Proof proof = 1;
  79. Operation operation = 3;
  80. string correlation_id = 4;
  81. }
  82. message Proof {
  83. uint64 amount = 1;
  84. string keyset_id = 2;
  85. bytes secret = 3;
  86. bytes c = 4;
  87. }
  88. message ProofDLEQ {
  89. bytes e = 1;
  90. bytes s = 2;
  91. bytes r = 3;
  92. }
  93. message SigningResponse {
  94. Error error = 1;
  95. BlindSignatures blind_signatures = 2;
  96. }
  97. message BlindSignatures {
  98. repeated BlindSignature blind_signatures = 1;
  99. }
  100. message BlindSignature {
  101. uint64 amount = 1;
  102. string keyset_id = 2;
  103. bytes blinded_secret = 3;
  104. optional BlindSignatureDLEQ dleq = 4;
  105. }
  106. message BlindSignatureDLEQ {
  107. bytes e = 1;
  108. bytes s = 2;
  109. }
  110. // Witness type
  111. message Witness {
  112. oneof witness_type {
  113. P2PKWitness p2pk_witness = 1;
  114. HTLCWitness htlc_witness = 2;
  115. }
  116. }
  117. // P2PKWitness type
  118. message P2PKWitness {
  119. // List of signatures
  120. repeated string signatures = 1;
  121. }
  122. // HTLCWitness type
  123. message HTLCWitness {
  124. // Preimage
  125. string preimage = 1;
  126. // List of signatures
  127. repeated string signatures = 2;
  128. }
  129. enum ErrorCode {
  130. ERROR_CODE_UNSPECIFIED = 0;
  131. ERROR_CODE_AMOUNT_OUTSIDE_LIMIT = 1;
  132. ERROR_CODE_DUPLICATE_INPUTS_PROVIDED = 2;
  133. ERROR_CODE_DUPLICATE_OUTPUTS_PROVIDED = 3;
  134. ERROR_CODE_KEYSET_NOT_KNOWN = 4;
  135. ERROR_CODE_KEYSET_INACTIVE = 5;
  136. ERROR_CODE_MINTING_DISABLED = 6;
  137. ERROR_CODE_COULD_NOT_ROTATE_KEYSET = 7;
  138. ERROR_CODE_INVALID_PROOF = 8;
  139. ERROR_CODE_INVALID_BLIND_MESSAGE = 9;
  140. ERROR_CODE_UNIT_NOT_SUPPORTED = 10;
  141. }
  142. message Error {
  143. ErrorCode code = 1;
  144. string detail = 2;
  145. }
  146. message EmptyRequest {}