{"_id":"@anyone-dev/app-store-server-library","name":"@anyone-dev/app-store-server-library","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.1":{"name":"@anyone-dev/app-store-server-library","version":"0.1.1","description":"The App Store Server Library","main":"dist/index.js","keywords":[],"author":{"name":"Apple Inc."},"license":"MIT","private":false,"repository":{"url":"git+https://github.com/anyone-dev/app-store-server-library-node.git"},"types":"dist/index.d.ts","dependencies":{"@types/jsonwebtoken":"^8.5.9","@types/jsrsasign":"^10.5.8","@types/node":"^18.11.18","@types/node-fetch":"^2.6.3","base64url":"^3.0.1","jsonwebtoken":"^9.0.0","jose":"^5.0.1","jsrsasign":"^10.7.0","node-fetch":"^2.6.7"},"devDependencies":{"@types/jest":"^29.5.0","jest":"^29.5.0","ts-jest":"^29.1.0","typedoc":"^0.23.28","typescript":"^5.0.3"},"scripts":{"build":"tsc -p .","test":"jest","build-docs":"typedoc index.ts"},"gitHead":"47cc229903c3486ef649a23ca9243fcce73fc89a","bugs":{"url":"https://github.com/anyone-dev/app-store-server-library-node/issues"},"homepage":"https://github.com/anyone-dev/app-store-server-library-node#readme","_id":"@anyone-dev/app-store-server-library@0.1.1","_nodeVersion":"18.16.0","_npmVersion":"9.5.1","dist":{"integrity":"sha512-ilEzX4Eus8essPd3GjqOcKIg9wt92rCYfwoiH/n9ZN738O5sdiGioVLKlAmCPsAeXtQd5LdI6elOu2t8eA/f1A==","shasum":"e20121dbd3c1d20f8014e2a021d6a39a5d4597cf","tarball":"https://registry.npmjs.org/@anyone-dev/app-store-server-library/-/app-store-server-library-0.1.1.tgz","fileCount":119,"unpackedSize":579924,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDzV2mZWdY7HJs07zwY9+HCsE2XjUk2CKAULrzbhFd0ewIhAPk5m7JPnhnjLFR4tjsR5pbIaCOwgtJOdLTtqYNNSp0j"}]},"_npmUser":{"name":"vlaoff","email":"vlaoff@gmail.com"},"directories":{},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/app-store-server-library_0.1.1_1698345458887_0.21954234372682158"},"_hasShrinkwrap":false}},"time":{"created":"2023-10-26T18:37:38.801Z","0.1.1":"2023-10-26T18:37:39.108Z","modified":"2023-10-26T18:37:39.417Z"},"maintainers":[{"name":"vlaoff","email":"vlaoff@gmail.com"}],"description":"The App Store Server Library","homepage":"https://github.com/anyone-dev/app-store-server-library-node#readme","keywords":[],"repository":{"url":"git+https://github.com/anyone-dev/app-store-server-library-node.git"},"author":{"name":"Apple Inc."},"bugs":{"url":"https://github.com/anyone-dev/app-store-server-library-node/issues"},"license":"MIT","readme":"# Apple App Store Server Node.js Library\nThe Node.js server library for the [App Store Server API](https://developer.apple.com/documentation/appstoreserverapi) and [App Store Server Notifications](https://developer.apple.com/documentation/appstoreservernotifications). Also available in [Swift](https://github.com/apple/app-store-server-library-swift), [Python](https://github.com/apple/app-store-server-library-python), and [Java](https://github.com/apple/app-store-server-library-java).\n\n## Table of Contents\n1. [Beta](#-beta-)\n2. [Installation](#installation)\n3. [Documentation](#documentation)\n4. [Usage](#usage)\n5. [Support](#support)\n\n## ⚠️ Beta ⚠️\n\nThis software is currently in Beta testing. Therefore, it should only be used for testing purposes, like for the Sandbox environment. API signatures may change between releases and signature verification may receive security updates. \n\n## Installation\n\n#### Requirements\n\n- Node 16+\n\n### NPM/Yarn\n```bash\n# With NPM\nnpm install @apple/app-store-server-library --save\n# With Yarn\nyarn add @apple/app-store-server-library\n```\n\n## Documentation\n\n[Documentation](https://apple.github.io/app-store-server-library-node/)\n\n[WWDC Video](https://developer.apple.com/videos/play/wwdc2023/10143/)\n## Usage\n\n### API Usage\n\n```typescript\nimport { AppStoreServerAPIClient, Environment, SendTestNotificationResponse } from \"@apple/app-store-server-library\"\n\nconst issuerId = \"99b16628-15e4-4668-972b-eeff55eeff55\"\nconst keyId = \"ABCDEFGHIJ\"\nconst bundleId = \"com.example\"\nconst filePath = \"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\"\nconst encodedKey = readFile(filePath) // Specific implementation may vary\nconst environment = Environment.SANDBOX\n\nconst client = new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment)\n\ntry {\n    const response: SendTestNotificationResponse = await client.requestTestNotification()\n    console.log(response)\n} catch (e) {\n    console.error(e)\n}\n```\n\n### Verification Usage\n\n```typescript\nimport { SignedDataVerifier } from \"@apple/app-store-server-library/dist/jwt_verification\"\n\nconst bundleId = \"com.example\"\nconst appleRootCAs: Buffer[] = loadRootCAs() // Specific implementation may vary\nconst enableOnlineChecks = true\nconst environment = Environment.SANDBOX\nconst verifier = new SignedDataVerifier(appleRootCAs, enableOnlineChecks, environment, bundleId)\n\nconst notificationPayload = \"ey...\"\nconst verifiedNotification = await verifier.verifyAndDecodeNotification()\nconsole.log(verifiedNotification)\n```\n\n### Receipt Usage\n\n```typescript\nimport { AppStoreServerAPIClient, Environment, ReceiptUtility, Order, ProductType, HistoryResponse, TransactionHistoryRequest } from \"@apple/app-store-server-library\"\n\nconst issuerId = \"99b16628-15e4-4668-972b-eeff55eeff55\"\nconst keyId = \"ABCDEFGHIJ\"\nconst bundleId = \"com.example\"\nconst filePath = \"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\"\nconst encodedKey = readFile(filePath) // Specific implementation may vary\nconst environment = Environment.SANDBOX\n\nconst client =\n        new AppStoreServerAPIClient(encodedKey, keyId, issuerId, bundleId, environment)\n\nconst appReceipt = \"MI...\"\nconst receiptUtil = new ReceiptUtility()\nconst transactionId = receiptUtil.extractTransactionIdFromAppReceipt(appReceipt)\nif (transactionId != null) {\n    const transactionHistoryRequest: TransactionHistoryRequest = {\n        sort: Order.ASCENDING,\n        revoked: false,\n        productTypes: [ProductType.AUTO_RENEWABLE]\n    }\n    let response: HistoryResponse | null = null\n    let transactions: string[] = []\n    do {\n        const revisionToken = response !== null && response.revision !== null ? response.revision : null\n        response = await client.getTransactionHistory(transactionId, revisionToken, transactionHistoryRequest)\n        if (response.signedTransactions) {\n            transactions = transactions.concat(response.signedTransactions)\n        }\n    } while (response.hasMore)\n    console.log(transactions)\n}\n```\n\n### Promotional Offer Signature Creation\n\n```typescript\nimport { PromotionalOfferSignatureCreator } from \"@apple/app-store-server-library\"\n\nconst keyId = \"ABCDEFGHIJ\"\nconst bundleId = \"com.example\"\nconst filePath = \"/path/to/key/SubscriptionKey_ABCDEFGHIJ.p8\"\nconst encodedKey = readFile(filePath) // Specific implementation may vary\n\nconst productId = \"<product_id>\"\nconst subscriptionOfferId = \"<subscription_offer_id>\"\nconst applicationUsername = \"<application_username>\"\nconst signatureCreator = new PromotionalOfferSignatureCreator(encodedKey, keyId, bundleId)\n\nconst signature = signatureCreator.createSignature(productId, subscriptionOfferId, signatureCreator)\nconsole.log(signature)\n```\n\n## Support\n\nOnly the latest major version of the library will receive updates, including security updates. Therefore, it is recommended to update to new major versions.\n","readmeFilename":"README.md"}