diff --git a/purchases/src/customEntitlementComputation/kotlin/com/revenuecat/purchases/PurchasesConfiguration.kt b/purchases/src/customEntitlementComputation/kotlin/com/revenuecat/purchases/PurchasesConfiguration.kt index e78167519..ccb67822e 100644 --- a/purchases/src/customEntitlementComputation/kotlin/com/revenuecat/purchases/PurchasesConfiguration.kt +++ b/purchases/src/customEntitlementComputation/kotlin/com/revenuecat/purchases/PurchasesConfiguration.kt @@ -8,11 +8,12 @@ open class PurchasesConfiguration(builder: Builder) { val context: Context val apiKey: String val appUserID: String - val observerMode: Boolean + internal val observerMode: Boolean val service: ExecutorService? internal val store: Store internal val diagnosticsEnabled: Boolean val dangerousSettings: DangerousSettings + internal val verificationMode: EntitlementVerificationMode init { this.context = builder.context @@ -22,6 +23,7 @@ open class PurchasesConfiguration(builder: Builder) { this.service = builder.service this.store = builder.store this.diagnosticsEnabled = builder.diagnosticsEnabled + this.verificationMode = builder.verificationMode this.dangerousSettings = builder.dangerousSettings } @@ -42,6 +44,9 @@ open class PurchasesConfiguration(builder: Builder) { @set:JvmSynthetic @get:JvmSynthetic internal var diagnosticsEnabled: Boolean = false + @set:JvmSynthetic @get:JvmSynthetic + internal var verificationMode: EntitlementVerificationMode = EntitlementVerificationMode.default + @set:JvmSynthetic @get:JvmSynthetic internal var dangerousSettings: DangerousSettings = DangerousSettings(customEntitlementComputation = true) @@ -49,6 +54,23 @@ open class PurchasesConfiguration(builder: Builder) { this.service = service } + /** + * Sets the [EntitlementVerificationMode] to perform signature verification of requests to the + * RevenueCat backend. + * + * When changing from [EntitlementVerificationMode.DISABLED] to other modes, the SDK will clear the + * CustomerInfo cache. + * This means users will need to connect to the internet to get their entitlements back. + * + * The result of the verification can be obtained from [EntitlementInfos.verification] or + * [EntitlementInfo.verification]. + * + * Default mode is disabled. Please see https://rev.cat/trusted-entitlements for more info. + */ + internal fun entitlementVerificationMode(verificationMode: EntitlementVerificationMode) = apply { + this.verificationMode = verificationMode + } + /** * Only use a Dangerous Setting if suggested by RevenueCat support team. */