signatory.proto 3.0 KB

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