cryden

module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: MIT

README ΒΆ

CrydenSync πŸ”

Embeddable authentication engine for Go β€” offline-first, framework-agnostic.

Go Reference Go Report Card GitHub Release Build Status

🎯 The Problem

Authentication is not business logic, yet every project rewrites it. Developers face three painful choices:

  1. Rewrite auth logic for every project β€” risky, inconsistent, time-consuming
  2. Use hosted auth services β€” vendor lock-in, users aren't yours, requires internet
  3. Use framework-specific tools β€” tied to Express, Django, Next.js β€” not reusable

πŸ’‘ The Solution

CrydenSync is an embeddable authentication engine that gives you a standard, reusable auth system you control:

import "github.com/crydensync/cryden"

func main() {
    engine := cryden.New()  // In-memory for testing
    
    // Or with persistent storage
    // engine, _ := cryden.WithSQLite("users.db")
    
    ctx := context.Background()
    
    // Sign up
    user, _ := cryden.SignUp(ctx, engine, "alice@example.com", "SecurePass123")
    
    // Login
    tokens, _, _ := cryden.Login(ctx, engine, "alice@example.com", "SecurePass123")
    
    // Protect routes
    userID, _ := cryden.VerifyToken(engine, tokens.AccessToken)
}

✨ Features

βœ… v1.0.0 (Current)

Β· Email/password authentication β€” Secure, bcrypt hashed Β· JWT access tokens β€” Short-lived, stateless Β· Opaque refresh tokens β€” Stored in DB for revocation Β· Rate limiting β€” Per IP with headers (X-RateLimit-*) Β· Audit logging β€” Track every auth event Β· Session management β€” Logout single device or all devices Β· Multiple storage backends β€” Memory, SQLite, PostgreSQL, MongoDB Β· Complete test suite β€” 90%+ coverage Β· Offline-first β€” Works without internet, SQLite by default

🚧 Coming Soon

Feature Status Target gRPC API 🚧 Planned v1.1.0 CLI tool (csax) 🚧 Planned v1.1.0 Language SDKs (JS, Python, PHP) 🚧 Planned v1.2.0 MFA/2FA (TOTP) πŸ“… Future v1.3.0 Magic Links πŸ“… Future v1.3.0 WebAuthn/Passkeys πŸ“… Future v2.0.0

πŸ“¦ Installation

go get github.com/crydensync/cryden@v1.0.0

πŸ“– Documentation

Section Description πŸ“š Getting Started 60-second working auth 🎯 Philosophy Why Cryden exists πŸ—οΈ Architecture How it works πŸ“ Design Decisions Why we built it this way πŸ”§ Guide Installation, config, middleware, testing πŸ”Œ Adapters Interface implementations πŸ“˜ API Reference Complete API docs πŸ’‘ Examples Copy-paste working code

πŸ§ͺ Testing

CrydenSync is designed for maximum testability:

func TestLogin(t *testing.T) {
    engine := cryden.New()  // In-memory storage
    
    // Optional: Use mock hasher for faster tests
    engine.WithHasher(&core.MockHasher{})
    
    // Optional: Disable rate limiting
    engine.WithRateLimiter(&core.NoopRateLimiter{})
    
    ctx := context.Background()
    cryden.SignUp(ctx, engine, "test@example.com", "pass")
    tokens, _, err := cryden.Login(ctx, engine, "test@example.com", "pass")
    
    assert.NoError(t, err)
    assert.NotEmpty(t, tokens.AccessToken)
}

πŸ“– Testing Guide β†’

πŸ”§ Configuration

// With SQLite persistence
engine, err := cryden.WithSQLite("users.db")

// With custom JWT secret (required in production)
cryden.WithJWTSecret(engine, os.Getenv("JWT_SECRET"))

// With custom rate limiter
engine.WithRateLimiter(redis.NewRateLimiter())

// With custom audit logger
engine.WithAuditLogger(file.NewAuditLogger("auth.log"))

πŸ“Š Storage Backends

Backend Status Use Case Memory βœ… Stable Testing SQLite βœ… Stable Offline-first, development PostgreSQL βœ… Stable Production MongoDB βœ… Stable Document stores MySQL 🚧 Planned v1.1.0 Redis 🚧 Planned v1.1.0 (rate limiting)

πŸ“› About the Name

CrydenSync is the full name of the project, but the Go package is simply cryden for brevity.

import "github.com/crydensync/cryden"  // Notice: crydensync/cryden

auth := cryden.New()  // Short and sweet!

πŸ”’ Security Notes v1.0.0

βœ… Implemented
  • Password hashing with bcrypt
  • JWT signing with HMAC-SHA256
  • Rate limiting to prevent brute force
  • Audit logging for all auth events
⚠️ Planned for v1.1.0
  • Refresh token hashing in database
  • Session token hashing
  • Device fingerprinting
  • Argon2id hasher option
Future Security Enhancements
  • Email verification (v1.1)
  • Password reset flow (v1.1)
  • MFA/2FA (v1.2)
  • Login notifications (v1.2)
  • Breached password detection (v1.2)
πŸ” Best Practices
  1. Always use HTTPS in production
  2. Set strong JWT secrets via environment variables
  3. Monitor audit logs for suspicious activity
  4. Add email verification before sensitive actions

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for:

Β· Code of Conduct Β· Development setup Β· Pull request process Β· Coding standards

πŸ“„ License

MIT Β© Crydensync

⭐ Support

If you find Cryden useful, please star the repo!

πŸ—ΊοΈ Roadmap

Current: v1.0.0 (March 2026)

βœ… Core authentication with email/password. βœ… JWT + refresh tokens. βœ… Rate limiting & audit logs. βœ… Multiple databases (SQLite, PostgreSQL, MongoDB)

Coming in v1.1.0 (Q2 2026)

πŸš€ CLI tool (csax) πŸ“± Device tracking (IP, user agent, last seen) πŸ” Argon2id hasher ⚑ Redis rate limiter le audit logger 🐬 MySQL support

Coming in v1.2.0 (Q3 2026)

πŸ”Œ gRPC API 🌐 Language SDKs (JS, Python, PHP) πŸ”” Webhooks πŸ”„ Migration tools (Clerk, Auth0, Supabase)

Coming in v1.3.0 (Q4 2026)

πŸ” Multi-Factor Authentication (TOTP) πŸ“§ Magic links & passwordless πŸ”‘ WebAuthn / Passkeys 🌍 Social login (OAuth2)

Future (2027+)

☁️ Optional cloud sync πŸ“Š Enterprise features πŸ”Œ More adapters πŸš€ v2.0.0 (breaking changes if needed)

View full roadmap β†’


Built with ❀️ in Africa · Own your users, not vendor lock-in

Directories ΒΆ

Path Synopsis
Package cryden is the main entry point for the CrydennSync authentication engine.
Package cryden is the main entry point for the CrydennSync authentication engine.
examples
basic command
complete command
internal

Jump to

Keyboard shortcuts

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