Versions in this module Expand all Collapse all v0 v0.1.0 Sep 12, 2023 Changes in this version + var ErrVaultNotInitialized = errors.New("vault is not properly initialized") + type AesGcmEncryption struct + func NewAesGcmEncryption(deriver KeyDeriver) *AesGcmEncryption + func (a AesGcmEncryption) Decrypt(cipherText []byte, passphrase string, salt, nonce []byte) (plainText []byte, err error) + func (a AesGcmEncryption) Encrypt(plainText []byte, passphrase string) (cipherText, salt, nonce []byte, err error) + type Decrypter interface + Decrypt func(cipherText []byte, passphrase string, salt, nonce []byte) (plainText []byte, err error) + type Encrypter interface + Encrypt func(plainText []byte, passphrase string) (cipherText, salt, nonce []byte, err error) + type Encryption interface + type Entry struct + Nonce []byte + Salt []byte + Value []byte + func EntryFromText(txt string) (e Entry, err error) + func (e Entry) Decrypt(decrypter Decrypter, passphrase string) ([]byte, error) + func (e Entry) MarshalText() string + type InitOption interface + func WithEncryption(encryption Encryption) InitOption + func WithLoadFromPath(path string) InitOption + func WithPassphrase(passphrase string) InitOption + func WithPassphraseFile(path string) InitOption + type KeyDeriver interface + DeriveKey func(passphrase string, existingSalt []byte) (key, salt []byte) + func Pbkdf2Deriver() KeyDeriver + type KeyDeriverFunc func(passphrase string, existingSalt []byte) (key, salt []byte) + func (f KeyDeriverFunc) DeriveKey(passphrase string, existingSalt []byte) (key, salt []byte) + type Vault struct + func NewVault(opts ...InitOption) (*Vault, error) + func (v *Vault) GetValue(entryKey string) ([]byte, error) + func (v *Vault) Keys() []string + func (v *Vault) MarshalJSON() ([]byte, error) + func (v *Vault) RemoveValue(entryKey string) + func (v *Vault) SetValue(entryKey string, plainText []byte) error + func (v *Vault) UnmarshalJSON(data []byte) error