db

package
v0.0.0-...-17a4613 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalDB *gorm.DB

Functions

func HandleDBErrors

func HandleDBErrors(c *gin.Context, result *gorm.DB, notFoundString string)

func HandleUserNotAllowed

func HandleUserNotAllowed(c *gin.Context, user User, resourceUserID uint)

func InitDatabase

func InitDatabase(user string, password string, db_addr string, db_name string) (err error)

Types

type CaesarEntry

type CaesarEntry struct {
	Model
	StrToEncrypt string
	Key          int32
	StrEncrypted string
	UserID       uint
	User         User
}

type DHEntry

type DHEntry struct {
	Model
	Prime        uint64
	Primitive    uint64
	UserSecret   uint64
	ServerSecret uint64
	SharedSecret uint64
	UserID       uint
	User         User
}

type Model

type Model struct {
	gorm.Model
	UserID uint
}

func (*Model) DeleteModel

func (m *Model) DeleteModel(c *gin.Context, notFoundString string)

type RSAEncryption

type RSAEncryption struct {
	Model
	Text     string
	Result   string
	Exponent uint64
	Modulus  uint64
	UserID   uint
	User     User
}

type RSAEntry

type RSAEntry struct {
	Model
	PrimeP  uint64
	PrimeQ  uint64
	Private uint64
	Public  uint64
	Modulus uint64
	UserID  uint
	User    User
}

type User

type User struct {
	gorm.Model
	Username     string `json:"username" gorm:"unique"`
	PasswordHash string `json:"phash"`
}

func GetUser

func GetUser(c *gin.Context) (user User)

func (*User) CheckPassword

func (user *User) CheckPassword(providedPassword string) error

func (*User) CreateUserRecord

func (user *User) CreateUserRecord() error

func (*User) HashPassword

func (user *User) HashPassword(password string) error

type VigenereEntry

type VigenereEntry struct {
	Model
	StrToEncrypt string
	Key          string
	StrEncrypted string
	UserID       uint
	User         User
}

Jump to

Keyboard shortcuts

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