Documentation
¶
Index ¶
- Constants
- Variables
- func Check(id string, password string, key string) (bool, error)
- func Clean() error
- func DecryptOTP(cipherBytes []byte, secret []byte) string
- func Delete(id string) error
- func DisableRecovery()
- func EnableRecovery(key string)
- func EncryptOTP(text string) ([]byte, []byte)
- func FilePath(id string) string
- func Get(id string, key string) (string, error)
- func GetFileEnding() string
- func GetStorePath() string
- func List() ([]string, error)
- func NormalizeId(path string) string
- func Overwrite(id string, password string, key string) error
- func Set(id string, oldPassword string, newPassword string, key string) error
- func SetFileEnding(e string)
- func SetStorePath(path string)
- func Unset(id string, password string, key string) error
- type HashFunc
Constants ¶
const RecoveryIdSuffix string = ".recovery"
RecoveryIdSuffix stores the id and file suffix that identifies recovery key files.
Variables ¶
var HashPassword bool = false
HashPassword signals if passwords will be stored as hashes.
var StorageDirMode os.FileMode = 0700
StorageDirMode controls the directory permission set by this package.
var StorageFileMode os.FileMode = 0600
StorageFileMode controls the file permission set by this package.
Functions ¶
func Check ¶
Check an existing password for equality with the provided password. key is the encryption secret for storage.
func DecryptOTP ¶ added in v0.3.2
DecryptOTP returns the decrypted message from a One-Time-Pad (OTP) encryption.
func DisableRecovery ¶ added in v0.3.2
func DisableRecovery()
DisableRecovery will stop recovery key file storage alongside passwords.
func EnableRecovery ¶ added in v0.3.2
func EnableRecovery(key string)
EnableRecovery will enforce recovery key file storage alongside passwords.
func EncryptOTP ¶ added in v0.3.2
EncryptOTP returns a One-Time-Pad (OTP) encrypted message and its OTP secret.
func FilePath ¶
FilePath returns the storage filepath of a given password-id with system-specific path separators. It accepts system-unspecific or mixed id separators, i.e. forward- and backward-slashes are treated as the same character.
func GetFileEnding ¶
func GetFileEnding() string
GetFileEnding returns the current file ending of storage files.
func GetStorePath ¶
func GetStorePath() string
GetStorePath returns the current storage path with system-specific path separators.
func NormalizeId ¶
NormalizeId transforms path to lower case letters and normalizes the path separator
func Overwrite ¶
Overwrite an existing password or create a new one. key is the encryption secret for storage.
func Set ¶
Set an existing password-id or create a new one. oldPassword must match the currently stored password. key is the encryption secret for storage.
func SetFileEnding ¶
func SetFileEnding(e string)
SetFileEnding accepts a new file ending for storage files.
func SetStorePath ¶
func SetStorePath(path string)
SetStorePath accepts a new storage path with system-unspecific or mixed path separators.
Types ¶
type HashFunc ¶ added in v0.2.1
HashFunc is a function signature. The Hash function will be called for password and secret hashing.
var Hash HashFunc = argon2iHash
Hash will calculate a 32 byte hash from a given byte slice. It is used for password and secret hashing. You can overwrite it with any function that meets the HashFunc signature. By default, it is set to a variant of argon2.Key.