feat(auth): add authentication protocol definitions and build configuration
- Add TokenClaims message for JWT payload structure with user id, issuer, timestamps, and scopes - Implement IssueTokenRequest/Response for creating access and refresh tokens with TTL support - Create RefreshTokenRequest/Response for token rotation functionality - Define RevokeTokenRequest/Response with support for single token or user-wide revocation - Add VerifyTokenRequest/Response for validating JWT tokens with detailed claims information - Implement signing key distribution system with GetSigningKeysRequest/Response - Create TokenService gRPC service with IssueToken, RefreshToken, RevokeToken, VerifyToken, and GetSigningKeys methods - Add build.rs configuration to compile proto files using tonic_prost_build - Include channel, channel_settings, member, and permission protocol definitions for IM services - Generate Rust code bindings through pb/core.rs and pb/im.rs modules
This commit is contained in:
@@ -0,0 +1,401 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package appks.im.v1;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
|
||||
message ChannelRole {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string name = 3;
|
||||
repeated string permissions = 4;
|
||||
bool assignable = 5;
|
||||
google.protobuf.Timestamp created_at = 6;
|
||||
google.protobuf.Timestamp updated_at = 7;
|
||||
}
|
||||
|
||||
message ListChannelRolesRequest { string channel_id = 1; }
|
||||
message ListChannelRolesResponse { repeated ChannelRole roles = 1; }
|
||||
|
||||
message CreateChannelRoleRequest {
|
||||
string channel_id = 1;
|
||||
string name = 2;
|
||||
repeated string permissions = 3;
|
||||
bool assignable = 4;
|
||||
}
|
||||
message CreateChannelRoleResponse { ChannelRole role = 1; }
|
||||
|
||||
message UpdateChannelRoleRequest {
|
||||
string role_id = 1;
|
||||
optional string name = 2;
|
||||
repeated string permissions = 3;
|
||||
optional bool assignable = 4;
|
||||
}
|
||||
message UpdateChannelRoleResponse { ChannelRole role = 1; }
|
||||
|
||||
message DeleteChannelRoleRequest { string role_id = 1; }
|
||||
message DeleteChannelRoleResponse {}
|
||||
|
||||
service ChannelRoleService {
|
||||
rpc ListChannelRoles(ListChannelRolesRequest) returns (ListChannelRolesResponse);
|
||||
rpc CreateChannelRole(CreateChannelRoleRequest) returns (CreateChannelRoleResponse);
|
||||
rpc UpdateChannelRole(UpdateChannelRoleRequest) returns (UpdateChannelRoleResponse);
|
||||
rpc DeleteChannelRole(DeleteChannelRoleRequest) returns (DeleteChannelRoleResponse);
|
||||
}
|
||||
|
||||
|
||||
message ChannelInvitation {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string invited_by = 3;
|
||||
string invited_user_id = 4;
|
||||
string role = 5;
|
||||
string status = 6;
|
||||
google.protobuf.Timestamp created_at = 7;
|
||||
google.protobuf.Timestamp updated_at = 8;
|
||||
}
|
||||
|
||||
message ListInvitationsRequest { string channel_id = 1; }
|
||||
message ListInvitationsResponse { repeated ChannelInvitation invitations = 1; }
|
||||
|
||||
message CreateInvitationRequest {
|
||||
string channel_id = 1;
|
||||
string invited_user_id = 2;
|
||||
string role = 3;
|
||||
}
|
||||
message CreateInvitationResponse { ChannelInvitation invitation = 1; }
|
||||
|
||||
message AcceptInvitationRequest { string invitation_id = 1; }
|
||||
message AcceptInvitationResponse { ChannelInvitation invitation = 1; }
|
||||
|
||||
message RevokeInvitationRequest { string invitation_id = 1; }
|
||||
message RevokeInvitationResponse {}
|
||||
|
||||
service ChannelInvitationService {
|
||||
rpc ListInvitations(ListInvitationsRequest) returns (ListInvitationsResponse);
|
||||
rpc CreateInvitation(CreateInvitationRequest) returns (CreateInvitationResponse);
|
||||
rpc AcceptInvitation(AcceptInvitationRequest) returns (AcceptInvitationResponse);
|
||||
rpc RevokeInvitation(RevokeInvitationRequest) returns (RevokeInvitationResponse);
|
||||
}
|
||||
|
||||
|
||||
message ChannelWebhook {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string name = 3;
|
||||
string url = 4;
|
||||
string secret = 5;
|
||||
repeated string events = 6;
|
||||
bool active = 7;
|
||||
google.protobuf.Timestamp created_at = 8;
|
||||
google.protobuf.Timestamp updated_at = 9;
|
||||
}
|
||||
|
||||
message ListWebhooksRequest { string channel_id = 1; }
|
||||
message ListWebhooksResponse { repeated ChannelWebhook webhooks = 1; }
|
||||
|
||||
message CreateWebhookRequest {
|
||||
string channel_id = 1;
|
||||
string name = 2;
|
||||
string url = 3;
|
||||
optional string secret = 4;
|
||||
repeated string events = 5;
|
||||
}
|
||||
message CreateWebhookResponse { ChannelWebhook webhook = 1; }
|
||||
|
||||
message UpdateWebhookRequest {
|
||||
string webhook_id = 1;
|
||||
optional string name = 2;
|
||||
optional string url = 3;
|
||||
optional string secret = 4;
|
||||
repeated string events = 5;
|
||||
optional bool active = 6;
|
||||
}
|
||||
message UpdateWebhookResponse { ChannelWebhook webhook = 1; }
|
||||
|
||||
message DeleteWebhookRequest { string webhook_id = 1; }
|
||||
message DeleteWebhookResponse {}
|
||||
|
||||
service ChannelWebhookService {
|
||||
rpc ListWebhooks(ListWebhooksRequest) returns (ListWebhooksResponse);
|
||||
rpc CreateWebhook(CreateWebhookRequest) returns (CreateWebhookResponse);
|
||||
rpc UpdateWebhook(UpdateWebhookRequest) returns (UpdateWebhookResponse);
|
||||
rpc DeleteWebhook(DeleteWebhookRequest) returns (DeleteWebhookResponse);
|
||||
}
|
||||
|
||||
|
||||
message ChannelSlashCommand {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string command = 3;
|
||||
string description = 4;
|
||||
string request_url = 5;
|
||||
repeated string scopes = 6;
|
||||
google.protobuf.Timestamp created_at = 7;
|
||||
google.protobuf.Timestamp updated_at = 8;
|
||||
}
|
||||
|
||||
message ListSlashCommandsRequest { string channel_id = 1; }
|
||||
message ListSlashCommandsResponse { repeated ChannelSlashCommand commands = 1; }
|
||||
|
||||
message CreateSlashCommandRequest {
|
||||
string channel_id = 1;
|
||||
string command = 2;
|
||||
string description = 3;
|
||||
string request_url = 4;
|
||||
repeated string scopes = 5;
|
||||
}
|
||||
message CreateSlashCommandResponse { ChannelSlashCommand command = 1; }
|
||||
|
||||
message UpdateSlashCommandRequest {
|
||||
string command_id = 1;
|
||||
optional string description = 2;
|
||||
optional string request_url = 3;
|
||||
repeated string scopes = 4;
|
||||
}
|
||||
message UpdateSlashCommandResponse { ChannelSlashCommand command = 1; }
|
||||
|
||||
message DeleteSlashCommandRequest { string command_id = 1; }
|
||||
message DeleteSlashCommandResponse {}
|
||||
|
||||
service ChannelSlashCommandService {
|
||||
rpc ListSlashCommands(ListSlashCommandsRequest) returns (ListSlashCommandsResponse);
|
||||
rpc CreateSlashCommand(CreateSlashCommandRequest) returns (CreateSlashCommandResponse);
|
||||
rpc UpdateSlashCommand(UpdateSlashCommandRequest) returns (UpdateSlashCommandResponse);
|
||||
rpc DeleteSlashCommand(DeleteSlashCommandRequest) returns (DeleteSlashCommandResponse);
|
||||
}
|
||||
|
||||
|
||||
message ChannelRepoLink {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string repo_id = 3;
|
||||
string link_type = 4;
|
||||
repeated string events = 5;
|
||||
google.protobuf.Timestamp created_at = 6;
|
||||
google.protobuf.Timestamp updated_at = 7;
|
||||
}
|
||||
|
||||
message ListRepoLinksRequest { string channel_id = 1; }
|
||||
message ListRepoLinksResponse { repeated ChannelRepoLink links = 1; }
|
||||
|
||||
message CreateRepoLinkRequest {
|
||||
string channel_id = 1;
|
||||
string repo_id = 2;
|
||||
string link_type = 3;
|
||||
repeated string events = 4;
|
||||
}
|
||||
message CreateRepoLinkResponse { ChannelRepoLink link = 1; }
|
||||
|
||||
message DeleteRepoLinkRequest { string link_id = 1; }
|
||||
message DeleteRepoLinkResponse {}
|
||||
|
||||
service ChannelRepoLinkService {
|
||||
rpc ListRepoLinks(ListRepoLinksRequest) returns (ListRepoLinksResponse);
|
||||
rpc CreateRepoLink(CreateRepoLinkRequest) returns (CreateRepoLinkResponse);
|
||||
rpc DeleteRepoLink(DeleteRepoLinkRequest) returns (DeleteRepoLinkResponse);
|
||||
}
|
||||
|
||||
|
||||
message ImIntegration {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string provider = 3;
|
||||
string external_channel_id = 4;
|
||||
string sync_direction = 5;
|
||||
bool active = 6;
|
||||
google.protobuf.Timestamp created_at = 7;
|
||||
google.protobuf.Timestamp updated_at = 8;
|
||||
}
|
||||
|
||||
message ListIntegrationsRequest { string channel_id = 1; }
|
||||
message ListIntegrationsResponse { repeated ImIntegration integrations = 1; }
|
||||
|
||||
message CreateIntegrationRequest {
|
||||
string channel_id = 1;
|
||||
string provider = 2;
|
||||
string external_channel_id = 3;
|
||||
string sync_direction = 4;
|
||||
}
|
||||
message CreateIntegrationResponse { ImIntegration integration = 1; }
|
||||
|
||||
message UpdateIntegrationRequest {
|
||||
string integration_id = 1;
|
||||
optional string sync_direction = 2;
|
||||
optional bool active = 3;
|
||||
}
|
||||
message UpdateIntegrationResponse { ImIntegration integration = 1; }
|
||||
|
||||
message DeleteIntegrationRequest { string integration_id = 1; }
|
||||
message DeleteIntegrationResponse {}
|
||||
|
||||
service ImIntegrationService {
|
||||
rpc ListIntegrations(ListIntegrationsRequest) returns (ListIntegrationsResponse);
|
||||
rpc CreateIntegration(CreateIntegrationRequest) returns (CreateIntegrationResponse);
|
||||
rpc UpdateIntegration(UpdateIntegrationRequest) returns (UpdateIntegrationResponse);
|
||||
rpc DeleteIntegration(DeleteIntegrationRequest) returns (DeleteIntegrationResponse);
|
||||
}
|
||||
|
||||
|
||||
message CustomEmoji {
|
||||
string id = 1;
|
||||
string workspace_id = 2;
|
||||
string name = 3;
|
||||
string image_url = 4;
|
||||
google.protobuf.Timestamp created_at = 5;
|
||||
}
|
||||
|
||||
message ListCustomEmojisRequest { string workspace_id = 1; }
|
||||
message ListCustomEmojisResponse { repeated CustomEmoji emojis = 1; }
|
||||
|
||||
message CreateCustomEmojiRequest {
|
||||
string workspace_id = 1;
|
||||
string name = 2;
|
||||
string image_url = 3;
|
||||
}
|
||||
message CreateCustomEmojiResponse { CustomEmoji emoji = 1; }
|
||||
|
||||
message DeleteCustomEmojiRequest { string emoji_id = 1; }
|
||||
message DeleteCustomEmojiResponse {}
|
||||
|
||||
service CustomEmojiService {
|
||||
rpc ListCustomEmojis(ListCustomEmojisRequest) returns (ListCustomEmojisResponse);
|
||||
rpc CreateCustomEmoji(CreateCustomEmojiRequest) returns (CreateCustomEmojiResponse);
|
||||
rpc DeleteCustomEmoji(DeleteCustomEmojiRequest) returns (DeleteCustomEmojiResponse);
|
||||
}
|
||||
|
||||
|
||||
message ForumTag {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string name = 3;
|
||||
bool moderated = 4;
|
||||
int32 position = 5;
|
||||
google.protobuf.Timestamp created_at = 6;
|
||||
google.protobuf.Timestamp updated_at = 7;
|
||||
}
|
||||
|
||||
message ListForumTagsRequest { string channel_id = 1; }
|
||||
message ListForumTagsResponse { repeated ForumTag tags = 1; }
|
||||
|
||||
message CreateForumTagRequest {
|
||||
string channel_id = 1;
|
||||
string name = 2;
|
||||
bool moderated = 3;
|
||||
optional int32 position = 4;
|
||||
}
|
||||
message CreateForumTagResponse { ForumTag tag = 1; }
|
||||
|
||||
message UpdateForumTagRequest {
|
||||
string tag_id = 1;
|
||||
optional string name = 2;
|
||||
optional bool moderated = 3;
|
||||
optional int32 position = 4;
|
||||
}
|
||||
message UpdateForumTagResponse { ForumTag tag = 1; }
|
||||
|
||||
message DeleteForumTagRequest { string tag_id = 1; }
|
||||
message DeleteForumTagResponse {}
|
||||
|
||||
service ForumTagService {
|
||||
rpc ListForumTags(ListForumTagsRequest) returns (ListForumTagsResponse);
|
||||
rpc CreateForumTag(CreateForumTagRequest) returns (CreateForumTagResponse);
|
||||
rpc UpdateForumTag(UpdateForumTagRequest) returns (UpdateForumTagResponse);
|
||||
rpc DeleteForumTag(DeleteForumTagRequest) returns (DeleteForumTagResponse);
|
||||
}
|
||||
|
||||
|
||||
message VoiceParticipant {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string user_id = 3;
|
||||
bool muted = 4;
|
||||
bool deafened = 5;
|
||||
google.protobuf.Timestamp joined_at = 6;
|
||||
}
|
||||
|
||||
message ListVoiceParticipantsRequest { string channel_id = 1; }
|
||||
message ListVoiceParticipantsResponse { repeated VoiceParticipant participants = 1; }
|
||||
|
||||
message UpdateVoiceStateRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
optional bool muted = 3;
|
||||
optional bool deafened = 4;
|
||||
}
|
||||
message UpdateVoiceStateResponse { VoiceParticipant participant = 1; }
|
||||
|
||||
service VoiceService {
|
||||
rpc ListVoiceParticipants(ListVoiceParticipantsRequest) returns (ListVoiceParticipantsResponse);
|
||||
rpc UpdateVoiceState(UpdateVoiceStateRequest) returns (UpdateVoiceStateResponse);
|
||||
}
|
||||
|
||||
|
||||
message Stage {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string topic = 3;
|
||||
string privacy_level = 4;
|
||||
bool discoverable = 5;
|
||||
google.protobuf.Timestamp started_at = 6;
|
||||
google.protobuf.Timestamp ended_at = 7;
|
||||
google.protobuf.Timestamp created_at = 8;
|
||||
google.protobuf.Timestamp updated_at = 9;
|
||||
}
|
||||
|
||||
message GetStageRequest { string channel_id = 1; }
|
||||
message GetStageResponse { Stage stage = 1; }
|
||||
|
||||
message CreateStageRequest {
|
||||
string channel_id = 1;
|
||||
string topic = 2;
|
||||
string privacy_level = 3;
|
||||
bool discoverable = 4;
|
||||
}
|
||||
message CreateStageResponse { Stage stage = 1; }
|
||||
|
||||
message UpdateStageRequest {
|
||||
string stage_id = 1;
|
||||
optional string topic = 2;
|
||||
optional string privacy_level = 3;
|
||||
optional bool discoverable = 4;
|
||||
}
|
||||
message UpdateStageResponse { Stage stage = 1; }
|
||||
|
||||
message DeleteStageRequest { string stage_id = 1; }
|
||||
message DeleteStageResponse {}
|
||||
|
||||
service StageService {
|
||||
rpc GetStage(GetStageRequest) returns (GetStageResponse);
|
||||
rpc CreateStage(CreateStageRequest) returns (CreateStageResponse);
|
||||
rpc UpdateStage(UpdateStageRequest) returns (UpdateStageResponse);
|
||||
rpc DeleteStage(DeleteStageRequest) returns (DeleteStageResponse);
|
||||
}
|
||||
|
||||
|
||||
message ChannelAuditEvent {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string actor_id = 3;
|
||||
string event_type = 4;
|
||||
string target_type = 5;
|
||||
string target_id = 6;
|
||||
optional string old_value = 7;
|
||||
optional string new_value = 8;
|
||||
google.protobuf.Timestamp created_at = 9;
|
||||
}
|
||||
|
||||
message ListChannelEventsRequest {
|
||||
string channel_id = 1;
|
||||
int32 limit = 2;
|
||||
int32 offset = 3;
|
||||
}
|
||||
message ListChannelEventsResponse {
|
||||
repeated ChannelAuditEvent events = 1;
|
||||
int32 total = 2;
|
||||
}
|
||||
|
||||
service ChannelAuditService {
|
||||
rpc ListChannelEvents(ListChannelEventsRequest) returns (ListChannelEventsResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user