Overview of Adapty.js Script Functionality

Oct 10, 2024

Notes on Adapty.js Script

General Information

  • Title: Adapty.js Script
  • Date: 2024-09-29
  • Author: chxm1023
  • Source URL: Adapty.js

Functionality Overview

The script is designed to interact with the API of Adapty for validating in-app purchases and managing subscriptions.

Rewrite Local

  • Pattern: Matches URLs for Adapty API, particularly those involved with analytics or purchase validations.
  • Script: Uses adapty.js from GitHub to handle response bodies for these URLs.

Man-In-The-Middle (MITM)

  • Hostname Intercepted: api.adapty.io

Script Details

Variables and Constants

  • User Agent and Profile ID: Extracted from request headers.
  • Current Time: Captured using Date.now().

Apps and Subscriptions

  • List of Apps:
    • SketchAR
    • Universal (TVRemote)
    • Lingvist
    • ChatAI
    • FacePlus
    • Batched
  • String Identifiers:
    • Each app has a unique identifier for subscription ID, bundle ID, and a dynamic key (dy).

Template Structures

  • PremiumTemplate: Data structure representing a lifetime subscription.
  • ReceiptTemplate: Represents purchase receipt information.

Main Processing Loop

  • Iterates through the list of apps to check if the user-agent matches any app pattern.
  • Based on the app type (dypda or dypdb), constructs subscription and receipt data.

Response Modification

  • Analytics and Purchase Handling:
    • Modifies the response data (chxm1023) for purchase validation and analytics profiles.
    • Updates attributes such as app ID, profile ID, subscriptions, and validation results.
  • Receipt Validation:
    • Constructs receipt validation data, including receipt details, status, and renewal info.

Logging

  • Outputs a message linking back to a Telegram channel.

Conclusion

The script effectively modifies responses for specific API endpoints related to in-app purchases and subscriptions through Adapty, enabling certain functionalities for app users based on their usage patterns.