signatory.proto 3.2 KB

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