data

package
v0.0.0-...-c43a9c1 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MySigningKey string

MySigningKey is a variable that defines JWT secret

Functions

func ConfigInit

func ConfigInit(config *entities.Configuration) error

ConfigInit is a function to initialize app configuration

func FromJSON

func FromJSON(payload interface{}, reader io.Reader) error

FromJSON deserializes the object from JSON string in an io.Reader to the given interface

func ToJSON

func ToJSON(payload interface{}, writer io.Writer) error

ToJSON serializes the given interface into a string based JSON format

Types

type Claims

type Claims struct {
	Username string
	jwt.StandardClaims
}

Claims determine the token holder

type Credentials

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

Credentials defines a struct for credentials flow

func NewCredentials

func NewCredentials(waClient waProtos.WhatsAppClient, emailClient protos.EmailClient, emailHandler *mailer.Email, newLogger hclog.Logger, newFacebookOauthConfig *oauth2.Config) *Credentials

NewCredentials is a function to create new credentials struct

func (*Credentials) CreateO2AuthUser

func (cred *Credentials) CreateO2AuthUser(rw http.ResponseWriter, r *http.Request, store *mysqlstore.MySQLStore, providerID, provider, email, name string) error

CreateO2AuthUser is a function to create O2Auth user based on the given login provider

func (*Credentials) GenerateJWT

func (cred *Credentials) GenerateJWT(rw http.ResponseWriter, r *http.Request, store *mysqlstore.MySQLStore, username string) error

GenerateJWT Generates a JWT token by validating the signing key

func (*Credentials) GenerateOTP

func (cred *Credentials) GenerateOTP() (string, error)

GenerateOTP Generates an OTP code string

func (*Credentials) GetCurrentUser

func (cred *Credentials) GetCurrentUser(rw http.ResponseWriter, r *http.Request, store *mysqlstore.MySQLStore) (*database.MasterUser, error)

GetCurrentUser will get the current user login info

func (*Credentials) GetFacebookUserInfo

func (cred *Credentials) GetFacebookUserInfo(code string) ([]byte, error)

GetFacebookUserInfo process the facebook OAuth2 user info

func (*Credentials) GetGoogleUserInfo

func (cred *Credentials) GetGoogleUserInfo(accessToken string) ([]byte, error)

GetGoogleUserInfo process the google OAuth2 user info

func (*Credentials) SendOTP

SendOTP is a function to send OTP to either users email or phone number (WA)

Jump to

Keyboard shortcuts

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