package vault type InitOption interface { applyToVault(v *Vault) error } type initOptionFunc func(*Vault) error func (f initOptionFunc) applyToVault(v *Vault) error { return f(v) } type Encryption interface { Encrypter Decrypter } type Encrypter interface { Encrypt(plainText []byte, passphrase string) (cipherText, salt, nonce []byte, err error) } type Decrypter interface { Decrypt(cipherText []byte, passphrase string, salt, nonce []byte) (plainText []byte, err error) } type KeyDeriver interface { DeriveKey(passphrase string, existingSalt []byte) (key, salt []byte) } type KeyDeriverFunc func(passphrase string, existingSalt []byte) (key, salt []byte) func (f KeyDeriverFunc) DeriveKey(passphrase string, existingSalt []byte) (key, salt []byte) { return f(passphrase, existingSalt) }