From 6be21bf0ff03c99f564ab8b3a5d6a4f3e79b6101 Mon Sep 17 00:00:00 2001 From: Alex Baker Date: Wed, 21 Feb 2024 17:39:23 -0800 Subject: [PATCH] Resolves https://github.com/apple/app-store-server-library-java/issues/66, add appAppleId + Production IllegalArgumentException --- README.md | 3 ++- .../apple/itunes/storekit/verification/SignedDataVerifier.java | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 81022f6f..5d5db028 100644 --- a/README.md +++ b/README.md @@ -89,8 +89,9 @@ public class ExampleVerification { new FileInputStream("/path/to/rootCA1"), new FileInputStream("/path/to/rootCA2") ); + Long appAppleId = null; // appAppleId must be provided for the Production environment - SignedDataVerifier signedPayloadVerifier = new SignedDataVerifier(rootCAs, bundleId, null, environment, true); + SignedDataVerifier signedPayloadVerifier = new SignedDataVerifier(rootCAs, bundleId, appAppleId, environment, true); String notificationPayload = "ey..."; diff --git a/src/main/java/com/apple/itunes/storekit/verification/SignedDataVerifier.java b/src/main/java/com/apple/itunes/storekit/verification/SignedDataVerifier.java index 3ccc5fe8..506aa401 100644 --- a/src/main/java/com/apple/itunes/storekit/verification/SignedDataVerifier.java +++ b/src/main/java/com/apple/itunes/storekit/verification/SignedDataVerifier.java @@ -55,6 +55,9 @@ public SignedDataVerifier(Set rootCertificates, String bundleId, Lo .withIsGetterVisibility(JsonAutoDetect.Visibility.NONE) .withSetterVisibility(JsonAutoDetect.Visibility.NONE) .withCreatorVisibility(JsonAutoDetect.Visibility.NONE)); + if (appAppleId == null && Environment.PRODUCTION.equals(environment)) { + throw new IllegalArgumentException("appAppleId is required when the environment is Production"); + } } /**