signatory.proto 2.8 KB

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