auth

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

internal/auth/auth.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSecureKey

func GenerateSecureKey(length int) ([]byte, error)

GenerateSecureKey generates a secure random key for token signing

func GenerateToken

func GenerateToken(userID string, config *TokenConfig) (string, error)

GenerateToken creates a new authentication token

Types

type Token

type Token struct {
	UserID    string            `json:"user_id"`
	ExpiresAt int64             `json:"expires_at"`
	IssuedAt  int64             `json:"issued_at"`
	Claims    map[string]string `json:"claims,omitempty"`
}

Token represents an authentication token

func ParseToken

func ParseToken(tokenString string, config *TokenConfig) (*Token, error)

ParseToken parses and validates a token

type TokenConfig

type TokenConfig struct {
	Secret     []byte
	Expiration time.Duration
}

TokenConfig holds the configuration for token generation

Jump to

Keyboard shortcuts

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