auth

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashPassword

func HashPassword(password string) (string, error)

HashPassword hashes a password using bcrypt

func ParseToken

func ParseToken(tokenString string) (string, error)

ParseToken validates and parses a JWT token, returning the user ID

Types

type Credentials

type Credentials struct {
	Email    string `json:"email" form:"email"`
	Password string `json:"password" form:"password"`
}

Credentials holds user authentication credentials

func (*Credentials) Authenticate

func (creds *Credentials) Authenticate(hashedPassword string) error

Authenticate compares a password with a stored hash

type Token

type Token struct {
	Token string `json:"token"`
}

Token wraps a JWT token string

func NewToken

func NewToken(userID uuid.UUID, email string) (*Token, error)

NewToken generates a new JWT token for a user

Jump to

Keyboard shortcuts

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