Documentation
¶
Overview ¶
Package encryptor provides helpers for symmetric encryption.
Index ¶
- type AESEncrypter
- func (a *AESEncrypter) Decrypt(ciphertext []byte, nonce []byte) ([]byte, error)
- func (a *AESEncrypter) DecryptFromJSON(enc json.RawMessage) ([]byte, error)
- func (a *AESEncrypter) Encrypt(plaintext []byte, nonce []byte) ([]byte, error)
- func (a *AESEncrypter) EncryptToJSON(payload json.RawMessage) (json.RawMessage, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AESEncrypter ¶
type AESEncrypter struct {
// contains filtered or unexported fields
}
AESEncrypter wraps AES-GCM operations.
func NewAESEncrypter ¶
func NewAESEncrypter(hexKey string) (*AESEncrypter, error)
NewAESEncrypter constructs an AESEncrypter from a hex-encoded key.
func (*AESEncrypter) Decrypt ¶
func (a *AESEncrypter) Decrypt( ciphertext []byte, nonce []byte) ([]byte, error)
Decrypt decrypts ciphertext with the provided nonce.
func (*AESEncrypter) DecryptFromJSON ¶
func (a *AESEncrypter) DecryptFromJSON(enc json.RawMessage) ([]byte, error)
DecryptFromJSON expects base64 fields and returns decrypted bytes.
func (*AESEncrypter) Encrypt ¶
func (a *AESEncrypter) Encrypt(plaintext []byte, nonce []byte) ([]byte, error)
Encrypt encrypts plaintext with the provided nonce.
func (*AESEncrypter) EncryptToJSON ¶
func (a *AESEncrypter) EncryptToJSON( payload json.RawMessage) (json.RawMessage, error)
EncryptToJSON returns a JSON object with base64 nonce and cipher for payload.
Click to show internal directories.
Click to hide internal directories.