Documentation ¶
Index ¶
- Variables
- func GenRandomCode(length uint) string
- func HashID(username, number string) string
- func HttpEntry() *http.EntrySet
- func RegisterVerifyCodeServiceServer(s grpc.ServiceRegistrar, srv VerifyCodeServiceServer)
- 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) 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 UnimplementedVerifyCodeServiceServer
- type UnsafeVerifyCodeServiceServer
- type VerifyCodeServiceClient
- type VerifyCodeServiceServer
Constants ¶
This section is empty.
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_pkg_verifycode_pb_enum_proto protoreflect.FileDescriptor
var File_pkg_verifycode_pb_request_proto protoreflect.FileDescriptor
var File_pkg_verifycode_pb_service_proto protoreflect.FileDescriptor
var File_pkg_verifycode_pb_verifycode_proto protoreflect.FileDescriptor
var VerifyCodeService_ServiceDesc = grpc.ServiceDesc{ ServiceName: "keyauth.verifycode.VerifyCodeService", HandlerType: (*VerifyCodeServiceServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "IssueCode", Handler: _VerifyCodeService_IssueCode_Handler, }, { MethodName: "CheckCode", Handler: _VerifyCodeService_CheckCode_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "pkg/verifycode/pb/service.proto", }
VerifyCodeService_ServiceDesc is the grpc.ServiceDesc for VerifyCodeService service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func RegisterVerifyCodeServiceServer ¶
func RegisterVerifyCodeServiceServer(s grpc.ServiceRegistrar, srv VerifyCodeServiceServer)
Types ¶
type CheckCodeRequest ¶
type CheckCodeRequest struct { Username string `protobuf:"bytes,1,opt,name=username,proto3" json:"username" 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 { 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 { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username" validate:"required"` Number string `protobuf:"bytes,3,opt,name=number,proto3" json:"number" validate:"required"` IssueAt int64 `protobuf:"varint,4,opt,name=issue_at,json=issueAt,proto3" json:"issue_at" bson:"issue_at"` 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 { IssueType IssueType `protobuf:"varint,1,opt,name=issue_type,json=issueType,proto3,enum=keyauth.verifycode.IssueType" json:"issue_type"` Username string `protobuf:"bytes,2,opt,name=username,proto3" json:"username" validate:"required"` Password string `protobuf:"bytes,3,opt,name=password,proto3" json:"password" validate:"required"` ClientId string `protobuf:"bytes,4,opt,name=client_id,json=clientId,proto3" json:"client_id" 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) 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 { 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 UnimplementedVerifyCodeServiceServer ¶
type UnimplementedVerifyCodeServiceServer struct { }
UnimplementedVerifyCodeServiceServer must be embedded to have forward compatible implementations.
func (UnimplementedVerifyCodeServiceServer) CheckCode ¶
func (UnimplementedVerifyCodeServiceServer) CheckCode(context.Context, *CheckCodeRequest) (*Code, error)
func (UnimplementedVerifyCodeServiceServer) IssueCode ¶
func (UnimplementedVerifyCodeServiceServer) IssueCode(context.Context, *IssueCodeRequest) (*IssueCodeResponse, error)
type UnsafeVerifyCodeServiceServer ¶
type UnsafeVerifyCodeServiceServer interface {
// contains filtered or unexported methods
}
UnsafeVerifyCodeServiceServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to VerifyCodeServiceServer will result in compilation errors.
type VerifyCodeServiceClient ¶
type VerifyCodeServiceClient interface { IssueCode(ctx context.Context, in *IssueCodeRequest, opts ...grpc.CallOption) (*IssueCodeResponse, error) CheckCode(ctx context.Context, in *CheckCodeRequest, opts ...grpc.CallOption) (*Code, error) }
VerifyCodeServiceClient is the client API for VerifyCodeService 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 NewVerifyCodeServiceClient ¶
func NewVerifyCodeServiceClient(cc grpc.ClientConnInterface) VerifyCodeServiceClient
type VerifyCodeServiceServer ¶
type VerifyCodeServiceServer interface { IssueCode(context.Context, *IssueCodeRequest) (*IssueCodeResponse, error) CheckCode(context.Context, *CheckCodeRequest) (*Code, error) // contains filtered or unexported methods }
VerifyCodeServiceServer is the server API for VerifyCodeService service. All implementations must embed UnimplementedVerifyCodeServiceServer for forward compatibility