Add AuthService proto and go.mod for standalone module usage
This commit is contained in:
parent
51a7f583da
commit
96298efc46
715
auth.pb.go
Normal file
715
auth.pb.go
Normal file
@ -0,0 +1,715 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// versions:
|
||||
// protoc-gen-go v1.36.11
|
||||
// protoc v7.34.0
|
||||
// source: proto/l-ai-core-proto/auth.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
|
||||
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
|
||||
reflect "reflect"
|
||||
sync "sync"
|
||||
unsafe "unsafe"
|
||||
)
|
||||
|
||||
const (
|
||||
// Verify that this generated code is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
|
||||
// Verify that runtime/protoimpl is sufficiently up-to-date.
|
||||
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
|
||||
)
|
||||
|
||||
// TelegramAuthRequest contains the data sent by the Telegram Login Widget
|
||||
type TelegramAuthRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Id int64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
|
||||
FirstName string `protobuf:"bytes,2,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
|
||||
LastName string `protobuf:"bytes,3,opt,name=last_name,json=lastName,proto3" json:"last_name,omitempty"`
|
||||
Username string `protobuf:"bytes,4,opt,name=username,proto3" json:"username,omitempty"`
|
||||
PhotoUrl string `protobuf:"bytes,5,opt,name=photo_url,json=photoUrl,proto3" json:"photo_url,omitempty"`
|
||||
AuthDate int64 `protobuf:"varint,6,opt,name=auth_date,json=authDate,proto3" json:"auth_date,omitempty"`
|
||||
Hash string `protobuf:"bytes,7,opt,name=hash,proto3" json:"hash,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) Reset() {
|
||||
*x = TelegramAuthRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[0]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*TelegramAuthRequest) ProtoMessage() {}
|
||||
|
||||
func (x *TelegramAuthRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[0]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use TelegramAuthRequest.ProtoReflect.Descriptor instead.
|
||||
func (*TelegramAuthRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetId() int64 {
|
||||
if x != nil {
|
||||
return x.Id
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetFirstName() string {
|
||||
if x != nil {
|
||||
return x.FirstName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetLastName() string {
|
||||
if x != nil {
|
||||
return x.LastName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetUsername() string {
|
||||
if x != nil {
|
||||
return x.Username
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetPhotoUrl() string {
|
||||
if x != nil {
|
||||
return x.PhotoUrl
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetAuthDate() int64 {
|
||||
if x != nil {
|
||||
return x.AuthDate
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *TelegramAuthRequest) GetHash() string {
|
||||
if x != nil {
|
||||
return x.Hash
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// GetDiscordOAuthURLRequest — caller provides the redirect_uri for their service
|
||||
type GetDiscordOAuthURLRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RedirectUri string `protobuf:"bytes,1,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *GetDiscordOAuthURLRequest) Reset() {
|
||||
*x = GetDiscordOAuthURLRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[1]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *GetDiscordOAuthURLRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*GetDiscordOAuthURLRequest) ProtoMessage() {}
|
||||
|
||||
func (x *GetDiscordOAuthURLRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[1]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use GetDiscordOAuthURLRequest.ProtoReflect.Descriptor instead.
|
||||
func (*GetDiscordOAuthURLRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{1}
|
||||
}
|
||||
|
||||
func (x *GetDiscordOAuthURLRequest) GetRedirectUri() string {
|
||||
if x != nil {
|
||||
return x.RedirectUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// OAuthURLResponse returns the full OAuth redirect URL including state
|
||||
type OAuthURLResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Url string `protobuf:"bytes,1,opt,name=url,proto3" json:"url,omitempty"`
|
||||
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *OAuthURLResponse) Reset() {
|
||||
*x = OAuthURLResponse{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[2]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *OAuthURLResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*OAuthURLResponse) ProtoMessage() {}
|
||||
|
||||
func (x *OAuthURLResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[2]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use OAuthURLResponse.ProtoReflect.Descriptor instead.
|
||||
func (*OAuthURLResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{2}
|
||||
}
|
||||
|
||||
func (x *OAuthURLResponse) GetUrl() string {
|
||||
if x != nil {
|
||||
return x.Url
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *OAuthURLResponse) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// DiscordExchangeRequest — exchange code received in Discord callback
|
||||
type DiscordExchangeRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
|
||||
State string `protobuf:"bytes,2,opt,name=state,proto3" json:"state,omitempty"`
|
||||
RedirectUri string `protobuf:"bytes,3,opt,name=redirect_uri,json=redirectUri,proto3" json:"redirect_uri,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *DiscordExchangeRequest) Reset() {
|
||||
*x = DiscordExchangeRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[3]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *DiscordExchangeRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*DiscordExchangeRequest) ProtoMessage() {}
|
||||
|
||||
func (x *DiscordExchangeRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[3]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use DiscordExchangeRequest.ProtoReflect.Descriptor instead.
|
||||
func (*DiscordExchangeRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{3}
|
||||
}
|
||||
|
||||
func (x *DiscordExchangeRequest) GetCode() string {
|
||||
if x != nil {
|
||||
return x.Code
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DiscordExchangeRequest) GetState() string {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *DiscordExchangeRequest) GetRedirectUri() string {
|
||||
if x != nil {
|
||||
return x.RedirectUri
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// AuthResponse is returned after successful authentication
|
||||
type AuthResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
AccessToken string `protobuf:"bytes,1,opt,name=access_token,json=accessToken,proto3" json:"access_token,omitempty"`
|
||||
RefreshToken string `protobuf:"bytes,2,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
|
||||
GlobalUserId int64 `protobuf:"varint,3,opt,name=global_user_id,json=globalUserId,proto3" json:"global_user_id,omitempty"`
|
||||
DisplayName string `protobuf:"bytes,4,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
ExpiresAt int64 `protobuf:"varint,5,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"` // unix timestamp of access token expiry
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *AuthResponse) Reset() {
|
||||
*x = AuthResponse{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[4]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *AuthResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*AuthResponse) ProtoMessage() {}
|
||||
|
||||
func (x *AuthResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[4]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use AuthResponse.ProtoReflect.Descriptor instead.
|
||||
func (*AuthResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{4}
|
||||
}
|
||||
|
||||
func (x *AuthResponse) GetAccessToken() string {
|
||||
if x != nil {
|
||||
return x.AccessToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuthResponse) GetRefreshToken() string {
|
||||
if x != nil {
|
||||
return x.RefreshToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuthResponse) GetGlobalUserId() int64 {
|
||||
if x != nil {
|
||||
return x.GlobalUserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *AuthResponse) GetDisplayName() string {
|
||||
if x != nil {
|
||||
return x.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *AuthResponse) GetExpiresAt() int64 {
|
||||
if x != nil {
|
||||
return x.ExpiresAt
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type RefreshTokenRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
RefreshToken string `protobuf:"bytes,1,opt,name=refresh_token,json=refreshToken,proto3" json:"refresh_token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) Reset() {
|
||||
*x = RefreshTokenRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[5]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RefreshTokenRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RefreshTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[5]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RefreshTokenRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RefreshTokenRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{5}
|
||||
}
|
||||
|
||||
func (x *RefreshTokenRequest) GetRefreshToken() string {
|
||||
if x != nil {
|
||||
return x.RefreshToken
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RevokeTokenRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RevokeTokenRequest) Reset() {
|
||||
*x = RevokeTokenRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[6]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RevokeTokenRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RevokeTokenRequest) ProtoMessage() {}
|
||||
|
||||
func (x *RevokeTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[6]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RevokeTokenRequest.ProtoReflect.Descriptor instead.
|
||||
func (*RevokeTokenRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{6}
|
||||
}
|
||||
|
||||
func (x *RevokeTokenRequest) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type RevokeTokenResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *RevokeTokenResponse) Reset() {
|
||||
*x = RevokeTokenResponse{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[7]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *RevokeTokenResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*RevokeTokenResponse) ProtoMessage() {}
|
||||
|
||||
func (x *RevokeTokenResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[7]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use RevokeTokenResponse.ProtoReflect.Descriptor instead.
|
||||
func (*RevokeTokenResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{7}
|
||||
}
|
||||
|
||||
func (x *RevokeTokenResponse) GetSuccess() bool {
|
||||
if x != nil {
|
||||
return x.Success
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ValidateTokenRequest struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ValidateTokenRequest) Reset() {
|
||||
*x = ValidateTokenRequest{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[8]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ValidateTokenRequest) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ValidateTokenRequest) ProtoMessage() {}
|
||||
|
||||
func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[8]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.
|
||||
func (*ValidateTokenRequest) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{8}
|
||||
}
|
||||
|
||||
func (x *ValidateTokenRequest) GetToken() string {
|
||||
if x != nil {
|
||||
return x.Token
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
type ValidateTokenResponse struct {
|
||||
state protoimpl.MessageState `protogen:"open.v1"`
|
||||
Valid bool `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
|
||||
GlobalUserId int64 `protobuf:"varint,2,opt,name=global_user_id,json=globalUserId,proto3" json:"global_user_id,omitempty"`
|
||||
DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
|
||||
LinkedPlatforms []string `protobuf:"bytes,4,rep,name=linked_platforms,json=linkedPlatforms,proto3" json:"linked_platforms,omitempty"`
|
||||
unknownFields protoimpl.UnknownFields
|
||||
sizeCache protoimpl.SizeCache
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) Reset() {
|
||||
*x = ValidateTokenResponse{}
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[9]
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) String() string {
|
||||
return protoimpl.X.MessageStringOf(x)
|
||||
}
|
||||
|
||||
func (*ValidateTokenResponse) ProtoMessage() {}
|
||||
|
||||
func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message {
|
||||
mi := &file_proto_l_ai_core_proto_auth_proto_msgTypes[9]
|
||||
if x != nil {
|
||||
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||
if ms.LoadMessageInfo() == nil {
|
||||
ms.StoreMessageInfo(mi)
|
||||
}
|
||||
return ms
|
||||
}
|
||||
return mi.MessageOf(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use ValidateTokenResponse.ProtoReflect.Descriptor instead.
|
||||
func (*ValidateTokenResponse) Descriptor() ([]byte, []int) {
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescGZIP(), []int{9}
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) GetValid() bool {
|
||||
if x != nil {
|
||||
return x.Valid
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) GetGlobalUserId() int64 {
|
||||
if x != nil {
|
||||
return x.GlobalUserId
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) GetDisplayName() string {
|
||||
if x != nil {
|
||||
return x.DisplayName
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (x *ValidateTokenResponse) GetLinkedPlatforms() []string {
|
||||
if x != nil {
|
||||
return x.LinkedPlatforms
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_proto_l_ai_core_proto_auth_proto protoreflect.FileDescriptor
|
||||
|
||||
const file_proto_l_ai_core_proto_auth_proto_rawDesc = "" +
|
||||
"\n" +
|
||||
" proto/l-ai-core-proto/auth.proto\x12\x04auth\"\xcb\x01\n" +
|
||||
"\x13TelegramAuthRequest\x12\x0e\n" +
|
||||
"\x02id\x18\x01 \x01(\x03R\x02id\x12\x1d\n" +
|
||||
"\n" +
|
||||
"first_name\x18\x02 \x01(\tR\tfirstName\x12\x1b\n" +
|
||||
"\tlast_name\x18\x03 \x01(\tR\blastName\x12\x1a\n" +
|
||||
"\busername\x18\x04 \x01(\tR\busername\x12\x1b\n" +
|
||||
"\tphoto_url\x18\x05 \x01(\tR\bphotoUrl\x12\x1b\n" +
|
||||
"\tauth_date\x18\x06 \x01(\x03R\bauthDate\x12\x12\n" +
|
||||
"\x04hash\x18\a \x01(\tR\x04hash\">\n" +
|
||||
"\x19GetDiscordOAuthURLRequest\x12!\n" +
|
||||
"\fredirect_uri\x18\x01 \x01(\tR\vredirectUri\":\n" +
|
||||
"\x10OAuthURLResponse\x12\x10\n" +
|
||||
"\x03url\x18\x01 \x01(\tR\x03url\x12\x14\n" +
|
||||
"\x05state\x18\x02 \x01(\tR\x05state\"e\n" +
|
||||
"\x16DiscordExchangeRequest\x12\x12\n" +
|
||||
"\x04code\x18\x01 \x01(\tR\x04code\x12\x14\n" +
|
||||
"\x05state\x18\x02 \x01(\tR\x05state\x12!\n" +
|
||||
"\fredirect_uri\x18\x03 \x01(\tR\vredirectUri\"\xbe\x01\n" +
|
||||
"\fAuthResponse\x12!\n" +
|
||||
"\faccess_token\x18\x01 \x01(\tR\vaccessToken\x12#\n" +
|
||||
"\rrefresh_token\x18\x02 \x01(\tR\frefreshToken\x12$\n" +
|
||||
"\x0eglobal_user_id\x18\x03 \x01(\x03R\fglobalUserId\x12!\n" +
|
||||
"\fdisplay_name\x18\x04 \x01(\tR\vdisplayName\x12\x1d\n" +
|
||||
"\n" +
|
||||
"expires_at\x18\x05 \x01(\x03R\texpiresAt\":\n" +
|
||||
"\x13RefreshTokenRequest\x12#\n" +
|
||||
"\rrefresh_token\x18\x01 \x01(\tR\frefreshToken\"*\n" +
|
||||
"\x12RevokeTokenRequest\x12\x14\n" +
|
||||
"\x05token\x18\x01 \x01(\tR\x05token\"/\n" +
|
||||
"\x13RevokeTokenResponse\x12\x18\n" +
|
||||
"\asuccess\x18\x01 \x01(\bR\asuccess\",\n" +
|
||||
"\x14ValidateTokenRequest\x12\x14\n" +
|
||||
"\x05token\x18\x01 \x01(\tR\x05token\"\xa1\x01\n" +
|
||||
"\x15ValidateTokenResponse\x12\x14\n" +
|
||||
"\x05valid\x18\x01 \x01(\bR\x05valid\x12$\n" +
|
||||
"\x0eglobal_user_id\x18\x02 \x01(\x03R\fglobalUserId\x12!\n" +
|
||||
"\fdisplay_name\x18\x03 \x01(\tR\vdisplayName\x12)\n" +
|
||||
"\x10linked_platforms\x18\x04 \x03(\tR\x0flinkedPlatforms2\xb5\x03\n" +
|
||||
"\vAuthService\x12A\n" +
|
||||
"\x10AuthWithTelegram\x12\x19.auth.TelegramAuthRequest\x1a\x12.auth.AuthResponse\x12M\n" +
|
||||
"\x12GetDiscordOAuthURL\x12\x1f.auth.GetDiscordOAuthURLRequest\x1a\x16.auth.OAuthURLResponse\x12G\n" +
|
||||
"\x13ExchangeDiscordCode\x12\x1c.auth.DiscordExchangeRequest\x1a\x12.auth.AuthResponse\x12=\n" +
|
||||
"\fRefreshToken\x12\x19.auth.RefreshTokenRequest\x1a\x12.auth.AuthResponse\x12B\n" +
|
||||
"\vRevokeToken\x12\x18.auth.RevokeTokenRequest\x1a\x19.auth.RevokeTokenResponse\x12H\n" +
|
||||
"\rValidateToken\x12\x1a.auth.ValidateTokenRequest\x1a\x1b.auth.ValidateTokenResponseB(Z&ai_service/proto/l-ai-core-proto;protob\x06proto3"
|
||||
|
||||
var (
|
||||
file_proto_l_ai_core_proto_auth_proto_rawDescOnce sync.Once
|
||||
file_proto_l_ai_core_proto_auth_proto_rawDescData []byte
|
||||
)
|
||||
|
||||
func file_proto_l_ai_core_proto_auth_proto_rawDescGZIP() []byte {
|
||||
file_proto_l_ai_core_proto_auth_proto_rawDescOnce.Do(func() {
|
||||
file_proto_l_ai_core_proto_auth_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_proto_l_ai_core_proto_auth_proto_rawDesc), len(file_proto_l_ai_core_proto_auth_proto_rawDesc)))
|
||||
})
|
||||
return file_proto_l_ai_core_proto_auth_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_proto_l_ai_core_proto_auth_proto_msgTypes = make([]protoimpl.MessageInfo, 10)
|
||||
var file_proto_l_ai_core_proto_auth_proto_goTypes = []any{
|
||||
(*TelegramAuthRequest)(nil), // 0: auth.TelegramAuthRequest
|
||||
(*GetDiscordOAuthURLRequest)(nil), // 1: auth.GetDiscordOAuthURLRequest
|
||||
(*OAuthURLResponse)(nil), // 2: auth.OAuthURLResponse
|
||||
(*DiscordExchangeRequest)(nil), // 3: auth.DiscordExchangeRequest
|
||||
(*AuthResponse)(nil), // 4: auth.AuthResponse
|
||||
(*RefreshTokenRequest)(nil), // 5: auth.RefreshTokenRequest
|
||||
(*RevokeTokenRequest)(nil), // 6: auth.RevokeTokenRequest
|
||||
(*RevokeTokenResponse)(nil), // 7: auth.RevokeTokenResponse
|
||||
(*ValidateTokenRequest)(nil), // 8: auth.ValidateTokenRequest
|
||||
(*ValidateTokenResponse)(nil), // 9: auth.ValidateTokenResponse
|
||||
}
|
||||
var file_proto_l_ai_core_proto_auth_proto_depIdxs = []int32{
|
||||
0, // 0: auth.AuthService.AuthWithTelegram:input_type -> auth.TelegramAuthRequest
|
||||
1, // 1: auth.AuthService.GetDiscordOAuthURL:input_type -> auth.GetDiscordOAuthURLRequest
|
||||
3, // 2: auth.AuthService.ExchangeDiscordCode:input_type -> auth.DiscordExchangeRequest
|
||||
5, // 3: auth.AuthService.RefreshToken:input_type -> auth.RefreshTokenRequest
|
||||
6, // 4: auth.AuthService.RevokeToken:input_type -> auth.RevokeTokenRequest
|
||||
8, // 5: auth.AuthService.ValidateToken:input_type -> auth.ValidateTokenRequest
|
||||
4, // 6: auth.AuthService.AuthWithTelegram:output_type -> auth.AuthResponse
|
||||
2, // 7: auth.AuthService.GetDiscordOAuthURL:output_type -> auth.OAuthURLResponse
|
||||
4, // 8: auth.AuthService.ExchangeDiscordCode:output_type -> auth.AuthResponse
|
||||
4, // 9: auth.AuthService.RefreshToken:output_type -> auth.AuthResponse
|
||||
7, // 10: auth.AuthService.RevokeToken:output_type -> auth.RevokeTokenResponse
|
||||
9, // 11: auth.AuthService.ValidateToken:output_type -> auth.ValidateTokenResponse
|
||||
6, // [6:12] is the sub-list for method output_type
|
||||
0, // [0:6] is the sub-list for method input_type
|
||||
0, // [0:0] is the sub-list for extension type_name
|
||||
0, // [0:0] is the sub-list for extension extendee
|
||||
0, // [0:0] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_proto_l_ai_core_proto_auth_proto_init() }
|
||||
func file_proto_l_ai_core_proto_auth_proto_init() {
|
||||
if File_proto_l_ai_core_proto_auth_proto != nil {
|
||||
return
|
||||
}
|
||||
type x struct{}
|
||||
out := protoimpl.TypeBuilder{
|
||||
File: protoimpl.DescBuilder{
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: unsafe.Slice(unsafe.StringData(file_proto_l_ai_core_proto_auth_proto_rawDesc), len(file_proto_l_ai_core_proto_auth_proto_rawDesc)),
|
||||
NumEnums: 0,
|
||||
NumMessages: 10,
|
||||
NumExtensions: 0,
|
||||
NumServices: 1,
|
||||
},
|
||||
GoTypes: file_proto_l_ai_core_proto_auth_proto_goTypes,
|
||||
DependencyIndexes: file_proto_l_ai_core_proto_auth_proto_depIdxs,
|
||||
MessageInfos: file_proto_l_ai_core_proto_auth_proto_msgTypes,
|
||||
}.Build()
|
||||
File_proto_l_ai_core_proto_auth_proto = out.File
|
||||
file_proto_l_ai_core_proto_auth_proto_goTypes = nil
|
||||
file_proto_l_ai_core_proto_auth_proto_depIdxs = nil
|
||||
}
|
||||
88
auth.proto
Normal file
88
auth.proto
Normal file
@ -0,0 +1,88 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package auth;
|
||||
|
||||
option go_package = "ai_service/proto/l-ai-core-proto;proto";
|
||||
|
||||
// AuthService handles OAuth authentication and JWT token management.
|
||||
// It is the single auth authority for all services in the platform.
|
||||
service AuthService {
|
||||
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||
rpc AuthWithTelegram(TelegramAuthRequest) returns (AuthResponse);
|
||||
|
||||
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||
rpc GetDiscordOAuthURL(GetDiscordOAuthURLRequest) returns (OAuthURLResponse);
|
||||
|
||||
// Discord OAuth — exchange authorization code for JWT tokens
|
||||
rpc ExchangeDiscordCode(DiscordExchangeRequest) returns (AuthResponse);
|
||||
|
||||
// Issue new token pair from a valid refresh token
|
||||
rpc RefreshToken(RefreshTokenRequest) returns (AuthResponse);
|
||||
|
||||
// Revoke a token (add to blacklist)
|
||||
rpc RevokeToken(RevokeTokenRequest) returns (RevokeTokenResponse);
|
||||
|
||||
// Validate a token and return its claims (optional — services can validate locally)
|
||||
rpc ValidateToken(ValidateTokenRequest) returns (ValidateTokenResponse);
|
||||
}
|
||||
|
||||
// TelegramAuthRequest contains the data sent by the Telegram Login Widget
|
||||
message TelegramAuthRequest {
|
||||
int64 id = 1;
|
||||
string first_name = 2;
|
||||
string last_name = 3;
|
||||
string username = 4;
|
||||
string photo_url = 5;
|
||||
int64 auth_date = 6;
|
||||
string hash = 7;
|
||||
}
|
||||
|
||||
// GetDiscordOAuthURLRequest — caller provides the redirect_uri for their service
|
||||
message GetDiscordOAuthURLRequest {
|
||||
string redirect_uri = 1;
|
||||
}
|
||||
|
||||
// OAuthURLResponse returns the full OAuth redirect URL including state
|
||||
message OAuthURLResponse {
|
||||
string url = 1;
|
||||
string state = 2;
|
||||
}
|
||||
|
||||
// DiscordExchangeRequest — exchange code received in Discord callback
|
||||
message DiscordExchangeRequest {
|
||||
string code = 1;
|
||||
string state = 2;
|
||||
string redirect_uri = 3;
|
||||
}
|
||||
|
||||
// AuthResponse is returned after successful authentication
|
||||
message AuthResponse {
|
||||
string access_token = 1;
|
||||
string refresh_token = 2;
|
||||
int64 global_user_id = 3;
|
||||
string display_name = 4;
|
||||
int64 expires_at = 5; // unix timestamp of access token expiry
|
||||
}
|
||||
|
||||
message RefreshTokenRequest {
|
||||
string refresh_token = 1;
|
||||
}
|
||||
|
||||
message RevokeTokenRequest {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
message RevokeTokenResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
message ValidateTokenRequest {
|
||||
string token = 1;
|
||||
}
|
||||
|
||||
message ValidateTokenResponse {
|
||||
bool valid = 1;
|
||||
int64 global_user_id = 2;
|
||||
string display_name = 3;
|
||||
repeated string linked_platforms = 4;
|
||||
}
|
||||
329
auth_grpc.pb.go
Normal file
329
auth_grpc.pb.go
Normal file
@ -0,0 +1,329 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.6.1
|
||||
// - protoc v7.34.0
|
||||
// source: proto/l-ai-core-proto/auth.proto
|
||||
|
||||
package proto
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.64.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion9
|
||||
|
||||
const (
|
||||
AuthService_AuthWithTelegram_FullMethodName = "/auth.AuthService/AuthWithTelegram"
|
||||
AuthService_GetDiscordOAuthURL_FullMethodName = "/auth.AuthService/GetDiscordOAuthURL"
|
||||
AuthService_ExchangeDiscordCode_FullMethodName = "/auth.AuthService/ExchangeDiscordCode"
|
||||
AuthService_RefreshToken_FullMethodName = "/auth.AuthService/RefreshToken"
|
||||
AuthService_RevokeToken_FullMethodName = "/auth.AuthService/RevokeToken"
|
||||
AuthService_ValidateToken_FullMethodName = "/auth.AuthService/ValidateToken"
|
||||
)
|
||||
|
||||
// AuthServiceClient is the client API for AuthService service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
//
|
||||
// AuthService handles OAuth authentication and JWT token management.
|
||||
// It is the single auth authority for all services in the platform.
|
||||
type AuthServiceClient interface {
|
||||
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||
AuthWithTelegram(ctx context.Context, in *TelegramAuthRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||
GetDiscordOAuthURL(ctx context.Context, in *GetDiscordOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error)
|
||||
// Discord OAuth — exchange authorization code for JWT tokens
|
||||
ExchangeDiscordCode(ctx context.Context, in *DiscordExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||
// Issue new token pair from a valid refresh token
|
||||
RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error)
|
||||
// Revoke a token (add to blacklist)
|
||||
RevokeToken(ctx context.Context, in *RevokeTokenRequest, opts ...grpc.CallOption) (*RevokeTokenResponse, error)
|
||||
// Validate a token and return its claims (optional — services can validate locally)
|
||||
ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error)
|
||||
}
|
||||
|
||||
type authServiceClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewAuthServiceClient(cc grpc.ClientConnInterface) AuthServiceClient {
|
||||
return &authServiceClient{cc}
|
||||
}
|
||||
|
||||
func (c *authServiceClient) AuthWithTelegram(ctx context.Context, in *TelegramAuthRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AuthResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_AuthWithTelegram_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) GetDiscordOAuthURL(ctx context.Context, in *GetDiscordOAuthURLRequest, opts ...grpc.CallOption) (*OAuthURLResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(OAuthURLResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_GetDiscordOAuthURL_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) ExchangeDiscordCode(ctx context.Context, in *DiscordExchangeRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AuthResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_ExchangeDiscordCode_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) RefreshToken(ctx context.Context, in *RefreshTokenRequest, opts ...grpc.CallOption) (*AuthResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(AuthResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_RefreshToken_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) RevokeToken(ctx context.Context, in *RevokeTokenRequest, opts ...grpc.CallOption) (*RevokeTokenResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(RevokeTokenResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_RevokeToken_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *authServiceClient) ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error) {
|
||||
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
||||
out := new(ValidateTokenResponse)
|
||||
err := c.cc.Invoke(ctx, AuthService_ValidateToken_FullMethodName, in, out, cOpts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// AuthServiceServer is the server API for AuthService service.
|
||||
// All implementations must embed UnimplementedAuthServiceServer
|
||||
// for forward compatibility.
|
||||
//
|
||||
// AuthService handles OAuth authentication and JWT token management.
|
||||
// It is the single auth authority for all services in the platform.
|
||||
type AuthServiceServer interface {
|
||||
// Telegram Login Widget — verify widget callback data and return JWT tokens
|
||||
AuthWithTelegram(context.Context, *TelegramAuthRequest) (*AuthResponse, error)
|
||||
// Discord OAuth — generate redirect URL (state stored server-side)
|
||||
GetDiscordOAuthURL(context.Context, *GetDiscordOAuthURLRequest) (*OAuthURLResponse, error)
|
||||
// Discord OAuth — exchange authorization code for JWT tokens
|
||||
ExchangeDiscordCode(context.Context, *DiscordExchangeRequest) (*AuthResponse, error)
|
||||
// Issue new token pair from a valid refresh token
|
||||
RefreshToken(context.Context, *RefreshTokenRequest) (*AuthResponse, error)
|
||||
// Revoke a token (add to blacklist)
|
||||
RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error)
|
||||
// Validate a token and return its claims (optional — services can validate locally)
|
||||
ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
|
||||
mustEmbedUnimplementedAuthServiceServer()
|
||||
}
|
||||
|
||||
// UnimplementedAuthServiceServer must be embedded to have
|
||||
// forward compatible implementations.
|
||||
//
|
||||
// NOTE: this should be embedded by value instead of pointer to avoid a nil
|
||||
// pointer dereference when methods are called.
|
||||
type UnimplementedAuthServiceServer struct{}
|
||||
|
||||
func (UnimplementedAuthServiceServer) AuthWithTelegram(context.Context, *TelegramAuthRequest) (*AuthResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method AuthWithTelegram not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) GetDiscordOAuthURL(context.Context, *GetDiscordOAuthURLRequest) (*OAuthURLResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method GetDiscordOAuthURL not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) ExchangeDiscordCode(context.Context, *DiscordExchangeRequest) (*AuthResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ExchangeDiscordCode not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) RefreshToken(context.Context, *RefreshTokenRequest) (*AuthResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RefreshToken not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) RevokeToken(context.Context, *RevokeTokenRequest) (*RevokeTokenResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method RevokeToken not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error) {
|
||||
return nil, status.Error(codes.Unimplemented, "method ValidateToken not implemented")
|
||||
}
|
||||
func (UnimplementedAuthServiceServer) mustEmbedUnimplementedAuthServiceServer() {}
|
||||
func (UnimplementedAuthServiceServer) testEmbeddedByValue() {}
|
||||
|
||||
// UnsafeAuthServiceServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to AuthServiceServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeAuthServiceServer interface {
|
||||
mustEmbedUnimplementedAuthServiceServer()
|
||||
}
|
||||
|
||||
func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer) {
|
||||
// If the following call panics, it indicates UnimplementedAuthServiceServer was
|
||||
// embedded by pointer and is nil. This will cause panics if an
|
||||
// unimplemented method is ever invoked, so we test this at initialization
|
||||
// time to prevent it from happening at runtime later due to I/O.
|
||||
if t, ok := srv.(interface{ testEmbeddedByValue() }); ok {
|
||||
t.testEmbeddedByValue()
|
||||
}
|
||||
s.RegisterService(&AuthService_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _AuthService_AuthWithTelegram_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(TelegramAuthRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).AuthWithTelegram(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_AuthWithTelegram_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).AuthWithTelegram(ctx, req.(*TelegramAuthRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_GetDiscordOAuthURL_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(GetDiscordOAuthURLRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).GetDiscordOAuthURL(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_GetDiscordOAuthURL_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).GetDiscordOAuthURL(ctx, req.(*GetDiscordOAuthURLRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_ExchangeDiscordCode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(DiscordExchangeRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).ExchangeDiscordCode(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_ExchangeDiscordCode_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).ExchangeDiscordCode(ctx, req.(*DiscordExchangeRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_RefreshToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RefreshTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).RefreshToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_RefreshToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).RefreshToken(ctx, req.(*RefreshTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_RevokeToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(RevokeTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).RevokeToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_RevokeToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).RevokeToken(ctx, req.(*RevokeTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _AuthService_ValidateToken_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ValidateTokenRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AuthServiceServer).ValidateToken(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: AuthService_ValidateToken_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AuthServiceServer).ValidateToken(ctx, req.(*ValidateTokenRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// AuthService_ServiceDesc is the grpc.ServiceDesc for AuthService service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var AuthService_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "auth.AuthService",
|
||||
HandlerType: (*AuthServiceServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "AuthWithTelegram",
|
||||
Handler: _AuthService_AuthWithTelegram_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "GetDiscordOAuthURL",
|
||||
Handler: _AuthService_GetDiscordOAuthURL_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ExchangeDiscordCode",
|
||||
Handler: _AuthService_ExchangeDiscordCode_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RefreshToken",
|
||||
Handler: _AuthService_RefreshToken_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RevokeToken",
|
||||
Handler: _AuthService_RevokeToken_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ValidateToken",
|
||||
Handler: _AuthService_ValidateToken_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "proto/l-ai-core-proto/auth.proto",
|
||||
}
|
||||
15
go.mod
Normal file
15
go.mod
Normal file
@ -0,0 +1,15 @@
|
||||
module ai_service/proto/l-ai-core-proto
|
||||
|
||||
go 1.23.0
|
||||
|
||||
require (
|
||||
google.golang.org/grpc v1.70.0
|
||||
google.golang.org/protobuf v1.36.8
|
||||
)
|
||||
|
||||
require (
|
||||
golang.org/x/net v0.43.0 // indirect
|
||||
golang.org/x/sys v0.35.0 // indirect
|
||||
golang.org/x/text v0.28.0 // indirect
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a // indirect
|
||||
)
|
||||
32
go.sum
Normal file
32
go.sum
Normal file
@ -0,0 +1,32 @@
|
||||
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
|
||||
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
|
||||
github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||
github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek=
|
||||
github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
|
||||
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
||||
go.opentelemetry.io/otel v1.32.0 h1:WnBN+Xjcteh0zdk01SVqV55d/m62NJLJdIyb4y/WO5U=
|
||||
go.opentelemetry.io/otel v1.32.0/go.mod h1:00DCVSB0RQcnzlwyTfqtxSm+DRr9hpYrHjNGiBHVQIg=
|
||||
go.opentelemetry.io/otel/metric v1.32.0 h1:xV2umtmNcThh2/a/aCP+h64Xx5wsj8qqnkYZktzNa0M=
|
||||
go.opentelemetry.io/otel/metric v1.32.0/go.mod h1:jH7CIbbK6SH2V2wE16W05BHCtIDzauciCRLoc/SyMv8=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0 h1:RNxepc9vK59A8XsgZQouW8ue8Gkb4jpWtJm9ge5lEG4=
|
||||
go.opentelemetry.io/otel/sdk v1.32.0/go.mod h1:LqgegDBjKMmb2GC6/PrTnteJG39I8/vJCAP9LlJXEjU=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.32.0 h1:rZvFnvmvawYb0alrYkjraqJq0Z4ZUJAiyYCU9snn1CU=
|
||||
go.opentelemetry.io/otel/sdk/metric v1.32.0/go.mod h1:PWeZlq0zt9YkYAp3gjKZ0eicRYvOh1Gd+X99x6GHpCQ=
|
||||
go.opentelemetry.io/otel/trace v1.32.0 h1:WIC9mYrXf8TmY/EXuULKc8hR17vE+Hjv2cssQDe03fM=
|
||||
go.opentelemetry.io/otel/trace v1.32.0/go.mod h1:+i4rkvCraA+tG6AzwloGaCtkx53Fa+L+V8e9a7YvhT8=
|
||||
golang.org/x/net v0.43.0 h1:lat02VYK2j4aLzMzecihNvTlJNQUq316m2Mr9rnM6YE=
|
||||
golang.org/x/net v0.43.0/go.mod h1:vhO1fvI4dGsIjh73sWfUVjj3N7CA9WkKJNQm2svM6Jg=
|
||||
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
|
||||
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a h1:hgh8P4EuoxpsuKMXX/To36nOFD7vixReXgn8lPGnt+o=
|
||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241202173237-19429a94021a/go.mod h1:5uTbfoYQed2U9p3KIj2/Zzm02PYhndfdmML0qC3q3FU=
|
||||
google.golang.org/grpc v1.70.0 h1:pWFv03aZoHzlRKHWicjsZytKAiYCtNS0dHbXnIdq7jQ=
|
||||
google.golang.org/grpc v1.70.0/go.mod h1:ofIJqVKDXx/JiXrwr2IG4/zwdH9txy3IlF40RmcJSQw=
|
||||
google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc=
|
||||
google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU=
|
||||
Loading…
Reference in New Issue
Block a user