SteamKit icon indicating copy to clipboard operation
SteamKit copied to clipboard

Ability to serialize and deserialize an active session.

Open ryantheleach opened this issue 2 years ago • 4 comments

What problem is this feature trying to solve?

I've attempted to fork DepotDownloader to create a PR, and have come to the realization that it may be impossible to save login sessions between runs with the current way that SteamKit creates and logs in users. (I may be wrong, I'm brand new to this project)

How would you like it to be solved?

If a SteamUser was able to be reinflated from serialized data, I think that would make it possible to "login from disk" an already logged in user, as long as they didn't previously disconnect.

Have you considered any alternative solutions

I'm brand new to these projects, so no.

Additional Information

No response

ryantheleach avatar Apr 12 '22 20:04 ryantheleach

it may be impossible to save login sessions between runs with the current way that SteamKit creates and logs in users. (I may be wrong, I'm brand new to this project)

And indeed, you are wrong, my ASF project is prime example which uses login keys and doesn't ask users for e.g. 2FA (but also SteamGuard) credentials more than once, and I'm not using any SK2 fork. It was possible since the beginning, so at least 7 years, likely even longer than I'm using it for.

I recommend you to take a look at my code, in particular LoginKey and ShouldRememberPassword of LogOnDetails, and LoginKeyCallback.

JustArchi avatar Apr 12 '22 21:04 JustArchi

Judging by your problem description in https://github.com/SteamRE/DepotDownloader/issues/312#issuecomment-1097150314 I think we need a bit more detail:

  1. Is login actually the thing being rate-limited? If so,
  2. Can you loop through all the desired in DD inside a single user session, rather than spawning way too many DD instances from your outer script?

Bypassing restrictions, including rate limits, is not something we take lightly. This could also be a security concern if the serialised state is not properly secured. Therefore, I’d rather try and find a different solution to the problem.

yaakov-h avatar Apr 12 '22 22:04 yaakov-h

I’d also note that it may have to serialise UDP connection state and reconnect within the UDP timeout window. I suspect you may have trouble resuming an existing session across a new TCP or WebSocket connection…

yaakov-h avatar Apr 12 '22 22:04 yaakov-h

As far as I know it was login.

I'm not attempting to bypass rate limiting for what it's worth, but respect the API that's being hit by not hitting it if it's not necessary. The same thing would happen if trying to update multiple apps using DepotDownloader in the way it's currently written.

Most of my experience with interacting with web services / CDN's has used JWT, so sorry for the limited perspective, I figured if the session was valid, why would you need to re-login.

Hearing about the UDP connection state, makes it clear that there IS a constant connection required, and therefore isn't straightforward as I originally guessed, maybe not impossible, but definitely impractical.

Can you loop through all the desired in DD inside a single user session, rather than spawning way too many DD instances from your outer script?

Likely yes, but as it seemed that supporting multiple manifests or apps was not something that the devs wanted or intended, I figured from a nieve point of view, that perhaps session saving was a more apt PR. It appears I'm wrong.

ryantheleach avatar Apr 13 '22 07:04 ryantheleach

I'm gonna close this because you're essentially asking SK2 to somehow reconnect to TCP and continue an existing session which is not possible.

You have to go through the login process again. With #1125 and remember password option, you'd only need to resend the username and access token.

xPaw avatar Mar 21 '23 08:03 xPaw