Documentation ¶
Index ¶
- Constants
- Variables
- func GenRandomCode(length uint) string
- func HashID(username, number string) string
- func HttpEntry() *http.EntrySet
- func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
- type CheckCodeRequest
- func (*CheckCodeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CheckCodeRequest) GetNumber() string
- func (x *CheckCodeRequest) GetUsername() string
- func (req *CheckCodeRequest) HashID() string
- func (*CheckCodeRequest) ProtoMessage()
- func (x *CheckCodeRequest) ProtoReflect() protoreflect.Message
- func (x *CheckCodeRequest) Reset()
- func (x *CheckCodeRequest) String() string
- func (req *CheckCodeRequest) Validate() error
- type CheckCodeResponse
- type Code
- func (*Code) Descriptor() ([]byte, []int)deprecated
- func (c *Code) ExpiredMiniteString() string
- func (x *Code) GetExpiredMinite() uint32
- func (x *Code) GetId() string
- func (x *Code) GetIssueAt() int64
- func (x *Code) GetNumber() string
- func (x *Code) GetUsername() string
- func (c *Code) IsExpired() bool
- func (*Code) ProtoMessage()
- func (x *Code) ProtoReflect() protoreflect.Message
- func (x *Code) Reset()
- func (x *Code) String() string
- type Config
- type IssueCodeRequest
- func (req *IssueCodeRequest) Account() string
- func (*IssueCodeRequest) Descriptor() ([]byte, []int)deprecated
- func (x *IssueCodeRequest) GetAccessToken() string
- func (x *IssueCodeRequest) GetClientId() string
- func (x *IssueCodeRequest) GetClientSecret() string
- func (x *IssueCodeRequest) GetIssueType() IssueType
- func (x *IssueCodeRequest) GetPassword() string
- func (x *IssueCodeRequest) GetUsername() string
- func (*IssueCodeRequest) ProtoMessage()
- func (x *IssueCodeRequest) ProtoReflect() protoreflect.Message
- func (x *IssueCodeRequest) Reset()
- func (x *IssueCodeRequest) String() string
- func (req *IssueCodeRequest) Validate() error
- func (req *IssueCodeRequest) ValidateByPass() error
- func (req *IssueCodeRequest) ValidateByToken() error
- type IssueCodeResponse
- type IssueType
- func (IssueType) Descriptor() protoreflect.EnumDescriptor
- func (x IssueType) Enum() *IssueType
- func (IssueType) EnumDescriptor() ([]byte, []int)deprecated
- func (t IssueType) Equal(target IssueType) bool
- func (t IssueType) IsIn(targets ...IssueType) bool
- func (t IssueType) MarshalJSON() ([]byte, error)
- func (x IssueType) Number() protoreflect.EnumNumber
- func (x IssueType) String() string
- func (IssueType) Type() protoreflect.EnumType
- func (t *IssueType) UnmarshalJSON(b []byte) error
- type NotifyType
- func (NotifyType) Descriptor() protoreflect.EnumDescriptor
- func (x NotifyType) Enum() *NotifyType
- func (NotifyType) EnumDescriptor() ([]byte, []int)deprecated
- func (t NotifyType) Equal(target NotifyType) bool
- func (t NotifyType) IsIn(targets ...NotifyType) bool
- func (t NotifyType) MarshalJSON() ([]byte, error)
- func (x NotifyType) Number() protoreflect.EnumNumber
- func (x NotifyType) String() string
- func (NotifyType) Type() protoreflect.EnumType
- func (t *NotifyType) UnmarshalJSON(b []byte) error
- type ServiceClient
- type ServiceServer
- type UnimplementedServiceServer
- type UnsafeServiceServer
Constants ¶
const (
AppName = "verifycode"
)
Variables ¶
var ( NotifyType_name = map[int32]string{ 0: "MAIL", 2: "SMS", } NotifyType_value = map[string]int32{ "MAIL": 0, "SMS": 2, } )
Enum value maps for NotifyType.
var ( IssueType_name = map[int32]string{ 0: "PASS", 1: "TOKEN", } IssueType_value = map[string]int32{ "PASS": 0, "TOKEN": 1, } )
Enum value maps for IssueType.
var File_app_verifycode_pb_enum_proto protoreflect.FileDescriptor
var File_app_verifycode_pb_request_proto protoreflect.FileDescriptor
var File_app_verifycode_pb_service_proto protoreflect.FileDescriptor
var File_app_verifycode_pb_verifycode_proto protoreflect.FileDescriptor
var Service_ServiceDesc = grpc.ServiceDesc{ ServiceName: "infraboard.keyauth.verifycode.Service", HandlerType: (*ServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "IssueCode", Handler: _Service_IssueCode_Handler, }, { MethodName: "CheckCode", Handler: _Service_CheckCode_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "app/verifycode/pb/service.proto", }
Service_ServiceDesc is the grpc.ServiceDesc for Service service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterServiceServer ¶ added in v0.6.4
func RegisterServiceServer(s grpc.ServiceRegistrar, srv ServiceServer)
Types ¶
type CheckCodeRequest ¶
type CheckCodeRequest struct { // @gotags: json:"username" validate:"required" Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username" validate:"required"` // @gotags: json:"number" validate:"required" Number string `protobuf:"bytes,2,opt,name=number,proto3" json:"number" validate:"required"` // contains filtered or unexported fields }
CheckCodeRequest 验证码校验请求
func NewCheckCodeRequest ¶
func NewCheckCodeRequest(username, number string) *CheckCodeRequest
NewCheckCodeRequest todo
func (*CheckCodeRequest) Descriptor
deprecated
func (*CheckCodeRequest) Descriptor() ([]byte, []int)
Deprecated: Use CheckCodeRequest.ProtoReflect.Descriptor instead.
func (*CheckCodeRequest) GetNumber ¶
func (x *CheckCodeRequest) GetNumber() string
func (*CheckCodeRequest) GetUsername ¶
func (x *CheckCodeRequest) GetUsername() string
func (*CheckCodeRequest) ProtoMessage ¶
func (*CheckCodeRequest) ProtoMessage()
func (*CheckCodeRequest) ProtoReflect ¶
func (x *CheckCodeRequest) ProtoReflect() protoreflect.Message
func (*CheckCodeRequest) Reset ¶
func (x *CheckCodeRequest) Reset()
func (*CheckCodeRequest) String ¶
func (x *CheckCodeRequest) String() string
type CheckCodeResponse ¶
type CheckCodeResponse struct { // @gotags: json:"message" Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"` // contains filtered or unexported fields }
CheckCodeResponse todo
func (*CheckCodeResponse) Descriptor
deprecated
func (*CheckCodeResponse) Descriptor() ([]byte, []int)
Deprecated: Use CheckCodeResponse.ProtoReflect.Descriptor instead.
func (*CheckCodeResponse) GetMessage ¶
func (x *CheckCodeResponse) GetMessage() string
func (*CheckCodeResponse) ProtoMessage ¶
func (*CheckCodeResponse) ProtoMessage()
func (*CheckCodeResponse) ProtoReflect ¶
func (x *CheckCodeResponse) ProtoReflect() protoreflect.Message
func (*CheckCodeResponse) Reset ¶
func (x *CheckCodeResponse) Reset()
func (*CheckCodeResponse) String ¶
func (x *CheckCodeResponse) String() string
type Code ¶
type Code struct { // @gotags: bson:"_id" json:"id" Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` // @gotags: json:"username" validate:"required" Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username" validate:"required"` // @gotags: json:"number" validate:"required" Number string `protobuf:"bytes,3,opt,name=number,proto3" json:"number" validate:"required"` // @gotags: bson:"issue_at" json:"issue_at" IssueAt int64 `protobuf:"varint,4,opt,name=issue_at,json=issueAt,proto3" json:"issue_at" bson:"issue_at"` // @gotags: bson:"expired_minite" json:"expired_minite" ExpiredMinite uint32 `protobuf:"varint,5,opt,name=expired_minite,json=expiredMinite,proto3" json:"expired_minite" bson:"expired_minite"` // contains filtered or unexported fields }
Code todo
func (*Code) Descriptor
deprecated
func (*Code) ExpiredMiniteString ¶
ExpiredMiniteString todo
func (*Code) GetExpiredMinite ¶
func (*Code) GetIssueAt ¶
func (*Code) GetUsername ¶
func (*Code) ProtoMessage ¶
func (*Code) ProtoMessage()
func (*Code) ProtoReflect ¶
func (x *Code) ProtoReflect() protoreflect.Message
type Config ¶
type Config struct { NotifyType NotifyType `bson:"notify_type" json:"notify_type"` ExpireMinutes uint `bson:"expire_minutes" json:"expire_minutes" validate:"required,gte=10,lte=600"` // 验证码默认过期时间 MailTemplate string `bson:"mail_template" json:"mail_template"` // 邮件通知时的模板 SmsTemplateID string `bson:"sms_template_id" json:"sms_template_id"` // 短信通知时的云商模板ID }
Config todo
func (*Config) RenderMailTemplate ¶
RenderMailTemplate todo
type IssueCodeRequest ¶
type IssueCodeRequest struct { // @gotags: json:"issue_type" IssueType IssueType `protobuf:"varint,1,opt,name=issue_type,json=issueType,proto3,enum=infraboard.keyauth.verifycode.IssueType" json:"issue_type"` // @gotags: json:"username" Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username"` // @gotags: json:"password" Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password"` // @gotags: json:"access_token" AccessToken string `protobuf:"bytes,6,opt,name=access_token,json=accessToken,proto3" json:"access_token"` // @gotags: json:"client_id" validate:"required" ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id" validate:"required"` // @gotags: json:"client_secret" validate:"required" ClientSecret string `protobuf:"bytes,5,opt,name=client_secret,json=clientSecret,proto3" json:"client_secret" validate:"required"` // contains filtered or unexported fields }
IssueCodeRequest 验证码申请请求
func NewIssueCodeRequestByPass ¶
func NewIssueCodeRequestByPass() *IssueCodeRequest
NewIssueCodeRequestByPass todo
func NewIssueCodeRequestByToken ¶
func NewIssueCodeRequestByToken() *IssueCodeRequest
NewIssueCodeRequestByToken todo
func (*IssueCodeRequest) Descriptor
deprecated
func (*IssueCodeRequest) Descriptor() ([]byte, []int)
Deprecated: Use IssueCodeRequest.ProtoReflect.Descriptor instead.
func (*IssueCodeRequest) GetAccessToken ¶
func (x *IssueCodeRequest) GetAccessToken() string
func (*IssueCodeRequest) GetClientId ¶
func (x *IssueCodeRequest) GetClientId() string
func (*IssueCodeRequest) GetClientSecret ¶
func (x *IssueCodeRequest) GetClientSecret() string
func (*IssueCodeRequest) GetIssueType ¶
func (x *IssueCodeRequest) GetIssueType() IssueType
func (*IssueCodeRequest) GetPassword ¶
func (x *IssueCodeRequest) GetPassword() string
func (*IssueCodeRequest) GetUsername ¶
func (x *IssueCodeRequest) GetUsername() string
func (*IssueCodeRequest) ProtoMessage ¶
func (*IssueCodeRequest) ProtoMessage()
func (*IssueCodeRequest) ProtoReflect ¶
func (x *IssueCodeRequest) ProtoReflect() protoreflect.Message
func (*IssueCodeRequest) Reset ¶
func (x *IssueCodeRequest) Reset()
func (*IssueCodeRequest) String ¶
func (x *IssueCodeRequest) String() string
func (*IssueCodeRequest) ValidateByPass ¶
func (req *IssueCodeRequest) ValidateByPass() error
ValidateByPass todo
func (*IssueCodeRequest) ValidateByToken ¶
func (req *IssueCodeRequest) ValidateByToken() error
ValidateByToken todo
type IssueCodeResponse ¶
type IssueCodeResponse struct { // @gotags: json:"message" Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message"` // contains filtered or unexported fields }
IssueCodeResponse todo
func NewIssueCodeResponse ¶
func NewIssueCodeResponse(message string) *IssueCodeResponse
NewIssueCodeResponse todo
func (*IssueCodeResponse) Descriptor
deprecated
func (*IssueCodeResponse) Descriptor() ([]byte, []int)
Deprecated: Use IssueCodeResponse.ProtoReflect.Descriptor instead.
func (*IssueCodeResponse) GetMessage ¶
func (x *IssueCodeResponse) GetMessage() string
func (*IssueCodeResponse) ProtoMessage ¶
func (*IssueCodeResponse) ProtoMessage()
func (*IssueCodeResponse) ProtoReflect ¶
func (x *IssueCodeResponse) ProtoReflect() protoreflect.Message
func (*IssueCodeResponse) Reset ¶
func (x *IssueCodeResponse) Reset()
func (*IssueCodeResponse) String ¶
func (x *IssueCodeResponse) String() string
type IssueType ¶
type IssueType int32
func ParseIssueTypeFromString ¶
ParseIssueTypeFromString Parse IssueType from string
func (IssueType) Descriptor ¶
func (IssueType) Descriptor() protoreflect.EnumDescriptor
func (IssueType) EnumDescriptor
deprecated
func (IssueType) Number ¶
func (x IssueType) Number() protoreflect.EnumNumber
func (IssueType) Type ¶
func (IssueType) Type() protoreflect.EnumType
func (*IssueType) UnmarshalJSON ¶
UnmarshalJSON todo
type NotifyType ¶
type NotifyType int32
const ( NotifyType_MAIL NotifyType = 0 NotifyType_SMS NotifyType = 2 )
func ParseNotifyTypeFromString ¶
func ParseNotifyTypeFromString(str string) (NotifyType, error)
ParseNotifyTypeFromString Parse NotifyType from string
func (NotifyType) Descriptor ¶
func (NotifyType) Descriptor() protoreflect.EnumDescriptor
func (NotifyType) Enum ¶
func (x NotifyType) Enum() *NotifyType
func (NotifyType) EnumDescriptor
deprecated
func (NotifyType) EnumDescriptor() ([]byte, []int)
Deprecated: Use NotifyType.Descriptor instead.
func (NotifyType) Number ¶
func (x NotifyType) Number() protoreflect.EnumNumber
func (NotifyType) String ¶
func (x NotifyType) String() string
func (NotifyType) Type ¶
func (NotifyType) Type() protoreflect.EnumType
func (*NotifyType) UnmarshalJSON ¶
func (t *NotifyType) UnmarshalJSON(b []byte) error
UnmarshalJSON todo
type ServiceClient ¶ added in v0.6.4
type ServiceClient interface { IssueCode(ctx context.Context, in *IssueCodeRequest, opts ...grpc.CallOption) (*IssueCodeResponse, error) CheckCode(ctx context.Context, in *CheckCodeRequest, opts ...grpc.CallOption) (*Code, error) }
ServiceClient is the client API for Service 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.
func NewServiceClient ¶ added in v0.6.4
func NewServiceClient(cc grpc.ClientConnInterface) ServiceClient
type ServiceServer ¶ added in v0.6.4
type ServiceServer interface { IssueCode(context.Context, *IssueCodeRequest) (*IssueCodeResponse, error) CheckCode(context.Context, *CheckCodeRequest) (*Code, error) // contains filtered or unexported methods }
ServiceServer is the server API for Service service. All implementations must embed UnimplementedServiceServer for forward compatibility
type UnimplementedServiceServer ¶ added in v0.6.4
type UnimplementedServiceServer struct { }
UnimplementedServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedServiceServer) CheckCode ¶ added in v0.6.4
func (UnimplementedServiceServer) CheckCode(context.Context, *CheckCodeRequest) (*Code, error)
func (UnimplementedServiceServer) IssueCode ¶ added in v0.6.4
func (UnimplementedServiceServer) IssueCode(context.Context, *IssueCodeRequest) (*IssueCodeResponse, error)
type UnsafeServiceServer ¶ added in v0.6.4
type UnsafeServiceServer interface {
// contains filtered or unexported methods
}
UnsafeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to ServiceServer will result in compilation errors.