signatory.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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. }
  77. message ProofDLEQ {
  78. bytes e = 1;
  79. bytes s = 2;
  80. bytes r = 3;
  81. }
  82. message SigningResponse {
  83. Error error = 1;
  84. BlindSignatures blind_signatures = 2;
  85. }
  86. message BlindSignatures {
  87. repeated BlindSignature blind_signatures = 1;
  88. }
  89. message BlindSignature {
  90. uint64 amount = 1;
  91. string keyset_id = 2;
  92. bytes blinded_secret = 3;
  93. optional BlindSignatureDLEQ dleq = 4;
  94. }
  95. message BlindSignatureDLEQ {
  96. bytes e = 1;
  97. bytes s = 2;
  98. }
  99. // Witness type
  100. message Witness {
  101. oneof witness_type {
  102. P2PKWitness p2pk_witness = 1;
  103. HTLCWitness htlc_witness = 2;
  104. }
  105. }
  106. // P2PKWitness type
  107. message P2PKWitness {
  108. // List of signatures
  109. repeated string signatures = 1;
  110. }
  111. // HTLCWitness type
  112. message HTLCWitness {
  113. // Preimage
  114. string preimage = 1;
  115. // List of signatures
  116. repeated string signatures = 2;
  117. }
  118. enum ErrorCode {
  119. UNKNOWN = 0;
  120. AMOUNT_OUTSIDE_LIMIT = 1;
  121. DUPLICATE_INPUTS_PROVIDED = 2;
  122. DUPLICATE_OUTPUTS_PROVIDED = 3;
  123. KEYSET_NOT_KNOWN = 4;
  124. KEYSET_INACTIVE = 5;
  125. MINTING_DISABLED = 6;
  126. COULD_NOT_ROTATE_KEYSET = 7;
  127. INVALID_PROOF = 8;
  128. INVALID_BLIND_MESSAGE = 9;
  129. UNIT_NOT_SUPPORTED = 10;
  130. }
  131. message Error {
  132. ErrorCode code = 1;
  133. string detail = 2;
  134. }
  135. message EmptyRequest {}