1- /// <reference path="../shared.d.ts" />
1+ /// <reference path="../shared.d.ts" />;
22
33declare module 'libsession_util_nodejs' {
44 type WithProRotatingEd25519PrivKey = { proRotatingEd25519PrivKey : string | null } ;
@@ -74,6 +74,85 @@ declare module 'libsession_util_nodejs' {
7474 expiryUnixTsMs : number ;
7575 } ;
7676
77+ type WithMasterPrivKey = { masterPrivKey : Uint8Array } ;
78+
79+ type ProPaymentItem = {
80+ /**
81+ * Describes the current status of the consumption of the payment for Session Pro entitlement
82+ * The status should be used to determine which timestamps should be used.
83+
84+ * For example, a payment can be in a redeemed state whilst also have a refunded timestamp set
85+ * if the payment was refunded and then the refund was reversed. We preserve all timestamps for
86+ * book-keeping purposes.
87+ */
88+ status : 'NIL' | 'UNREDEEMED' | 'REDEEMED' | 'EXPIRED' | 'REFUNDED' ;
89+ /**
90+ * Session Pro product/plan item that was purchased
91+ */
92+ plan : 'NIL' | 'ONE_MONTH' | 'THREE_MONTHS' | 'TWELVE_MONTHS' ;
93+ /**
94+ * Store front that this particular payment came from
95+ */
96+ paymentProvider : ProOriginatingPlatform ;
97+ /**
98+ * Flag indicating whether or not this payment will automatically bill itself at the end of the
99+ billing cycle.
100+ */
101+ autoRenewing : boolean ;
102+ /**
103+ * Unix timestamp of when the payment was witnessed by the Pro Backend. Always set
104+ */
105+ unredeemedTsMs : number ;
106+ /**
107+ * Unix timestamp of when the payment was redeemed. 0 if not activated
108+ */
109+ redeemedTsMs : number ;
110+ /**
111+ * Unix timestamp of when the payment was expiry. 0 if not activated
112+ */
113+ expiryTsMs : number ;
114+ /**
115+ * Duration of the grace period, e.g. when the payment provider will start to attempt to renew
116+ * the Session Pro subscription. During the period between
117+ * [expiry_unix_ts, expiry_unix_ts + grace_period_duration_ms] the user continues to have
118+ * entitlement to Session Pro. This value is only applicable if `auto_renewing` is `true`.
119+ */
120+ gracePeriodDurationMs : number ;
121+ /**
122+ * Unix deadline timestamp of when the user is able to refund the subscription via the payment
123+ provider.
124+ * Thereafter the user must initiate a refund manually via Session support.
125+ */
126+ platformRefundExpiryTsMs : number ;
127+ /**
128+ * Unix timestamp of when the payment was revoked or refunded. 0 if not applicable.
129+ */
130+ revokedTsMs : number ;
131+ /**
132+ * When payment provider is set to Google Play Store, this is the platform-specific purchase
133+ token.
134+ * This information should be considered as confidential and stored appropriately.
135+ */
136+ googlePaymentToken : string | null ;
137+ /**
138+ * When payment provider is set to iOS App Store, this is the platform-specific original
139+ transaction ID.
140+ * This information should be considered as confidential and stored appropriately.
141+ */
142+ appleOriginalTxId : string | null ;
143+ /**
144+ * When payment provider is set to iOS App Store, this is the platform-specific transaction ID
145+ * This information should be considered as confidential and stored appropriately.
146+ */
147+ appleTxId : string | null ;
148+ /**
149+ * When payment provider is set to iOS App Store, this is the platform-specific web line order
150+ * ID.
151+ * This information should be considered as confidential and stored appropriately.
152+ */
153+ appleWebLineOrderId : string | null ;
154+ } ;
155+
77156 type ProWrapper = {
78157 proFeaturesForMessage : ( args : {
79158 utf16 : string ;
@@ -83,12 +162,13 @@ declare module 'libsession_util_nodejs' {
83162 */
84163 proFeatures : ProFeatures ;
85164 } ) => WithProFeatures & { success : boolean ; error : string | null ; codepointCount : number } ;
86- proProofRequestBody : ( args : {
87- requestVersion : number ;
88- masterPrivkey : Uint8Array ;
89- rotatingPrivkey : Uint8Array ;
90- unixTsMs : number ;
91- } ) => string ;
165+ proProofRequestBody : (
166+ args : WithMasterPrivKey & {
167+ requestVersion : number ;
168+ rotatingPrivkey : Uint8Array ;
169+ unixTsMs : number ;
170+ }
171+ ) => string ;
92172
93173 proProofParseResponse : ( args : {
94174 json : string ;
@@ -97,22 +177,23 @@ declare module 'libsession_util_nodejs' {
97177 /**
98178 * @param version: Request version. The latest accepted version is 0
99179 * @param ticket: 4-byte monotonic integer for the caller's revocation list iteration. Set to 0 if unknown; otherwise, use the latest known `ticket` from a prior `GetProRevocationsResponse` to allow
100- /// the Session Pro Backend to omit the revocation list if it has not changed.
180+ the Session Pro Backend to omit the revocation list if it has not changed.
101181 * @returns the stringified body to include in the request
102182 */
103183 proRevocationsRequestBody : ( args : { requestVersion : number ; ticket : number } ) => string ;
104184
105185 proRevocationsParseResponse : ( args : { json : string } ) => WithProBackendResponse & {
106186 ticket : number | null ;
107- items : Array < ProRevocationItem > ;
187+ items : Array < ProRevocationItem > | null ;
108188 } ;
109189
110- proStatusRequestBody : ( args : {
111- requestVersion : number ;
112- masterPrivkey : Uint8Array ;
113- unixTsMs : number ;
114- withPaymentHistory : boolean ;
115- } ) => string ;
190+ proStatusRequestBody : (
191+ args : WithMasterPrivKey & {
192+ requestVersion : number ;
193+ unixTsMs : number ;
194+ withPaymentHistory : boolean ;
195+ }
196+ ) => string ;
116197
117198 proStatusParseResponse : ( args : { json : string } ) => WithProBackendResponse & {
118199 ticket : number | null ;
0 commit comments