Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EncryptorDecryptor ¶
type EncryptorDecryptor[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any](salt []byte, iterations int) (*EncryptorDecryptor[T], error)
New creates a new EncryptorDecryptor instance with a random password and nonce.
func NewWithPasswordNonce ¶
func NewWithPasswordNonce[T any](password, nonce, salt []byte, iterations int) (*EncryptorDecryptor[T], error)
NewWithPasswordNonce creates a new EncryptorDecryptor instance with a specified password and nonce. Use this if you intend to persist whatever is encrypted.
func (*EncryptorDecryptor[T]) Decrypt ¶
func (e *EncryptorDecryptor[T]) Decrypt(ciphertext []byte) (T, error)
func (*EncryptorDecryptor[T]) Encrypt ¶
func (e *EncryptorDecryptor[T]) Encrypt(value T) ([]byte, error)
Click to show internal directories.
Click to hide internal directories.