-
Notifications
You must be signed in to change notification settings - Fork 1
Release notes
Eugene Lazutkin edited this page Jul 17, 2026
·
2 revisions
Detailed per-version history. The README carries the one-line summaries.
The port family is complete — and the browser side is documented:
-
Fetch and Lambda middleware ports.
cognito-toolkit/fetchwraps(request: Request) => Responsehandlers (Bun.serve, Deno.serve / Deploy, Cloudflare Workers, Hono);cognito-toolkit/lambdawraps(event, context)handlers with API Gateway v1 / v2 / Function URL / ALB event shapes auto-detected (case-insensitive headers, v2cookiesarray, ALB multi-value header mode mirrored on responses). Both use the handler-wrapper model:getUseris a per-request-memoized lookup, guards wrap handlers, denials are aResponse/ result envelope. The family now mirrors dynamodb-toolkit's adapter ports (./koa,./express,./fetch,./lambda), so the two toolkits compose without glue; sources moved undersrc/http/to match. -
Renewal hardening in
createRenewableAccessToken. A failed scheduled renewal no longer stops the cycle silently: it keeps the previous token and retries everyretryIntervalms (new option, default one minute) until success or cancellation, reporting each failure to the newonErrorhook (or the debug channel) — never an unhandled rejection.cancelRenewal()is now final even mid-flight: a renewal already awaiting the token endpoint neither stores its late result nor reschedules. -
AlbJwtVerifierre-exported from the root alongsideCognitoJwtVerifier/JwtVerifier— the lambda port's ALB story is one-stop now. -
Documentation build-out. The wiki gained a formal reference tier (Middleware ports, Core-API, per-port pages, the token-utility pages) and Browser usage — the production-proven client-side pattern: 401-driven login redirects with return URLs, active-user renewal timers, history hygiene (
location.replace+history.go(-N)), and the double-meh pairing. The README added TypeScript and CommonJS notes. - Internal: subpath entry points restructured as folder barrels (importmap-friendly exports, public paths unchanged);
@ts-self-typesdirectives added acrosssrc/; retiredllms/llmsFullpackage fields and the policy-onlyengines.nodedropped;@types/aws-lambdajoined the dev dependencies.
Breaking reshape — the package became the web-app glue over AWS's official verifier:
-
Verification delegated to aws-jwt-verify (
^5.2.1), the single runtime dependency (itself dependency-free). The 1.x homegrown verification stack (jsonwebtoken-era code and its 2.x zero-dependency rewrite) is gone.CognitoJwtVerifier/JwtVerifierare re-exported from the package root. -
makeGetUser(verifier, options?)replacesmakeGetUser(pools, options?): build the verifier yourself (CognitoJwtVerifier.create({userPoolId, clientId, tokenUse})) and hand it over. An absent token resolvesnulland never throws; verification failures resolvenullor, underthrowOnError, throw aws-jwt-verify error classes.prime()maps to the verifier'shydrate(). -
Middlewares absorbed as subpaths — the sister packages
koa-cognito-middlewareandcognito-express-middlewaremoved in ascognito-toolkit/koaandcognito-toolkit/express; the standalone packages are frozen re-export thunks (their 2.0.0).makeAuth(options)returns a per-instance bundle —getUser,isAuthenticated,hasGroup,hasScope,isAllowed,setAuthCookie,stateUserProperty— replacing the former module-level statics. -
Auth-cookie fix: the cookie
domaindefaults to the request hostname — the oldhostdefault broke on Express 5, which keeps the port onreq.host(the cookie serializer rejects it). - Guards read Cognito's
cognito:groupsand OAuth2scopeclaims; 401 for anonymous, 403 for authenticated-but-unauthorized. Tokens are used bare (noBearerstripping — use a customsourceto strip). - Token utilities (
utils/lazy-access-token,utils/renewable-access-token) are unchanged from 2.x. - Migration guides: from the v1 middlewares and from cognito-toolkit 1.x.
Zero-dependency, ESM-only rewrite of the 1.x verifier on Node built-ins (crypto + fetch): configurable algorithm policy, audience / tokenUse / validate checks, typed CognitoAuthError, per-issuer JWKS with rotation refresh. Never published — the survey found AWS's aws-jwt-verify at parity-plus, which led directly to the 3.0.0 delegation.
- 1.0.6 — updated dependencies.
- 1.0.5 — updated dependencies.
- 1.0.4 — updated dependencies.
- 1.0.3 — updated dependencies.
- 1.0.2 — updated dependencies.
- 1.0.1 — added support for multiple pools.
-
1.0.0 — the initial public release (CommonJS,
jsonwebtoken+jwk-to-pem).
Start here
Reference
Under the hood