signatory.proto 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. bytes 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. bytes id = 1;
  50. CurrencyUnit unit = 2;
  51. bool active = 3;
  52. uint64 input_fee_ppk = 4;
  53. Keys keys = 5;
  54. optional uint64 final_expiry = 6;
  55. uint64 version = 7;
  56. repeated uint64 amounts = 8;
  57. }
  58. message Keys {
  59. map<uint64, bytes> keys = 1;
  60. }
  61. message RotationRequest {
  62. CurrencyUnit unit = 1;
  63. uint64 input_fee_ppk = 2;
  64. repeated uint64 amounts = 3;
  65. }
  66. enum CurrencyUnitType {
  67. CURRENCY_UNIT_TYPE_UNSPECIFIED = 0;
  68. CURRENCY_UNIT_TYPE_SAT = 1;
  69. CURRENCY_UNIT_TYPE_MSAT = 2;
  70. CURRENCY_UNIT_TYPE_USD = 3;
  71. CURRENCY_UNIT_TYPE_EUR = 4;
  72. CURRENCY_UNIT_TYPE_AUTH = 5;
  73. }
  74. message CurrencyUnit {
  75. oneof currency_unit {
  76. CurrencyUnitType unit = 1;
  77. string custom_unit = 2;
  78. }
  79. }
  80. message Proofs {
  81. repeated Proof proof = 1;
  82. Operation operation = 3;
  83. string correlation_id = 4;
  84. }
  85. message Proof {
  86. uint64 amount = 1;
  87. bytes keyset_id = 2;
  88. bytes secret = 3;
  89. bytes c = 4;
  90. }
  91. message BlindSignatures {
  92. repeated BlindSignature blind_signatures = 1;
  93. }
  94. message BlindSignature {
  95. uint64 amount = 1;
  96. bytes keyset_id = 2;
  97. bytes blinded_secret = 3;
  98. optional BlindSignatureDLEQ dleq = 4;
  99. }
  100. message BlindSignatureDLEQ {
  101. bytes e = 1;
  102. bytes s = 2;
  103. }
  104. enum ErrorCode {
  105. ERROR_CODE_UNSPECIFIED = 0;
  106. ERROR_CODE_AMOUNT_OUTSIDE_LIMIT = 1;
  107. ERROR_CODE_DUPLICATE_INPUTS_PROVIDED = 2;
  108. ERROR_CODE_DUPLICATE_OUTPUTS_PROVIDED = 3;
  109. ERROR_CODE_KEYSET_NOT_KNOWN = 4;
  110. ERROR_CODE_KEYSET_INACTIVE = 5;
  111. ERROR_CODE_MINTING_DISABLED = 6;
  112. ERROR_CODE_COULD_NOT_ROTATE_KEYSET = 7;
  113. ERROR_CODE_INVALID_PROOF = 8;
  114. ERROR_CODE_INVALID_BLIND_MESSAGE = 9;
  115. ERROR_CODE_UNIT_NOT_SUPPORTED = 10;
  116. }
  117. message Error {
  118. ErrorCode code = 1;
  119. string detail = 2;
  120. }
  121. message EmptyRequest {}