Documentation ¶
Overview ¶
Package crypto provides basic cryptography wrappers and implementations for encryption, token management and hashing.
The crypto package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package crypto provides basic cryptography wrappers and implementations for encryption, token management and hashing.
The crypto package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package crypto provides basic cryptography wrappers and implementations for encryption, token management and hashing.
The crypto package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package crypto provides basic cryptography wrappers and implementations for encryption, token management and hashing.
The crypto package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Package crypto provides basic cryptography wrappers and implementations for encryption, token management and hashing.
The crypto package's structures are self-initialized by fx and bootstrapper. Fields are populated via yaml values or env variables. Env variables overwrite yaml configuration.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrJwtManagerCastOrInvalidToken = errors.New("could not cast claims or invalid jwt")
var ErrJwtManagerEmptyDecodingBody = errors.New("could not decode a jwt. Got empty interface")
var ErrJwtManagerEmptySecret = errors.New("could not sign/verify witn an empty secret")
var ErrJwtManagerEmptyToken = errors.New("could not verify an empty jwt")
var ErrJwtManagerInvalidSigningMethod = errors.New("unexpected jwt signing method")
var ErrJwtManagerSigning = errors.New("could not generate a new jwt")
Functions ¶
This section is empty.
Types ¶
type Encryptor ¶
type Encryptor interface { Encrypt(text string, key []byte) (string, error) Decrypt(ciphertext string, key []byte) (string, error) }
An Encryptor provides basic contract for encryption types. The implementation structure is expected to be initialized automatically by fx and bootstrapper.
func NewEncryptor ¶
func NewEncryptor(config *config.CryptoConfig) Encryptor
An Encryptor constructor. Called automatically by fx and bootstrapper.
Returns an encryptor implementation based on configuration. By default returns an AES GCM encryptor.
type Hasher ¶
A Hasher provides basic contract for generating hash. The implementation structure is expected to be intialized automatically by fx and bootstrapper.
func NewHasher ¶
func NewHasher(config *config.CryptoConfig) Hasher
A Hasher constructor. Called automatically by fx and bootstrapper.
Returns a hasher implementation based on configuration. By default returns an md5 hasher.
type JwtManager ¶
type JwtManager interface { Sign(secret string, payload jwt.Claims) (string, error) Verify(secret, jwtToken string, body interface{}) error }
A JwtManager provides basic contract for jwt generation and verification. The implementation structure is expected to be intialized automatically by fx and bootstrapper.
func NewJwtManager ¶
func NewJwtManager(config *config.CryptoConfig) JwtManager
A JwtManager constructor. Called automatically by fx and bootstrapper.
Returns a jwt manager implementation based on configuration.
type StateGenerator ¶
A StateGenerator provides basic contract for generating a cryptographic state. The implementation structure is expected to be intialized automatically by fx and bootstrapper.
func NewStateGenerator ¶
func NewStateGenerator() StateGenerator
A StateGenerator constructor. Called automatically by fx and bootstrapper.
Returns a state generator implementation based on configuration.