@vllnt/convex-api-keys 0.3.0 → 0.3.1-canary.a0808f9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,168 @@
1
+ # Changelog
2
+
3
+ ## [Unreleased]
4
+
5
+ ### Added
6
+
7
+ - The npm package now ships `docs/API.md`, `CHANGELOG.md` and `llms.txt`, so
8
+ coding agents can read docs that match the installed version from
9
+ `node_modules/@vllnt/convex-api-keys/`. `llms.txt` links shipped files by
10
+ relative path. `pnpm test:package` (run by `pnpm test` and
11
+ `pnpm test:coverage`) fails when one of them is missing from the tarball.
12
+ - `docs/API.md` documents the package entry points and exported types.
13
+
14
+ ### Changed
15
+
16
+ - Canary releases publish on every push to `main` that touches the package or
17
+ its shipped docs; a repository variable no longer gates them.
18
+ - `homepage` points to https://oss.vllnt.com/packages/convex-api-keys.
19
+ - Update `@convex-dev/sharded-counter` to `^0.2.4`.
20
+
21
+ ## [0.3.0] - 2026-11-26
22
+
23
+ ### Added
24
+
25
+ - `matchStatus` query (component `queries.matchStatus` and client
26
+ `matchStatus(ctx, { key })`): the stored status of the key matching a key
27
+ string, or `null` for a malformed or unknown key. Read-only, so a caller can
28
+ refuse revoked, disabled, expired or exhausted keys without running the
29
+ `validate` mutation. `validate` and `matchStatus` share one key lookup.
30
+
31
+ ### Fixed
32
+
33
+ - Reject `NaN` and `Infinity` for `expiresAt`, and `NaN`, `Infinity`, fractional
34
+ values for `remaining`. They previously compared as "not expired" and "not
35
+ exhausted", producing keys that never expired or never ran out.
36
+ - Reject a `NaN` `gracePeriodMs` in `rotate()`. It previously slipped past the
37
+ range check and left the old key valid forever.
38
+ - Reject non-finite `cleanupIntervalMs` and `defaultExpiryMs` in `configure()`.
39
+ - Reject an empty `ownerId` or `name` in `create()`, an empty `name` in
40
+ `update()`, and an empty or malformed `tag` in `revokeByTag()`.
41
+ - Reject a non-positive or non-integer `limit` in `list()` and `listByTag()`.
42
+ - Keep expired keys terminal across repeated validation, restrict rotation to
43
+ active unlimited-use keys, and cap the old key's grace window at its absolute
44
+ expiry.
45
+ - Stop shipping unit-test files in the npm package.
46
+
47
+ ### Changed
48
+
49
+ - `listByTag` stops reading once it has `limit` matches instead of collecting every key the
50
+ owner ever had (including revoked and expired history) before filtering.
51
+ - **Peer range**: requires `convex@^1.45.0` (0.2.0 required `^1.36.1`).
52
+ - **License**: relicensed from Apache-2.0 to MIT.
53
+ - Enforce the documented 100% statement, branch, function, and line coverage
54
+ gate.
55
+ - Treat Convex `_generated` output as CLI-owned, exclude it from formatting, and
56
+ expose a dedicated codegen script.
57
+ - Update `@convex-dev/sharded-counter` to `^0.2.3`.
58
+ - README documents installing the stable release, how to use `/test` in a
59
+ consuming app (`convex-test` and `vitest` are required there), and that scope
60
+ and rate-limit enforcement belong to the host.
61
+ - Releases are published from CI only (trusted publishing with provenance);
62
+ stable versions come from `v*.*.*` tags.
63
+
64
+ ## [0.2.0] - 2026-04-25
65
+
66
+ ### Breaking Changes
67
+
68
+ - **Convex compatibility**: this release targets `convex@^1.36.1` and
69
+ `convex-test@^0.0.50`.
70
+ - **`create()` / `rotate()`**: Secret material (lookupPrefix, secretHex, hash)
71
+ now generated server-side. Remove these from client args.
72
+ - **Admin mutations** (`revoke`, `disable`, `enable`, `update`, `rotate`,
73
+ `getUsage`): `ownerId` is now a required argument for auth boundary
74
+ enforcement.
75
+ - **`apiKeyEvents` table removed**: Audit trail replaced with structured logging
76
+ (Convex dashboard). Export existing event data before upgrading.
77
+ - **`@convex-dev/rate-limiter` removed**: Rate limiting is now the integrator's
78
+ responsibility at their HTTP action/mutation layer. Remove
79
+ `rateLimiterTest.register()` from test setup.
80
+ - **`@convex-dev/aggregate` and `@convex-dev/crons` removed**: Remove
81
+ `aggregateTest.register()` and `cronsTest.register()` from test setup.
82
+ - **`getUsage()`**: `period` param removed (counter-only). `lastUsedAt` removed
83
+ from return type.
84
+ - **`validate()`**: `retryAfter` removed from failure response (no internal rate
85
+ limiting).
86
+ - **`list()` / `listByTag()`**: Now paginated with `limit` param (default 100).
87
+
88
+ ### Migration Guide
89
+
90
+ ```ts
91
+ // BEFORE (v0.1)
92
+ const { key } = await apiKeys.create(ctx, {
93
+ name: "My Key",
94
+ ownerId: "org_1",
95
+ lookupPrefix,
96
+ secretHex,
97
+ hash, // ← REMOVE these
98
+ });
99
+ await apiKeys.revoke(ctx, { keyId });
100
+ await apiKeys.rotate(ctx, { keyId, lookupPrefix, secretHex });
101
+ const usage = await apiKeys.getUsage(ctx, { keyId, period: { start, end } });
102
+
103
+ // AFTER (v0.2)
104
+ const { key } = await apiKeys.create(ctx, {
105
+ name: "My Key",
106
+ ownerId: "org_1",
107
+ // secret material generated server-side
108
+ });
109
+ await apiKeys.revoke(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId
110
+ await apiKeys.rotate(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId
111
+ const usage = await apiKeys.getUsage(ctx, { keyId, ownerId: "org_1" }); // ← ADD ownerId, REMOVE period
112
+ ```
113
+
114
+ Test setup:
115
+
116
+ ```ts
117
+ // BEFORE
118
+ import rateLimiterTest from "@convex-dev/rate-limiter/test";
119
+ import aggregateTest from "@convex-dev/aggregate/test";
120
+ import cronsTest from "@convex-dev/crons/test";
121
+ rateLimiterTest.register(t, "apiKeys/rateLimiter");
122
+ aggregateTest.register(t, "apiKeys/usageAggregate");
123
+ cronsTest.register(t, "apiKeys/crons");
124
+
125
+ // AFTER — only shardedCounter remains
126
+ import shardedCounterTest from "@convex-dev/sharded-counter/test";
127
+ shardedCounterTest.register(t, "apiKeys/shardedCounter");
128
+ ```
129
+
130
+ ### New Features
131
+
132
+ - Public client wrapper now forwards optional `limit` to `list()` and
133
+ `listByTag()`
134
+ - `ValidationFailure` no longer advertises the removed `retryAfter` field
135
+ - Auth boundary: `ownerId` cross-check on all admin mutations
136
+ - Server-side secret generation for `create()` and `rotate()`
137
+ - Input validation: keyPrefix charset, env charset, gracePeriodMs bounds
138
+ (60s–30d), metadata size (4KB), scopes (50), tags (20)
139
+ - Configure bounds validation (reject negative/zero)
140
+ - Structured audit logging on all mutation outcomes
141
+ - lastUsedAt throttled to 60s (reduces OCC contention)
142
+ - Remaining decrement decoupled from lastUsedAt write (single merged patch)
143
+ - revokeByTag expanded to include `rotating` and `disabled` statuses
144
+ - Paginated list/listByTag with configurable limit
145
+
146
+ ## 0.1.1
147
+
148
+ Not published to npm.
149
+
150
+ - CI fix: add --ignore-scripts to npm publish
151
+
152
+ ## [0.1.0] - 2026-03-23
153
+
154
+ - Initial release
155
+ - Key creation with SHA-256 hashing, prefix-indexed lookup
156
+ - Key validation with status/expiry/remaining checks
157
+ - Key revocation (single + bulk by tag)
158
+ - Key rotation with configurable grace period
159
+ - Key listing by owner, tag, environment
160
+ - Key update (name, scopes, tags, metadata) without rotation
161
+ - Key disable/enable (reversible pause)
162
+ - Finite-use keys (remaining counter with atomic decrement)
163
+ - Key types (secret / publishable) with type-encoded prefix
164
+ - Environment-aware key format
165
+ - Multi-tenant isolation (ownerId-scoped queries)
166
+ - Audit event log (apiKeyEvents table)
167
+ - Usage analytics via event counting
168
+ - Child components: @convex-dev/rate-limiter, sharded-counter, aggregate, crons
package/README.md CHANGED
@@ -68,6 +68,13 @@ export default app;
68
68
  > plan tier). The component has none. Scope enforcement is yours too: `validate`
69
69
  > returns the key's `scopes`; check them before acting.
70
70
 
71
+ ## For coding agents
72
+
73
+ The npm package bundles its docs at `node_modules/@vllnt/convex-api-keys/`:
74
+ `docs/API.md`, `CHANGELOG.md`, `llms.txt` and the TypeScript source in `src/`.
75
+ They match the installed version. Read them before writing code against this
76
+ package.
77
+
71
78
  ## Usage
72
79
 
73
80
  Expose a host mutation that derives ownership from authenticated identity:
@@ -166,8 +173,9 @@ See [docs/API.md](docs/API.md).
166
173
  ## Testing your app
167
174
 
168
175
  `@vllnt/convex-api-keys/test` exports `register(t, name = "apiKeys")` to mount
169
- the component in a `convex-test` instance. It needs `convex-test` and `vitest`
170
- (with Vite's `import.meta.glob`) in the consuming app:
176
+ the component in a `convex-test` instance. It needs `convex-test`, `vitest`
177
+ (with Vite's `import.meta.glob`) and `@convex-dev/sharded-counter` (for its
178
+ `/test` helper) installed in the consuming app:
171
179
 
172
180
  ```ts
173
181
  /// <reference types="vite/client" />
@@ -181,21 +189,36 @@ register(t, "apiKeys");
181
189
  shardedCounterTest.register(t, "apiKeys/shardedCounter");
182
190
  ```
183
191
 
192
+ ## Related packages
193
+
194
+ - [`@vllnt/convex-tokens`](https://www.npmjs.com/package/@vllnt/convex-tokens) —
195
+ short-lived tokens shown once, with a TTL that always expires and revoke (for
196
+ example invite or reset links). Use convex-api-keys for long-lived keys with
197
+ rotation, usage counts and per-owner listing.
198
+ - [`@vllnt/convex-permissions`](https://www.npmjs.com/package/@vllnt/convex-permissions)
199
+ — role-based access control. Use it to decide what a validated key's owner may
200
+ do; this package only returns the key's `scopes`.
201
+ - [`@vllnt/convex-quota`](https://www.npmjs.com/package/@vllnt/convex-quota) —
202
+ allowances that reset on a schedule (per day, week, month). Use it for per-key
203
+ plan limits; `remaining` here is a one-off counter that never resets.
204
+
184
205
  ## Contributing
185
206
 
186
- See [CONTRIBUTING.md](./CONTRIBUTING.md) for development setup, testing, and PR
187
- guidelines.
207
+ See
208
+ [CONTRIBUTING.md](https://github.com/vllnt/convex-api-keys/blob/main/CONTRIBUTING.md)
209
+ for development setup, testing, and PR guidelines.
188
210
 
189
211
  ## Author
190
212
 
191
213
  Built by [bntvllnt](https://github.com/bntvllnt) ·
192
214
  [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
193
215
 
194
- Part of the [@vllnt](https://github.com/vllnt) Convex component fleet —
195
- [vllnt.com](https://vllnt.com)
196
-
197
216
  If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
198
217
 
199
218
  ## License
200
219
 
201
220
  MIT — see [LICENSE](LICENSE).
221
+
222
+ ---
223
+
224
+ Part of vllnt oss: https://oss.vllnt.com
package/docs/API.md ADDED
@@ -0,0 +1,206 @@
1
+ # API Reference — @vllnt/convex-api-keys
2
+
3
+ **Compatibility:** requires `convex@^1.45.0` (releases before `0.3.0` required
4
+ `convex@^1.36.1`).
5
+
6
+ ## Package exports
7
+
8
+ | Import path | Exports |
9
+ | ----------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
10
+ | `@vllnt/convex-api-keys` | `ApiKeys` class; types `ApiKeysConfig`, `CreateKeyOptions`, `CreateKeyResult`, `ValidationResult`, `ValidationFailureReason`, `KeyMetadata`, `UsageStats`, `RotateResult`, `KeyType`, `KeyStatus`, `RunMutationCtx`, `RunQueryCtx` |
11
+ | `@vllnt/convex-api-keys/convex.config` (`.js`) | default: the component definition, passed to `app.use()` |
12
+ | `@vllnt/convex-api-keys/test` | `register(t, name = "apiKeys")` to mount the component in `convex-test`, plus a default export `{ register, schema, modules }` (TypeScript source; needs Vite's `import.meta.glob`) |
13
+ | `@vllnt/convex-api-keys/_generated/component` (`.js`) | type `ComponentApi` (the type of `components.apiKeys`) |
14
+
15
+ `RunMutationCtx` is any context with `runMutation` (mutation or action);
16
+ `RunQueryCtx` is any context with `runQuery` (query, mutation or action).
17
+
18
+ ## ApiKeys Class
19
+
20
+ ```ts
21
+ import { ApiKeys } from "@vllnt/convex-api-keys";
22
+ import { components } from "./_generated/api";
23
+
24
+ const apiKeys = new ApiKeys(components.apiKeys, {
25
+ prefix: "myapp", // key prefix (default: "vk")
26
+ defaultType: "secret", // "secret" | "publishable" (default: "secret")
27
+ });
28
+ ```
29
+
30
+ ## Methods
31
+
32
+ ### create(ctx, options)
33
+
34
+ Create a new API key. Secret material is generated server-side. Returns the raw
35
+ key once — only the hash is stored.
36
+
37
+ | Param | Type | Required | Description |
38
+ | ----------- | --------------------------- | -------- | ------------------------------------------------------------- |
39
+ | `name` | `string` | yes | Display name (max 256 chars) |
40
+ | `ownerId` | `string` | yes | Tenant/org/user ID |
41
+ | `type` | `"secret" \| "publishable"` | no | Key type (default from config) |
42
+ | `scopes` | `string[]` | no | Permission scopes (max 50) |
43
+ | `tags` | `string[]` | no | Filterable tags (max 20) |
44
+ | `env` | `string` | no | Environment (default: `"live"`, must match `^[a-zA-Z0-9-]+$`) |
45
+ | `metadata` | `Record<string, unknown>` | no | Arbitrary JSON (max 4KB) |
46
+ | `remaining` | `number` | no | Finite-use counter |
47
+ | `expiresAt` | `number` | no | Expiry timestamp (ms) |
48
+
49
+ **Returns:** `{ keyId: string, key: string }`
50
+
51
+ ### validate(ctx, { key })
52
+
53
+ Validate a key and track usage. Decrements `remaining` if set.
54
+
55
+ **Returns:**
56
+ `{ valid: true, keyId, ownerId, type, env, scopes, tags, metadata, remaining }`
57
+ or `{ valid: false, reason }`
58
+
59
+ **Rejection reasons:** `"malformed"`, `"not_found"`, `"revoked"`, `"disabled"`,
60
+ `"expired"`, `"exhausted"`
61
+
62
+ ### revoke(ctx, { keyId, ownerId })
63
+
64
+ Permanently revoke a key. Requires `ownerId` for auth boundary. Any status
65
+ except `revoked` becomes `revoked`, including `expired` and `exhausted`;
66
+ revoking a key that is already revoked does nothing.
67
+
68
+ ### revokeByTag(ctx, { ownerId, tag })
69
+
70
+ Bulk revoke all keys matching a tag. Covers `active`, `rotating`, and `disabled`
71
+ statuses.
72
+
73
+ **Returns:** `{ revokedCount: number }`
74
+
75
+ ### rotate(ctx, { keyId, ownerId, gracePeriodMs? })
76
+
77
+ Create a new key and put the old key in grace period. Both keys validate during
78
+ the grace period, capped by the old key's absolute expiry. Rotation requires an
79
+ active unlimited-use key; finite-use keys must be replaced explicitly so their
80
+ quota cannot be duplicated. Secret material is generated server-side.
81
+
82
+ | Param | Type | Default | Description |
83
+ | --------------- | -------- | -------------- | ----------------------------------- |
84
+ | `gracePeriodMs` | `number` | `3600000` (1h) | Grace period (min 60s, max 30 days) |
85
+
86
+ **Returns:** `{ newKeyId, newKey, oldKeyExpiresAt }`
87
+
88
+ ### list(ctx, { ownerId, env?, status?, limit? })
89
+
90
+ Return a bounded array of keys for an owner (default limit 100), with no raw
91
+ keys or hashes. There is no cursor or continuation token.
92
+
93
+ **Returns:** `KeyMetadata[]` —
94
+ `{ keyId, name, lookupPrefix, type, env, scopes, tags, status, metadata?, remaining?, expiresAt?, createdAt, lastUsedAt? }`
95
+
96
+ ### listByTag(ctx, { ownerId, tag, limit? })
97
+
98
+ Return a bounded array of keys matching a tag (default limit 100). There is no
99
+ cursor or continuation token; repeating the call does not advance a page.
100
+
101
+ **Returns:** `KeyMetadata[]` (same shape as `list`)
102
+
103
+ ### update(ctx, { keyId, ownerId, name?, scopes?, tags?, metadata? })
104
+
105
+ Update key metadata in-place without rotation. Requires `ownerId` for auth
106
+ boundary.
107
+
108
+ ### disable(ctx, { keyId, ownerId })
109
+
110
+ Temporarily disable a key. Reversible via `enable()`. Requires `ownerId`.
111
+
112
+ ### enable(ctx, { keyId, ownerId })
113
+
114
+ Re-enable a disabled key. Requires `ownerId`.
115
+
116
+ ### matchStatus(ctx, { key })
117
+
118
+ Read-only lookup: the stored status of the key matching `key`
119
+ (`"active" | "disabled" | "revoked" | "rotating" | "expired" | "exhausted"`),
120
+ or `null` when `key` is malformed or matches no key. It writes nothing and does
121
+ not count usage. The stored status is not re-evaluated, so a key past
122
+ `expiresAt` (or a rotating key past its grace window) reads as `active` /
123
+ `rotating` until `validate()` marks it expired: treat those two values as
124
+ "maybe valid" and call `validate()` before trusting the key. Also available as
125
+ the component query `components.apiKeys.queries.matchStatus`.
126
+
127
+ **Returns:** `KeyStatus | null`
128
+
129
+ ### getUsage(ctx, { keyId, ownerId })
130
+
131
+ Get usage count for a key. Returns O(1) counter value.
132
+
133
+ **Returns:** `{ total: number, remaining?: number }`
134
+
135
+ ### configure(ctx, { cleanupIntervalMs?, defaultExpiryMs? })
136
+
137
+ Store runtime configuration. Admin-only surface — no ownerId scoping. Values
138
+ must be finite and > 0. In this version the values are only stored: no cleanup
139
+ job runs and `create()` does not apply `defaultExpiryMs`; pass `expiresAt` to
140
+ `create()` to set an expiry.
141
+
142
+ ## Errors
143
+
144
+ Methods that take `keyId` and `ownerId` throw `key not found` for an unknown key
145
+ and `unauthorized: key does not belong to owner` when `ownerId` does not match.
146
+ Status rules:
147
+
148
+ - `update()` throws `cannot update terminal key` for `revoked`, `expired` and
149
+ `exhausted` keys.
150
+ - `disable()` works on `active` keys only; disabling a `disabled` key does
151
+ nothing.
152
+ - `enable()` works on `disabled` keys only; enabling an `active` key does
153
+ nothing.
154
+ - `rotate()` works on `active` keys without `remaining` and not past
155
+ `expiresAt`.
156
+
157
+ ## Input Validation
158
+
159
+ | Field | Constraint |
160
+ | ------------------- | -------------------------------------------------------------------------------- |
161
+ | `keyPrefix` | `^[a-zA-Z0-9]+$` (no underscores), max 256 characters |
162
+ | `env` | `^[a-zA-Z0-9-]+$` (no underscores — would break key parsing), max 256 characters |
163
+ | `ownerId` (create) | must not be empty (`ownerId must not be empty`) |
164
+ | `name` | must not be empty, max 256 characters |
165
+ | `metadata` | max 4096 characters of `JSON.stringify` output |
166
+ | `scopes` | max 50 entries |
167
+ | `tags` | max 20 entries, each matching `^[a-zA-Z0-9][a-zA-Z0-9-]*$` |
168
+ | `gracePeriodMs` | min 60,000 (60s), max 2,592,000,000 (30 days); NaN rejected |
169
+ | `tag` (revokeByTag) | same pattern as `tags`; empty is rejected (`Invalid tag`) |
170
+ | `remaining` | finite integer > 0 |
171
+ | `expiresAt` | finite timestamp in the future (NaN/Infinity rejected) |
172
+ | `limit` (queries) | positive integer (`limit must be a positive integer`) |
173
+ | `cleanupIntervalMs` | finite number > 0 |
174
+ | `defaultExpiryMs` | finite number > 0 |
175
+
176
+ ## Key Format
177
+
178
+ ```
179
+ {prefix}_{type}_{env}_{random8}_{secret64}
180
+
181
+ Examples:
182
+ myapp_secret_live_a1b2c3d4_<hex> ← production secret
183
+ myapp_pub_test_e5f6a7b8_<hex> ← test publishable
184
+ ```
185
+
186
+ ## Key Lifecycle
187
+
188
+ ```
189
+ create() → ACTIVE ──→ DISABLED (reversible via enable())
190
+ ──→ REVOKED (terminal)
191
+ ──→ ROTATING (grace period → EXPIRED)
192
+ ──→ EXPIRED (terminal, time-based)
193
+ ──→ EXHAUSTED (terminal, remaining=0)
194
+ ```
195
+
196
+ ## Security Model
197
+
198
+ This component protects against **accidental cross-tenant bugs in honest host
199
+ apps**. The `ownerId` check prevents a bug from operating on another tenant's
200
+ keys — it does NOT prevent a compromised host app from passing a forged
201
+ `ownerId`.
202
+
203
+ Integrators must derive `ownerId` from their own auth layer (e.g.,
204
+ `ctx.auth.getUserIdentity()`) before passing it to the component. Secret
205
+ material is generated server-side and only the SHA-256 hash is stored; the raw
206
+ key is returned once at creation and is irrecoverable afterward.
package/llms.txt ADDED
@@ -0,0 +1,32 @@
1
+ # @vllnt/convex-api-keys
2
+
3
+ > Secure API key management as a Convex component. Create, validate, revoke, rotate, and track usage with owner-scoped admin APIs, server-side secret generation, and structured audit logging.
4
+
5
+ `@vllnt/convex-api-keys` is a publishable Convex component for multi-tenant API key management. Keys are stored as SHA-256 hashes, looked up by prefix, and never persisted in raw form. Requires `convex@^1.45.0` (releases before 0.3.0 targeted `convex@^1.36.1`) and uses `@convex-dev/sharded-counter` for per-key usage counts.
6
+
7
+ For coding agents: this file, the API reference and the changelog are bundled in the npm package at `node_modules/@vllnt/convex-api-keys/`, next to the source in `src/`. They match the installed version. Read them before writing code against this package.
8
+
9
+ ## Docs
10
+
11
+ - [README](./README.md): Project overview, installation, usage examples, and security model
12
+ - [API Reference](./docs/API.md): Package exports, `ApiKeys` class methods, return shapes, and input validation rules
13
+ - [Changelog](./CHANGELOG.md): Version history and release notes
14
+ - [Contributing](https://github.com/vllnt/convex-api-keys/blob/main/CONTRIBUTING.md): Development setup, validation commands, and release workflow notes
15
+
16
+ ## Examples
17
+
18
+ These files are on GitHub `main` and may be newer than the installed version.
19
+
20
+ - [Example component wrapper](https://github.com/vllnt/convex-api-keys/blob/main/example/convex/example.ts): Host-app wrapper functions around the component API
21
+ - [Example tests](https://github.com/vllnt/convex-api-keys/blob/main/example/convex/example.test.ts): End-to-end usage coverage with `convex-test`
22
+
23
+ ## Ecosystem
24
+
25
+ - [vllnt oss](https://oss.vllnt.com/llms.txt): Index of the other vllnt open-source packages
26
+
27
+ ## Optional
28
+
29
+ - [AGENTS](https://github.com/vllnt/convex-api-keys/blob/main/AGENTS.md): Agent instructions for contributors to this repository
30
+ - [Security Policy](https://github.com/vllnt/convex-api-keys/blob/main/SECURITY.md): Vulnerability reporting policy
31
+ - [Code of Conduct](https://github.com/vllnt/convex-api-keys/blob/main/CODE_OF_CONDUCT.md): Community participation guidelines
32
+ - [License](./LICENSE): MIT license
package/package.json CHANGED
@@ -1,15 +1,19 @@
1
1
  {
2
2
  "name": "@vllnt/convex-api-keys",
3
- "version": "0.3.0",
3
+ "version": "0.3.1-canary.a0808f9",
4
4
  "description": "Convex component for secure API key management — create, validate, revoke, rotate, and track usage",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
- "packageManager": "pnpm@10.34.8",
7
+ "packageManager": "pnpm@10.34.9",
8
8
  "files": [
9
9
  "dist",
10
10
  "src",
11
+ "docs/API.md",
12
+ "CHANGELOG.md",
13
+ "llms.txt",
11
14
  "!src/**/*.test.ts",
12
- "!src/**/*.spec.*"],
15
+ "!src/**/*.spec.*"
16
+ ],
13
17
  "exports": {
14
18
  "./package.json": "./package.json",
15
19
  ".": {
@@ -41,16 +45,17 @@
41
45
  "typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo",
42
46
  "typecheck:ci": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck-ci.tsbuildinfo --project tsconfig.ci.json",
43
47
  "lint": "pnpm check:agents && eslint --cache --cache-location node_modules/.cache/eslint/ .",
44
- "test": "pnpm check:agents && vitest run --passWithNoTests",
48
+ "test": "pnpm check:agents && pnpm test:package && vitest run --passWithNoTests",
45
49
  "test:watch": "vitest --typecheck --clearScreen false",
46
- "test:coverage": "vitest run --coverage --coverage.reporter=text",
50
+ "test:coverage": "pnpm test:package && vitest run --coverage --coverage.reporter=text",
51
+ "test:package": "node scripts/test-package.mjs",
47
52
  "generate:llms": "node scripts/generate-llms.mjs",
48
53
  "preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test && pnpm typecheck && pnpm generate:llms",
49
54
  "check:agents": "node -e \"const f=require('node:fs');if(!f.existsSync('AGENTS.md')||f.existsSync('CLAUDE.md')||f.existsSync('.claude'))process.exit(1)\"",
50
55
  "codegen": "pnpm convex codegen --component-dir ./src/component"
51
56
  },
52
57
  "dependencies": {
53
- "@convex-dev/sharded-counter": "^0.2.3"
58
+ "@convex-dev/sharded-counter": "^0.2.4"
54
59
  },
55
60
  "peerDependencies": {
56
61
  "convex": "^1.45.0"
@@ -58,18 +63,18 @@
58
63
  "devDependencies": {
59
64
  "@edge-runtime/vm": "^5.0.0",
60
65
  "@typescript/native": "npm:typescript@7.0.2",
61
- "@vitest/coverage-v8": "^5.1.0",
66
+ "@vitest/coverage-v8": "^5.1.1",
62
67
  "@vllnt/eslint-config": "2.1.0",
63
- "@vllnt/typescript": "2.0.0",
64
- "convex": "1.50.0",
65
- "convex-test": "^0.0.71",
66
- "eslint": "^9.39.5",
68
+ "@vllnt/typescript": "3.0.0",
69
+ "convex": "1.51.0",
70
+ "convex-test": "^0.0.73",
71
+ "eslint": "^10.15.0",
67
72
  "prettier": "^3.10.1",
68
73
  "typescript": "npm:@typescript/typescript6@^6.0.2",
69
74
  "vite": "^8.3.8",
70
- "vitest": "^5.1.0"
75
+ "vitest": "^5.1.1"
71
76
  },
72
- "homepage": "https://github.com/vllnt/convex-api-keys#readme",
77
+ "homepage": "https://oss.vllnt.com/packages/convex-api-keys",
73
78
  "bugs": {
74
79
  "url": "https://github.com/vllnt/convex-api-keys/issues"
75
80
  },
@@ -94,10 +99,12 @@
94
99
  "sideEffects": false,
95
100
  "keywords": [
96
101
  "convex",
102
+ "convex-component",
97
103
  "api-keys",
104
+ "api-key-management",
105
+ "key-rotation",
98
106
  "authentication",
99
- "multi-tenant",
100
- "convex-component"
107
+ "multi-tenant"
101
108
  ],
102
109
  "pnpm": {
103
110
  "minimumReleaseAge": 10080,