model

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2023 License: MIT Imports: 7 Imported by: 10

Documentation

Overview

Package model contains all the models required for a functional database management system

Index

Constants

View Source
const (
	EmailNotVerified       int8 = -1
	EmailVerifyNotRequired int8 = 0
	EmailVerified          int8 = 1
)

Email verification statuses

View Source
const (
	EmailTypeVerification int = 1
	EmailTypePassRecovery int = 2
)

Email type

View Source
const (
	EmailVerificationKeyPrefix string = "gorest-email-verification-"
	PasswordRecoveryKeyPrefix  string = "gorest-pass-recover-"
)

Redis key prefixes

Variables

View Source
var InMemorySecret2FA = make(map[uint64]Secret2FA)

InMemorySecret2FA - keep secrets temporarily in memory to setup 2FA

Functions

This section is empty.

Types

type Auth

type Auth struct {
	AuthID      uint64         `gorm:"primaryKey" json:"authID,omitempty"`
	CreatedAt   time.Time      `json:"createdAt,omitempty"`
	UpdatedAt   time.Time      `json:"updatedAt,omitempty"`
	DeletedAt   gorm.DeletedAt `gorm:"index" json:"-"`
	Email       string         `json:"email"`
	Password    string         `json:"password"`
	VerifyEmail int8           `json:"-"`
}

Auth model - `auths` table

func (Auth) MarshalJSON

func (v Auth) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*Auth) UnmarshalJSON

func (v *Auth) UnmarshalJSON(b []byte) error

UnmarshalJSON ...

type AuthPayload added in v1.6.1

type AuthPayload struct {
	Email    string `json:"email,omitempty"`
	Password string `json:"password,omitempty"`

	VerificationCode string `json:"verificationCode,omitempty"`

	OTP string `json:"otp,omitempty"`

	SecretCode  string `json:"secretCode,omitempty"`
	RecoveryKey string `json:"recoveryKey,omitempty"`

	PassNew    string `json:"passNew,omitempty"`
	PassRepeat string `json:"passRepeat,omitempty"`
}

AuthPayload - struct to handle all auth data

type HTTPResponse added in v1.6.1

type HTTPResponse struct {
	Message interface{} `json:"message,omitempty"`
}

HTTPResponse - final response to the api consumers

type Secret2FA added in v1.6.1

type Secret2FA struct {
	PassSHA []byte `json:"-"`
	Secret  []byte `json:"-"`
	Image   string `json:"-"`
}

Secret2FA - save encoded secrets in RAM temporarily

type TwoFA added in v1.6.1

type TwoFA struct {
	ID        uint64         `gorm:"primaryKey" json:"-"`
	CreatedAt time.Time      `json:"-"`
	UpdatedAt time.Time      `json:"-"`
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
	KeyMain   string         `json:"-"`
	KeyBackup string         `json:"-"`
	UUIDSHA   string         `json:"-"`
	UUIDEnc   string         `json:"-"`
	Status    string         `json:"-"`
	IDAuth    uint64         `json:"-"`
}

TwoFA model - 'two_fas' table

Jump to

Keyboard shortcuts

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