Documentation ¶
Index ¶
- func GeneratePassword(length, noUpperCase, noLowerCase, noNumber, noSpecials int, ignore string) string
- type IO
- type PasswordManager
- type Vault
- func (v Vault) Backup(after func() error) (func() error, error)
- func (v *Vault) Decrypt(key string, file []byte) (map[string]string, error)
- func (v *Vault) Encrypt(key string, vault []byte) ([]byte, error)
- func (v Vault) EvaluatePassword(password string) int
- func (v Vault) GetPath() string
- func (v Vault) Init(clIO IO) error
- func (v Vault) IsInit() (bool, error)
- func (v Vault) Read() ([]byte, error)
- func (v Vault) Serialize(data map[string]string) ([]byte, error)
- func (v Vault) Write(data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GeneratePassword ¶
func GeneratePassword(length, noUpperCase, noLowerCase, noNumber, noSpecials int, ignore string) string
if length is less then noUpperCase + noLowerCase + noNumber + noSpecials length will be ignored
Types ¶
type IO ¶
type PasswordManager ¶
type PasswordManager interface { // required pre-condition: is false new vault needs be created Init(clIO IO) error IsInit() (bool, error) // wrapper to read and write to the file Read() ([]byte, error) Write(data []byte) error Serialize(data map[string]string) ([]byte, error) // wrapper function to perform a backup of the vault // befor proceeding with a function (like writing a new vault) Backup(after func() error) (func() error, error) EvaluatePassword(password string) int Encrypt(key string, vault []byte) ([]byte, error) Decrypt(key string, vault []byte) (map[string]string, error) GetPath() string }
PasswordManager is the interface to act with the vault
func NewPasswordManager ¶
func NewPasswordManager(path string) PasswordManager
NewPasswordManager returns a pointer to a Vault implementing the PasswordManager interface
type Vault ¶
type Vault struct {
Path string
}
func (Vault) Backup ¶
Backup takes a backup of the current file then executes the passed function. If function returns nil the backup file gets deleted
func (*Vault) Decrypt ¶
Decrypt takes a key and a byte slice and decrypts the AES encrypted byte slice
func (*Vault) Encrypt ¶
Encrypt takes a key and a byte slice and performs a AES encryption on the slcie
func (Vault) EvaluatePassword ¶
EvaluatePassword evaluates the strength of a password (range between 0-100)
Click to show internal directories.
Click to hide internal directories.