INNER CODE UNIT · JavaScript

generateIdempotencyKey

adeekshith/watomatic · functions/index.js:844

function generateIdempotencyKey(purchaseToken, notificationType, eventTimeMillis) {
    // Use a hash of purchaseToken to keep the key shorter (Firestore doc ID limit is 1500 bytes)
    const crypto = require('crypto');
    const tokenHash = crypto.createHash('sha256').update(purchaseToken).digest('hex').substring(0, 16);
    return `${tokenHash}_${notificationType}_${eventTimeMillis}`;
}

/**
 * Process Google Play Real-Time Developer Notifications
 * Triggered when messages are published to the Pub/Sub topic
 */
exports.processPlayStoreNotification = onMessagePublished(
    {
        topic: 'play-billing-notifications',
        region: 'us-central1',
        retry: true,
        timeoutSeconds: 60,
    },

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…