utils

package
v0.0.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAccount

func AddAccount(name, username, email, secret string) error

AddAccount add new account to the db

func ConfirmPrompt

func ConfirmPrompt(message string) bool

ConfirmPrompt will prompt to user for yes or no

func CopyToClipboard

func CopyToClipboard(text string)

Copy to clipboard function for Linux, Windows, MacOS

func CopyToClipboardWithBinding

func CopyToClipboardWithBinding(text binding.String)

Copy to clipboard function for Linux, Windows, MacOS

func Decrypt

func Decrypt(key, data []byte) ([]byte, error)

Decrypt returns decrypted data and errors

func Encrypt

func Encrypt(key, data []byte) ([]byte, error)

Encrypt returns encrypted data and errors

func GenTips

func GenTips() string

GenTips generates random tips

func GenerateID

func GenerateID() string

GenerateID generates a random ID

func GetConfig

func GetConfig() string

GetConfigFile returns the config file path

func GetHOTPToken

func GetHOTPToken(secret string, interval int64) string

GetHOTPToken returns the HOTP token

func GetTOTPToken

func GetTOTPToken(secret string) string

GetTOTPToken returns the TOTP token

func IsBase32

func IsBase32(str string) bool

IsBase32 checks if a string is a valid base32 string

func PanicIf

func PanicIf(err error)

PanicIf error is not nil

func ReadAccounts

func ReadAccounts(configFile string) ([]models.Account, error)

ReadAccounts decrypt all accounts

func RemoveAccount

func RemoveAccount(id string)

RemoveAccount remove account from the db

func SaveAccounts

func SaveAccounts(accounts []models.Account, configFile string) error

SaveAccounts save all accounts

func VerifyKey

func VerifyKey(key, data []byte) bool

VerifyKey verify the password

Types

This section is empty.

Jump to

Keyboard shortcuts

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