How Tierux handles purchase token security — SHA-256 hashing for deduplication, AES-256-GCM encryption for refresh operations, and zero raw token storage.
When your backend sends a purchase token to Tierux for verification, here's what happens:
Raw purchase tokens are never stored on disk. Only the hash (for dedup) and the encrypted copy (for refresh) are persisted.
Tierux uses SHA-256 hashing for deduplication. Two identical purchase tokens produce the same hash, so re-sending the same token for verification is a no-op — the existing entitlement state is returned.
// Dedup flow
purchaseToken → SHA-256(purchaseToken) → hash lookup
→ Found? Return existing entitlement state
→ Not found? Verify with store, then store hash + encrypted tokenWhen a token refresh is needed, Tierux decrypts the stored encrypted copy using AES-256-GCM. The encryption key is configured via the PURCHASE_TOKEN_ENCRYPTION_KEY environment variable (minimum 16 characters).
# Required environment variable PURCHASE_TOKEN_ENCRYPTION_KEY="your-secure-key-min-16-chars"
Each encryption operation uses a unique initialization vector (IV) for GCM, and the authentication tag ensures ciphertext integrity. Tokens are only decrypted transiently during refresh — never exposed in logs or responses.
Google Play tokens are verified via the androidpublisher.purchases.subscriptions.get API for subscriptions or androidpublisher.purchases.products.get for one-time products. Tierux extracts expiry time, auto-renew status, and cancellation state from the response.
Apple StoreKit 2 transactions arrive as JWS tokens. Tierux verifies the JWS signature against Apple's root certificates, decodes the transaction payload, and normalizes it into the same entitlement state used for Google Play.
Deep dive on Apple StoreKit 2 JWS verification and certificate chain validation.
Google Play real-time developer notification handling and entitlement state sync.
Checklist for Tierux configuration, required store-console work, REST integration, and purchase verification.
Free tier — unlimited apps, 1 paywall. No credit card, no revenue share.
Start free