otp_pb

package
v0.0.0-...-ab7124e Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package otp_pb is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
var File_entry_otp_otp_pb_otp_proto protoreflect.FileDescriptor

Functions

func RegisterOtpGinServer

func RegisterOtpGinServer(r gin.IRouter, server OtpServer)

func RegisterOtpHandler

func RegisterOtpHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterOtpHandler registers the http handlers for service Otp to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterOtpHandlerClient

func RegisterOtpHandlerClient(ctx context.Context, mux *runtime.ServeMux, client OtpClient) error

RegisterOtpHandlerClient registers the http handlers for service Otp to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "OtpClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "OtpClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "OtpClient" to call the correct interceptors.

func RegisterOtpHandlerFromEndpoint

func RegisterOtpHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterOtpHandlerFromEndpoint is same as RegisterOtpHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterOtpHandlerServer

func RegisterOtpHandlerServer(ctx context.Context, mux *runtime.ServeMux, server OtpServer) error

RegisterOtpHandlerServer registers the http handlers for service Otp to "mux". UnaryRPC :call OtpServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterOtpHandlerFromEndpoint instead.

func RegisterOtpServer

func RegisterOtpServer(s grpc.ServiceRegistrar, srv OtpServer)

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: 60)
	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

func (*GenerateRequest) Validate

func (this *GenerateRequest) Validate() error

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

func (*GenerateResponse) Validate

func (this *GenerateResponse) Validate() error

type OtpClient

type OtpClient interface {
	Generate(ctx context.Context, in *GenerateRequest, opts ...grpc.CallOption) (*GenerateResponse, error)
	Validate(ctx context.Context, in *ValidateRequest, opts ...grpc.CallOption) (*ValidateResponse, error)
}

OtpClient is the client API for Otp 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 GetOtpClient

func GetOtpClient(srv string, opts ...func(cfg *grpcc.Cfg)) OtpClient

func NewOtpClient

func NewOtpClient(cc grpc.ClientConnInterface) OtpClient

type OtpServer

type OtpServer interface {
	Generate(context.Context, *GenerateRequest) (*GenerateResponse, error)
	Validate(context.Context, *ValidateRequest) (*ValidateResponse, error)
}

OtpServer is the server API for Otp service. All implementations should embed UnimplementedOtpServer for forward compatibility

type UnimplementedOtpServer

type UnimplementedOtpServer struct {
}

UnimplementedOtpServer should be embedded to have forward compatible implementations.

func (UnimplementedOtpServer) Generate

func (UnimplementedOtpServer) Validate

type UnsafeOtpServer

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

UnsafeOtpServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to OtpServer will result in compilation errors.

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"`
	// 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

func (*ValidateRequest) Validate

func (this *ValidateRequest) Validate() error

type ValidateResponse

type ValidateResponse struct {

	// returns true if the code is valid for the ID
	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

func (*ValidateResponse) Validate

func (this *ValidateResponse) Validate() error

Jump to

Keyboard shortcuts

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