otp

package
v0.9.53 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IOTP

type IOTP interface {
	SendSMS(ormService *beeorm.Engine, phone *Phone) (string, error)
	VerifyOTP(ormService *beeorm.Engine, phone *Phone, code string) (bool, bool, error)
	Call(ormService *beeorm.Engine, phone *Phone, customMessage string) (string, error)
}

type IOTPSMSGateway

type IOTPSMSGateway interface {
	GetName() string
	GetCode() string
	SendOTP(phone *Phone, code string) (string, string, error)
	Call(phone *Phone, code string, customMessage string) (string, string, error)
	VerifyOTP(phone *Phone, code string) (string, string, bool, bool, error)
}

type OTP

type OTP struct {
	GatewayPriority []IOTPSMSGateway
	GatewayName     map[string]IOTPSMSGateway
}

func NewOTP

func NewOTP(gateways ...IOTPSMSGateway) *OTP

func (*OTP) Call added in v0.9.45

func (o *OTP) Call(ormService *beeorm.Engine, phone *Phone, customMessage string) (string, error)

func (*OTP) SendSMS

func (o *OTP) SendSMS(ormService *beeorm.Engine, phone *Phone) (string, error)

func (*OTP) VerifyOTP added in v0.9.45

func (o *OTP) VerifyOTP(ormService *beeorm.Engine, phone *Phone, code string) (bool, bool, error)

type Phone

type Phone struct {
	Number  string
	ISO3166 phonenumber.ISO3166
}

type Twilio

type Twilio struct {
	Client          *twilio.RestClient
	VerificationSID string
}

func NewTwilioSMSOTPProvider

func NewTwilioSMSOTPProvider(accountSid, authToken, verificationSid string) *Twilio

func (*Twilio) Call added in v0.9.45

func (t *Twilio) Call(phone *Phone, _ string, customMessage string) (string, string, error)

func (*Twilio) GetCode

func (t *Twilio) GetCode() string

func (*Twilio) GetName

func (t *Twilio) GetName() string

func (*Twilio) SendOTP

func (t *Twilio) SendOTP(phone *Phone, _ string) (string, string, error)

func (*Twilio) VerifyOTP

func (t *Twilio) VerifyOTP(phone *Phone, code string) (string, string, bool, bool, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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