Skip to content

Commit

Permalink
Update docs after enabling Trusted Entitlements by default (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
tonidero authored Jan 22, 2025
1 parent 2ad20b4 commit 17bc324
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 16 deletions.
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements-capacitor.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
await Purchases.configure({
apiKey: <public_api_key>,
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED
});
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements-rn.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
await Purchases.configure({
apiKey: <public_api_key>,
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.INFORMATIONAL
entitlementVerificationMode: ENTITLEMENT_VERIFICATION_MODE.DISABLED
});
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Purchases.PurchasesConfiguration.Builder builder = Purchases.PurchasesConfiguration.Builder.Init(<public_api_key>);
Purchases.PurchasesConfiguration purchasesConfiguration =
.SetEntitlementVerificationMode(Purchases.EntitlementVerificationMode.Informational)
.SetEntitlementVerificationMode(Purchases.EntitlementVerificationMode.Disabled)
.Build();
purchases.Configure(purchasesConfiguration);
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
PurchasesConfiguration configuration = PurchasesConfiguration(<public_api_key>);
configuration.entitlementVerificationMode = EntitlementVerificationMode.informational;
configuration.entitlementVerificationMode = EntitlementVerificationMode.disabled;
await Purchases.configure(configuration);
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Purchases.configure(
PurchasesConfiguration.Builder(context, apiKey = <api_key>)
.entitlementVerificationMode(EntitlementVerificationMode.INFORMATIONAL)
.entitlementVerificationMode(EntitlementVerificationMode.DISABLED)
.build()
)
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements.m
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[RCPurchases configureWithConfigurationBuilder:[[RCConfiguration builderWithAPIKey:<api_key>]
withEntitlementVerificationMode:RCEntitlementVerificationModeInformational]];
withEntitlementVerificationMode:RCEntitlementVerificationModeDisabled]];
2 changes: 1 addition & 1 deletion code_blocks/customers/trusted-entitlements.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Purchases.configure(
with: Configuration.Builder(withAPIKey: <api_key>)
.with(entitlementVerificationMode: .informational)
.with(entitlementVerificationMode: .disabled)
)
13 changes: 4 additions & 9 deletions docs/customers/trusted-entitlements.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,7 @@ Trusted Entitlements is supported in iOS SDK version 4.25.0 and up, and Android

### Configuration

SDKs can be configured in one of 3 `EntitlementVerificationMode`'s:

- Disabled (*default*): equivalent to no verification. Susceptible to request tampering.
- Informational (*beta*): No behavior change, but the result of verification is included in `EntitlementInfos` / `EntitlementInfo`.
- Enforced (*coming soon*): verification failures result in `ErrorCode.signatureVerificationFailed` error being thrown.

Trusted Entitlements is enabled by default and it doesn't have any impact on performance or behavior by default. You can disable it by doing the following:


import content1 from "!!raw-loader!@site/code_blocks/customers/trusted-entitlements.swift";
Expand Down Expand Up @@ -68,7 +63,7 @@ import content7 from "!!raw-loader!@site/code_blocks/customers/trusted-entitleme

### Verification

When configuring the SDK with `EntitlementVerificationMode.informational`, `EntitlementInfo` contains the verification result:
When Trusted Entitlements are enabled, `EntitlementInfo` contains the verification result:

import content8 from "!!raw-loader!@site/code_blocks/customers/verification-result.swift";
import content9 from "!!raw-loader!@site/code_blocks/customers/verification-result.m";
Expand Down Expand Up @@ -115,9 +110,9 @@ Additionally, verification errors are always forwarded to `Purchases.errorHandle

## Edge cases

### Cache invalidation
### Cache leftover

Transitioning an app from `EntitlementVerificationMode.disabled` to `EntitlementVerificationMode.informational` means that cached data would not be verified. In order for a user to be able to rely on this new behavior, the SDKs invalidate caches when this change is detected, so that all subsequent data requests are guaranteed to have validation information.
Transitioning an app from `EntitlementVerificationMode.disabled` to `EntitlementVerificationMode.informational` means that cached data would not be verified. The SDK will keep using that cached data, which should be updated with the result of the verification after a request to the RevenueCat servers is performed successfully. In this scenario, the `EntitlementInfo` will have a VerificationResult of "not requested". You may clear the CustomerInfo cache by calling the `Purchases/invalidateCustomerInfoCache()` method in the SDK if you want to avoid having unverified entitlements.

### Key replacement

Expand Down

0 comments on commit 17bc324

Please sign in to comment.