enigma

package
v0.0.0-...-d641761 Latest Latest
Warning

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

Go to latest
Published: May 31, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package enigma is a Go utility library for cryptographic operations, including JWT creation, password hashing, and API key generation.

Index

Constants

View Source
const (
	// HashingCost is the cost for cryptographic hashing.
	HashingCost = 14
	// APIKeyPrefixLength is the length of API key prefixes.
	APIKeyPrefixLength = 8
	// APIKeySecretNBytes is the number of bytes in API key secrets.
	APIKeySecretNBytes = 32
	// IDPrefixJWT is the prefix for JWT IDs.
	IDPrefixJWT = "jwt"
)

Variables

This section is empty.

Functions

func NewEnigma

func NewEnigma(
	timeProvider TimeProvider,
	secretKey string,
) *enigma

NewEnigma returns a new enigma.

Types

type JWTType

type JWTType string

JWTType is a string representing type of JWT. Allowed strings are "access", "refresh", and "activation".

type TimeProvider

type TimeProvider interface {
	Now() time.Time
}

TimeProvider represents a component that provides the current timestamp.

type UserJWTClaims

type UserJWTClaims struct {
	Subject   string         `json:"sub"`
	TokenType string         `json:"token_type"`
	IssuedAt  jxon.Timestamp `json:"iat"`
	ExpiresAt jxon.Timestamp `json:"exp"`
	JWTID     string         `json:"jti"`
	jwt.RegisteredClaims
}

UserJWTClaims represents claims in JWTs for users.

Jump to

Keyboard shortcuts

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