Skip to content

Conversation

@Doy-lee
Copy link

@Doy-lee Doy-lee commented Aug 27, 2025

This PR goes ontop of #63 only need to review the delta between the two.

--

The commits here are a polish pass over the draft code that was dumped into src/pro.cpp. That file has been renamed to src/pro_backend.cpp. The role of this file now is to interop with the pro backend and adds a bunch of functions to construct the necessary HTTP POST payloads to send off to a Session Pro Backend to do one of the following operations:

  1. Redeem a payment the client has purchased for entitlement to Session Pro. This gets the Session Pro Backend after verifying it successfully, to generate a proof that the client can attach to their messages to enable Pro features.
  2. Authorise a new Ed25519 key pair to be the signatory of their Session Pro Proof that can be used on the protocol
  3. Retrieve the historical list of payments associated with a Session account
  4. Get the current list of global proofs which is maintained by the Session Pro backend that clients will reject proofs from until the designated expiry time.

Additionally for each payment provider, libsession exposes the various platform specific URLs to centralise those strings into the same repository, as per:

const session_pro_payment_provider_metadata SESSION_PRO_PAYMENT_PROVIDER_METADATA[SESSION_PRO_PAYMENT_PROVIDER_COUNT] = {
    /*SESSION_PRO_PAYMENT_PROVIDER_NIL*/ {
        .request_refund_support_url = string8_literal(""),
        .subscription_page_url      = string8_literal(""),
    },
    /*SESSION_PRO_PAYMENT_PROVIDER_GOOGLE_PLAY_STORE*/ {
        .request_refund_support_url = string8_literal("https://support.google.com/googleplay/workflow/9813244"),
        .subscription_page_url      = string8_literal("https://play.google.com/store/account/subscriptions?package=network.loki.messenger"),
    },
    /*SESSION_PRO_PAYMENT_PROVIDER_IOS_APP_STORE*/ {
        .request_refund_support_url = string8_literal("https://support.apple.com/118223"),
        .subscription_page_url      = string8_literal("https://account.apple.com/account/manage/section/subscriptions")
    }
};

The general usage pattern for the request and response code available in pro_backend.{hpp,h}

GetProProofRequest  request       = {...};                                           // Build the request object
std::string         request_json  = request.to_json();                               // Convert it to json
std::string         response_json = send_net_request(pro_backend_url, request_json); // Send POST request using your networking APIs
GetProProofResponse response      = GetProProofResponse::parse(response_json);

if (response.status == SESSION_PRO_BACKEND_SUCCESS_STATUS) {
  // Success! Use the values in the struct
} else {
  // Failure! Parsing errors or input validation errors. Errors are held in the errors array
  for (auto it : response.errors)
    fprintf(stderr, "ERROR: %s\n", it.c_str());
}

@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 4 times, most recently from 410f0e7 to a83ab26 Compare August 29, 2025 05:50
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 4 times, most recently from 745e4ca to 7bf64c8 Compare September 25, 2025 04:11
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch 3 times, most recently from f8c8263 to 6af3762 Compare October 22, 2025 01:23
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch from 7cb1ea3 to 8136920 Compare October 23, 2025 05:21
get_pro_proof  -> generate_pro_proof
GetProProof    -> GenerateProProof
get_pro_status -> get_pro_details
GetProStatus   -> GetProDetails
@Doy-lee Doy-lee force-pushed the doyle-pro-backend-polish branch from e07effd to 4945c20 Compare November 14, 2025 04:25
mpretty-cyro and others added 28 commits November 17, 2025 14:53
• Added the ProConfig back
• Stored the ProConfig in the extra_data of UserProfile so it isn't synced
• Added syncing of the pro features bitset to UserProfile and Contacts configs
• Added syncing of the pro genIndexHash and expiryUnixTs to the ConvoInfoVolatile config
• Fixed an issue where `load_extra_data` wasn't getting called
• Fixed an issue where the `rotating_privkey` wasn't being copied between C/C++
Added syncing for Session Pro profile values
…y-ts

Added syncing for a 'pro_access_expiry_ts' value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants