Package riversecretbox provides a riverencrypt.Encryptor implementation that uses NaCl Secretbox, a good default encryption choice using widely respected cryptography.
This section is empty.
This section is empty.
This section is empty.
type SecretboxEncryptor struct {/* contains filtered or unexported fields */}
func NewSecretboxEncryptor(keys ...[keySize]byte) *SecretboxEncryptor
NewSecretBoxEncryptor returns a new SecretBoxEncryptor, an encryptor making use of NaCl Secretbox for use with riverencrypt.EncryptHook.
Multiple encryption keys may be specified for purposes of key rotation. When encrypting data, the first key is always used. When decrypting, all keys are tried, starting with the first, and an error is only returned if no key is capable of decrypting encrypted data. When rotating keys, initialize the lifecycle with the new key first and old key second. After all jobs that need to the old key be decrypted have rotated out of the database, remove the old key, after which the key rotation is complete.
func (e *SecretboxEncryptor) Decrypt(cipher []byte) ([]byte, error)
func (e *SecretboxEncryptor) Encrypt(plain []byte) []byte