app

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2020 License: AGPL-3.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ExpiredToken = fmt.Errorf("Token expired or invalid")
	Unauthorized = fmt.Errorf("Unauthorized")
)
View Source
var (
	BackupError      = errors.New("error occurred while backing up data")
	NoBackupFilesErr = errors.New("no backup file  provided")
)
View Source
var (
	MinSecureKeyLength = 8
	ShortSecureKeyErr  = errors.New("length of secure key does not meet with minimum requirements")
)

Functions

func CreateBankAccount

func CreateBankAccount(s storage.Store, dto *model.BankAccountDTO, schema string) (*model.BankAccount, error)

CreateBankAccount creates a new bank account and saves it to the store

func CreateCreditCard

func CreateCreditCard(s storage.Store, dto *model.CreditCardDTO, schema string) (*model.CreditCard, error)

CreateCreditCard creates a new credit card and saves it to the store

func CreateEmail

func CreateEmail(s storage.Store, dto *model.EmailDTO, schema string) (*model.Email, error)

CreateEmail creates a new bank account and saves it to the store

func CreateHash

func CreateHash(key string) string

CreateHash ...

func CreateLogin

func CreateLogin(s storage.Store, dto *model.LoginDTO, schema string) (*model.Login, error)

CreateLogin creates a login and saves it to the store

func CreateLogins

func CreateLogins(s storage.Store, dtos []model.LoginDTO, schema string) error

CreateLogins is needed for import

func CreateNote

func CreateNote(s storage.Store, dto *model.NoteDTO, schema string) (*model.Note, error)

CreateNote creates a new note and saves it to the store

func CreateServer

func CreateServer(s storage.Store, dto *model.ServerDTO, schema string) (*model.Server, error)

CreateServer creates a server and saves it to the store

func CreateToken

func CreateToken(user *model.User) (*model.TokenDetailsDTO, error)

CreateToken ...

func CreateUser

func CreateUser(s storage.Store, userDTO *model.UserDTO) (*model.User, error)

CreateUser creates a user and saves it to the store

func Decrypt

func Decrypt(dataStr string, passphrase string) []byte

Decrypt ...

func DecryptFile

func DecryptFile(filename string, passphrase string) []byte

DecryptFile ...

func DecryptJSON

func DecryptJSON(key string, encrypted []byte, v interface{}) error

DecryptJSON ...

func DecryptModel

func DecryptModel(rawModel interface{}) (interface{}, error)

DecryptModel decrypts struct pointer according to struct tags

func Encrypt

func Encrypt(dataStr string, passphrase string) []byte

Encrypt ..

func EncryptFile

func EncryptFile(filename string, data []byte, passphrase string)

EncryptFile ...

func EncryptJSON

func EncryptJSON(key string, v interface{}) ([]byte, error)

EncryptJSON ...

func EncryptModel

func EncryptModel(rawModel interface{}) interface{}

EncryptModel encrypts struct pointer according to struct tags

func FallbackInsecureKey

func FallbackInsecureKey(length int) (string, error)

func FindIndex

func FindIndex(vs []string, t string) int

FindIndex ...

func GenerateSchema

func GenerateSchema(s storage.Store, user *model.User) (*model.User, error)

GenerateSchema creates user schema and tables

func GenerateSecureKey

func GenerateSecureKey(length int) (string, error)

func GetBackupFiles

func GetBackupFiles() ([]os.FileInfo, error)

func GetMD5Hash

func GetMD5Hash(text []byte) string

GetMD5Hash ...

func MigrateSystemTables

func MigrateSystemTables(s storage.Store)

MigrateSystemTables runs auto migration for the system models (Token and User), will only add missing fields won't delete/change current data in the store.

func MigrateUserTables

func MigrateUserTables(s storage.Store, schema string)

MigrateUserTables runs auto migration for user models in user schema, will only add missing fields won't delete/change current data in the store.

func NewBcrypt

func NewBcrypt(key []byte) string

NewBcrypt ...

func RandomMD5Hash

func RandomMD5Hash() string

RandomMD5Hash returns random md5 hash for unique conifrim links

func SendMail

func SendMail(to []string, subject, body string)

SendMail is an helper to send mail all over the project

func TokenValid

func TokenValid(bearerToken string) (*jwt.Token, error)

TokenValid ...

func UpdateBankAccount

func UpdateBankAccount(s storage.Store, bankAccount *model.BankAccount, dto *model.BankAccountDTO, schema string) (*model.BankAccount, error)

UpdateBankAccount updates the account with the dto and applies the changes in the store

func UpdateCreditCard

func UpdateCreditCard(s storage.Store, creditCard *model.CreditCard, dto *model.CreditCardDTO, schema string) (*model.CreditCard, error)

UpdateCreditCard updates the credit card with the dto and applies the changes in the store

func UpdateEmail

func UpdateEmail(s storage.Store, email *model.Email, dto *model.EmailDTO, schema string) (*model.Email, error)

UpdateEmail updates the account with the dto and applies the changes in the store

func UpdateLogin

func UpdateLogin(s storage.Store, login *model.Login, dto *model.LoginDTO, schema string) (*model.Login, error)

UpdateLogin updates the login with the dto and applies the changes in the store

func UpdateNote

func UpdateNote(s storage.Store, note *model.Note, dto *model.NoteDTO, schema string) (*model.Note, error)

UpdateNote updates the note with the dto and applies the changes in the store

func UpdateServer

func UpdateServer(s storage.Store, server *model.Server, dto *model.ServerDTO, schema string) (*model.Server, error)

UpdateServer updates the server with the dto and applies the changes in the store

func UpdateUser

func UpdateUser(s storage.Store, user *model.User, userDTO *model.UserDTO, isAuthorized bool) (*model.User, error)

UpdateUser updates the user with the dto and applies the changes in the store

Types

This section is empty.

Jump to

Keyboard shortcuts

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