service.proto raw
1 syntax = "proto3";
2 package orlysync.relaygroup.v1;
3 option go_package = "next.orly.dev/pkg/proto/orlysync/relaygroup/v1;relaygroupv1";
4
5 import "orlysync/common/v1/types.proto";
6
7 // RelayGroupService provides relay group configuration discovery
8 // by selecting authoritative config from Kind 39105 events
9 service RelayGroupService {
10 // === Lifecycle Methods ===
11
12 // Ready returns whether the service is ready to serve requests
13 rpc Ready(orlysync.common.v1.Empty) returns (orlysync.common.v1.ReadyResponse);
14
15 // === Configuration Lookup ===
16
17 // FindAuthoritativeConfig finds the authoritative relay group configuration
18 // using timestamp ordering with hash tie-breaking
19 rpc FindAuthoritativeConfig(orlysync.common.v1.Empty) returns (RelayGroupConfigResponse);
20
21 // GetRelays returns the list of relays from the authoritative config
22 rpc GetRelays(orlysync.common.v1.Empty) returns (RelaysResponse);
23
24 // === Publisher Verification ===
25
26 // IsAuthorizedPublisher checks if a pubkey can publish relay group configs
27 rpc IsAuthorizedPublisher(AuthorizedPublisherRequest) returns (AuthorizedPublisherResponse);
28
29 // GetAuthorizedPubkeys returns all authorized publisher pubkeys
30 rpc GetAuthorizedPubkeys(orlysync.common.v1.Empty) returns (AuthorizedPubkeysResponse);
31
32 // === Event Handling ===
33
34 // ValidateRelayGroupEvent validates a relay group configuration event
35 rpc ValidateRelayGroupEvent(ValidateEventRequest) returns (ValidateEventResponse);
36
37 // HandleRelayGroupEvent processes a relay group event and triggers peer updates
38 rpc HandleRelayGroupEvent(HandleEventRequest) returns (orlysync.common.v1.Empty);
39 }
40
41 // === Request/Response Messages ===
42
43 // RelayGroupConfig represents a relay group configuration
44 message RelayGroupConfig {
45 repeated string relays = 1; // List of relay URLs
46 }
47
48 // RelayGroupConfigResponse contains the authoritative config
49 message RelayGroupConfigResponse {
50 RelayGroupConfig config = 1;
51 bool found = 2;
52 bytes source_event_id = 3; // ID of the event that provided this config
53 int64 source_timestamp = 4; // Timestamp of the source event
54 }
55
56 // RelaysResponse contains the list of relays
57 message RelaysResponse {
58 repeated string relays = 1;
59 }
60
61 // AuthorizedPublisherRequest checks if a pubkey is authorized
62 message AuthorizedPublisherRequest {
63 bytes pubkey = 1; // 32 bytes public key
64 }
65
66 // AuthorizedPublisherResponse indicates if the pubkey is authorized
67 message AuthorizedPublisherResponse {
68 bool authorized = 1;
69 }
70
71 // AuthorizedPubkeysResponse contains all authorized pubkeys
72 message AuthorizedPubkeysResponse {
73 repeated bytes pubkeys = 1; // List of 32-byte pubkeys
74 }
75
76 // ValidateEventRequest requests validation of a relay group event
77 message ValidateEventRequest {
78 orlysync.common.v1.Event event = 1;
79 }
80
81 // ValidateEventResponse contains validation results
82 message ValidateEventResponse {
83 bool valid = 1;
84 string error = 2; // Error message if not valid
85 }
86
87 // HandleEventRequest requests processing of a relay group event
88 message HandleEventRequest {
89 orlysync.common.v1.Event event = 1;
90 }
91