◉RORK LABJP
●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left●ARCHIVE — Since 11/22 you can archive a Rork project instead of deleting it, and bring it back from Archived●PLAY FIX — Fixed: Expo apps built for Google Play losing their Rork AI key, which broke AI features●SONNET 4.5 — Sonnet 4.5 retires from the Claude API on 11/30, 7 days left. Check which model your app calls●SPLASH — Expo users report apps stuck on the splash screen after rolling back to an earlier update●NEW — New: Three clues to check before replying to a "stuck on the splash screen" review●2.5 ROUTE — From 12/1, Gemini 2.5 requests reroute to newer models at new rates. 8 days left
Articles/Dev Tools
⬡ Dev Tools/2026-07-11Advanced

Verifying StoreKit 2 Signed Transactions in a Cloudflare Worker

If you trust whatever the device says about its purchase state, a tampered entitlement walks right through. This walks through verifying StoreKit 2 signed transactions (JWS) in a Cloudflare Worker so you grant entitlements without trusting the client, with working code.

StoreKit 217Cloudflare Workers26Purchase VerificationJWS3Rork621

✦ Premium Article

The first time purchase logic gave me a cold feeling was in an app where I stored a "premium unlocked" flag in UserDefaults and gated features on it. In front of a jailbroken device or a proxied request, that flag guarantees nothing. The whole app could be unlocked for free, and I only noticed the shape of that hole some time after release.

Purchase decisions should ultimately rest on one question: who signed this? StoreKit 2 hands you transactions carrying Apple's signature. So you can draw a boundary where your own server verifies that signature and never trusts the device's raw claim. Here I'll build that verification on a Cloudflare Worker, piece by piece, with code you can actually run.

What "don't trust the device" really means

There are two stances for deciding purchase state. One takes the device at its word when it says "I'm a paying user." The other accepts only the "Apple-signed evidence" the device carries, and only after verifying it. The difference isn't implementation complexity — it's where you place trust.

AspectTrust the device's claimVerify the signature first
Tamper resistanceNone (rewrite the flag, get unlocked)Present (nothing passes without Apple's signature)
Source of truthThe device's local storageAn entitlement your server verified and issued
Offline behaviorAlways instant (but forgeable)Cache the verified result to stay instant
CostLowOne extra Worker

As an indie developer, you want everything to live on the device with no server at all. I did too. But the closer a feature sits to revenue, the more a single verification layer earns its keep. The nice part is that a Cloudflare Worker lets you run that signature check only when a request arrives, without keeping an always-on server around. That "a verification layer that spins up only when needed" shape fits solo operations well.

StoreKit 2's signed transactions (JWS)

In StoreKit 2, purchase results and transaction history come back as a VerificationResult. Inside sits a raw, Apple-signed string: jwsRepresentation. It's a JWS (JSON Web Signature) in compact form — header.payload.signature, three parts joined by dots.

The header carries the signing algorithm (ES256) and an x5c certificate chain. x5c is an array: the first entry is the certificate that actually signed (the leaf), followed by the intermediate, and finally Apple's root (Apple Root CA - G3). The payload holds bundleId, productId, transactionId, environment, purchase dates, and so on.

So verification decomposes into three checks. First, that the JWS signature is valid under the leaf certificate's public key. Second, that the certificate chain climbs correctly to Apple's root. Third, that the payload points at the right product in your own app. Only when all three hold can you conclude the device genuinely purchased.

✦

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
✦If you have been uneasy about trusting the device's claim of 'I'm a paying user,' you'll get a working server-side verification that grants entitlements only after checking Apple's signature
✦You'll understand how Apple's signed transactions (JWS) and their certificate chain work, and be able to write a Worker that verifies them with Web Crypto and jose
✦You'll be able to close three quiet holes at the code level: replay, environment mix-ups, and an unpinned root certificate
Secure payment via Stripe · Cancel anytime
✦

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Rork Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • ✦Copy-paste ready implementation code
  • ✦New advanced guides published daily
  • ✦$5/mo or $10 for lifetime access
View Membership →

Related Articles

⬡ Dev Tools2026-04-25
Outgrowing RevenueCat: A Self-Hosted Guide to App Store Server Notifications V2 for Rork Apps
A complete implementation guide for receiving App Store Server Notifications V2 in Cloudflare Workers without RevenueCat — covering JWS verification, idempotent state updates, user binding, and production testing for Rork apps.
⬡ Dev Tools2026-05-09
Building a Rork A/B Testing Platform with GrowthBook and PostHog from Scratch
Drop Firebase and pair GrowthBook with PostHog to ship an A/B testing stack for your Rork apps: SDK wiring, a KV-cached feature endpoint on Cloudflare Workers, sample-size math, SRM checks, and the operational pitfalls.
⬡ Dev Tools2026-04-30
Rork × AI Moderation Production Guide: Reporting, Auto-Review, and Tiered Sanctions for UGC Apps
A complete production-grade guide to layering AI moderation, reporting, and tiered sanctions into your Rork UGC app. Includes a working three-layer pipeline using OpenAI Moderation, Perspective API, and Cloudflare Workers Queues.