Documentation ¶
Overview ¶
Package encryption provides methods for deterministic encryption, a wrapper type EncryptedString for transparent encryption/decryption of strings during database operations and custom JSON marshaller/unmarshaller for correct serialization/unserialization.
Index ¶
- Variables
- func Decrypt(cryptoText string) (string, error)
- func Encrypt(text string) (string, error)
- func SetKey(secretKey []byte) error
- type EncryptedString
- func (es EncryptedString) Equals(estr EncryptedString) bool
- func (es *EncryptedString) MarshalJSON() ([]byte, error)
- func (es *EncryptedString) Scan(value interface{}) error
- func (es EncryptedString) String() string
- func (es *EncryptedString) UnmarshalJSON(b []byte) error
- func (es EncryptedString) Value() (value driver.Value, err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Disabled indicates if encryption is disabled Disabled bool )
Functions ¶
Types ¶
type EncryptedString ¶
type EncryptedString struct {
S string
}
EncryptedString is a wrappper around plain string allowing it to be transparently encrypted and decrypted
func (EncryptedString) Equals ¶
func (es EncryptedString) Equals(estr EncryptedString) bool
Equals tells if this ecrypted string is the same as the given encrypted string
func (*EncryptedString) MarshalJSON ¶
func (es *EncryptedString) MarshalJSON() ([]byte, error)
MarshalJSON marshals nested cleartext string
func (*EncryptedString) Scan ¶
func (es *EncryptedString) Scan(value interface{}) error
Scan implements sql.Scanner and decryptes incoming sql column data
func (EncryptedString) String ¶
func (es EncryptedString) String() string
func (*EncryptedString) UnmarshalJSON ¶
func (es *EncryptedString) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals string into S var
Click to show internal directories.
Click to hide internal directories.