auth

package
v0.0.0-...-662030e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthService_Register_FullMethodName      = "/auth.AuthService/Register"
	AuthService_Login_FullMethodName         = "/auth.AuthService/Login"
	AuthService_ValidateToken_FullMethodName = "/auth.AuthService/ValidateToken"
)

Variables

View Source
var (
	ErrorCode_name = map[int32]string{
		0: "UNKNOWN",
		1: "VALIDATION_FAILED",
		2: "EMAIL_ALREADY_EXISTS",
		3: "PASSWORD_TOO_WEAK",
		4: "INVALID_CREDENTIALS",
		5: "INTERNAL_ERROR",
	}
	ErrorCode_value = map[string]int32{
		"UNKNOWN":              0,
		"VALIDATION_FAILED":    1,
		"EMAIL_ALREADY_EXISTS": 2,
		"PASSWORD_TOO_WEAK":    3,
		"INVALID_CREDENTIALS":  4,
		"INTERNAL_ERROR":       5,
	}
)

Enum value maps for ErrorCode.

View Source
var AuthService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "auth.AuthService",
	HandlerType: (*AuthServiceServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Register",
			Handler:    _AuthService_Register_Handler,
		},
		{
			MethodName: "Login",
			Handler:    _AuthService_Login_Handler,
		},
		{
			MethodName: "ValidateToken",
			Handler:    _AuthService_ValidateToken_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "auth/auth.proto",
}

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)

View Source
var File_auth_auth_proto protoreflect.FileDescriptor

Functions

func RegisterAuthServiceServer

func RegisterAuthServiceServer(s grpc.ServiceRegistrar, srv AuthServiceServer)

Types

type AuthServiceClient

type AuthServiceClient interface {
	Register(ctx context.Context, in *RegisterRequest, opts ...grpc.CallOption) (*RegisterResponse, error)
	// Добавим методы для будущего расширения
	Login(ctx context.Context, in *LoginRequest, opts ...grpc.CallOption) (*LoginResponse, error)
	ValidateToken(ctx context.Context, in *ValidateTokenRequest, opts ...grpc.CallOption) (*ValidateTokenResponse, error)
}

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.

Сервис аутентификации

type AuthServiceServer

type AuthServiceServer interface {
	Register(context.Context, *RegisterRequest) (*RegisterResponse, error)
	// Добавим методы для будущего расширения
	Login(context.Context, *LoginRequest) (*LoginResponse, error)
	ValidateToken(context.Context, *ValidateTokenRequest) (*ValidateTokenResponse, error)
	// contains filtered or unexported methods
}

AuthServiceServer is the server API for AuthService service. All implementations must embed UnimplementedAuthServiceServer for forward compatibility.

Сервис аутентификации

type ErrorCode

type ErrorCode int32
const (
	ErrorCode_UNKNOWN              ErrorCode = 0
	ErrorCode_VALIDATION_FAILED    ErrorCode = 1
	ErrorCode_EMAIL_ALREADY_EXISTS ErrorCode = 2
	ErrorCode_PASSWORD_TOO_WEAK    ErrorCode = 3
	ErrorCode_INVALID_CREDENTIALS  ErrorCode = 4
	ErrorCode_INTERNAL_ERROR       ErrorCode = 5
)

func (ErrorCode) Descriptor

func (ErrorCode) Descriptor() protoreflect.EnumDescriptor

func (ErrorCode) Enum

func (x ErrorCode) Enum() *ErrorCode

func (ErrorCode) EnumDescriptor deprecated

func (ErrorCode) EnumDescriptor() ([]byte, []int)

Deprecated: Use ErrorCode.Descriptor instead.

func (ErrorCode) Number

func (x ErrorCode) Number() protoreflect.EnumNumber

func (ErrorCode) String

func (x ErrorCode) String() string

func (ErrorCode) Type

type ErrorResponse

type ErrorResponse struct {
	Error string    `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	Code  ErrorCode `protobuf:"varint,2,opt,name=code,proto3,enum=auth.ErrorCode" json:"code,omitempty"`
	// contains filtered or unexported fields
}

Сообщения об ошибках

func (*ErrorResponse) Descriptor deprecated

func (*ErrorResponse) Descriptor() ([]byte, []int)

Deprecated: Use ErrorResponse.ProtoReflect.Descriptor instead.

func (*ErrorResponse) GetCode

func (x *ErrorResponse) GetCode() ErrorCode

func (*ErrorResponse) GetError

func (x *ErrorResponse) GetError() string

func (*ErrorResponse) ProtoMessage

func (*ErrorResponse) ProtoMessage()

func (*ErrorResponse) ProtoReflect

func (x *ErrorResponse) ProtoReflect() protoreflect.Message

func (*ErrorResponse) Reset

func (x *ErrorResponse) Reset()

func (*ErrorResponse) String

func (x *ErrorResponse) String() string

type LoginRequest

type LoginRequest struct {
	Email    string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	// contains filtered or unexported fields
}

Запрос на логин

func (*LoginRequest) Descriptor deprecated

func (*LoginRequest) Descriptor() ([]byte, []int)

Deprecated: Use LoginRequest.ProtoReflect.Descriptor instead.

func (*LoginRequest) GetEmail

func (x *LoginRequest) GetEmail() string

func (*LoginRequest) GetPassword

func (x *LoginRequest) GetPassword() string

func (*LoginRequest) ProtoMessage

func (*LoginRequest) ProtoMessage()

func (*LoginRequest) ProtoReflect

func (x *LoginRequest) ProtoReflect() protoreflect.Message

func (*LoginRequest) Reset

func (x *LoginRequest) Reset()

func (*LoginRequest) String

func (x *LoginRequest) String() string

type LoginResponse

type LoginResponse struct {
	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"`
	ExpiresAt    *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=expires_at,json=expiresAt,proto3" json:"expires_at,omitempty"`
	// contains filtered or unexported fields
}

Ответ на логин

func (*LoginResponse) Descriptor deprecated

func (*LoginResponse) Descriptor() ([]byte, []int)

Deprecated: Use LoginResponse.ProtoReflect.Descriptor instead.

func (*LoginResponse) GetAccessToken

func (x *LoginResponse) GetAccessToken() string

func (*LoginResponse) GetExpiresAt

func (x *LoginResponse) GetExpiresAt() *timestamppb.Timestamp

func (*LoginResponse) GetRefreshToken

func (x *LoginResponse) GetRefreshToken() string

func (*LoginResponse) ProtoMessage

func (*LoginResponse) ProtoMessage()

func (*LoginResponse) ProtoReflect

func (x *LoginResponse) ProtoReflect() protoreflect.Message

func (*LoginResponse) Reset

func (x *LoginResponse) Reset()

func (*LoginResponse) String

func (x *LoginResponse) String() string

type RegisterRequest

type RegisterRequest struct {
	Email     string `protobuf:"bytes,1,opt,name=email,proto3" json:"email,omitempty"`
	Password  string `protobuf:"bytes,2,opt,name=password,proto3" json:"password,omitempty"`
	FirstName string `protobuf:"bytes,3,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
	Surname   string `protobuf:"bytes,4,opt,name=surname,proto3" json:"surname,omitempty"`
	// contains filtered or unexported fields
}

Запрос на регистрацию

func (*RegisterRequest) Descriptor deprecated

func (*RegisterRequest) Descriptor() ([]byte, []int)

Deprecated: Use RegisterRequest.ProtoReflect.Descriptor instead.

func (*RegisterRequest) GetEmail

func (x *RegisterRequest) GetEmail() string

func (*RegisterRequest) GetFirstName

func (x *RegisterRequest) GetFirstName() string

func (*RegisterRequest) GetPassword

func (x *RegisterRequest) GetPassword() string

func (*RegisterRequest) GetSurname

func (x *RegisterRequest) GetSurname() string

func (*RegisterRequest) ProtoMessage

func (*RegisterRequest) ProtoMessage()

func (*RegisterRequest) ProtoReflect

func (x *RegisterRequest) ProtoReflect() protoreflect.Message

func (*RegisterRequest) Reset

func (x *RegisterRequest) Reset()

func (*RegisterRequest) String

func (x *RegisterRequest) String() string

type RegisterResponse

type RegisterResponse struct {
	Id        int64                  `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Email     string                 `protobuf:"bytes,2,opt,name=email,proto3" json:"email,omitempty"`
	FirstName string                 `protobuf:"bytes,3,opt,name=first_name,json=firstName,proto3" json:"first_name,omitempty"`
	Surname   string                 `protobuf:"bytes,4,opt,name=surname,proto3" json:"surname,omitempty"`
	CreatedAt *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=created_at,json=createdAt,proto3" json:"created_at,omitempty"`
	// contains filtered or unexported fields
}

Ответ на регистрацию

func (*RegisterResponse) Descriptor deprecated

func (*RegisterResponse) Descriptor() ([]byte, []int)

Deprecated: Use RegisterResponse.ProtoReflect.Descriptor instead.

func (*RegisterResponse) GetCreatedAt

func (x *RegisterResponse) GetCreatedAt() *timestamppb.Timestamp

func (*RegisterResponse) GetEmail

func (x *RegisterResponse) GetEmail() string

func (*RegisterResponse) GetFirstName

func (x *RegisterResponse) GetFirstName() string

func (*RegisterResponse) GetId

func (x *RegisterResponse) GetId() int64

func (*RegisterResponse) GetSurname

func (x *RegisterResponse) GetSurname() string

func (*RegisterResponse) ProtoMessage

func (*RegisterResponse) ProtoMessage()

func (*RegisterResponse) ProtoReflect

func (x *RegisterResponse) ProtoReflect() protoreflect.Message

func (*RegisterResponse) Reset

func (x *RegisterResponse) Reset()

func (*RegisterResponse) String

func (x *RegisterResponse) String() string

type UnimplementedAuthServiceServer

type UnimplementedAuthServiceServer struct{}

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.

func (UnimplementedAuthServiceServer) Login

func (UnimplementedAuthServiceServer) Register

func (UnimplementedAuthServiceServer) ValidateToken

type UnsafeAuthServiceServer

type UnsafeAuthServiceServer interface {
	// contains filtered or unexported methods
}

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 ValidateTokenRequest

type ValidateTokenRequest struct {
	Token string `protobuf:"bytes,1,opt,name=token,proto3" json:"token,omitempty"`
	// contains filtered or unexported fields
}

Запрос на валидацию токена

func (*ValidateTokenRequest) Descriptor deprecated

func (*ValidateTokenRequest) Descriptor() ([]byte, []int)

Deprecated: Use ValidateTokenRequest.ProtoReflect.Descriptor instead.

func (*ValidateTokenRequest) GetToken

func (x *ValidateTokenRequest) GetToken() string

func (*ValidateTokenRequest) ProtoMessage

func (*ValidateTokenRequest) ProtoMessage()

func (*ValidateTokenRequest) ProtoReflect

func (x *ValidateTokenRequest) ProtoReflect() protoreflect.Message

func (*ValidateTokenRequest) Reset

func (x *ValidateTokenRequest) Reset()

func (*ValidateTokenRequest) String

func (x *ValidateTokenRequest) String() string

type ValidateTokenResponse

type ValidateTokenResponse struct {
	Valid  bool   `protobuf:"varint,1,opt,name=valid,proto3" json:"valid,omitempty"`
	UserId string `protobuf:"bytes,2,opt,name=user_id,json=userId,proto3" json:"user_id,omitempty"`
	Email  string `protobuf:"bytes,3,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

Ответ на валидацию токена

func (*ValidateTokenResponse) Descriptor deprecated

func (*ValidateTokenResponse) Descriptor() ([]byte, []int)

Deprecated: Use ValidateTokenResponse.ProtoReflect.Descriptor instead.

func (*ValidateTokenResponse) GetEmail

func (x *ValidateTokenResponse) GetEmail() string

func (*ValidateTokenResponse) GetUserId

func (x *ValidateTokenResponse) GetUserId() string

func (*ValidateTokenResponse) GetValid

func (x *ValidateTokenResponse) GetValid() bool

func (*ValidateTokenResponse) ProtoMessage

func (*ValidateTokenResponse) ProtoMessage()

func (*ValidateTokenResponse) ProtoReflect

func (x *ValidateTokenResponse) ProtoReflect() protoreflect.Message

func (*ValidateTokenResponse) Reset

func (x *ValidateTokenResponse) Reset()

func (*ValidateTokenResponse) String

func (x *ValidateTokenResponse) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL