[ CONVEX COMPONENT · STABLE · Apache-2.0 ]
@vllnt/convex-api-keys
Convex component for secure API key management — create, validate, revoke, rotate, and track usage
STABLE 0.2.0 · 1 GitHub star
Package details
Install
The untagged install gets the latest stable version (0.2.0). The canary tag tracks main (0.3.0-canary.be675d5).
pnpm add @vllnt/convex-api-keys
pnpm add @vllnt/convex-api-keys@canaryRegister the component
Add it to your app’s convex/convex.config.ts, then run npx convex dev to generate the references.
import { defineApp } from "convex/server";
import apiKeys from "@vllnt/convex-api-keys/convex.config";
const app = defineApp();
app.use(apiKeys);
export default app;Use it
Usage, options and examples are in the package README.
Downloads
- Last 7 days
- 1,916
- Since first publish
- 49,624
Downloads per week since 23 March 2026, oldest on the left. Weeks count back from 23 November 2026, so the first one may be shorter than seven days.
1,916 downloads in the last 7 days. 49,624 downloads since 23 March 2026. Source: npm, counted through 23 November 2026.
Show downloads per week as a table
| Week | Downloads |
|---|---|
| 23 March 2026 | 28 |
| 24 March 2026 to 30 March 2026 | 583 |
| 31 March 2026 to 6 April 2026 | 179 |
| 7 April 2026 to 13 April 2026 | 91 |
| 14 April 2026 to 20 April 2026 | 51 |
| 21 April 2026 to 27 April 2026 | 437 |
| 28 April 2026 to 4 May 2026 | 504 |
| 5 May 2026 to 11 May 2026 | 496 |
| 12 May 2026 to 18 May 2026 | 760 |
| 19 May 2026 to 25 May 2026 | 954 |
| 26 May 2026 to 1 June 2026 | 164 |
| 2 June 2026 to 8 June 2026 | 117 |
| 9 June 2026 to 15 June 2026 | 578 |
| 16 June 2026 to 22 June 2026 | 462 |
| 23 June 2026 to 29 June 2026 | 902 |
| 30 June 2026 to 6 July 2026 | 887 |
| 7 July 2026 to 13 July 2026 | 966 |
| 14 July 2026 to 20 July 2026 | 343 |
| 21 July 2026 to 27 July 2026 | 377 |
| 28 July 2026 to 3 August 2026 | 1,702 |
| 4 August 2026 to 10 August 2026 | 2,337 |
| 11 August 2026 to 17 August 2026 | 2,146 |
| 18 August 2026 to 24 August 2026 | 1,962 |
| 25 August 2026 to 31 August 2026 | 3,136 |
| 1 September 2026 to 7 September 2026 | 2,317 |
| 8 September 2026 to 14 September 2026 | 3,912 |
| 15 September 2026 to 21 September 2026 | 2,750 |
| 22 September 2026 to 28 September 2026 | 1,947 |
| 29 September 2026 to 5 October 2026 | 2,201 |
| 6 October 2026 to 12 October 2026 | 2,976 |
| 13 October 2026 to 19 October 2026 | 2,120 |
| 20 October 2026 to 26 October 2026 | 2,043 |
| 27 October 2026 to 2 November 2026 | 4,205 |
| 3 November 2026 to 9 November 2026 | 2,025 |
| 10 November 2026 to 16 November 2026 | 1,050 |
| 17 November 2026 to 23 November 2026 | 1,916 |
Release history
Every release on a timeline, oldest on the left. A tall mark with its version is a stable release; a short mark is a canary build. The time axis is the one of the downloads chart, so a release stands above the week it shipped in.
2 stable releases and 20 canary builds since 23 March 2026. Latest stable: 0.2.0 on 25 April 2026.
Show every release as a table
| Version | Kind | Published |
|---|---|---|
| 0.3.0-canary.be675d5 | canary | 23 November 2026 |
| 0.3.0-canary.2a5f447 | canary | 23 November 2026 |
| 0.3.0-canary.a17e376 | canary | 22 November 2026 |
| 0.3.0-canary.c1e6b53 | canary | 31 October 2026 |
| 0.2.1-canary.c478e3d | canary | 31 October 2026 |
| 0.2.1-canary.6b29f95 | canary | 30 October 2026 |
| 0.2.1-canary.48f454a | canary | 24 October 2026 |
| 0.2.1-canary.9b260a8 | canary | 1 September 2026 |
| 0.2.1-canary.1629092 | canary | 31 August 2026 |
| 0.2.1-canary.5593afc | canary | 31 August 2026 |
| 0.2.1-canary.1e357f9 | canary | 31 August 2026 |
| 0.2.0-canary.3df35d3 | canary | 13 June 2026 |
| 0.2.0-canary.8d1ace0 | canary | 12 June 2026 |
| 0.2.0-canary.d26dea5 | canary | 12 June 2026 |
| 0.2.0 | stable | 25 April 2026 |
| 0.2.0-canary.780c0c3 | canary | 25 April 2026 |
| 0.2.0-canary.3214568 | canary | 25 April 2026 |
| 0.1.1-canary.61796d1 | canary | 27 March 2026 |
| 0.1.1-canary.f11443e | canary | 25 March 2026 |
| 0.1.1-canary.2fc1258 | canary | 24 March 2026 |
| 0.1.0-canary.f67cc26 | canary | 24 March 2026 |
| 0.1.0 | stable | 23 March 2026 |
Changelog
The newest stable releases of @vllnt/convex-api-keys, with the notes from its changelog.
0.2.0
Breaking Changes
- Convex compatibility: this release targets
convex@^1.36.1andconvex-test@^0.0.50. create()/rotate(): Secret material (lookupPrefix, secretHex, hash) now generated server-side. Remove these from client args.- Admin mutations (
revoke,disable,enable,update,rotate,getUsage):ownerIdis now a required argument for auth boundary enforcement. apiKeyEventstable removed: Audit trail replaced with structured logging (Convex dashboard). Export existing event data before upgrading.@convex-dev/rate-limiterremoved: Rate limiting is now the integrator's responsibility at their HTTP action/mutation layer. RemoverateLimiterTest.register()from test setup.@convex-dev/aggregateand@convex-dev/cronsremoved: RemoveaggregateTest.register()andcronsTest.register()from test setup.getUsage():periodparam removed (counter-only).lastUsedAtremoved from return type.validate():retryAfterremoved from failure response (no internal rate limiting).list()/listByTag(): Now paginated withlimitparam (default 100).
Migration Guide
// BEFORE (v0.1) const { key } = await apiKeys.create(ctx, { name: "My Key", ownerId: "org_1", lookupPrefix, secretHex, hash, // ← REMOVE these }); await apiKeys.revoke(ctx, { keyId }); await apiKeys.rotate(ctx, { keyId, lookupPrefix, secretHex }); const usage = await apiKeys.getUsage(ctx, { keyId, period: { start, end } }); // AFTER (v0.2) const { key } = await apiKeys.create(ctx, { name: "My Key", ownerId: "org_1", // secret material generated server-side }); await apiKeys.revoke(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId await apiKeys.rotate(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId const usage = await apiKeys.getUsage(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId, REMOVE periodTest setup:
// BEFORE import rateLimiterTest from "@convex-dev/rate-limiter/test"; import aggregateTest from "@convex-dev/aggregate/test"; import cronsTest from "@convex-dev/crons/test"; rateLimiterTest.register(t, "apiKeys/rateLimiter"); aggregateTest.register(t, "apiKeys/usageAggregate"); cronsTest.register(t, "apiKeys/crons"); // AFTER — only shardedCounter remains import shardedCounterTest from "@convex-dev/sharded-counter/test"; shardedCounterTest.register(t, "apiKeys/shardedCounter");New Features
- Public client wrapper now forwards optional
limittolist()andlistByTag() ValidationFailureno longer advertises the removedretryAfterfield- Auth boundary:
ownerIdcross-check on all admin mutations - Server-side secret generation for
create()androtate() - Input validation: keyPrefix charset, env charset, gracePeriodMs bounds (60s–30d), metadata size (4KB), scopes (50), tags (20)
- Configure bounds validation (reject negative/zero)
- Structured audit logging on all mutation outcomes
- lastUsedAt throttled to 60s (reduces OCC contention)
- Remaining decrement decoupled from lastUsedAt write (single merged patch)
- revokeByTag expanded to include
rotatinganddisabledstatuses - Paginated list/listByTag with configurable limit
- Convex compatibility: this release targets
0.1.0
- Initial release
- Key creation with SHA-256 hashing, prefix-indexed lookup
- Key validation with status/expiry/remaining checks
- Key revocation (single + bulk by tag)
- Key rotation with configurable grace period
- Key listing by owner, tag, environment
- Key update (name, scopes, tags, metadata) without rotation
- Key disable/enable (reversible pause)
- Finite-use keys (remaining counter with atomic decrement)
- Key types (secret / publishable) with type-encoded prefix
- Environment-aware key format
- Multi-tenant isolation (ownerId-scoped queries)
- Audit event log (apiKeyEvents table)
- Usage analytics via event counting
- Child components: @convex-dev/rate-limiter, sharded-counter, aggregate, crons
Licence
Released under the Apache-2.0 licence. The full text is in the source repository.
[ PACKAGE ]
- Stable
- 0.2.0
- Canary
- 0.3.0-canary.be675d5
- GitHub stars
- 1 GitHub star
- Licence
- Apache-2.0
- Issues
- Open an issue