Documentation
¶
Index ¶
- Variables
- func NewOtpEndpoints() []*api.Endpoint
- func RegisterOtpHandler(s server.Server, hdlr OtpHandler, opts ...server.HandlerOption) error
- type GenerateRequest
- func (*GenerateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GenerateRequest) GetExpiry() int64
- func (x *GenerateRequest) GetId() string
- func (x *GenerateRequest) GetSize() int64
- func (*GenerateRequest) ProtoMessage()
- func (x *GenerateRequest) ProtoReflect() protoreflect.Message
- func (x *GenerateRequest) Reset()
- func (x *GenerateRequest) String() string
- type GenerateResponse
- type OtpHandler
- type OtpService
- type ValidateRequest
- func (*ValidateRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ValidateRequest) GetCode() string
- func (x *ValidateRequest) GetId() string
- func (*ValidateRequest) ProtoMessage()
- func (x *ValidateRequest) ProtoReflect() protoreflect.Message
- func (x *ValidateRequest) Reset()
- func (x *ValidateRequest) String() string
- type ValidateResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var File_proto_otp_proto protoreflect.FileDescriptor
Functions ¶
func NewOtpEndpoints ¶
func RegisterOtpHandler ¶
func RegisterOtpHandler(s server.Server, hdlr OtpHandler, opts ...server.HandlerOption) error
Types ¶
type GenerateRequest ¶
type GenerateRequest struct {
// unique id, email or user to generate an OTP for
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// number of characters (default: 6)
Size int64 `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
// expiration in seconds (default: 300)
Expiry int64 `protobuf:"varint,3,opt,name=expiry,proto3" json:"expiry,omitempty"`
// contains filtered or unexported fields
}
Generate an OTP (one time pass) code
func (*GenerateRequest) Descriptor
deprecated
func (*GenerateRequest) Descriptor() ([]byte, []int)
Deprecated: Use GenerateRequest.ProtoReflect.Descriptor instead.
func (*GenerateRequest) GetExpiry ¶
func (x *GenerateRequest) GetExpiry() int64
func (*GenerateRequest) GetId ¶
func (x *GenerateRequest) GetId() string
func (*GenerateRequest) GetSize ¶
func (x *GenerateRequest) GetSize() int64
func (*GenerateRequest) ProtoMessage ¶
func (*GenerateRequest) ProtoMessage()
func (*GenerateRequest) ProtoReflect ¶
func (x *GenerateRequest) ProtoReflect() protoreflect.Message
func (*GenerateRequest) Reset ¶
func (x *GenerateRequest) Reset()
func (*GenerateRequest) String ¶
func (x *GenerateRequest) String() string
type GenerateResponse ¶
type GenerateResponse struct {
// one time pass code
Code string `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"`
// contains filtered or unexported fields
}
func (*GenerateResponse) Descriptor
deprecated
func (*GenerateResponse) Descriptor() ([]byte, []int)
Deprecated: Use GenerateResponse.ProtoReflect.Descriptor instead.
func (*GenerateResponse) GetCode ¶
func (x *GenerateResponse) GetCode() string
func (*GenerateResponse) ProtoMessage ¶
func (*GenerateResponse) ProtoMessage()
func (*GenerateResponse) ProtoReflect ¶
func (x *GenerateResponse) ProtoReflect() protoreflect.Message
func (*GenerateResponse) Reset ¶
func (x *GenerateResponse) Reset()
func (*GenerateResponse) String ¶
func (x *GenerateResponse) String() string
type OtpHandler ¶
type OtpHandler interface {
Generate(context.Context, *GenerateRequest, *GenerateResponse) error
Validate(context.Context, *ValidateRequest, *ValidateResponse) error
}
type OtpService ¶
type OtpService interface {
Generate(ctx context.Context, in *GenerateRequest, opts ...client.CallOption) (*GenerateResponse, error)
Validate(ctx context.Context, in *ValidateRequest, opts ...client.CallOption) (*ValidateResponse, error)
}
func NewOtpService ¶
func NewOtpService(name string, c client.Client) OtpService
type ValidateRequest ¶
type ValidateRequest struct {
// unique id, email or user for which the code was generated
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
// 6 digit one time pass code to validate
Code string `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
// contains filtered or unexported fields
}
Validate the OTP code
func (*ValidateRequest) Descriptor
deprecated
func (*ValidateRequest) Descriptor() ([]byte, []int)
Deprecated: Use ValidateRequest.ProtoReflect.Descriptor instead.
func (*ValidateRequest) GetCode ¶
func (x *ValidateRequest) GetCode() string
func (*ValidateRequest) GetId ¶
func (x *ValidateRequest) GetId() string
func (*ValidateRequest) ProtoMessage ¶
func (*ValidateRequest) ProtoMessage()
func (*ValidateRequest) ProtoReflect ¶
func (x *ValidateRequest) ProtoReflect() protoreflect.Message
func (*ValidateRequest) Reset ¶
func (x *ValidateRequest) Reset()
func (*ValidateRequest) String ¶
func (x *ValidateRequest) String() string
type ValidateResponse ¶
type ValidateResponse struct {
// returns true if successful
Success bool `protobuf:"varint,1,opt,name=success,proto3" json:"success,omitempty"`
// contains filtered or unexported fields
}
func (*ValidateResponse) Descriptor
deprecated
func (*ValidateResponse) Descriptor() ([]byte, []int)
Deprecated: Use ValidateResponse.ProtoReflect.Descriptor instead.
func (*ValidateResponse) GetSuccess ¶
func (x *ValidateResponse) GetSuccess() bool
func (*ValidateResponse) ProtoMessage ¶
func (*ValidateResponse) ProtoMessage()
func (*ValidateResponse) ProtoReflect ¶
func (x *ValidateResponse) ProtoReflect() protoreflect.Message
func (*ValidateResponse) Reset ¶
func (x *ValidateResponse) Reset()
func (*ValidateResponse) String ¶
func (x *ValidateResponse) String() string
Click to show internal directories.
Click to hide internal directories.