feat(cloudflare): add @keycardai/cloudflare package#8
Merged
Larry-Osakwe merged 3 commits intomainfrom Apr 6, 2026
Merged
Conversation
- createKeycardWorker() high-level wrapper: CORS, metadata, bearer auth, delegation - JWT verification via @keycardai/oauth keyring (JWKS discovery + caching) - IsolateSafeTokenCache: per-user token cache with request deduplication - WorkersClientSecret and WorkersWebIdentity credential modes - Extract ApplicationCredential interface to @keycardai/oauth/credentials so @keycardai/mcp and @keycardai/cloudflare share a single source of truth - Full example in examples/cloudflare-worker/ - 30 tests passing, builds clean, strict TypeScript Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
160648c to
7b2cce1
Compare
- Remove dead `resource` variable in handleProtectedResourceMetadata (computed but never used — response already uses `baseUrl`) - Fix audience check in verifyBearerToken to compare origin only, not full URL including path+query. A token scoped to https://example.com should validate for requests to any path on that origin. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@keycardai/cloudflarepackage adapting Keycard OAuth primitives to Workers'fetch()handler modelcreateKeycardWorker()high-level wrapper chains metadata + auth + user handlerexamples/cloudflare-worker/with MCP tools and token exchangeNew files
packages/cloudflare/— the package (auth, metadata, credentials, tokenCache, worker)examples/cloudflare-worker/— working example with READMETest plan
pnpm -r run build— all 4 packages buildpnpm --filter @keycardai/cloudflare test— 30 tests passpnpm --filter @keycardai/cloudflare typecheck— strict TS clean🤖 Generated with Claude Code