Documentation
ΒΆ
Overview ΒΆ
Package cryden is the main entry point for the CrydennSync authentication engine.
Index ΒΆ
- Variables
- func ChangeEmail(ctx context.Context, engine *Engine, userID, newEmail string) error
- func ChangePassword(ctx context.Context, engine *Engine, userID, oldPassword, newPassword string) error
- func DeleteAccount(ctx context.Context, engine *Engine, userID string) error
- func Login(ctx context.Context, engine *Engine, email, password string) (*TokenPair, *LimitResult, error)
- func Logout(ctx context.Context, engine *Engine, refreshToken string) error
- func LogoutAll(ctx context.Context, engine *Engine, userID string) error
- func RevokeSession(ctx context.Context, engine *Engine, sessionID string) error
- func VerifyToken(engine *Engine, tokenString string) (string, error)
- type AuditEntry
- type AuditLogger
- type Claims
- type Engine
- func New() *Engine
- func WithAuditLogger(engine *Engine, logger AuditLogger) *Engine
- func WithHasher(engine *Engine, hasher Hasher) *Engine
- func WithJWTSecret(engine *Engine, secret string) *Engine
- func WithRateLimiter(engine *Engine, limiter RateLimiter) *Engine
- func WithSQLite(dbPath string) (*Engine, error)
- type Hasher
- type LimitResult
- type RateLimiter
- type Session
- type SessionStore
- type TokenPair
- type User
- type UserStore
Constants ΒΆ
This section is empty.
Variables ΒΆ
View Source
var ( ErrUserExists = core.ErrUserExists ErrUserNotFound = core.ErrUserNotFound ErrInvalidCredentials = core.ErrInvalidCredentials ErrInvalidEmail = core.ErrInvalidEmail ErrPasswordTooShort = core.ErrPasswordTooShort ErrPasswordTooLong = core.ErrPasswordTooLong ErrPasswordNoUpper = core.ErrPasswordNoUpper ErrPasswordNoLower = core.ErrPasswordNoLower ErrPasswordNoNumber = core.ErrPasswordNoNumber ErrTooManyAttempts = core.ErrTooManyAttempts ErrInvalidToken = core.ErrInvalidToken ErrSessionNotFound = core.ErrSessionNotFound )
Functions ΒΆ
func ChangeEmail ΒΆ
ChangeEmail updates user's email
func ChangePassword ΒΆ
func ChangePassword(ctx context.Context, engine *Engine, userID, oldPassword, newPassword string) error
ChangePassword updates user's password and logs out all devices
func DeleteAccount ΒΆ
DeleteAccount removes user and all sessions
func Login ΒΆ
func Login(ctx context.Context, engine *Engine, email, password string) (*TokenPair, *LimitResult, error)
Login authenticates a user and returns tokens
func RevokeSession ΒΆ
RevokeSession manually revokes a specific session
Types ΒΆ
type AuditEntry ΒΆ
type AuditEntry = core.AuditEntry
type AuditLogger ΒΆ
type AuditLogger = core.AuditLogger
type Engine ΒΆ
Engine is the main authentication engine
func WithAuditLogger ΒΆ
func WithAuditLogger(engine *Engine, logger AuditLogger) *Engine
WithAuditLogger sets a custom audit logger
func WithHasher ΒΆ
WithHasher sets a custom password hasher
func WithJWTSecret ΒΆ
WithJWTSecret sets a custom JWT secret
func WithRateLimiter ΒΆ
func WithRateLimiter(engine *Engine, limiter RateLimiter) *Engine
WithRateLimiter sets a custom rate limiter
func WithSQLite ΒΆ
WithSQLite creates an engine with persistent SQLite storage
type LimitResult ΒΆ
type LimitResult = core.LimitResult
type RateLimiter ΒΆ
type RateLimiter = core.RateLimiter
type SessionStore ΒΆ
type SessionStore = core.SessionStore
Click to show internal directories.
Click to hide internal directories.