go-steam icon indicating copy to clipboard operation
go-steam copied to clipboard

AuthSessionTicket implementation

Open mogaika opened this issue 5 years ago • 2 comments

I implemented AuthSessionTicket generation (and AuthTIcket verification), but I do not know how to format and fix code. Almost sure that I did wrong sync.Mutex stuff and naming/packaging.

https://github.com/mogaika/go-steam/commit/f4c74f9e57498b36561049054f44b7a78cfa71c2

If someone need this and want to risk to use my code there is gs bot example main cycle change which illustrates how to use new feature

        var ast []byte

	for event := range client.Events() {
		auth.HandleEvent(event)
		debug.HandleEvent(event)
		serverList.HandleEvent(event)

		switch e := event.(type) {
		case error:
			fmt.Printf("Error: %v", e)
		case *steam.LoggedOnEvent:
			client.Social.SetPersonaState(steamlang.EPersonaState_Online)
			log.Printf("Logged on")

			log.Printf("Setting game played")
			client.GC.SetGamesPlayed(APPID)

			log.Printf("Getting app ownership ticket")
			client.GetAppOwnershipTicket(APPID)
		case *steam.TicketAuthComplete:
			log.Printf("can be ignored")
		case *steam.TicketAuthAck:
			// DO YOUR MAGIC WITH AST TICKET
                        // TO CONVERT TO STRING USE
                        ticket := fmt.Sprintf("%X", ast)
                        _ = ticket
		case *steam.AppOwnershipTicket:
			aot := event.(*steam.AppOwnershipTicket)

			ast = client.AuthSessionTicket(aot.AppOwnershipTicket)
			log.Printf("verifiying ast: %X", ast)
		}
	}

as reference I used https://github.com/DoctorMcKay/node-steam-user https://github.com/dotdotmaples/node-steam-user https://github.com/SteamRE/SteamKit/pull/789 so it also would be good to check LICENSE files

mogaika avatar Dec 20 '19 02:12 mogaika

Nice! Yeah, the code could be cleaned up a bit. In particular, I'm not sure the manual serialization is the cleanest way to do this. Unfortunately, I don't have the time to personally review this in detail.

But I think if you'd open a pull request someone may turn up to help 👍

Philipp15b avatar Jan 22 '20 16:01 Philipp15b

@Philipp15b so, probably we can merge this implementation? i think that it better then nothing

https://github.com/Philipp15b/go-steam/pull/127

molecul avatar Apr 25 '22 20:04 molecul