@revenuecat/purchases-typescript-internal 7.4.0-beta.1 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ import { VERIFICATION_RESULT } from "./enums";
1
2
  /**
2
3
  * The EntitlementInfo object gives you access to all of the information about the status of a user entitlement.
3
4
  */
@@ -93,6 +94,10 @@ export interface PurchasesEntitlementInfo {
93
94
  * UNKNOWN if the purchase has no or an unknown ownership type.
94
95
  */
95
96
  readonly ownershipType: "FAMILY_SHARED" | "PURCHASED" | "UNKNOWN";
97
+ /**
98
+ * If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED
99
+ */
100
+ readonly verification: VERIFICATION_RESULT;
96
101
  }
97
102
  /**
98
103
  * Contains all the entitlements associated to the user.
@@ -110,6 +115,10 @@ export interface PurchasesEntitlementInfos {
110
115
  readonly active: {
111
116
  [key: string]: PurchasesEntitlementInfo;
112
117
  };
118
+ /**
119
+ * If entitlement verification was enabled, the result of that verification. If not, VerificationResult.NOT_REQUESTED
120
+ */
121
+ readonly verification: VERIFICATION_RESULT;
113
122
  }
114
123
  export interface CustomerInfo {
115
124
  /**
package/dist/enums.d.ts CHANGED
@@ -80,3 +80,53 @@ export declare enum IN_APP_MESSAGE_TYPE {
80
80
  */
81
81
  GENERIC = 2
82
82
  }
83
+ /**
84
+ * Enum of entitlement verification modes.
85
+ */
86
+ export declare enum ENTITLEMENT_VERIFICATION_MODE {
87
+ /**
88
+ * The SDK will not perform any entitlement verification.
89
+ */
90
+ DISABLED = "DISABLED",
91
+ /**
92
+ * Enable entitlement verification.
93
+ *
94
+ * If verification fails, this will be indicated with [VerificationResult.FAILED] in
95
+ * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
96
+ * (i.e. Entitlements will still be granted).
97
+ *
98
+ * This can be useful if you want to handle verification failures to display an error/warning to the user
99
+ * or to track this situation but still grant access.
100
+ */
101
+ INFORMATIONAL = "INFORMATIONAL"
102
+ }
103
+ /**
104
+ * The result of the verification process. For more details check: http://rev.cat/trusted-entitlements
105
+ *
106
+ * This is accomplished by preventing MiTM attacks between the SDK and the RevenueCat server.
107
+ * With verification enabled, the SDK ensures that the response created by the server was not
108
+ * modified by a third-party, and the response received is exactly what was sent.
109
+ *
110
+ * - Note: Verification is only performed if enabled using PurchasesConfiguration's
111
+ * entitlementVerificationMode property. This is disabled by default.
112
+ */
113
+ export declare enum VERIFICATION_RESULT {
114
+ /**
115
+ * No verification was done.
116
+ *
117
+ * This value is returned when verification is not enabled in PurchasesConfiguration
118
+ */
119
+ NOT_REQUESTED = "NOT_REQUESTED",
120
+ /**
121
+ * Verification with our server was performed successfully.
122
+ */
123
+ VERIFIED = "VERIFIED",
124
+ /**
125
+ * Verification failed, possibly due to a MiTM attack.
126
+ */
127
+ FAILED = "FAILED",
128
+ /**
129
+ * Verification was performed on device.
130
+ */
131
+ VERIFIED_ON_DEVICE = "VERIFIED_ON_DEVICE"
132
+ }
package/dist/enums.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IN_APP_MESSAGE_TYPE = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASE_TYPE = void 0;
3
+ exports.VERIFICATION_RESULT = exports.ENTITLEMENT_VERIFICATION_MODE = exports.IN_APP_MESSAGE_TYPE = exports.LOG_LEVEL = exports.REFUND_REQUEST_STATUS = exports.BILLING_FEATURE = exports.PURCHASE_TYPE = void 0;
4
4
  /**
5
5
  * @deprecated, use PRODUCT_CATEGORY
6
6
  */
@@ -89,3 +89,57 @@ var IN_APP_MESSAGE_TYPE;
89
89
  */
90
90
  IN_APP_MESSAGE_TYPE[IN_APP_MESSAGE_TYPE["GENERIC"] = 2] = "GENERIC";
91
91
  })(IN_APP_MESSAGE_TYPE || (exports.IN_APP_MESSAGE_TYPE = IN_APP_MESSAGE_TYPE = {}));
92
+ /**
93
+ * Enum of entitlement verification modes.
94
+ */
95
+ var ENTITLEMENT_VERIFICATION_MODE;
96
+ (function (ENTITLEMENT_VERIFICATION_MODE) {
97
+ /**
98
+ * The SDK will not perform any entitlement verification.
99
+ */
100
+ ENTITLEMENT_VERIFICATION_MODE["DISABLED"] = "DISABLED";
101
+ /**
102
+ * Enable entitlement verification.
103
+ *
104
+ * If verification fails, this will be indicated with [VerificationResult.FAILED] in
105
+ * the [EntitlementInfos.verification] and [EntitlementInfo.verification] properties but parsing will not fail
106
+ * (i.e. Entitlements will still be granted).
107
+ *
108
+ * This can be useful if you want to handle verification failures to display an error/warning to the user
109
+ * or to track this situation but still grant access.
110
+ */
111
+ ENTITLEMENT_VERIFICATION_MODE["INFORMATIONAL"] = "INFORMATIONAL";
112
+ // Add ENFORCED mode once we're ready to ship it.
113
+ // ENFORCED = "ENFORCED"
114
+ })(ENTITLEMENT_VERIFICATION_MODE || (exports.ENTITLEMENT_VERIFICATION_MODE = ENTITLEMENT_VERIFICATION_MODE = {}));
115
+ /**
116
+ * The result of the verification process. For more details check: http://rev.cat/trusted-entitlements
117
+ *
118
+ * This is accomplished by preventing MiTM attacks between the SDK and the RevenueCat server.
119
+ * With verification enabled, the SDK ensures that the response created by the server was not
120
+ * modified by a third-party, and the response received is exactly what was sent.
121
+ *
122
+ * - Note: Verification is only performed if enabled using PurchasesConfiguration's
123
+ * entitlementVerificationMode property. This is disabled by default.
124
+ */
125
+ var VERIFICATION_RESULT;
126
+ (function (VERIFICATION_RESULT) {
127
+ /**
128
+ * No verification was done.
129
+ *
130
+ * This value is returned when verification is not enabled in PurchasesConfiguration
131
+ */
132
+ VERIFICATION_RESULT["NOT_REQUESTED"] = "NOT_REQUESTED";
133
+ /**
134
+ * Verification with our server was performed successfully.
135
+ */
136
+ VERIFICATION_RESULT["VERIFIED"] = "VERIFIED";
137
+ /**
138
+ * Verification failed, possibly due to a MiTM attack.
139
+ */
140
+ VERIFICATION_RESULT["FAILED"] = "FAILED";
141
+ /**
142
+ * Verification was performed on device.
143
+ */
144
+ VERIFICATION_RESULT["VERIFIED_ON_DEVICE"] = "VERIFIED_ON_DEVICE";
145
+ })(VERIFICATION_RESULT || (exports.VERIFICATION_RESULT = VERIFICATION_RESULT = {}));
@@ -1,3 +1,4 @@
1
+ import { ENTITLEMENT_VERIFICATION_MODE } from "./enums";
1
2
  /**
2
3
  * Holds parameters to initialize the SDK.
3
4
  */
@@ -45,4 +46,9 @@ export interface PurchasesConfiguration {
45
46
  * check: https://rev.cat/storekit-message and https://rev.cat/googleplayinappmessaging
46
47
  */
47
48
  shouldShowInAppMessagesAutomatically?: boolean;
49
+ /**
50
+ * Verification strictness levels for [EntitlementInfo].
51
+ * See https://rev.cat/trusted-entitlements for more info.
52
+ */
53
+ entitlementVerificationInfo?: ENTITLEMENT_VERIFICATION_MODE;
48
54
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@revenuecat/purchases-typescript-internal",
3
3
  "title": "Purchases typescript internal shared code",
4
- "version": "7.4.0-beta.1",
4
+ "version": "7.4.0",
5
5
  "description": "Typescript code to be used by RevenueCat's hybrid SDKs. Not meant for external usage.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",