Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
macos:
name: macOS (Build & Test)
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: swift build -v
- name: Test
run: swift test -v

ios:
name: iOS (Build & Test)
runs-on: macos-26
steps:
- uses: actions/checkout@v4
- name: List available simulators
run: |
xcrun simctl list devices
xcodebuild -showsdks
- name: Build
run: xcodebuild build -scheme TPInAppReceipt -destination 'platform=iOS Simulator,OS=latest,name=iPhone 17' -skipPackagePluginValidation SWIFT_STRICT_CONCURRENCY=targeted
- name: Test
run: xcodebuild test -scheme TPInAppReceipt -destination 'platform=iOS Simulator,OS=latest,name=iPhone 17' -skipPackagePluginValidation SWIFT_STRICT_CONCURRENCY=targeted

linux:
name: Linux (Build & Test)
runs-on: ubuntu-latest
container: swift:6.0
steps:
- uses: actions/checkout@v4

- name: Show Swift & OS info
run: |
swift --version
uname -a

- name: Restore swift package cache
uses: actions/cache@v4
with:
path: |
.build
.swiftpm
key: ${{ runner.os }}-swift-${{ hashFiles('**/Package.resolved') }}

- name: Resolve Packages
run: swift package resolve -v

- name: Build
run: swift build -v

- name: Test
run: swift test -v
18 changes: 0 additions & 18 deletions .github/workflows/swift.yml

This file was deleted.

85 changes: 12 additions & 73 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,74 +1,13 @@
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## Build generated
build/
DerivedData/
Packages/
iOS Example/ViewController.swift

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/

## Other
*.moved-aside
*.xcuserstate

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots
fastlane/test_output

# AppCode
.idea

TPInAppReceiptTests/MyDevice.swift

.swiftpm/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Package.resolved
.swiftpm
/out
.claude
4 changes: 4 additions & 0 deletions .spi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
version: 1
builder:
configs:
- documentation_targets: [TPInAppReceipt]
58 changes: 58 additions & 0 deletions .swift-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"fileScopedDeclarationPrivacy" : {
"accessLevel" : "private"
},
"indentation" : {
"spaces" : 4
},
"indentConditionalCompilationBlocks" : false,
"indentSwitchCaseLabels" : false,
"lineBreakAroundMultilineExpressionChainComponents" : false,
"lineBreakBeforeControlFlowKeywords" : false,
"lineBreakBeforeEachArgument" : true,
"lineBreakBeforeEachGenericRequirement" : true,
"lineLength" : 120,
"maximumBlankLines" : 1,
"prioritizeKeepingFunctionOutputTogether" : true,
"respectsExistingLineBreaks" : true,
"rules" : {
"AllPublicDeclarationsHaveDocumentation" : false,
"AlwaysUseLowerCamelCase" : false,
"AmbiguousTrailingClosureOverload" : true,
"BeginDocumentationCommentWithOneLineSummary" : false,
"DoNotUseSemicolons" : true,
"DontRepeatTypeInStaticProperties" : true,
"FileScopedDeclarationPrivacy" : true,
"FullyIndirectEnum" : true,
"GroupNumericLiterals" : true,
"IdentifiersMustBeASCII" : true,
"NeverForceUnwrap" : false,
"NeverUseForceTry" : false,
"NeverUseImplicitlyUnwrappedOptionals" : false,
"NoAccessLevelOnExtensionDeclaration" : true,
"NoAssignmentInExpressions" : true,
"NoBlockComments" : true,
"NoCasesWithOnlyFallthrough" : true,
"NoEmptyTrailingClosureParentheses" : true,
"NoLabelsInCasePatterns" : false,
"NoLeadingUnderscores" : false,
"NoParensAroundConditions" : true,
"NoVoidReturnOnFunctionSignature" : true,
"OneCasePerLine" : true,
"OneVariableDeclarationPerLine" : true,
"OnlyOneTrailingClosureArgument" : true,
"OrderedImports" : false,
"ReturnVoidInsteadOfEmptyTuple" : true,
"UseEarlyExits" : true,
"UseLetInEveryBoundCaseVariable" : false,
"UseShorthandTypeNames" : true,
"UseSingleLinePropertyGetter" : false,
"UseSynthesizedInitializer" : false,
"UseTripleSlashForDocumentationComments" : true,
"UseWhereClausesInForLoops" : false,
"ValidateDocumentationComments" : false
},
"spacesAroundRangeFormationOperators" : false,
"tabWidth" : 4,
"version" : 1
}
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Changelog

## 4.0.0

### Breaking Changes

- `InAppReceipt` class replaced by `AppReceipt` typealias over `ContentInfo<SignedData<InAppReceiptPayload>>`
- Sync validation (`try receipt.verify()`) replaced by async (`await receipt.validate()`)
- Error types renamed: `IARError` → `AppReceiptError`, `ReceiptValidatorError`
- `originalAppVersion` is now `String?` (was `String`)
- `ageRating` is now `String?` (was `String`)
- Minimum platforms raised: iOS 13+, macOS 10.15+, tvOS 13+
- Swift tools version: 6.0
- Removed Objective-C support
- Removed CocoaPods support

### New

- Full PKCS#7 structure: `ContentInfo`, `SignedData`, `EncapsulatedContentInfo`, `SignerInfo`, `AlgorithmIdentifier`, etc.
- Composable validation via `@VerifierBuilder` and `ReceiptValidator`
- X.509 certificate chain verification using swift-certificates
- Signature verification using swift-crypto
- New receipt fields: `environment`, `appStoreID`, `transactionDate`, `fulfillmentToolVersion`, `developerID`, `downloadID`, `installerVersionID`
- `InAppReceiptPayload.Environment` enum (`.production`, `.sandbox`, `.xcode`, `.productionSandbox`)
- `InAppPurchase.Type` enum (`.consumable`, `.nonConsumable`, `.autoRenewableSubscription`, `.nonRenewingSubscription`)
- Blocking API via `@_spi(Blocking)`: `local_blocking`, `validate_blocking()`
- Pluggable decoder via `AppReceiptDecoder.Engine` protocol
- DocC documentation
- Privacy manifest (`PrivacyInfo.xcprivacy`)
- visionOS support

### Dependencies

- Removed: ASN1Swift
- Added: [swift-asn1](https://github.com/apple/swift-asn1) 1.5.0+, [swift-certificates](https://github.com/apple/swift-certificates) 1.15.1+, [swift-crypto](https://github.com/apple/swift-crypto) 4.2.0+
53 changes: 47 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,54 @@
# Contributing to TPInAppReceipt

### All contributions to TPInAppReceipt are welcome.
Thank you for your interest in contributing to TPInAppReceipt! This document provides guidelines and instructions for contributing.

If you want to help developing TPInAppReceipt, please take a look for any opened issue or you can introduce a new functionality.
## Reporting Bugs

### Increase unit test coverage
If you find a bug, please open an issue on [GitHub Issues](https://github.com/tikhop/TPInAppReceipt/issues) with:

Additional unit test coverage is welcome.
- A clear, descriptive title
- Steps to reproduce the issue
- Expected behavior vs actual behavior
- Swift version and platform information
- Minimal code example if possible

## Issues
## Suggesting Features

If TPInAppReceipt doesn't work as you expect, please review [any open issues](https://github.com/tikhop/TPInAppReceipt/issues) before opening a new one.
Feature requests are welcome! Please open an issue with:

- A clear description of the feature
- Use cases and motivation
- Any implementation ideas you may have

## Pull Request Process

1. Fork the repository and create your branch from `master`
2. Make your changes and ensure tests pass
3. Add tests for any new functionality
4. Update documentation if needed
5. Submit a pull request with a clear description of your changes

### PR Guidelines

- Keep changes focused and atomic
- Follow existing code patterns
- Ensure all tests pass before submitting

## Code Style

This project follows Swift conventions. Please reference `.swift-format` for formatting guidelines.

To format all files: `swift format -i . --recursive`

Key points:
- Keep lines reasonably short
- Use meaningful variable and function names

## Testing Requirements

All contributions should include appropriate tests:

- Run existing tests with `swift test`
- Add unit tests for new functionality

Thank you for contributing!
44 changes: 0 additions & 44 deletions Documentation/UseInObjCProject.md

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2016-present Pavel Tikhoneko
Copyright (c) 2016-Present Pavel Tikhonenko

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
14 changes: 0 additions & 14 deletions Package.resolved

This file was deleted.

Loading
Loading