package
Version:
v1.2.4
Opens a new window with list of versions in this module.
Published: Aug 23, 2026
License: MIT
Opens a new window with license information.
Imports: 6
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
README
ΒΆ
π Authentication Engine (internal/auth)
internal/auth provides password security and JWT token management for multi-tenant authentication in PingGopher.
π¦ Key Exports
Password Hashing
HashPassword(password string) (string, error): Hashes plaintext passwords using Bcrypt (bcrypt.DefaultCost).
CheckPasswordHash(password, hash string) bool: Validates a plaintext password against a stored Bcrypt hash.
JWT Token Management
GenerateJWTToken(userID uuid.UUID, email string, secret string, duration time.Duration) (string, error): Generates signed HMAC-SHA256 JWT tokens containing UserID and Email claims.
ValidateJWTToken(tokenString string, secret string) (*JWTClaims, error): Parses and validates incoming JWT Bearer tokens.
π§ͺ Unit Testing
go test -v ./internal/auth
Documentation
ΒΆ
func CheckPasswordHash(password, hash string) bool
CheckPasswordHash compares a plaintext password with a stored Bcrypt hash.
GenerateJWTToken generates a signed JWT token valid for specified duration.
HashPassword hashes a plaintext password using Bcrypt.
JWTClaims defines the token payload claims for authenticated tenant users.
ValidateJWTToken parses and validates a signed JWT token string.
Source Files
ΒΆ
Click to show internal directories.
Click to hide internal directories.