Skip to content

Implement Subscriptions#29

Draft
Laincy wants to merge 16 commits intoReconnectedCC:mainfrom
Laincy:subscriptions
Draft

Implement Subscriptions#29
Laincy wants to merge 16 commits intoReconnectedCC:mainfrom
Laincy:subscriptions

Conversation

@Laincy
Copy link
Contributor

@Laincy Laincy commented Feb 3, 2026

Opening a draft PR mostly to give a status update and keep myself organized. This is pretty much all new code, a couple things had to happen to make subscriptions work.

Subscriptions are made up of 2 components, a contract and a subscription:

  • Contract - An offer made by a service provider, which other wallets can agree to. This stores information such as the subscription period, price, and who is allowed to use the subscription.
  • Subscription - Wallets that have agreed to a contract. Stores information such as the start date of the current term, the time it will lapse at, and the current state of the subscription.

Logic for lapsing subscriptions has been implemented and tested. There are absolutely better ways to go about implementing it, but until I see a performance reason to do it what we have will work fine.

Kromer Authorization

Authorization for the Kromer V1 API is done using sessions stored on the server. Session IDs are passed as bearer auth.

  • Login - Pass private key in request body and it will return a session UUID. Currently, sessions expire after 1 hour.
  • Logout - By connecting with an authorized session, the current session will be ended and the UUID will no longer work.
  • Internal API for revoking active sessions. Just an idea, but could be useful if we run into another soak.

Contract API

  • Create contracts
  • List contracts, with filters for specific owners and their status.
  • Get info on a specific contract by ID
  • List subscribers to specific contract.
  • Edit contract

Subscriber API

  • Subscribe to contracts
  • List subscribers, with filters for specific wallets and status.
  • Cancel Subscription.

Websocket API

  • Notify transaction listeners when subscription payment is made
  • Notify contract listeners when subscription status is changed or renewed

Let me know what I've missed, I'm sure there are obvious API's that I've forgotten. Will continue to update here as I continue to flesh things out.

Laincy added 16 commits February 2, 2026 21:01
Added a flake and docker compose to help with dev, will probably cherry
pick these out later if sov doesn't let me upstream them.
Tested manually, so far all codepaths work. Need to add endpoints.
Added endpoints that allow you to begin and end sessions. Pretty much
just bearer auth where you passa UUID back and forth.
Change deserialization errors to return 400 errors rather than 500
errors as they did previously.
Added a patch type to define our update semantics
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.

1 participant