signatory.proto 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. syntax = "proto3";
  2. package signatory;
  3. service Signatory {
  4. rpc BlindSign(BlindedMessage) returns (BlindSignature);
  5. rpc VerifyProof(Proof) returns (Empty);
  6. rpc Keysets(Empty) returns (VecSignatoryKeySet);
  7. rpc RotateKeyset(RotateKeyArguments) returns (MintKeySetInfo);
  8. }
  9. message Empty {}
  10. message VecSignatoryKeySet {
  11. repeated SignatoryKeySet keysets = 1;
  12. optional bool is_none = 2;
  13. }
  14. message SignatoryKeySet {
  15. KeySet key = 1;
  16. MintKeySetInfo info = 2;
  17. }
  18. message KeySet {
  19. Id id = 1;
  20. CurrencyUnit unit = 2;
  21. Keys keys = 3;
  22. }
  23. message Keys {
  24. map<uint64, bytes> keys = 1;
  25. }
  26. message RotateKeyArguments {
  27. CurrencyUnit unit = 1;
  28. optional uint32 derivation_path_index = 2;
  29. uint32 max_order = 3;
  30. uint64 input_fee_ppk = 4;
  31. }
  32. message CustomDerivationPath {
  33. CurrencyUnit unit = 1;
  34. repeated DerivationPath derivation_path = 2;
  35. }
  36. enum CurrencyUnitType {
  37. SAT = 0;
  38. MSAT = 1;
  39. USD = 2;
  40. EUR = 3;
  41. }
  42. message CurrencyUnit {
  43. oneof currency_unit {
  44. CurrencyUnitType unit = 1;
  45. string custom_unit = 2;
  46. }
  47. }
  48. message Proof {
  49. uint64 amount = 1;
  50. string keyset_id = 2;
  51. string secret = 3;
  52. bytes C = 4;
  53. optional Witness witness = 5;
  54. optional ProofDLEQ dleq = 6;
  55. }
  56. message ProofDLEQ {
  57. bytes e = 1;
  58. bytes s = 2;
  59. bytes r = 3;
  60. }
  61. message BlindSignature {
  62. uint64 amount = 1;
  63. string keyset_id = 2;
  64. bytes blinded_secret = 3;
  65. optional BlindSignatureDLEQ dleq = 4;
  66. }
  67. message BlindSignatureDLEQ {
  68. bytes e = 1;
  69. bytes s = 2;
  70. }
  71. message KeySetInfo {
  72. Id id = 1;
  73. CurrencyUnit unit = 2;
  74. bool active = 3;
  75. uint64 input_fee_ppk = 4;
  76. }
  77. // Witness type
  78. message Witness {
  79. oneof witness_type {
  80. P2PKWitness p2pk_witness = 1;
  81. HTLCWitness htlc_witness = 2;
  82. }
  83. }
  84. // P2PKWitness type
  85. message P2PKWitness {
  86. // List of signatures
  87. repeated string signatures = 1;
  88. }
  89. // HTLCWitness type
  90. message HTLCWitness {
  91. // Preimage
  92. string preimage = 1;
  93. // List of signatures
  94. repeated string signatures = 2;
  95. }
  96. message BlindedMessage {
  97. uint64 amount = 1;
  98. string keyset_id = 2;
  99. bytes blinded_secret = 3;
  100. optional Witness witness = 4; // This field is optional by default in proto3
  101. }
  102. message KeysResponse {
  103. repeated KeySet keysets = 1;
  104. }
  105. message Id {
  106. bytes inner = 1;
  107. }
  108. message DerivationPath {
  109. oneof child_number {
  110. uint32 normal = 1;
  111. uint32 hardened = 2;
  112. }
  113. }
  114. message MintKeySetInfo {
  115. Id id = 1;
  116. CurrencyUnit unit = 2;
  117. bool active = 3;
  118. uint64 valid_from = 4;
  119. optional uint64 valid_to = 5;
  120. repeated DerivationPath derivation_path = 6;
  121. optional uint32 derivation_path_index = 7;
  122. uint32 max_order = 8;
  123. uint64 input_fee_ppk = 9;
  124. }