Help us shape the future of Go! Take the 2026 Go Developer Survey

otp

package
v0.9.15 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2021 License: MIT 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)
	VerifySMS(ormService *beeorm.Engine, phone *Phone, code string) (bool, bool, error)
}

type IOTPSMSGateway

type IOTPSMSGateway interface {
	GetName() string
	GetCode() string
	SendOTP(phone *Phone, code 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) SendSMS

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

func (*OTP) VerifySMS

func (o *OTP) VerifySMS(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) 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)

Jump to

Keyboard shortcuts

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