[ CONVEX COMPONENT · STABLE · MIT ]
@vllnt/convex-tokens
Hashed-secret token primitive with mint-once, TTL, revoke and scope
STABLE 0.1.0 · 1 GitHub star
Package details
Install
The untagged install gets the latest stable version (0.1.0). The canary tag tracks main (0.1.1-canary.075894c).
pnpm add @vllnt/convex-tokens
pnpm add @vllnt/convex-tokens@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 tokens from "@vllnt/convex-tokens/convex.config";
const app = defineApp();
app.use(tokens);
export default app;Use it
Usage, options and examples are in the package README.
Downloads
- Last 7 days
- 247
- Since first publish
- 2,441
Downloads per week since 14 June 2026, oldest on the left. Weeks count back from 21 November 2026, so the first one may be shorter than seven days.
247 downloads in the last 7 days. 2,441 downloads since 14 June 2026. Source: npm, counted through 21 November 2026.
Show downloads per week as a table
| Week | Downloads |
|---|---|
| 14 June 2026 to 20 June 2026 | 532 |
| 21 June 2026 to 27 June 2026 | 17 |
| 28 June 2026 to 4 July 2026 | 61 |
| 5 July 2026 to 11 July 2026 | 57 |
| 12 July 2026 to 18 July 2026 | 19 |
| 19 July 2026 to 25 July 2026 | 8 |
| 26 July 2026 to 1 August 2026 | 7 |
| 2 August 2026 to 8 August 2026 | 6 |
| 9 August 2026 to 15 August 2026 | 13 |
| 16 August 2026 to 22 August 2026 | 9 |
| 23 August 2026 to 29 August 2026 | 6 |
| 30 August 2026 to 5 September 2026 | 554 |
| 6 September 2026 to 12 September 2026 | 77 |
| 13 September 2026 to 19 September 2026 | 21 |
| 20 September 2026 to 26 September 2026 | 13 |
| 27 September 2026 to 3 October 2026 | 11 |
| 4 October 2026 to 10 October 2026 | 6 |
| 11 October 2026 to 17 October 2026 | 9 |
| 18 October 2026 to 24 October 2026 | 19 |
| 25 October 2026 to 31 October 2026 | 174 |
| 1 November 2026 to 7 November 2026 | 333 |
| 8 November 2026 to 14 November 2026 | 242 |
| 15 November 2026 to 21 November 2026 | 247 |
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.
1 stable release and 8 canary builds since 14 June 2026. Latest stable: 0.1.0 on 1 September 2026.
Show every release as a table
| Version | Kind | Published |
|---|---|---|
| 0.1.1-canary.075894c | canary | 31 October 2026 |
| 0.1.0 | stable | 1 September 2026 |
| 0.1.0-canary.1581eb6 | canary | 31 August 2026 |
| 0.1.0-canary.efeaa33 | canary | 31 August 2026 |
| 0.1.0-canary.78e6cbb | canary | 31 August 2026 |
| 0.1.0-canary.3d5a3ae | canary | 16 June 2026 |
| 0.1.0-canary.7e6dd78 | canary | 16 June 2026 |
| 0.1.0-canary.4bc4600 | canary | 16 June 2026 |
| 0.1.0-canary.4f0e428 | canary | 14 June 2026 |
Changelog
The newest stable releases of @vllnt/convex-tokens, with the notes from its changelog.
0.1.0
Added
- First release of
@vllnt/convex-tokens— a hashed-secret token primitive. Tokensclient:mint(mint-once, raw returned a single time),validate,revoke,prune, and the safe management readslistandgetMetadata(token metadata only — nevertokenHash).- Hash-at-rest: only the digest of a token is stored; the raw secret is
generated and hashed client-side with Web Crypto and never reaches the
component. Digest algorithm is configurable per mount (
hashAlgo:"SHA-256"default or"SHA-512"). - Server-sourced time: the component computes
expiresAtfrom a requestedttlMsand readsDate.now()insidevalidate— the client never sends a timestamp, so expiry cannot be forged. A non-finitettlMsfalls back to the default, so no non-expiring token can be minted. - TTL clamped server-side into
[MIN_TTL_MS, maxTtlMs], scoping via an opaquescope, and an opaque host-ownedresourceRefcarried on each token. - A built-in daily cron prunes expired tokens and revoked tokens past a retention window, in bounded self-rescheduling batches.
- Configurable client options:
defaultScope,defaultTtlMs,maxTtlMs,tokenBytes,hashAlgo.
Changed
- Treat Convex
_generatedoutput as CLI-owned, exclude it from formatting, and expose a dedicated codegen script. - Refresh all direct dependencies to their latest compatible releases for canary validation.
- Require
convex@^1.45.0and updateconvex-testto^0.0.56.
Security
- Expiry is enforced from the component's own clock; there is no client-supplied
noworexpiresAtto bypass it. - The management surface (
list,getMetadata) never exposestokenHash. - Server-side hash guard on
mint: the component now rejects atokenHashargument that is not a plausible hex digest (minimum 64 characters, lowercase hex only — SHA-256 minimum). A misconfigured or adversarial direct caller cannot persist a raw token or garbage string as the stored digest. ThrowsConvexError({ code: "INVALID_TOKEN_HASH" }). - Discriminated union on
validatereturn:{ valid: false }structurally cannot carryresourceRef— the failed branch has no such key at the type level.ValidateResultis now a discriminated union onvalid. revokesemantics clarified (transition contract):revokereturnstrueonly if this call transitioned a token from active to revoked. A second call on the same token returnsfalse(already revoked). This distinguishes "successfully revoked" from "token was already revoked".listceiling: thelimitargument is clamped to a hard ceiling of 1000 rows. Values above the ceiling are silently clamped;limit: 0returns an empty array.
- First release of
Licence
Released under the MIT licence. The full text is in the source repository.
[ PACKAGE ]
- Stable
- 0.1.0
- Canary
- 0.1.1-canary.075894c
- GitHub stars
- 1 GitHub star
- Licence
- MIT
- Issues
- Open an issue