Skip to content

Commit

Permalink
Adding support for Xcode and LocalTesting environments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexanderjordanbaker committed Nov 3, 2023
1 parent d18570d commit 00d3c2c
Show file tree
Hide file tree
Showing 38 changed files with 456 additions and 3 deletions.
2 changes: 2 additions & 0 deletions appstoreserverlibrary/models/Environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ class Environment(Enum):
"""
SANDBOX = "Sandbox"
PRODUCTION = "Production"
XCODE = "Xcode"
LOCAL_TESTING = "LocalTesting"
25 changes: 23 additions & 2 deletions appstoreserverlibrary/receipt_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def extract_transaction_id_from_app_receipt(self, app_receipt: str) -> Optional[
:param appReceipt: The unmodified app receipt
:return: A transaction id from the array of in-app purchases, null if the receipt contains no in-app purchases
"""
decoder = asn1.Decoder()
decoder = IndefiniteFormAwareDecoder()
decoder.start(b64decode(app_receipt, validate=True))
tag = decoder.peek()
if tag.typ != asn1.Types.Constructed or tag.nr != asn1.Numbers.Sequence:
Expand All @@ -39,6 +39,11 @@ def extract_transaction_id_from_app_receipt(self, app_receipt: str) -> Optional[
decoder.read()
decoder.enter()
tag, value = decoder.read()
# Xcode uses nested OctetStrings, we extract the inner string in this case
if tag.typ == asn1.Types.Constructed and tag.nr == asn1.Numbers.OctetString:
inner_decoder = asn1.Decoder()
inner_decoder.start(value)
tag, value = inner_decoder.read()
if tag.typ != asn1.Types.Primitive or tag.nr != asn1.Numbers.OctetString:
raise ValueError()
decoder = asn1.Decoder()
Expand Down Expand Up @@ -92,4 +97,20 @@ def extract_transaction_id_from_transaction_receipt(self, transaction_receipt: s
inner_matching_result = re.search('"transaction-id"\s+=\s+"([a-zA-Z0-9+/=]+)";', decoded_inner_level)
if inner_matching_result:
return inner_matching_result.group(1)
return None
return None

class IndefiniteFormAwareDecoder(asn1.Decoder):
def _read_length(self) -> int:
index, input_data = self.m_stack[-1]
try:
byte = input_data[index]
except IndexError:
raise asn1.Error('Premature end of input.')
if byte == 0x80:
# Xcode receipts use indefinite length encoding, not supported by all parsers
# Indefinite length encoding is only entered, but never left during parsing for receipts
# We therefore round up indefinite length encoding to be the remaining length
self._read_byte()
index, input_data = self.m_stack[-1]
return len(input_data) - index
return super()._read_length()
6 changes: 5 additions & 1 deletion appstoreserverlibrary/signed_data_verifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ def verify_and_decode_app_transaction(self, signed_app_transaction: str) -> AppT

def _decode_signed_object(self, signed_obj: str) -> dict:
try:
decoded_jwt = jwt.decode(signed_obj, options={"verify_signature": False})
if self._environment == Environment.XCODE or self._environment == Environment.LOCAL_TESTING:
# Data is not signed by the App Store, and verification should be skipped
# The environment MUST be checked in the public method calling this
return decoded_jwt
unverified_headers: dict = jwt.get_unverified_header(signed_obj)
x5c_header: List[str] = unverified_headers.get("x5c")
if x5c_header is None or len(x5c_header) == 0:
raise Exception("x5c claim was empty")
algorithm_header: str = unverified_headers.get("alg")
if algorithm_header is None or "ES256" != algorithm_header:
raise Exception("Algorithm was not ES256")
decoded_jwt = jwt.decode(signed_obj, options={"verify_signature": False})
signed_date = decoded_jwt.get('signedDate') if decoded_jwt.get('signedDate') is not None else decoded_jwt.get('receiptCreationDate')
effective_date = time.time() if self._enable_online_checks or signed_date is None else int(signed_date) // 1000
signing_key = self._chain_verifier.verify_chain(x5c_header, self._enable_online_checks, effective_date)
Expand Down
Binary file added tests/resources/certs/testCA.der
Binary file not shown.
5 changes: 5 additions & 0 deletions tests/resources/certs/testSigningKey.p8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgSpP55ELdXswj9JRZ
APRwtTfS4CNRqpKIs+28rNHiPAqhRANCAASs8nLES7b+goKslppNVOurf0MonZdw
3pb6TxS8Z/5j+UNY1sWK1ChxpuwNS9I3R50cfdQo/lA9PPhw6XIg8ytd
-----END PRIVATE KEY-----
1 change: 1 addition & 0 deletions tests/resources/mock_signed_data/legacyTransaction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ewoicHVyY2hhc2UtaW5mbyIgPSAiZXdvaWRISmhibk5oWTNScGIyNHRhV1FpSUQwZ0lqTXpPVGt6TXprNUlqc0tmUW89IjsKfQo=
1 change: 1 addition & 0 deletions tests/resources/mock_signed_data/missingX5CHeaderClaim
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJ0eXAiOiJKV1QiLCJhbGciOiJFUzI1NiIsIng1Y3dyb25nIjpbIk1JSUJvRENDQVVhZ0F3SUJBZ0lCRERBS0JnZ3Foa2pPUFFRREF6QkZNUXN3Q1FZRFZRUUdFd0pWVXpFTE1Ba0dBMVVFQ0F3Q1EwRXhFakFRQmdOVkJBY01DVU4xY0dWeWRHbHViekVWTUJNR0ExVUVDZ3dNU1c1MFpYSnRaV1JwWVhSbE1CNFhEVEl6TURFd05USXhNekV6TkZvWERUTXpNREV3TVRJeE16RXpORm93UFRFTE1Ba0dBMVVFQmhNQ1ZWTXhDekFKQmdOVkJBZ01Ba05CTVJJd0VBWURWUVFIREFsRGRYQmxjblJwYm04eERUQUxCZ05WQkFvTUJFeGxZV1l3V1RBVEJnY3Foa2pPUFFJQkJnZ3Foa2pPUFFNQkJ3TkNBQVRpdFlIRWFZVnVjOGc5QWpUT3dFck12R3lQeWtQYStwdXZUSThoSlRIWlpETEdhczJxWDErRXJ4Z1FUSmdWWHY3Nm5tTGhoUkpIK2oyNUFpQUk4aUdzb3k4d0xUQUpCZ05WSFJNRUFqQUFNQTRHQTFVZER3RUIvd1FFQXdJSGdEQVFCZ29xaGtpRzkyTmtCZ3NCQkFJRkFEQUtCZ2dxaGtqT1BRUURBd05JQURCRkFpQlg0YytUMEZwNW5KNVFSQ2xSZnU1UFNCeVJ2TlB0dWFUc2swdlBCM1dBSUFJaEFOZ2FhdUFqL1lQOXMwQWtFaHlKaHhR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hV1p2Y201cFlURVNNQkFHQTFVRUJ3d0pRM1Z3WlhKMGFXNXZNRmt3RXdZSEtvWkl6ajBDQVFZSUtvWkl6ajBEQVFjRFFnQUVjKy9CbCtnb3NwbzZ0ZjlaN2lvNXRkS2RybE4xWWRWbnFFaEVEWERTaHpkQUpQUWlqYW1YSU1IZjh4V1dUYTF6Z29ZVHhPS3BidUp0RHBsejFYcmlUYU1nTUI0d0RBWURWUjBUQkFVd0F3RUIvekFPQmdOVkhROEJBZjhFQkFNQ0FRWXdDZ1lJS29aSXpqMEVBd01EUndBd1JBSWdlbVdRWG5NQWRUYWQySkRKV25nOVU0dUJCTDVtQTdXSTA1SDdvSDdjNmlRQ0lIaVJxTWpOZnpVQXlpdTloNnJPVS9LK2lUUjBJLzNZL05TV3NYSFgrYWNjIl19.eyJkYXRhIjp7ImJ1bmRsZUlkIjoiY29tLmV4YW1wbGUifSwibm90aWZpY2F0aW9uVVVJRCI6IjlhZDU2YmQyLTBiYzYtNDJlMC1hZjI0LWZkOTk2ZDg3YTFlNiIsIm5vdGlmaWNhdGlvblR5cGUiOiJURVNUIn0.1TFhjDR4WwQJNgizVGYXz3WE3ajxTdH1wKLQQ71MtrkadSxxOo3yPo_6L9Z03unIU7YK-NRNzSIb5bh5WqTprQ
1 change: 1 addition & 0 deletions tests/resources/mock_signed_data/renewalInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJ4NWMiOlsiTUlJQm9EQ0NBVWFnQXdJQkFnSUJEREFLQmdncWhrak9QUVFEQXpCRk1Rc3dDUVlEVlFRR0V3SlZVekVMTUFrR0ExVUVDQXdDUTBFeEVqQVFCZ05WQkFjTUNVTjFjR1Z5ZEdsdWJ6RVZNQk1HQTFVRUNnd01TVzUwWlhKdFpXUnBZWFJsTUI0WERUSXpNREV3TlRJeE16RXpORm9YRFRNek1ERXdNVEl4TXpFek5Gb3dQVEVMTUFrR0ExVUVCaE1DVlZNeEN6QUpCZ05WQkFnTUFrTkJNUkl3RUFZ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orRlBBaUIzNW53azVxMHpjSXBlZnZZSjBNVS95R0dIU1dlejBicTBwRFlVTy9ubUR3PT0iXSwidHlwIjoiSldUIiwiYWxnIjoiRVMyNTYifQ.eyJkYXRhIjp7ImFwcEFwcGxlSWQiOjEyMzQsImVudmlyb25tZW50IjoiU2FuZGJveCIsImJ1bmRsZUlkIjoiY29tLmV4YW1wbGUifSwibm90aWZpY2F0aW9uVVVJRCI6IjlhZDU2YmQyLTBiYzYtNDJlMC1hZjI0LWZkOTk2ZDg3YTFlNiIsInNpZ25lZERhdGUiOjE2ODEzMTQzMjQwMDAsIm5vdGlmaWNhdGlvblR5cGUiOiJURVNUIn0.VVXYwuNm2Y3XsOUva-BozqatRCsDuykA7xIe_CCRw6aIAAxJ1nb2sw871jfZ6dcgNhUuhoZ93hfbc1v_5zB7Og
1 change: 1 addition & 0 deletions tests/resources/mock_signed_data/transactionInfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJ4NWMiOlsiTUlJQm9EQ0NBVWFnQXdJQkFnSUJDekFLQmdncWhrak9QUVFEQWpCTk1Rc3dDUVlEVlFRR0V3SlZVekVUTUJFR0ExVUVDQXdLUTJGc2FXWnZjbTVwWVRFU01CQUdBMVVFQnd3SlEzVndaWEowYVc1dk1SVXdFd1lEVlFRS0RBeEpiblJsY20xbFpHbGhkR1V3SGhjTk1qTXdNVEEwTVRZek56TXhXaGNOTXpJeE1qTXhNVFl6TnpNeFdqQkZNUXN3Q1FZRFZRUUdFd0pWVXpFVE1CRUdBMVVFQ0F3S1EyRnNhV1p2Y201cFlURVNNQkFHQTFVRUJ3d0pRM1Z3WlhKMGFXNXZNUTB3Q3dZRFZRUUtEQVJNWldGbU1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXpqMERBUWNEUWdBRTRyV0J4R21GYm5QSVBRSTB6c0JLekx4c2o4cEQydnFicjB5UElTVXgyV1F5eG1yTnFsOWZoSzhZRUV5WUZWNysrcDVpNFlVU1Ivbzl1UUlnQ1BJa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d0tRMkZzYVdadmNtNXBZVEVTTUJBR0ExVUVCd3dKUTNWd1pYSjBhVzV2TUI0WERUSXpNREV3TkRFMk1qQXpNbG9YRFRNek1ERXdNVEUyTWpBek1sb3dOakVMTUFrR0ExVUVCaE1DVlZNeEV6QVJCZ05WQkFnTUNrTmhiR2xtYjNKdWFXRXhFakFRQmdOVkJBY01DVU4xY0dWeWRHbHViekJaTUJNR0J5cUdTTTQ5QWdFR0NDcUdTTTQ5QXdFSEEwSUFCSFB2d1pmb0tMS2FPclgvV2U0cU9iWFNuYTVUZFdIVlo2aElSQTF3MG9jM1FDVDBJbzJwbHlEQjMvTVZsazJ0YzRLR0U4VGlxVzdpYlE2WmM5VjY0azB3Q2dZSUtvWkl6ajBFQXdNRFNBQXdSUUloQU1USGhXdGJBUU4waFN4SVhjUDRDS3JEQ0gvZ3N4V3B4NmpUWkxUZVorRlBBaUIzNW53azVxMHpjSXBlZnZZSjBNVS95R0dIU1dlejBicTBwRFlVTy9ubUR3PT0iXSwidHlwIjoiSldUIiwiYWxnIjoiRVMyNTYifQ.eyJlbnZpcm9ubWVudCI6IlNhbmRib3giLCJidW5kbGVJZCI6ImNvbS5leGFtcGxlIiwic2lnbmVkRGF0ZSI6MTY3Mjk1NjE1NDAwMH0.PnHWpeIJZ8f2Q218NSGLo_aR0IBEJvC6PxmxKXh-qfYTrZccx2suGl223OSNAX78e4Ylf2yJCG2N-FfU-NIhZQ
1 change: 1 addition & 0 deletions tests/resources/mock_signed_data/wrongBundleId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJ4NWMiOlsiTUlJQm9EQ0NBVWFnQXdJQkFnSUJEREFLQmdncWhrak9QUVFEQXpCRk1Rc3dDUVlEVlFRR0V3SlZVekVMTUFrR0ExVUVDQXdDUTBFeEVqQVFCZ05WQkFjTUNVTjFjR1Z5ZEdsdWJ6RVZNQk1HQTFVRUNnd01TVzUwWlhKdFpXUnBZWFJsTUI0WERUSXpNREV3TlRJeE16RXpORm9YRFR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TBiYzYtNDJlMC1hZjI0LWZkOTk2ZDg3YTFlNiIsIm5vdGlmaWNhdGlvblR5cGUiOiJURVNUIn0.WWE31hTB_mcv2O_lf-xI-MNY3d8txc0MzpqFx4QnYDfFIxB95Lo2Fm3r46YSjLLdL7xCWdEJrJP5bHgRCejAGg
4 changes: 4 additions & 0 deletions tests/resources/models/apiException.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errorCode": 5000000,
"errorMessage": "An unknown error occurred."
}
4 changes: 4 additions & 0 deletions tests/resources/models/apiTooManyRequestsException.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errorCode": 4290000,
"errorMessage": "Rate limit exceeded."
}
4 changes: 4 additions & 0 deletions tests/resources/models/apiUnknownError.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"errorCode": 9990000,
"errorMessage": "Testing error."
}
13 changes: 13 additions & 0 deletions tests/resources/models/appTransaction.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"receiptType": "LocalTesting",
"appAppleId": 531412,
"bundleId": "com.example",
"applicationVersion": "1.2.3",
"versionExternalIdentifier": 512,
"receiptCreationDate": 1698148900000,
"originalPurchaseDate": 1698148800000,
"originalApplicationVersion": "1.1.2",
"deviceVerification": "device_verification_value",
"deviceVerificationNonce": "48ccfa42-7431-4f22-9908-7e88983e105a",
"preorderDate": 1698148700000
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"requestIdentifier": "758883e8-151b-47b7-abd0-60c4d804c2f5"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"originalTransactionId": "2312412",
"webOrderLineItemId": "9993",
"success": true,
"effectiveDate": 1698148900000
}
35 changes: 35 additions & 0 deletions tests/resources/models/getAllSubscriptionStatusesResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"environment": "LocalTesting",
"bundleId": "com.example",
"appAppleId": 5454545,
"data": [
{
"subscriptionGroupIdentifier": "sub_group_one",
"lastTransactions": [
{
"status": 1,
"originalTransactionId": "3749183",
"signedTransactionInfo": "signed_transaction_one",
"signedRenewalInfo": "signed_renewal_one"
},
{
"status": 5,
"originalTransactionId": "5314314134",
"signedTransactionInfo": "signed_transaction_two",
"signedRenewalInfo": "signed_renewal_two"
}
]
},
{
"subscriptionGroupIdentifier": "sub_group_two",
"lastTransactions": [
{
"status": 2,
"originalTransactionId": "3413453",
"signedTransactionInfo": "signed_transaction_three",
"signedRenewalInfo": "signed_renewal_three"
}
]
}
]
}
27 changes: 27 additions & 0 deletions tests/resources/models/getNotificationHistoryResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"paginationToken": "57715481-805a-4283-8499-1c19b5d6b20a",
"hasMore": true,
"notificationHistory": [
{
"sendAttempts": [
{
"attemptDate": 1698148900000,
"sendAttemptResult": "NO_RESPONSE"
}, {
"attemptDate": 1698148950000,
"sendAttemptResult": "SUCCESS"
}
],
"signedPayload": "signed_payload_one"
},
{
"sendAttempts": [
{
"attemptDate": 1698148800000,
"sendAttemptResult": "CIRCULAR_REDIRECT"
}
],
"signedPayload": "signed_payload_two"
}
]
}
8 changes: 8 additions & 0 deletions tests/resources/models/getRefundHistoryResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"signedTransactions": [
"signed_transaction_one",
"signed_transaction_two"
],
"revision": "revision_output",
"hasMore": true
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"requestIdentifier": "20fba8a0-2b80-4a7d-a17f-85c1854727f8",
"complete": true,
"completeDate": 1698148900000,
"succeededCount": 30,
"failedCount": 2
}
12 changes: 12 additions & 0 deletions tests/resources/models/getTestNotificationStatusResponse.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"signedPayload": "signed_payload",
"sendAttempts": [
{
"attemptDate": 1698148900000,
"sendAttemptResult": "NO_RESPONSE"
}, {
"attemptDate": 1698148950000,
"sendAttemptResult": "SUCCESS"
}
]
}
Loading

0 comments on commit 00d3c2c

Please sign in to comment.