
Security Fundamentals
Obfuscation 101: Unmasking the Tricks Behind Malicious Code
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
app-store-server-api
Advanced tools
A Node.js client for the App Store Server API.
Node.js 15.6.0 or newer
npm install app-store-server-api
To get started, you must obtain the following:
A note on the issuer ID: Apple's documentation currently has incorrect instructions on how to obtain this. To get your issuer ID, you must create an API key for App Store Connect (not the App Store Server API). Only after creating your first API key will the issuer ID appear.
const { AppStoreServerAPI, Environment } = require("app-store-server-api")
// or
import { AppStoreServerAPI, Environment } from "app-store-server-api"
const KEY =
`-----BEGIN PRIVATE KEY-----
MHcCAQEEIPWH5lyoG7Wbzv71ntF6jNvFwwJLKYmPWN/KBD4qJfMcoAoGCCqGSM49
AwEHoUQDQgAEMOlUa/hmyAPU/RUBds6xzDO8QNrTFhFwzm8E4wxDnSAx8R9WOMnD
cVGdtnbLFIdLk8g4S7oAfV/gGILKuc+Vqw==
-----END PRIVATE KEY-----`
const KEY_ID = "ABCD123456"
const ISSUER_ID = "91fa5999-7b54-4363-a2a8-265363fa6cbe"
const APP_BUNDLE_ID = "com.yourcompany.app"
const api = new AppStoreServerAPI(
KEY, KEY_ID, ISSUER_ID, APP_BUNDLE_ID, Environment.Production
)
const response = await api.getTransactionHistory(originalTransactionId)
// Decoding not only reveals the contents of the transactions but also verifies that they were signed by Apple.
const transactions = await api.decodeTransactions(response.signedTransactions)
for (let transaction of transactions) {
// Do something with your transactions...
}
// The response contains at most 20 entries. You can check to see if there are more.
if (response.hasMore) {
const nextResponse = await api.getTransactionHistory(originalTransactionId, response.revision)
// ...
}
const response = await api.getSubscriptionStatuses(originalTransactionId)
// Find the transaction you're looking for
const item = response.data[0].lastTransactions.find(item => item.originalTransactionId === originalTransactionId)
const transactionInfo = await api.decodeTransaction(item.signedTransactionInfo)
const renewalInfo = await api.decodeRenewalInfo(item.signedRenewalInfo)
// Import the status type
import { OrderLookupStatus } from "app-store-server-api"
const response = await api.lookupOrder(orderId)
if (response.orderLookupStatus === OrderLookupStatus.Valid) {
const transactions = await api.decodeTransactions(response.signedTransactions)
/// ...
}
While not exactly part of the App Store Server API, App Store Server Notifications (version 2) is closely related and uses some of the same types and encoding format as the API. For that reason this package includes a function to help you decode notifications (which will also verify their signature).
import { decodeNotificationPayload } from "app-store-server-api"
// signedPayload is the body sent by Apple
const payload = await decodeNotificationPayload(signedPayload)
// You might want to check that the bundle ID matches that of your app
if (payload.data.bundleId === APP_BUNDLE_ID) {
// Handle the notification...
}
WWDC videos:
MIT
FAQs
A client for the App Store Server API
The npm package app-store-server-api receives a total of 7,856 weekly downloads. As such, app-store-server-api popularity was classified as popular.
We found that app-store-server-api demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security Fundamentals
Attackers use obfuscation to hide malware in open source packages. Learn how to spot these techniques across npm, PyPI, Maven, and more.
Security News
Join Socket for exclusive networking events, rooftop gatherings, and one-on-one meetings during BSidesSF and RSA 2025 in San Francisco.
Security News
Biome's v2.0 beta introduces custom plugins, domain-specific linting, and type-aware rules while laying groundwork for HTML support and embedded language features in 2025.