Documentation ¶ Index ¶ type Coder func New(cfg *Config) *Coder func (c *Coder) CompareHash(hash string, text string) error func (c *Coder) Decrypt(text string) (string, error) func (c *Coder) Encrypt(text string) string func (c *Coder) Hash(text string) (string, error) type Config Constants ¶ This section is empty. Variables ¶ This section is empty. Functions ¶ This section is empty. Types ¶ type Coder ¶ type Coder struct { // contains filtered or unexported fields } func New ¶ func New(cfg *Config) *Coder func (*Coder) CompareHash ¶ func (c *Coder) CompareHash(hash string, text string) error func (*Coder) Decrypt ¶ func (c *Coder) Decrypt(text string) (string, error) func (*Coder) Encrypt ¶ func (c *Coder) Encrypt(text string) string func (*Coder) Hash ¶ func (c *Coder) Hash(text string) (string, error) type Config ¶ type Config struct { Secret string `env:"ENCRYPT_SECRET" env-default:""` HashCost int `env:"HASH_COST" env-default:"10"` } Source Files ¶ View all Source files coder.go Click to show internal directories. Click to hide internal directories.