Pro backend 0.2 + libsession 1.7 compatibility updates#47
Open
jagerman wants to merge 13 commits into
Open
Conversation
…ent_id Adapt the Android glue to libsession-util pro-backend-updates (71d32b8a): - gen_index_hash -> revocation_tag (ProProof, Conversation.ProProofInfo, JNI, and protobuf regen: ProProof.genIndexHash -> revocationTag). - Pro timestamps milliseconds -> integer seconds (proof expiry, convo pro-expiry, generate-proof / get-details request ts, user-profile pro-access-expiry); dropped the misleading _ms name suffixes. - payment_provider / plan: integer enums -> opaque wire code strings. Provider slug constants (google_play / app_store / rangeproof). PaymentProviderMetadata table + getPaymentProviderMetadata removed (the apps now own store names / URLs). - Per-provider payment fields collapsed to a single opaque payment_id (add-payment drops order_id; provider passed as a code string). - decode_for_community now takes seconds (proof-validity check time). Bumps the libsession-util submodule to the pro-backend-updates tip. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e4d1e6)
Adapt to the redesigned session::pro_backend C++ API (free functions;
request structs + X::parse deleted; version param removed; provider URLs
re-added). libsession now owns both request-build and response-parse.
- Re-pin libsession-util submodule 71d32b8a -> 73e4d1e6.
- BackendRequests: build{AddProPayment,GenerateProProof,GetProDetails,Refund,
Revocations}Request -> ProRequest{endpoint,body}; parse{AddPayment,ProProof,
PaymentDetails,Refund,Revocations}Response -> typed structs; providerUrls().
Drop the old build*RequestJson (used the deleted structs) + version param.
- New Kotlin mirrors (ProBackendResponses.kt): ProRequest, ProviderUrls,
ProResponseHeader, ProProofResponse, ProPaymentItem/GetProDetailsResponse,
ProRevocationItem/GetProRevocationsResponse, SetPaymentRefundRequestedResponse.
- pro_backend.cpp: JNI marshalling of the C++ structs into those data classes;
purchased/revoked timestamps are ms (sys_ms), the rest whole seconds.
Kotlin + native (arm64) build green.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…L/PUBKEY) Bump the vendored libsession submodule 73e4d1e6 -> 857783e6 and adapt to the two changes since 73e4d1e6: - get-details status / user_status are now opaque string codes (the SESSION_PRO_BACKEND_PAYMENT_STATUS / _USER_PRO_STATUS enums were deleted; C++ fields are std::string). serialize_payment_item / serialize_get_details_ response now marshal them as jstring; ProPaymentItem.status / GetProDetailsResponse.userStatus retyped Int -> String. - Expose the libsession-owned backend identity so the app stops carrying its own copy: BackendRequests.proBackendUrl() (session::pro_backend::URL) and proBackendPubKeyHex() (hex of session::pro_backend::PUBKEY). Single source of truth — a future URL/pubkey change happens in libsession only. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ype) Bump vendored libsession 857783e6 -> 418cdaba and adapt the JNI marshalling: - C++ *_unix_ts -> *_at member renames (no wire change): serialize_payment_item / serialize_get_details_response / serialize_revocation_item (purchased_at, redeemed_at, expiry_at, platform_refund_expiry_at, revoked_at, refund_requested_at, effective_at), conversation.cpp pro_expiry_at, and pro_proof_util.cpp ProProof.expiry_at. (Kotlin field names/units unchanged.) - ProRequest now carries content_type: serialize_pro_request emits it (3-arg ctor) and ProRequest.kt gains `contentType`. C++ payload member is `data` (was `body`). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The JNI boundary still hands back raw epoch longs (efficient, primitive-only marshalling), but the app shouldn't juggle mixed-unit longs and magic-zero sentinels. Add typed Instant/Duration accessors on ProPaymentItem, GetProDetailsResponse and ProRevocationItem that convert once at the Kotlin glue boundary (seconds/ms per field) and map the "unset" 0 to null. Consumers should read these instead of the raw *UnixTs(Ms) fields. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Supersedes the Instant/Duration *accessors* on the raw-long classes: the get-details fields themselves are now the app-facing types — Instant dates, Duration intervals, String slugs (plan/provider/status), no magic-int constants. Following the ProProof pattern, each class keeps a @keep secondary constructor with the raw epoch-integer signature the C++ builds via NewObject (so the .cpp is untouched; verified BasicJavaClassInfo resolves the ctor by explicit signature), which converts once here at the glue boundary and maps the 0 "unset" sentinel to null. Types are @serializable (epoch-millis Instant / seconds Duration) so the app can persist them directly. ProResponseHeader is now @serializable too; its raw numeric `status` is kept but documented as redundant-with-errors / pending upstream removal — prefer isSuccess/errors. Revocations/proof/refund shapes are unchanged for now. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…lope Re-pin libsession submodule 418cdaba -> a9e790a8 (Delta session-foundation#12: response envelope is now a status enum + optional error_code slug + optional single diagnostic error, replacing the int status + errors[] array). - serialize_response_header reads the renamed C++ ResponseBase: status enum (marshalled as its ordinal), error_code / error (std::optional<string> -> nullable jstring); no more errors[] iteration. - ProResponseHeader: status is the closed ProResponseStatus enum (Ok/Fail/ Error, ordinals matching the C enum) + nullable errorCode/error; isSuccess == status Ok. @keep secondary ctor maps the JNI ordinal to the enum. Response-side app consumers (ProApi error handling, already-redeemed removal, error_code->Crowdin mapping) follow in the app repo. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e5a210 Add BackendRequests.visiblePlatforms() returning the purchasable provider slugs (JNI over session::pro_backend::visible_platforms()). Bumps the libsession-util submodule a9e790a8 -> c6e5a210 (adds visible_platforms; includes Delta session-foundation#13, client no-op). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ion-foundation#15) Re-pin libsession-util c6e5a21 -> 3f8aace0 and absorb the endpoint split: get_pro_details is replaced by get_pro_status (the light "am I Pro?" call) and a separate library-only get_payment_details history endpoint (not wired). - JNI (pro_backend.cpp): build the get_pro_status request via pro_status_request (drops the count param) and parse via parse_pro_status; the response now emits a single optional latest_payment (has-flag + nullable item) instead of an items[] list + payments_total. ProviderUrls -> ProviderURLs (C++ rename; fields now optional<string_view>). plan is now a parsed ProPlanPeriod, rendered back to the canonical "<N><unit>"/"lifetime" slug the app still consumes as a String. Fixed a latent ResponseBase.errors reference (Delta session-foundation#12 removed it) to use operator bool. - Kotlin: GetProDetailsResponse -> GetProStatusResponse (single latestPayment + hasLatestPayment flag, no items/paymentsTotal); buildGetProDetailsRequest -> buildGetProStatusRequest (no count); parsePaymentDetailsResponse -> parseProStatusResponse. Verified by recompiling the glue pro_backend.cpp translation unit against the new headers (cmake/ninja, arm64-v8a): builds clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The C API already exposes the parsed ProPlanPeriod (count + unit); stop re-stringifying it back to a compact "<N><unit>" slug that the app then re-parses. ProPaymentItem now carries planCount:Int + planUnit:String (lowercase unit name, matching the nodejs glue), so clients hold (count, unit) directly with no wire re-parsing and no canonicalization. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The wire spec (docs/pro-wire-protocol.md) dropped its Delta-N change-history annotations, so every 'Delta #N' citation was a dangling reference. Reworded each to the current section (envelope -> §5/§5.1/§5.2, plan grammar -> §1, get_pro_status -> §3.4) or dropped the parenthetical where there is no section. Verified all remaining pro-wire-protocol § references resolve. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…bmodule URL The refactor merged upstream (session-foundation/libsession-util dev, to become v1.7.0). Point the submodule back at the canonical session-foundation repo (undoing the WIP switch to the jagerman fork in b2f1430 — the target commit only exists on canonical) and re-pin off the now-orphaned WIP 3f8aace0 to the dev tip d63deea5, which includes the refactor plus Pro backend integration tests + CI. The pro API is identical to 3f8aace0 (only Delta-citation comments differ), so no glue code changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updates the JNI/Kotlin glue for the Session Pro backend wire changes. libsession remains the sole owner of the wire format; the glue only marshals to/from app-idiomatic Kotlin types and never parses JSON itself. Re-pins the
libsession-utilsubmodule toc6e5a210.This is required for Android compatibility with session-foundation/session-pro-backend#2 and session-foundation/libsession-util#95.
Changes
ProResponseHeaderwith astatusenum (Ok/Fail/Error), an optional machineerrorCodeslug, and a single English diagnosticerror(replacing the old int status +errors[]).@Serializable) withInstant/Durationaccessors (seconds/ms converted at the boundary).visible_platforms(): newBackendRequests.visiblePlatforms(): Array<String>(JNI oversession::pro_backend::visible_platforms()) returning the purchasable provider slugs (excludes non-purchasable providers likerangeproof).libsession-utilre-pinneda9e790a8 → c6e5a210(addsvisible_platforms).