buildr/internal/vault/api.go
Peter 1261932bdc
All checks were successful
continuous-integration/drone/push Build is passing
refactor: apply golangci-lint findings
2023-06-22 19:16:00 +02:00

35 lines
806 B
Go

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)
}