mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-10 22:45:55 +05:45
Fixes [CSDK-629]. Depends on #2274 and #2267. Entitlement verification is accomplished by preventing MiTM attacks between the SDK and the RevenueCat server. With verification enabled, the SDK ensures that the response created by the server was not modified by a third-party, and the entitlements received are exactly what was sent. Entitlements are only verified if enabled using `Configuration.Builder.with(entitlementVerificationMode:)`, which is disabled by default. ### Changes: - Added new `VerificationResult`, which replaces `HTTPResponseVerificationResult` - Renamed `Configuration.EntitlementVerificationLevel` to `Configuration.EntitlementVerificationMode` - `Configuration.with(entitlementVerificationMode:)` is now `public` - Added `CustomerInfo.entitlementVerification` - Added `EntitlementInfos.verification` and `EntitlementInfo.verification` - Added tests to cover serialization of these new values - `CustomerInfoResponseHandler` copies the `ValidationResult` to `CustomerInfo` (all operations that fetch `CustomerInfo` use this) - Renamed "validation" to "verification" everywhere for consistency - Finalized documentation ### TODO: - [x] Figure out whether to use a separate type from `HTTPResponseValidationResult` or rename that one - [x] Figure out final API type and property names - [x] Add tests for `CustomerInfo.copy(with:)` - [x] Ensure validation result is encoded and decoded (for caching) - [x] Add missing snapshots [CSDK-629]: https://revenuecats.atlassian.net/browse/CSDK-629?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ