types.proto raw

   1  syntax = "proto3";
   2  package orlyacl.v1;
   3  option go_package = "next.orly.dev/pkg/proto/orlyacl/v1;orlyaclv1";
   4  
   5  import "orlydb/v1/types.proto";
   6  
   7  // Empty is used for requests/responses with no data
   8  message Empty {}
   9  
  10  // Core ACL Messages
  11  
  12  message AccessLevelRequest {
  13    bytes pubkey = 1;
  14    string address = 2;
  15  }
  16  
  17  message AccessLevelResponse {
  18    string level = 1;  // none/read/write/admin/owner/banned/blocked
  19  }
  20  
  21  message ACLInfoResponse {
  22    string name = 1;
  23    string description = 2;
  24    string documentation = 3;
  25  }
  26  
  27  message ModeResponse {
  28    string mode = 1;  // none/follows/managed/curating
  29  }
  30  
  31  message ReadyResponse {
  32    bool ready = 1;
  33  }
  34  
  35  message BoolResponse {
  36    bool value = 1;
  37  }
  38  
  39  message PolicyCheckRequest {
  40    orlydb.v1.Event event = 1;
  41  }
  42  
  43  message PolicyCheckResponse {
  44    bool allowed = 1;
  45    string error = 2;
  46  }
  47  
  48  // Follows ACL Messages
  49  
  50  message ThrottleDelayRequest {
  51    bytes pubkey = 1;
  52    string ip = 2;
  53  }
  54  
  55  message ThrottleDelayResponse {
  56    int64 delay_ms = 1;
  57  }
  58  
  59  message AddFollowRequest {
  60    bytes pubkey = 1;
  61  }
  62  
  63  message FollowedPubkeysResponse {
  64    repeated bytes pubkeys = 1;
  65  }
  66  
  67  message AdminRelaysResponse {
  68    repeated string urls = 1;
  69  }
  70  
  71  // Managed ACL Messages
  72  
  73  message PubkeyRequest {
  74    string pubkey = 1;
  75  }
  76  
  77  message IPRequest {
  78    string ip = 1;
  79  }
  80  
  81  message BanPubkeyRequest {
  82    string pubkey = 1;
  83    string reason = 2;
  84  }
  85  
  86  message AllowPubkeyRequest {
  87    string pubkey = 1;
  88    string reason = 2;
  89  }
  90  
  91  message BannedPubkey {
  92    string pubkey = 1;
  93    string reason = 2;
  94    int64 added = 3;
  95  }
  96  
  97  message AllowedPubkey {
  98    string pubkey = 1;
  99    string reason = 2;
 100    int64 added = 3;
 101  }
 102  
 103  message BanEventRequest {
 104    string event_id = 1;
 105    string reason = 2;
 106  }
 107  
 108  message EventRequest {
 109    string event_id = 1;
 110  }
 111  
 112  message BannedEvent {
 113    string event_id = 1;
 114    string reason = 2;
 115    int64 added = 3;
 116  }
 117  
 118  message AllowedEvent {
 119    string event_id = 1;
 120    string reason = 2;
 121    int64 added = 3;
 122  }
 123  
 124  message BlockIPRequest {
 125    string ip = 1;
 126    string reason = 2;
 127  }
 128  
 129  message BlockedIP {
 130    string ip = 1;
 131    string reason = 2;
 132    int64 added = 3;
 133  }
 134  
 135  message AllowKindRequest {
 136    int32 kind = 1;
 137  }
 138  
 139  message KindRequest {
 140    int32 kind = 1;
 141  }
 142  
 143  message UpdatePeerAdminsRequest {
 144    repeated bytes peer_pubkeys = 1;
 145  }
 146  
 147  message ListBannedPubkeysResponse {
 148    repeated BannedPubkey pubkeys = 1;
 149  }
 150  
 151  message ListAllowedPubkeysResponse {
 152    repeated AllowedPubkey pubkeys = 1;
 153  }
 154  
 155  message ListBannedEventsResponse {
 156    repeated BannedEvent events = 1;
 157  }
 158  
 159  message ListAllowedEventsResponse {
 160    repeated AllowedEvent events = 1;
 161  }
 162  
 163  message ListBlockedIPsResponse {
 164    repeated BlockedIP ips = 1;
 165  }
 166  
 167  message ListAllowedKindsResponse {
 168    repeated int32 kinds = 1;
 169  }
 170  
 171  // Curating ACL Messages
 172  
 173  message TrustPubkeyRequest {
 174    string pubkey = 1;
 175    string note = 2;
 176  }
 177  
 178  message BlacklistPubkeyRequest {
 179    string pubkey = 1;
 180    string reason = 2;
 181  }
 182  
 183  message TrustedPubkey {
 184    string pubkey = 1;
 185    string note = 2;
 186    int64 added = 3;
 187  }
 188  
 189  message BlacklistedPubkey {
 190    string pubkey = 1;
 191    string reason = 2;
 192    int64 added = 3;
 193  }
 194  
 195  message MarkSpamRequest {
 196    string event_id = 1;
 197    string pubkey = 2;
 198    string reason = 3;
 199  }
 200  
 201  message SpamEvent {
 202    string event_id = 1;
 203    string pubkey = 2;
 204    string reason = 3;
 205    int64 added = 4;
 206  }
 207  
 208  message RateLimitCheckRequest {
 209    string pubkey = 1;
 210    string ip = 2;
 211  }
 212  
 213  message RateLimitCheckResponse {
 214    bool allowed = 1;
 215    string message = 2;
 216  }
 217  
 218  message ConfigEventRequest {
 219    orlydb.v1.Event event = 1;
 220  }
 221  
 222  message CuratingConfig {
 223    string config_event_id = 1;
 224    string config_pubkey = 2;
 225    int64 configured_at = 3;
 226    int32 daily_limit = 4;
 227    int32 ip_daily_limit = 5;
 228    int32 first_ban_hours = 6;
 229    int32 second_ban_hours = 7;
 230    repeated string kind_categories = 8;
 231    repeated string allowed_ranges = 9;
 232    repeated int32 allowed_kinds = 10;
 233  }
 234  
 235  message UnclassifiedUser {
 236    string pubkey = 1;
 237    int32 event_count = 2;
 238    string first_seen = 3;
 239  }
 240  
 241  message PaginationRequest {
 242    int32 limit = 1;
 243    int32 offset = 2;
 244  }
 245  
 246  message ListTrustedPubkeysResponse {
 247    repeated TrustedPubkey pubkeys = 1;
 248  }
 249  
 250  message ListBlacklistedPubkeysResponse {
 251    repeated BlacklistedPubkey pubkeys = 1;
 252  }
 253  
 254  message ListSpamEventsResponse {
 255    repeated SpamEvent events = 1;
 256  }
 257  
 258  message ListUnclassifiedUsersResponse {
 259    repeated UnclassifiedUser users = 1;
 260    int32 total = 2;
 261  }
 262  
 263  message GetEventsForPubkeyRequest {
 264    string pubkey = 1;
 265    int32 limit = 2;
 266    int32 offset = 3;
 267  }
 268  
 269  message EventSummary {
 270    string id = 1;
 271    uint32 kind = 2;
 272    bytes content = 3;
 273    int64 created_at = 4;
 274  }
 275  
 276  message EventsForPubkeyResponse {
 277    repeated EventSummary events = 1;
 278    int32 total = 2;
 279  }
 280  
 281  message DeleteEventsForPubkeyRequest {
 282    string pubkey = 1;
 283  }
 284  
 285  message DeleteCountResponse {
 286    int32 count = 1;
 287  }
 288  
 289  message ScanResultResponse {
 290    int32 total_pubkeys = 1;
 291    int32 total_events = 2;
 292  }
 293  
 294  // Paid ACL Messages
 295  
 296  message SubscribeRequest {
 297    string pubkey = 1;
 298    int64 expires_at = 2;
 299    string invoice_hash = 3;
 300    string alias = 4;
 301  }
 302  
 303  message SubscriptionResponse {
 304    string pubkey = 1;
 305    string alias = 2;
 306    int64 expires_at = 3;
 307    int64 created_at = 4;
 308    bool has_alias = 5;
 309  }
 310  
 311  message ClaimAliasRequest {
 312    string alias = 1;
 313    string pubkey = 2;
 314  }
 315  
 316  message AliasResponse {
 317    string alias = 1;
 318  }
 319  
 320  message AliasRequest {
 321    string alias = 1;
 322  }
 323  
 324  message PubkeyResponse {
 325    string pubkey = 1;
 326  }
 327