Standalone Authentication & Token Provisioning Application
ChittyAuth App is a fully independent, bolt-on authentication service that can be deployed without any external dependencies. Unlike the OS-integrated chittyauth service, this app uses Cloudflare-native storage (D1 + KV) and requires no external database connections.
ChittyAuth App provides secure API token provisioning and validation for applications that need authentication without coupling to the ChittyOS infrastructure. It's designed for:
- Third-party integrations - Deploy your own auth service
- Isolated environments - No dependency on chittyos-core database
- Custom deployments - Run on your own Cloudflare account
- Development/testing - Standalone setup for local development
| Feature | chittyauth (OS-Integrated) | chittyauth-app (Standalone) |
|---|---|---|
| Organization | chittyfoundation | chittyapps |
| Database | Neon PostgreSQL (shared chittyos-core) | D1 + KV (Cloudflare-native) |
| Dependencies | Requires ChittyOS infrastructure | Zero external dependencies |
| Use Case | Core ChittyOS services | Third-party apps, custom deployments |
| Deployment | auth.chitty.cc | Your own domain |
| Data Sharing | Shares identity data with ChittyID, ChittyVerify, ChittyTrust | Isolated data storage |
When to use which:
- Use chittyauth if you're building ChittyOS services that need to share identity data
- Use chittyauth-app if you need standalone authentication without ChittyOS dependencies
ChittyAuth App is considered successful when it meets these measurable targets:
- Availability: 99.9% uptime (measured monthly)
- Performance:
- Token validation < 100ms (p95)
- Token provisioning < 500ms (p95)
- Bootstrap registration < 2s (p95)
- Security: Zero unauthorized token access incidents
- Reliability: Token hash collision rate < 1 in 10^12
- Independence: Deployable without any external services
- Auditability: 100% of token operations logged with complete audit trail
ChittyAuth App explicitly does NOT:
- Connect to chittyos-core database: Uses D1/KV only
- Require ChittyID service: Can provision tokens independently
- Share data with ChittyOS: Isolated storage
- Provide ChittyConnect integration: Standalone identity management
- Handle biometric verification: Basic token-based auth only
- Sync with ChittyOS services: No cross-service coordination
curl -X POST https://your-domain.com/v1/tokens/provision \
-H "Content-Type: application/json" \
-d '{
"chittyId": "03-1-USA-0001-P-251-3-82",
"scope": ["chittyid:read", "chittyid:generate"],
"service": "chittyid",
"expiresIn": 2592000
}'Response:
{
"success": true,
"token": "ca_live_dG9rX2FiYzEyM18xNzMwNTQzMjk2X3NpZ25hdHVyZQ",
"tokenId": "tok_abc123xyz",
"scope": ["chittyid:read", "chittyid:generate"],
"expiresAt": "2025-12-02T00:00:00Z",
"rateLimit": {
"requests": 1000,
"window": "1h"
}
}curl -X POST https://your-domain.com/v1/tokens/validate \
-H "Content-Type: application/json" \
-d '{"token": "YOUR_TOKEN_HERE"}'POST /v1/register- PUBLIC - Register new user and get first tokenPOST /v1/tokens/provision- Provision new API tokenPOST /v1/tokens/validate- Validate existing tokenPOST /v1/tokens/refresh- Refresh token before expirationPOST /v1/tokens/revoke- Revoke token immediately
POST /v1/service/authenticate- Authenticate service-to-service requests
POST /v1/connect/verify- Verify ChittyID (if ChittyConnect configured)
GET /health- Health checkGET /v1/tokens/stats- Token usage statistics
See API_SPEC.md for complete API contracts and schemas.
- Node.js 18+
- Cloudflare account with Workers enabled
- Wrangler CLI installed globally (
npm install -g wrangler)
cd chittyauth-app
npm install# Production
wrangler kv:namespace create AUTH_TOKENS --env production
wrangler kv:namespace create AUTH_REVOCATIONS --env production
wrangler kv:namespace create AUTH_RATE_LIMITS --env production
wrangler kv:namespace create AUTH_AUDIT --env production
# Development
wrangler kv:namespace create AUTH_TOKENS --env development
wrangler kv:namespace create AUTH_REVOCATIONS --env development
wrangler kv:namespace create AUTH_RATE_LIMITS --env development
wrangler kv:namespace create AUTH_AUDIT --env developmentUpdate wrangler.toml with the created namespace IDs.
# Production
wrangler d1 create chittyauth-db
# Development
wrangler d1 create chittyauth-dev-dbUpdate wrangler.toml with the database IDs.
# Production
wrangler d1 execute chittyauth-db --env production --file=./schema.sql
# Development
wrangler d1 execute chittyauth-dev-db --env development --file=./schema.sql# Generate a secure signing key (256-bit)
openssl rand -base64 32
# Set the signing key
wrangler secret put TOKEN_SIGNING_KEY --env production
# Optional: Set ChittyConnect API key (if integrating)
wrangler secret put CHITTYCONNECT_API_KEY --env production# Deploy to production
npm run deploy
# Deploy to development
npm run deploy:devnpm run devThe service will be available at http://localhost:8787
# Register new user (public endpoint)
curl -X POST http://localhost:8787/v1/register \
-H "Content-Type: application/json" \
-d '{
"name": "Test User",
"email": "test@example.com"
}'
# Provision token
curl -X POST http://localhost:8787/v1/tokens/provision \
-H "Content-Type: application/json" \
-d '{
"chittyId": "03-1-USA-0001-P-251-3-82",
"scope": ["chittyid:read"],
"service": "chittyid",
"expiresIn": 3600
}'
# Validate token
curl -X POST http://localhost:8787/v1/tokens/validate \
-H "Content-Type: application/json" \
-d '{"token": "YOUR_TOKEN_HERE"}'# Run all tests
npm test
# Run unit tests only
npm run test:unit
# Run integration tests only
npm run test:integration- SHA-256 Token Hashing - Tokens never stored in plain text
- HMAC-SHA256 Signatures - Cryptographic token signatures
- Time-based Expiration - Configurable token TTL
- Automatic Revocation - Suspicious activity detection
- Rate Limiting - Per-token request limits
- Audit Logging - Complete event trail (stored in D1)
- Isolated Storage - No shared database vulnerabilities
chittyid:read- Read ChittyID informationchittyid:generate- Generate new ChittyIDschittyid:validate- Validate ChittyIDschittyid:audit- Access audit trails
You can define custom scopes for your application:
myapp:read- Read accessmyapp:write- Write accessmyapp:admin- Admin access
admin:*- Full administrative access
ChittyAuth App uses Cloudflare-native storage:
βββββββββββββββββββββββ
β User/Application β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β ChittyAuth App β β Cloudflare Worker
β (auth.your-domain) β
ββββββββββββ¬βββββββββββ
β
ββββββββββββββββ
β β
βΌ βΌ
ββββββββββββββββ ββββββββββββββββ
β D1 Database β β KV Storage β
β (Tokens, β β (Cache, β
β Audit Log) β β Rate Limit)β
ββββββββββββββββ ββββββββββββββββ
Storage Strategy:
- D1: Primary storage for tokens, users, audit logs
- KV: Fast cache for validation, rate limiting, revocation lists
curl https://your-domain.com/healthResponse:
{
"status": "healthy",
"service": "chittyauth-app",
"version": "1.0.0",
"timestamp": "2025-11-06T10:00:00Z",
"checks": {
"database": true,
"kv": true
}
}curl https://your-domain.com/v1/tokens/stats \
-H "Authorization: Bearer YOUR_ADMIN_TOKEN"- Register - User registers via
/v1/register(gets first token) - Provision - Additional tokens provisioned as needed
- Validate - Service validates token on each request
- Use - Token used to access protected resources
- Refresh - Token refreshed before expiration (optional)
- Revoke - Token revoked when no longer needed
TOKEN_SIGNING_KEY- 256-bit key for token signatures (required)
CHITTYCONNECT_API_KEY- Service token for ChittyConnect integration
ENVIRONMENT- "development" or "production"CHITTYCONNECT_URL- ChittyConnect endpoint (default: https://connect.chitty.cc)DEFAULT_TOKEN_EXPIRY- Default token lifetime in seconds (default: 2592000 = 30 days)MAX_TOKENS_PER_USER- Maximum tokens per user (default: 10)
This project follows the ChittyCanβ’ Universal Infrastructure Interface for standardized project management.
- Repository: https://github.com/chittyapps/chittyauth-app (TBD)
- Issues: https://github.com/chittyapps/chittyauth-app/issues (TBD)
- Decision Log: DECISIONS.md (TBD)
- API Contracts: API_SPEC.md (TBD)
- ChittyID Token: TBD (optional for standalone)
- Registry Registration: TBD (register at https://register.chitty.cc)
- Service Discovery: TBD (verify at https://registry.chitty.cc)
- Schema Alignment: Independent (no schema dependency)
- Production: Not yet deployed
- Staging: Not yet deployed
- Development: Local testing available
- Architecture Overview
- Deployment Guide
- API Specification (TBD - follow chittyauth API_SPEC.md)
- Decision Log (TBD)
- Check token format (must start with
ca_live_,ca_test_, etc.) - Verify token hasn't expired
- Ensure token hasn't been revoked
- Check rate limits
- Verify D1 database is accessible
- Verify D1 database is created:
wrangler d1 list - Check database binding in wrangler.toml
- Ensure schema is initialized:
wrangler d1 execute chittyauth-db --file=./schema.sql - Check database query logs:
wrangler tail
- Verify KV namespaces are created:
wrangler kv:namespace list - Check bindings in wrangler.toml match created namespace IDs
- Test KV access:
wrangler kv:key list --binding=AUTH_TOKENS
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
ChittyApps Project Β© 2025 ChittyCorp LLC
For issues and questions:
- Create an issue in the repository
- Check ARCHITECTURE.md for detailed documentation
- Contact ChittyCorp support
Built with β€οΈ for standalone deployments