Documentation ¶
Index ¶
- Constants
- Variables
- func BuildBox(name string, mp *orderedmap.Map) string
- func ClipTimeout(cmd *cobra.Command, t time.Duration)
- func Confirm(r io.Reader, message string) bool
- func DisplayQRCode(secret string) error
- func Erase(filename string) error
- func Exists(db *bolt.DB, name string, obj object) error
- func FmtExpires(expires string) (string, error)
- func MustExist(db *bolt.DB, obj object) cobra.PositionalArgs
- func MustExistLs(db *bolt.DB, obj object) cobra.PositionalArgs
- func MustNotExist(db *bolt.DB, obj object) cobra.PositionalArgs
- func NormalizeName(name string) string
- func Scanln(r *bufio.Reader, field string) string
- func Scanlns(r *bufio.Reader, field string) string
- func SelectEditor() string
- func SetContext(t test, path string) *bolt.DB
- func WatchFile(filename string, done chan struct{}, errCh chan error)
- type RunEFunc
Constants ¶
const ( Card object = iota Entry File TOTP )
Objects are used to identify which type is passed to Exists().
Variables ¶
var ( // ErrInvalidLength is returned when generating a password/passphrase and the length passed is < 1. ErrInvalidLength = errors.New("invalid length") // ErrInvalidName is returned when a name is required and received "" or contains "//". ErrInvalidName = errors.New("invalid name") // ErrInvalidPath is returned when a path is required and received "". ErrInvalidPath = errors.New("invalid path") )
Functions ¶
func BuildBox ¶
func BuildBox(name string, mp *orderedmap.Map) string
BuildBox constructs a responsive box used to display records information.
┌──── Sample ────┐ │ Key │ Value │ └────────────────┘
func ClipTimeout ¶
ClipTimeout deletes the clipboard content after t if it's higher than 0 or if there is a default timeout set in the configuration. Otherwise it does nothing.
func DisplayQRCode ¶
DisplayQRCode creates a qr code with the password provided and writes it to the terminal.
func Exists ¶
Exists checks if name or one of its folders is already being used.
Returns an error if a match was found.
func FmtExpires ¶
FmtExpires returns expires formatted.
func MustExist ¶
func MustExist(db *bolt.DB, obj object) cobra.PositionalArgs
MustExist returns an error if a record does not exist or if the name is invalid.
func MustExistLs ¶
func MustExistLs(db *bolt.DB, obj object) cobra.PositionalArgs
MustExistLs is like MustExist but for ls commands, it doesn't fail if there are no arguments or if the user is using the filter flag.
func MustNotExist ¶
func MustNotExist(db *bolt.DB, obj object) cobra.PositionalArgs
MustNotExist returns an error if the record exists or if the name is invalid.
func NormalizeName ¶
NormalizeName sanitizes the user input name.
func SelectEditor ¶
func SelectEditor() string
SelectEditor returns the editor to use, if none is found it returns vim.
func SetContext ¶
SetContext sets up the testing environment.
It uses t.Cleanup() to close the database connection after the test and all its subtests are completed.
Types ¶
Directories ¶
Path | Synopsis |
---|---|
Package tfa handles two-factor authentication codes.
|
Package tfa handles two-factor authentication codes. |