Skip to content

[ 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).

terminal
pnpm add @vllnt/convex-tokens
pnpm add @vllnt/convex-tokens@canary

Register the component

Add it to your app’s convex/convex.config.ts, then run npx convex dev to generate the references.

convex/convex.config.ts
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.

Read the 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
WeekDownloads
14 June 2026 to 20 June 2026532
21 June 2026 to 27 June 202617
28 June 2026 to 4 July 202661
5 July 2026 to 11 July 202657
12 July 2026 to 18 July 202619
19 July 2026 to 25 July 20268
26 July 2026 to 1 August 20267
2 August 2026 to 8 August 20266
9 August 2026 to 15 August 202613
16 August 2026 to 22 August 20269
23 August 2026 to 29 August 20266
30 August 2026 to 5 September 2026554
6 September 2026 to 12 September 202677
13 September 2026 to 19 September 202621
20 September 2026 to 26 September 202613
27 September 2026 to 3 October 202611
4 October 2026 to 10 October 20266
11 October 2026 to 17 October 20269
18 October 2026 to 24 October 202619
25 October 2026 to 31 October 2026174
1 November 2026 to 7 November 2026333
8 November 2026 to 14 November 2026242
15 November 2026 to 21 November 2026247

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
VersionKindPublished
0.1.1-canary.075894ccanary31 October 2026
0.1.0stable1 September 2026
0.1.0-canary.1581eb6canary31 August 2026
0.1.0-canary.efeaa33canary31 August 2026
0.1.0-canary.78e6cbbcanary31 August 2026
0.1.0-canary.3d5a3aecanary16 June 2026
0.1.0-canary.7e6dd78canary16 June 2026
0.1.0-canary.4bc4600canary16 June 2026
0.1.0-canary.4f0e428canary14 June 2026

Changelog

The newest stable releases of @vllnt/convex-tokens, with the notes from its changelog.

  1. 0.1.0

    Added
    • First release of @vllnt/convex-tokens — a hashed-secret token primitive.
    • Tokens client: mint (mint-once, raw returned a single time), validate, revoke, prune, and the safe management reads list and getMetadata (token metadata only — never tokenHash).
    • 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 expiresAt from a requested ttlMs and reads Date.now() inside validate — the client never sends a timestamp, so expiry cannot be forged. A non-finite ttlMs falls back to the default, so no non-expiring token can be minted.
    • TTL clamped server-side into [MIN_TTL_MS, maxTtlMs], scoping via an opaque scope, and an opaque host-owned resourceRef carried 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 _generated output 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.0 and update convex-test to ^0.0.56.
    Security
    • Expiry is enforced from the component's own clock; there is no client-supplied now or expiresAt to bypass it.
    • The management surface (list, getMetadata) never exposes tokenHash.
    • Server-side hash guard on mint: the component now rejects a tokenHash argument 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. Throws ConvexError({ code: "INVALID_TOKEN_HASH" }).
    • Discriminated union on validate return: { valid: false } structurally cannot carry resourceRef — the failed branch has no such key at the type level. ValidateResult is now a discriminated union on valid.
    • revoke semantics clarified (transition contract): revoke returns true only if this call transitioned a token from active to revoked. A second call on the same token returns false (already revoked). This distinguishes "successfully revoked" from "token was already revoked".
    • list ceiling: the limit argument is clamped to a hard ceiling of 1000 rows. Values above the ceiling are silently clamped; limit: 0 returns an empty array.
All releases of @vllnt/convex-tokens
Stable releases
RSSAtomJSON Feed
Canary builds
RSSAtomJSON Feed

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

Theme