crypto

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 15 Imported by: 19

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

View Source
var ErrJwtManagerCastOrInvalidToken = errors.New("could not cast claims or invalid jwt")
View Source
var ErrJwtManagerEmptyDecodingBody = errors.New("could not decode a jwt. Got empty interface")
View Source
var ErrJwtManagerEmptySecret = errors.New("could not sign/verify witn an empty secret")
View Source
var ErrJwtManagerEmptyToken = errors.New("could not verify an empty jwt")
View Source
var ErrJwtManagerInvalidSigningMethod = errors.New("unexpected jwt signing method")
View Source
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

type Hasher interface {
	Hash(text string) string
}

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

type StateGenerator interface {
	GenerateState(secret string) (string, error)
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL