app

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2022 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//ErrExpiredToken represents message for expired token
	ErrExpiredToken = errors.New("token expired or invalid")
	//ErrUnauthorized represents message for unauthorized
	ErrUnauthorized = errors.New("unauthorized")
)
View Source
var (
	// ErrGenerateSchema represents message for generating schema
	ErrGenerateSchema = errors.New("an error occured while genarating schema")
	// ErrCreateSchema represents message for creating schema
	ErrCreateSchema = errors.New("an error occured while creating the schema and tables")
)

Functions

func CancelSubscription added in v1.1.3

func CancelSubscription(s storage.Store, r *http.Request) (int, string)

func ChangeMasterPassword added in v1.2.1

func ChangeMasterPassword(s storage.Store, user *model.User, newMasterPassword string) (*model.User, error)

ChangeMasterPassword updates the user with the new master password

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 CreateSubscription added in v1.1.3

func CreateSubscription(s storage.Store, r *http.Request) (int, string)

CreateSubscription creates a subscription 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, error)

Decrypt ...

func DecryptFile

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

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 DecryptPayload added in v1.1.7

func DecryptPayload(key string, encrypted []byte) ([]byte, error)

DecryptPayload ...

func Encrypt

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

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)

FallbackInsecureKey fallback method for sercure key

func FindAllBankAccounts added in v1.2.1

func FindAllBankAccounts(s storage.Store, schema string) ([]model.BankAccount, error)

FindAllBankAccounts finds all logins

func FindAllCreditCards added in v1.2.1

func FindAllCreditCards(s storage.Store, schema string) ([]model.CreditCard, error)

FindAllCreditCards finds all logins

func FindAllEmails added in v1.2.1

func FindAllEmails(s storage.Store, schema string) ([]model.Email, error)

FindAllEmails finds all logins

func FindAllLogins added in v1.2.1

func FindAllLogins(s storage.Store, schema string) ([]model.Login, error)

FindAllLogins finds all logins

func FindAllNotes added in v1.2.1

func FindAllNotes(s storage.Store, schema string) ([]model.Note, error)

FindAllNotes finds all logins

func FindAllServers added in v1.2.1

func FindAllServers(s storage.Store, schema string) ([]model.Server, error)

FindAllServers finds all logins

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)

GenerateSecureKey generates a secure key width a given length

func GetBackupFiles

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

GetBackupFiles retrieves backup files

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) error

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 PayloadValidator added in v1.1.7

func PayloadValidator(model interface{}) error

PayloadValidator ...

func PaymentFailedSubscription added in v1.1.3

func PaymentFailedSubscription(s storage.Store, r *http.Request) (int, string)

func PaymentSucceedSubscription added in v1.1.3

func PaymentSucceedSubscription(s storage.Store, r *http.Request) (int, string)

func RandomMD5Hash

func RandomMD5Hash() string

RandomMD5Hash returns random md5 hash for unique conifrim links

func SendMail

func SendMail(name, email string, subject, bodyHTML string) error

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 UpdateSubscription added in v1.1.3

func UpdateSubscription(s storage.Store, r *http.Request) (int, string)

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