signatory.proto 2.7 KB

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