Skip to content

Commit

Permalink
Merge pull request #42 from namecare/develop
Browse files Browse the repository at this point in the history
chore: Release 0.9.0
  • Loading branch information
tikhop authored Jan 25, 2024
2 parents 3334c48 + 238a484 commit 9944b70
Show file tree
Hide file tree
Showing 20 changed files with 351 additions and 12 deletions.
7 changes: 6 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "app-store-server-library"
description = "The Rust server library for the App Store Server API and App Store Server Notifications"
version = "0.8.0"
version = "0.9.0"
repository = "https://github.com/namecare/app-store-server-library-rust"
homepage = "https://github.com/namecare/app-store-server-library-rust"
authors = ["tkhp", "namecare"]
Expand All @@ -27,8 +27,13 @@ serde_repr = "0.1.18"
uuid = { version = "1.7.0", features = ["serde", "v4"] }
chrono = { version = "0.4.32", features = ["serde"] }
base64 = "0.21.7"
asn1-rs = { version = "0.5.2", optional = true }

# Utils
thiserror = "1.0.56"

# Tools
regex = { version = "1.10.3", optional = true }

[features]
receipt_utility = ["dep:asn1-rs", "dep:regex"]
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Apple App Store Server Rust Library
The Rust 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)

## ⚠️ Beta ⚠️

This 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.

## Installation

Specify `app-store-server-library` in your project's `Cargo.toml` file, under the `[dependencies]` section:

```rust
[dependencies]
app-store-server-library = "0.8.0"
app-store-server-library = { version = "0.9.0", features = ["receipt_utility"] }
```
Check
[crates.io](https://crates.io/crates/app-store-server-library) for the latest version number.
Expand All @@ -36,13 +32,19 @@ let payload = "signed-payload";
let decoded_payload = verifier.verify_and_decode_notification(payload).unwrap();
```

### Receipt Usage
```rust
let receipt = "MI..";
let transaction_id = extract_transaction_id_from_app_receipt(receipt);
```
> Note: To extract transaction id from app/tx receipt, `receipt_utility` feature must be enabled.
### Promotional Offer Signature Creation
```rust
// .unwrap() used for example purposes only
let private_key = include_str!("../assets/SubscriptionKey_L256SYR32L.p8");
let creator = PromotionalOfferSignatureCreator::new(private_key, "L256SYR32L".to_string(), "com.test.app".to_string()).unwrap();
let signature: String = creator.create_signature("com.test.product", "com.test.offer", uuid::Uuid::new_v4().to_string().as_str(), &uuid::Uuid::new_v4(), i64::try_from(system_timestamp()).unwrap()).unwrap();

```

## Documentation
Expand Down
1 change: 1 addition & 0 deletions assets/legacyTransaction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ewoicHVyY2hhc2UtaW5mbyIgPSAiZXdvaWRISmhibk5oWTNScGIyNHRhV1FpSUQwZ0lqTXpPVGt6TXprNUlqc0tmUW89IjsKfQo=
1 change: 1 addition & 0 deletions assets/xcode-app-receipt-empty
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIHhMYHeMA8CAQACAQEEBwwFWGNvZGUwCwIBAQIBAQQDAgEAMDUCAQICAQEELQwrY29tLmV4YW1wbGUubmF0dXJlbGFiLmJhY2t5YXJkYmlyZHMuZXhhbXBsZTALAgEDAgEBBAMMATEwEAIBBAIBAQQI0bz+zwQAAAAwHAIBBQIBAQQU4nEwK24WxZhKi0PSGTYgWoXOIqMwCgIBCAIBAQQCFgAwHgIBDAIBAQQWFhQyMDIzLTEwLTE5VDAxOjE4OjU0WjAeAgEVAgEBBBYWFDQwMDEtMDEtMDFUMDA6MDA6MDBaAAAAAAAAoIIDeDCCA3QwggJcoAMCAQICAQEwDQYJKoZIhvcNAQELBQAwXzERMA8GA1UEAwwIU3RvcmVLaXQxETAPBgNVBAoMCFN0b3JlS2l0MREwDwYDVQQLDAhTdG9yZUtpdDELMAkGA1UEBhMCVVMxFzAVBgkqhkiG9w0BCQEWCFN0b3JlS2l0MB4XDTI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DVQQLDAhTdG9yZUtpdDELMAkGA1UEBhMCVVMxFzAVBgkqhkiG9w0BCQEWCFN0b3JlS2l0AgEBMA0GCWCGSAFlAwQCAQUAMA0GCSqGSIb3DQEBCwUABIIBAIjP3bmY+TrOM0e8n7PeH3OEies1+spNT1n8om4424n/NyIJ9XRyj1QGxshxh6p2BQuUQV8mkWKpHYQJqPobVEcl72ndbHSfzkH2vM57jy/2bCopLt+zWQl0QMA9iKEB3G075wgyD6lcSveZnER/4J6E9+tO6O3R2YFVziwL2UmNR1XgfOhKyNwCfSV1CyVVoSUkkZI7fJ1S6Pce2nLKM1pf+oCWr5vAySd9E4givt/YagGJF+3RHZMEcrqHnnP8kQKi99xnXcIfYyK6VMD9uBb2+4N7MCRDhoY/8+vX9I75paW0UicS6MwacJPueNxLaAboOP4nFSlYhEhZuLiZrdIAAAAAAAA=
1 change: 1 addition & 0 deletions assets/xcode-app-receipt-with-transaction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MIAGCSqGSIb3DQEHAqCAMIACAQExDzANBglghkgBZQMEAgEFADCABgkqhkiG9w0BBwGggCSABIIBdjGCAXIwDwIBAAIBAQQHDAVYY29kZTALAgEBAgEBBAMCAQAwNQIBAgIBAQQtDCtjb20uZXhhbXBsZS5uYXR1cmVsYWIuYmFja3lhcmRiaXJkcy5leGFtcGxlMAsCAQMCAQEEAwwBMTAQAgEEAgEBBAjyv/X7DwAAADAcAgEFAgEBBBQWU6vLoHZxeVVlaOg/UEG2OOKahTAKAgEIAgEBBAIWADAeAgEMAgEBBBYWFDIwMjMtMTAtMTlUMDE6NDU6NDBaMIGRAgERAgEBBIGIMYGFMAwCAgalAgEBBAMCAQEwFwICBqYCAQEEDgwMcGFzcy5wcmVtaXVtMAwCAganAgEBBAMMATAwHwICBqgCAQEEFhYUMjAyMy0xMC0xOVQwMTo0NTozNlowHwICBqwCAQEEFhYUMjAyMy0xMS0xOVQwMTo0NTozNlowDAICBrcCAQEEAwIBATAeAgEVAgEBBBY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pvemR/ICx15kyxEtP94x9eDX24WNegfOR/Y6uXmivDKtjQsuHVWg05G29nKKkSg9aHeG2ZvV6zCuCYzvbqw45taeu3QIE9hz1wUdHEXY2l3H9qWBreYHY3Uuz/rBldDBUvig/1icjXKx0e7CuRBac9TzGCAY8wggGLAgEBMGQwXzERMA8GA1UEAwwIU3RvcmVLaXQxETAPBgNVBAoMCFN0b3JlS2l0MREwDwYDVQQLDAhTdG9yZUtpdDELMAkGA1UEBhMCVVMxFzAVBgkqhkiG9w0BCQEWCFN0b3JlS2l0AgEBMA0GCWCGSAFlAwQCAQUAMA0GCSqGSIb3DQEBCwUABIIBAMNY9TpOCg59NnKdDA6Xc4D74lEaa+YwQqD/z8ajAGxpw3efoQRvx8Q1qR6IVs9BcRYGyJmsFrau19QeSIRjjqaxhV8ZbRFenWp0Yps6OCPVHw94Ej3AstAL/8WIArBM1OS6OZJESJdQz5xpwavWLGm1rU2730glMdHzHfm2h0wNp/0BKV0ugV9SRQN4RsyAMNS+rCO1mtSDI6nx8E+dEVMIa4mUg+yhXRlg6KzdzKWnr9vDtRVmhdq0ANfP+jfvncsyC+d/c3cAsXOK066hKFwYWTKaRZ7M2eXus5TcU83/aaovHyKVyKKCRnKuP7VPt9d5eWLSg/7v2ctHJtjmhqsAAAAAAAA=
1 change: 1 addition & 0 deletions assets/xcode-signed-app-transaction
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJ4NWMiOlsiTUlJQnpEQ0NBWEdnQXdJQkFnSUJBVEFLQmdncWhrak9QUVFEQWpCSU1TSXdJQVlEVlFRREV4bFRkRzl5WlV0cGRDQlVaWE4wYVc1bklHbHVJRmhqYjJSbE1TSXdJQVlEVlFRS0V4bFRkRzl5WlV0cGRDQlVaWE4wYVc1bklHbHVJRmhqYjJSbE1CNFhEVEl6TVRBeE9UQXhORFV6TmxvWERUSTBNVEF4T0RBeE5EVXpObG93U0RFaU1DQUdBMVVFQXhNWlUzUnZjbVZMYVhRZ1ZHVnpkR2x1W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3JpZ2luYWxBcHBsaWNhdGlvblZlcnNpb24iOiIxIiwib3JpZ2luYWxQdXJjaGFzZURhdGUiOi02MjEzNTc2OTYwMDAwMH0.Dpdk_VsO2MUCevwyS407alJpPc1Nq_UIP9EiDHaQBxlyi35NFnsKUVNuFNcGWrGRCCImnb4QGBKHfQC2i4sPCg
1 change: 1 addition & 0 deletions assets/xcode-signed-renewal-info
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
eyJraWQiOiJBcHBsZV9YY29kZV9LZXkiLCJ0eXAiOiJKV1QiLCJ4NWMiOlsiTUlJQnpEQ0NBWEdnQXdJQkFnSUJBVEFLQmdncWhrak9QUVFEQWpCSU1TSXdJQVlEVlFRREV4bFRkRzl5WlV0cGRDQlVaWE4wYVc1bklHbHVJRmhqYjJSbE1TSXdJQVlEVlFRS0V4bFRkRzl5WlV0cGRDQlVaWE4wYVc1bklHbHVJRmhqYjJSbE1CNFhEVEl6TVRBeE9UQXhORFV6TmxvWERUSTBNVEF4T0RBeE5EVXpObG93U0RFaU1DQUdBMVVFQXhNWlUzUnZjbVZMYVhRZ1ZHVnpkR2x1WnlCcGJpQllZMjlrWlRFaU1DQUdBMVVFQ2hNWlUzUnZjbVZMYVhRZ1ZHVnpkR2x1WnlCcGJpQllZMjlrWlRCWk1CTUdCeXFHU000OUFnRUdDQ3FHU000OUF3RUhBMElBQktYRVFnWWpDb3VQdFRzdEdyS3BZOEk1M25IN3JiREhuY0lMR25vZ1NBdWxJSTNzXC91Zk0wZzlEYzNCY3I0OTdBVWd6R1R2V3Bpd0p4cGVCMzcxTmdWK2pUREJLTUJJR0ExVWRFd0VCXC93UUlNQVlCQWY4Q0FRQXdKQVlEVlIwUkJCMHdHNEVaVTNSdmNtVkxhWFFnVkdWemRHbHVaeUJwYmlCWVkyOWtaVEFPQmdOVkhROEJBZjhFQkFNQ0I0QXdDZ1lJS29aSXpqMEVBd0lEU1FBd1JnSWhBTVp2VllKNjRDRitoMmZtc213dnpBY2VQcklEMTN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OjEsInF1YW50aXR5IjoxLCJ0cmFuc2FjdGlvbklkIjoiMCIsInR5cGUiOiJBdXRvLVJlbmV3YWJsZSBTdWJzY3JpcHRpb24iLCJ0cmFuc2FjdGlvblJlYXNvbiI6IlBVUkNIQVNFIiwicHJvZHVjdElkIjoicGFzcy5wcmVtaXVtIiwiZXhwaXJlc0RhdGUiOjE3MDAzNTgzMzYwNDkuNzI5NywiZW52aXJvbm1lbnQiOiJYY29kZSIsInN0b3JlZnJvbnRJZCI6IjE0MzQ0MSIsIm9yaWdpbmFsVHJhbnNhY3Rpb25JZCI6IjAiLCJidW5kbGVJZCI6ImNvbS5leGFtcGxlLm5hdHVyZWxhYi5iYWNreWFyZGJpcmRzLmV4YW1wbGUiLCJkZXZpY2VWZXJpZmljYXRpb25Ob25jZSI6IjdlZGVhODdkLTk4ZjAtNDJkMC05NjgyLTQ5Y2E4MTAyMmY3MyIsIndlYk9yZGVyTGluZUl0ZW1JZCI6IjAiLCJzdG9yZWZyb250IjoiVVNBIn0.rkJYnvujStteRkMHhoIR2ThmNFnyKcx5XxIakXYdh-1oKtEVEU5zQAiONaLDpBDO5JhLLrTbfp7LS5tMiqmgHw
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
pub mod chain_verifier;
pub mod primitives;
pub mod promotional_offer_signature_creator;
#[cfg(feature="receipt_utility")]
pub mod receipt_utility;
pub mod signed_data_verifier;
mod utils;
3 changes: 3 additions & 0 deletions src/primitives/error_payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ use serde::{Deserialize, Serialize};

#[derive(Debug, Clone, Deserialize, Serialize, Hash)]
pub struct ErrorPayload {
#[serde(rename = "errorCode")]
pub error_code: Option<i64>,

#[serde(rename = "errorMessage")]
pub error_message: Option<String>,
}
3 changes: 3 additions & 0 deletions src/primitives/extend_renewal_date_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ pub struct ExtendRenewalDateRequest {
/// [extendByDays](https://developer.apple.com/documentation/appstoreserverapi/extendbydays)
///
/// maximum: 90
#[serde(rename = "extendByDays")]
pub extend_by_days: Option<i32>,

/// The reason code for the subscription date extension.
///
/// [extendReasonCode](https://developer.apple.com/documentation/appstoreserverapi/extendreasoncode)
#[serde(rename = "extendReasonCode")]
pub extend_reason_code: Option<ExtendReasonCode>,

/// A string that contains a unique identifier you provide to track each subscription-renewal-date extension request.
///
/// [requestIdentifier](https://developer.apple.com/documentation/appstoreserverapi/requestidentifier)
#[serde(rename = "requestIdentifier")]
pub request_identifier: Option<String>,
}
4 changes: 4 additions & 0 deletions src/primitives/extend_renewal_date_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ pub struct ExtendRenewalDateResponse {
/// The original transaction identifier of a purchase.
///
/// [originalTransactionId](https://developer.apple.com/documentation/appstoreserverapi/originaltransactionid)
#[serde(rename = "originalTransactionId")]
pub original_transaction_id: Option<String>,

/// The unique identifier of subscription-purchase events across devices, including renewals.
///
/// [webOrderLineItemId](https://developer.apple.com/documentation/appstoreserverapi/weborderlineitemid)
#[serde(rename = "webOrderLineItemId")]
pub web_order_line_item_id: Option<String>,

/// A Boolean value that indicates whether the subscription-renewal-date extension succeeded.
///
/// [success](https://developer.apple.com/documentation/appstoreserverapi/success)
#[serde(rename = "success")]
pub success: Option<bool>,

/// The new subscription expiration date for a subscription-renewal extension.
///
/// [effectiveDate](https://developer.apple.com/documentation/appstoreserverapi/effectivedate)
#[serde(rename = "effectiveDate")]
pub effective_date: Option<DateTime<Utc>>,
}
10 changes: 8 additions & 2 deletions src/primitives/history_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,36 @@ pub struct HistoryResponse {
/// A token you use in a query to request the next set of transactions for the customer.
///
/// [revision](https://developer.apple.com/documentation/appstoreserverapi/revision)
#[serde(rename = "revision")]
pub revision: Option<String>,

/// A Boolean value indicating whether the App Store has more transaction data.
///
/// [hasMore](https://developer.apple.com/documentation/appstoreserverapi/hasmore)
#[serde(rename = "hasMore")]
pub has_more: Option<bool>,

/// The bundle identifier of an app.
///
/// [bundle_id](https://developer.apple.com/documentation/appstoreserverapi/bundleid)
/// [bundleId](https://developer.apple.com/documentation/appstoreserverapi/bundleid)
#[serde(rename = "bundleId")]
pub bundle_id: Option<String>,

/// The unique identifier of an app in the App Store.
///
/// [app_apple_id](https://developer.apple.com/documentation/appstoreservernotifications/appappleid)
/// [appAppleId](https://developer.apple.com/documentation/appstoreservernotifications/appappleid)
#[serde(rename = "appAppleId")]
pub app_apple_id: Option<i64>,

/// The server environment in which you’re making the request, whether sandbox or production.
///
/// [environment](https://developer.apple.com/documentation/appstoreserverapi/environment)
#[serde(rename = "environment")]
pub environment: Option<Environment>,

/// An array of in-app purchase transactions for the customer, signed by Apple, in JSON Web Signature format.
///
/// [JWSTransaction](https://developer.apple.com/documentation/appstoreserverapi/jwstransaction)
#[serde(rename = "signedTransactions")]
pub signed_transactions: Option<Vec<String>>,
}
4 changes: 4 additions & 0 deletions src/primitives/last_transactions_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,24 @@ pub struct LastTransactionsItem {
/// The status of the auto-renewable subscription.
///
/// [status](https://developer.apple.com/documentation/appstoreserverapi/status)
#[serde(rename = "status")]
pub status: Option<Status>,

/// The original transaction identifier of a purchase.
///
/// [originalTransactionId](https://developer.apple.com/documentation/appstoreserverapi/originaltransactionid)
#[serde(rename = "originalTransactionId")]
pub original_transaction_id: Option<String>,

/// Transaction information signed by the App Store, in JSON Web Signature (JWS) format.
///
/// [JWSTransaction](https://developer.apple.com/documentation/appstoreserverapi/jwstransaction)
#[serde(rename = "signedTransactionInfo")]
pub signed_transaction_info: Option<String>,

/// Subscription renewal information, signed by the App Store, in JSON Web Signature (JWS) format.
///
/// [JWSRenewalInfo](https://developer.apple.com/documentation/appstoreserverapi/jwsrenewalinfo)
#[serde(rename = "signedRenewalInfo")]
pub signed_renewal_info: Option<String>,
}
7 changes: 6 additions & 1 deletion src/primitives/send_attempt_item.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
use crate::primitives::send_attempt_result::SendAttemptResult;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};

use serde_with::formats::Flexible;
use serde_with::TimestampMilliSeconds;
/// The success or error information and the date the App Store server records when it attempts to send a server notification to your server.
///
/// [sendAttemptItem](https://developer.apple.com/documentation/appstoreserverapi/sendattemptitem)
#[serde_with::serde_as]
#[derive(Debug, Clone, Deserialize, Serialize, Hash)]
pub struct SendAttemptItem {
/// The date the App Store server attempts to send a notification.
///
/// [attemptDate](https://developer.apple.com/documentation/appstoreservernotifications/attemptdate)
#[serde(rename = "attemptDate")]
#[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
pub attempt_date: Option<DateTime<Utc>>,

/// The success or error information the App Store server records when it attempts to send an App Store server notification to your server.
///
/// [sendAttemptResult](https://developer.apple.com/documentation/appstoreserverapi/sendattemptresult)
#[serde(rename = "sendAttemptResult")]
pub send_attempt_result: Option<SendAttemptResult>,
}
5 changes: 5 additions & 0 deletions src/primitives/transaction_history_request.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
use crate::primitives::in_app_ownership_type::InAppOwnershipType;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use serde_with::formats::Flexible;
use serde_with::TimestampMilliSeconds;

#[serde_with::serde_as]
#[derive(Debug, Clone, Deserialize, Serialize, Hash, PartialEq, Eq)]
pub struct TransactionHistoryRequest {
/// An optional start date of the timespan for the transaction history records you’re requesting.
#[serde(rename = "startDate")]
#[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
pub start_date: Option<DateTime<Utc>>,

/// An optional end date of the timespan for the transaction history records you’re requesting.
#[serde(rename = "endDate")]
#[serde_as(as = "Option<TimestampMilliSeconds<String, Flexible>>")]
pub end_date: Option<DateTime<Utc>>,

/// An optional filter that indicates the product identifier to include in the transaction history.
Expand Down
Loading

0 comments on commit 9944b70

Please sign in to comment.