Add production-ready API key management to Convex with rotation, expiration, typed permissions, and audit logging for secure API access control.
npm install convex-api-keysConvex API Keys adds production-ready API key management to Convex.
## Features
- Create, validate, rotate, touch, and revoke keys
- Support expiration and idle timeouts
- Add typed namespaces, permissions, and metadata
- Keep audit logs for key lifecycle events
- Retain keys and audit events on separate cleanup schedules
## Use cases
A good fit for public APIs, partner integrations, internal tools, and service-to-service authentication.
Convex API Keys provides functions to create, validate, and manage API keys directly in your Convex backend. You can validate incoming API keys in your functions and enforce permissions based on namespaces and metadata attached to each key.
The component automatically handles key rotation with configurable expiration dates and idle timeouts. Keys can be programmatically rotated while maintaining audit logs of all lifecycle events for security compliance.
Use typed permissions and namespaces to create service-specific API keys with granular access control. The component supports metadata attachment and separate cleanup schedules for keys and audit events.
Convex API Keys implements production security patterns including automatic key expiration, usage tracking, and comprehensive audit logging. This enables secure public API exposure without custom authentication infrastructure.
Convex API Keys leverages Convex's built-in database indexes for fast key lookups and validation. The component includes a touch function to update last-used timestamps for idle timeout tracking without impacting validation performance.
Yes, Convex API Keys supports typed namespaces, custom permissions, and arbitrary metadata attachment to keys. This allows you to implement role-based access control and store application-specific data with each key.
The component maintains comprehensive audit logs for all key lifecycle events including creation, validation, rotation, and revocation. Audit events and keys have separate configurable cleanup schedules for compliance requirements.
Convex API Keys supports overlapping key validity periods during rotation. You can create new keys before revoking old ones, and the audit logs track the complete rotation history for each key.