Documentation ¶
Overview ¶
Package secret provides abstractions for storing data securely when possible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrIncorrectPassword = errors.New("incorrect password")
ErrIncorrectPassword is returned if the provided user password does not match what is on disk.
var ErrNotFound = errors.New("key not found")
ErrNotFound is returned for unknown keys.
var ErrUnsupportedPlatform = keyring.ErrUnsupportedPlatform
Functions ¶
func PathIsEncrypted ¶
PathIsEncrypted returns true if the given path is encrypted. It is the caller's responsibility to use SaltedFileDriver or EncryptedFileDriver on the same path.
In some cases, false will be returned if the status of encryption cannot be determined. In this case, when EncryptedFileDriver is used, storing will be errored out.
Types ¶
type EncryptedFile ¶
type EncryptedFile struct {
// contains filtered or unexported fields
}
EncryptedFile is an implementation of a secret driver that encrypts the value stored using a generated salt. When created, EncryptedFileDriver should be used over SaltedFileDriver.
func EncryptedFileDriver ¶
func EncryptedFileDriver(passphrase, path string) *EncryptedFile
EncryptedFileDriver creates a new encrypted file driver with the given passphrase. The passphrase is hashed and compared with an existing one, or it will be used if there is none.
func SaltedFileDriver ¶
func SaltedFileDriver(path string) *EncryptedFile
SaltedFileDriver creates a new encrypted file driver with a generated passphrase. The .salt file is solely used as the hashing input, so the algorithm will trip without it. One way to completely lock out accounts encrypted with it is to move the file somewhere else.
type Keyring ¶
type Keyring struct {
// contains filtered or unexported fields
}
Keyring is an implementation of a secret driver using the system's keyring driver.
func KeyringDriver ¶
KeyringDriver creates a new keyring driver.