Documentation ¶
Index ¶
- Variables
- type Credential
- type Vault
- func (v *Vault) Add(location string, credential Credential) error
- func (v *Vault) AddMeta(location string, name string, value string) error
- func (v *Vault) ChangePassphrase(newpassphrase string) error
- func (v *Vault) Delete(location string) error
- func (v *Vault) DeleteMeta(location string, metaname string) error
- func (v *Vault) Edit(location string, credential Credential) error
- func (v *Vault) EditMeta(location string, name string, newvalue string) error
- func (v *Vault) Find(searchtext string) (string, *Credential, error)
- func (v *Vault) FindMeta(location string, searchtext string) (string, string, error)
- func (v *Vault) Generate(location string, username string) error
- func (v *Vault) Get(location string) (*Credential, error)
- func (v *Vault) LoadCSV(c io.Reader, locationField, usernameField, passwordField string) (int, error)
- func (v *Vault) Locations() ([]string, error)
- func (v *Vault) Save(filename string) error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoSuchCredential is returned from a Get call if the requested // credential does not exist ErrNoSuchCredential = errors.New("credential at specified location does not exist in vault") // ErrCouldNotDecrypt is returned if secretbox decryption fails. ErrCouldNotDecrypt = errors.New("provided decryption key is incorrect or the provided vault is corrupt") // ErrCredentialExists is returned from Add if a credential already exists // at the provided location. ErrCredentialExists = errors.New("credential at specified location already exists") // ErrMetaExists is returned from AddMeta if a meta tag already exists. ErrMetaExists = errors.New("meta tag already exists") // ErrMetaDoesNotExist is returned from Editmeta if a meta tag does not // exist. ErrMetaDoesNotExist = errors.New("meta tag does not exist") )
Functions ¶
This section is empty.
Types ¶
type Credential ¶
Credential defines a Username and Password, and a map of Metadata to store inside the vault.
type Vault ¶
type Vault struct {
// contains filtered or unexported fields
}
Vault is a secure password vault. It can be created by calling New() with a passphrase. Passwords, usernames, and locations are encrypted using nacl/secretbox.
func Open ¶
Open reads a vault from the location provided to `filename` and decrypts it using `passphrase`. If decryption succeeds, new nonce is chosen and the vault is re-encrypted, ensuring nonces are unique and not reused across sessions.
func (*Vault) Add ¶
func (v *Vault) Add(location string, credential Credential) error
Add adds the credential provided to `credential` at the location provided by `location` to the vault.
func (*Vault) AddMeta ¶
AddMeta adds a meta tag to the credential in the vault at `location`. `name` is used for the name of the meta tag and `value` is used as its value.
func (*Vault) ChangePassphrase ¶
ChangePassphrase re-encrypts the entire vault with a new master key derived from the provided `newpassphrase`.
func (*Vault) DeleteMeta ¶
DeleteMeta removes a meta tag from the credential at `location`.
func (*Vault) Edit ¶
func (v *Vault) Edit(location string, credential Credential) error
Edit replaces the credential at location with the provided `credential`. The metadata from the old credential is preserved.
func (*Vault) EditMeta ¶
EditMeta changes a meta tag at a given location and meta tag name to `newvalue`.
func (*Vault) Find ¶
func (v *Vault) Find(searchtext string) (string, *Credential, error)
Find searches the vault for locations containing the `searchtext` and returns the matching credential name and credential if it is found. Otherwise, an error `ErrNoSuchCredential` will be returned.
func (*Vault) FindMeta ¶
FindMeta search the credential at location `location` for a meta value containing `serachtext` and returns the meta name and value if it is found. Otherwise, an error `ErrMetaDoesNotExist` will be returned.
func (*Vault) Generate ¶
Generate generates a new strong mnemonic passphrase and Add()s it to the vault.
func (*Vault) Get ¶
func (v *Vault) Get(location string) (*Credential, error)
Get retrieves a Credential at the provided `location`.
func (*Vault) LoadCSV ¶
func (v *Vault) LoadCSV(c io.Reader, locationField, usernameField, passwordField string) (int, error)
LoadCSV loads password data from a CSV file. The text provided by locationField is used as the key for Location data, usernameField and passwordField are used as the key for the Username and Password data.