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.