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,126 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package appks.im.v1;
|
||||
|
||||
import "google/protobuf/timestamp.proto";
|
||||
|
||||
// Member management service for the IM microservice.
|
||||
// Provides CRUD for channel members, join/leave, and membership checks.
|
||||
|
||||
enum Role {
|
||||
ROLE_UNSPECIFIED = 0;
|
||||
ROLE_OWNER = 1;
|
||||
ROLE_ADMIN = 2;
|
||||
ROLE_MAINTAINER = 3;
|
||||
ROLE_MODERATOR = 4;
|
||||
ROLE_MEMBER = 5;
|
||||
ROLE_CONTRIBUTOR = 6;
|
||||
ROLE_VIEWER = 7;
|
||||
ROLE_GUEST = 8;
|
||||
ROLE_BOT = 9;
|
||||
}
|
||||
|
||||
enum MemberStatus {
|
||||
MEMBER_STATUS_UNSPECIFIED = 0;
|
||||
MEMBER_STATUS_ACTIVE = 1;
|
||||
MEMBER_STATUS_INVITED = 2;
|
||||
MEMBER_STATUS_LEFT = 3;
|
||||
MEMBER_STATUS_KICKED = 4;
|
||||
MEMBER_STATUS_BANNED = 5;
|
||||
}
|
||||
|
||||
|
||||
message ChannelMember {
|
||||
string id = 1;
|
||||
string channel_id = 2;
|
||||
string user_id = 3;
|
||||
string role = 4;
|
||||
string status = 5;
|
||||
bool muted = 6;
|
||||
bool pinned = 7;
|
||||
optional string last_read_message_id = 8;
|
||||
optional google.protobuf.Timestamp last_read_at = 9;
|
||||
optional google.protobuf.Timestamp joined_at = 10;
|
||||
optional google.protobuf.Timestamp left_at = 11;
|
||||
google.protobuf.Timestamp created_at = 12;
|
||||
google.protobuf.Timestamp updated_at = 13;
|
||||
}
|
||||
|
||||
|
||||
message ListMembersRequest {
|
||||
string channel_id = 1;
|
||||
optional string status = 2;
|
||||
int32 limit = 3;
|
||||
int32 offset = 4;
|
||||
}
|
||||
|
||||
message ListMembersResponse {
|
||||
repeated ChannelMember members = 1;
|
||||
int32 total = 2;
|
||||
}
|
||||
|
||||
message InviteMemberRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
optional string role = 3;
|
||||
}
|
||||
|
||||
message InviteMemberResponse {
|
||||
ChannelMember member = 1;
|
||||
}
|
||||
|
||||
message UpdateMemberRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
optional string role = 3;
|
||||
optional bool muted = 4;
|
||||
optional bool pinned = 5;
|
||||
}
|
||||
|
||||
message UpdateMemberResponse {
|
||||
ChannelMember member = 1;
|
||||
}
|
||||
|
||||
message KickMemberRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
}
|
||||
|
||||
message KickMemberResponse {}
|
||||
|
||||
message JoinChannelRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
}
|
||||
|
||||
message JoinChannelResponse {
|
||||
ChannelMember member = 1;
|
||||
}
|
||||
|
||||
message LeaveChannelRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
}
|
||||
|
||||
message LeaveChannelResponse {}
|
||||
|
||||
message IsMemberRequest {
|
||||
string channel_id = 1;
|
||||
string user_id = 2;
|
||||
}
|
||||
|
||||
message IsMemberResponse {
|
||||
bool is_member = 1;
|
||||
string role = 2;
|
||||
}
|
||||
|
||||
|
||||
service MemberService {
|
||||
rpc ListMembers(ListMembersRequest) returns (ListMembersResponse);
|
||||
rpc InviteMember(InviteMemberRequest) returns (InviteMemberResponse);
|
||||
rpc UpdateMember(UpdateMemberRequest) returns (UpdateMemberResponse);
|
||||
rpc KickMember(KickMemberRequest) returns (KickMemberResponse);
|
||||
rpc JoinChannel(JoinChannelRequest) returns (JoinChannelResponse);
|
||||
rpc LeaveChannel(LeaveChannelRequest) returns (LeaveChannelResponse);
|
||||
rpc IsMember(IsMemberRequest) returns (IsMemberResponse);
|
||||
}
|
||||
Reference in New Issue
Block a user