Conversation
The JWT previously included device_token, transaction_id, and timestamp as custom claims. Apple's DeviceCheck docs specify these belong only in the POST body — the JWT should contain just standard claims (iss, iat, exp). Also switches to wrangler runtime types and includes test files in tsconfig for IDE support. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
26bd994 to
2a33c4e
Compare
93975f1 to
288e49f
Compare
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
This PR modernizes the project’s CI/CD, testing setup, Wrangler configuration, and DeviceCheck request flow. It improves correctness (especially around Apple DeviceCheck), adds automated testing, and updates the toolchain to current versions.
CI/CD Changes
Removed
deploy-worker.yaml(release-triggered deploy).Added:
pull-request.yml– runs on PRs tomain:npm cinpm run generate-typesnpm testpush.yml– runs on push tomain:release-pleasefor automated versioningUpdated README badge to reflect new workflow.
This ensures tests run before merge and deployments only happen from formal releases.
Testing (Vitest)
Added Vitest and coverage configuration.
Added comprehensive tests for:
fetchhandlerchecklogicValidates:
DeviceCheck Fix: JWT and Payload Separation
Previously,
device_token,transaction_id, andtimestampwere embedded in the JWT.Now:
iss,iat,exp).transaction_idusescrypto.randomUUID()instead of a timestamp-based value.This aligns the implementation with Apple’s DeviceCheck API expectations and prevents leaking device payload fields into JWT claims.
Wrangler v4 Migration
wrangler.tomltowrangler.jsonc.wrangler@^4.68.1.@cloudflare/workers-types.generate-typesandtype-checkscripts.worker-configuration.d.ts; types are now generated.Observability is enabled and compatibility dates updated.
Dependency Updates
wrangler→^4.68.1typescript→^5.9.3jose→^6.1.3vitestand@vitest/coverage-v8iOS Example Updates
X-Apple-Device-Developmentheader.Miscellaneous
.env.template.wrangler.tomltowrangler.jsonc..gitignorefor generated type files.