Philipp15b / go-steam

Steam's protocol in Go to allow automation of different actions on the Steam network without running an actual Steam client. Includes APIs for friends, chatting, trading, trade offers and TF2 crafting.
https://pkg.go.dev/github.com/Philipp15b/go-steam/v3
Other
387 stars 131 forks source link

AuthSessionTicket implementation #102

Open mogaika opened 4 years ago

mogaika commented 4 years ago

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

Philipp15b commented 4 years ago

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 đź‘Ť

molecul commented 2 years ago

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

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