otp

package
v0.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ImplOTP

type ImplOTP struct {
	// contains filtered or unexported fields
}

ImplOTP is the OTP service implementation

func NewOTP

func NewOTP(infrastructure infrastructure.Interactor) *ImplOTP

NewOTP initializes a otp service instance

func (*ImplOTP) EmailVerificationOtp

func (f *ImplOTP) EmailVerificationOtp(
	ctx context.Context,
	email *string,
) (string, error)

EmailVerificationOtp generates an OTP to the supplied email for verification

func (*ImplOTP) GenerateAndSendOTP

func (f *ImplOTP) GenerateAndSendOTP(
	ctx context.Context,
	msisdn string,
	appID *string,
) (string, error)

GenerateAndSendOTP creates an OTP and sends it to the supplied phone number as a text message

func (*ImplOTP) GenerateOTP

func (f *ImplOTP) GenerateOTP(
	ctx context.Context,
) (string, error)

GenerateOTP generates an OTP

func (*ImplOTP) GenerateRetryOTP

func (f *ImplOTP) GenerateRetryOTP(
	ctx context.Context,
	msisdn *string,
	retryStep int,
	appID *string,
) (string, error)

GenerateRetryOTP generates fallback OTPs when Africa is talking sms fails

func (*ImplOTP) SaveOTPToFirestore

func (f *ImplOTP) SaveOTPToFirestore(
	otp dto.OTP,
) error

SaveOTPToFirestore persists the supplied OTP

func (*ImplOTP) SendOTPToEmail

func (f *ImplOTP) SendOTPToEmail(
	ctx context.Context,
	msisdn string,
	email *string,
	appID *string) (string, error)

SendOTPToEmail is a companion to GenerateAndSendOTP function It will send the generated OTP to the provided email address

func (*ImplOTP) SendTemporaryPIN

func (f *ImplOTP) SendTemporaryPIN(
	ctx context.Context,
	input dto.TemporaryPIN,
) error

SendTemporaryPIN sends a temporary PIN message to user via whatsapp and SMS

func (*ImplOTP) VerifyEmailOtp

func (f *ImplOTP) VerifyEmailOtp(
	ctx context.Context,
	email,
	verificationCode *string,
) (bool, error)

VerifyEmailOtp checks for the validity of the supplied OTP but does not invalidate it

func (*ImplOTP) VerifyOtp

func (f *ImplOTP) VerifyOtp(
	ctx context.Context,
	msisdn string,
	verificationCode *string,
) (bool, error)

VerifyOtp checks for the validity of the supplied OTP but does not invalidate it

type UsecaseOTP

type UsecaseOTP interface {
	GenerateAndSendOTP(
		ctx context.Context,
		msisdn string,
		appID *string,
	) (string, error)
	SendOTPToEmail(
		ctx context.Context,
		msisdn,
		email *string,
		appID *string,
	) (string, error)
	SaveOTPToFirestore(
		otp dto.OTP,
	) error
	VerifyOtp(
		ctx context.Context,
		msisdn *string,
		verificationCode *string,
	) (bool, error)
	VerifyEmailOtp(
		ctx context.Context,
		email *string,
		verificationCode *string,
	) (bool, error)
	GenerateRetryOTP(
		ctx context.Context,
		msisdn *string,
		retryStep int,
		appID *string,
	) (string, error)
	EmailVerificationOtp(
		ctx context.Context,
		email *string,
	) (string, error)
	GenerateOTP(
		ctx context.Context,
	) (string, error)
	SendTemporaryPIN(
		ctx context.Context,
		input dto.TemporaryPIN,
	) error
}

UsecaseOTP defines otp service usecases interface

Jump to

Keyboard shortcuts

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