steamappticket

package module
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 17 Imported by: 0

README

Go Steam App Ticket Parser

Updated to support version 2.0 of the app ticket format.

This module allows you to authenticate steam users on your Go backend.

Basically a transpilation of DoctorMckay's excellent node implementation.

Usage

ParseEncryptedAppTicket (ticket, key)
  • ticket - []byte encrypted ticket data
  • key - []byte key data

Usually you get the ticket in base64 format and the key in hex format from Steam, you will need to decode both first.

If you are using encrypted app tickets you can ignore signature verification, since the encryption step validates the ticket.

import (
  "github.com/oddshotgames/steam-appticket-go"
  "encoding/base64"
  "encoding/hex"
)

ticket := base64.DecodeString('<TICKET>');
key := hex.DecodeString('<KEY>');

/* Returns a SteamAppTicket */
app_ticket, err := steamappticket.ParseEncryptedAppTicket(ticket, decryptionKey)
ParseAppTicket (ticket, key)
  • ticket - []byte encrypted ticket data
  • allowInvalidSignature - bool whether or not to error if the signature is invalid
import (
  "github.com/oddshotgames/steam-appticket-go"
  "encoding/base64"
)

ticket := base64.DecodeString('<TICKET>');

/* Returns a SteamAppTicket */
app_ticket, err := steamappticket.ParseAppTicket(ticket, false)

SteamAppTicket struct

  • AuthTicket []byte: The raw authentication ticket for the app.
  • SteamID uint64: The Steam ID of the user who owns the ticket.
  • GCToken uint64: The game connect token for the app.
  • GCTokenGenerated time.Time: The time when the ticket was generated.
  • SessionExternalIP net.IP: The external IP address of the user's session.
  • ClientConnectionTime uint32: The time when the client connected to the server.
  • ClientConnectionCount uint32: The number of times the client has connected to the server.
  • Version uint32: The version of the app.
  • AppID uint32: The game's Steam App ID.
  • OwnershipTicketExternalIP net.IP: The external IP address of the user's ownership ticket.
  • OwnershipTicketInternalIP net.IP: The internal IP address of the user's ownership ticket.
  • OwnershipFlags uint32: Flags associated with the ownership ticket.
  • OwnershipTicketGenerated time.Time: The time when the ownership ticket was generated.
  • OwnershipTicketExpires time.Time: The time when the ownership ticket expires.
  • Licenses []uint32: A list of the user's licenses for the app.
  • DLC []DLCDetails: A list of details about the DLCs which the account holds.
  • Signature []byte: The signature of the ticket.
  • IsExpired bool: Indicates whether the ticket has expired.
  • HasValidSignature bool: Indicates whether the ticket has a valid signature.
  • IsValid bool: Indicates whether the ticket is valid (neither expired nor with an invalid signature).
  • UserData []byte: Additional user data associated with the ticket, created when requesting the ticket.
DLCDetails
  • AppID uint32: The DLC's App ID
  • Licenses []uint32: Package IDs of all the licenses which give the owner access to this DLC

You can read more info about how app tickets work here.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DecryptionFailedError error = &SteamAppTicketError{Message: "Failed to decrypt ticket"}
View Source
var InvalidSignatureError error = &SteamAppTicketError{Message: "Missing or Invalid Signature"}
View Source
var InvalidTicketError error = &SteamAppTicketError{Message: "Invalid ticket"}
View Source
var SteamPublicKey, _ = pem.Decode([]byte(
	`-----BEGIN PUBLIC KEY-----
MIGdMA0GCSqGSIb3DQEBAQUAA4GLADCBhwKBgQDf7BrWLBBmLBc1OhSwfFkRf53T
2Ct64+AVzRkeRuh7h3SiGEYxqQMUeYKO6UWiSRKpI2hzic9pobFhRr3Bvr/WARvY
gdTckPv+T1JzZsuVcNfFjrocejN1oWI0Rrtgt4Bo+hOneoo3S57G9F1fOpn5nsQ6
6WOiu4gZKODnFMBCiQIBEQ==
-----END PUBLIC KEY-----`))

Functions

This section is empty.

Types

type AppOwnershipTicket

type AppOwnershipTicket struct {
	Version                   uint32    `json:"version"`
	SteamID                   SteamID   `json:"steamID"`
	AppID                     uint32    `json:"appID"`
	OwnershipTicketExternalIP net.IP    `json:"ownershipTicketExternalIP"`
	OwnershipTicketInternalIP net.IP    `json:"ownershipTicketInternalIP"`
	OwnershipFlags            uint32    `json:"ownershipFlags"`
	OwnershipTicketGenerated  time.Time `json:"ownershipTicketGenerated"`
	OwnershipTicketExpires    time.Time `json:"ownershipTicketExpires"`
	Licenses                  []uint32  `json:"licenses"`
	DLC                       []DLCInfo `json:"dlc"`
	Signature                 []byte    `json:"signature,omitempty"`
	IsExpired                 bool      `json:"isExpired"`
	HasValidSignature         bool      `json:"hasValidSignature"`
	IsValid                   bool      `json:"isValid"`
}

AppOwnershipTicket contains ownership information for a Steam application

type AppTicket

type AppTicket struct {
	AppOwnershipTicket
	AuthTicket            []byte    `json:"authTicket"`
	GCToken               string    `json:"gcToken"`
	TokenGenerated        time.Time `json:"tokenGenerated"`
	SessionExternalIP     net.IP    `json:"sessionExternalIP"`
	ClientConnectionTime  uint32    `json:"clientConnectionTime"`
	ClientConnectionCount uint32    `json:"clientConnectionCount"`
}

AppTicket extends AppOwnershipTicket with authentication information

func ParseAppTicket

func ParseAppTicket(ticket []byte, allowInvalidSignature bool) (*AppTicket, error)

*

*
* @param {[]byte} ticket - The raw encrypted ticket
* @param {bool} allowInvalidSignature - Whether to error on tickets with invalid signatures
* @returns {SteamAppTicket}

type DLCInfo

type DLCInfo struct {
	AppID    uint32   `json:"appID"`
	Licenses []uint32 `json:"licenses"`
}

DLCInfo contains information about downloadable content

type DecodedEncryptedAppTicket

type DecodedEncryptedAppTicket struct {
	Version                   uint32    `json:"version"`
	SteamID                   SteamID   `json:"steamID"`
	AppID                     uint32    `json:"appID"`
	OwnershipTicketExternalIP string    `json:"ownershipTicketExternalIP"`
	OwnershipTicketInternalIP string    `json:"ownershipTicketInternalIP"`
	OwnershipFlags            uint32    `json:"ownershipFlags"`
	OwnershipTicketGenerated  time.Time `json:"ownershipTicketGenerated"`
	Licenses                  []uint32  `json:"licenses"`
	DLC                       []DLCInfo `json:"dlc"`
	UserData                  []byte    `json:"userData"`
	Unknown2                  uint64    `json:"unknown2"`
	Unknown3                  uint64    `json:"unknown3"`
	Unknown4                  uint32    `json:"unknown4"`
}

DecodedEncryptedAppTicket represents a decoded encrypted application ticket

func ParseEncryptedAppTicket

func ParseEncryptedAppTicket(ticket []byte, key []byte) (*DecodedEncryptedAppTicket, error)

*

*
* @param {[]byte} ticket - The raw encrypted ticket
* @param {[]byte|string} encryptionKey - The raw encryption key
* @returns {SteamAppTicket}

type SteamAppTicketError

type SteamAppTicketError struct {
	Message string
}

func (*SteamAppTicketError) Error

func (e *SteamAppTicketError) Error() string

type SteamID

type SteamID uint64

SteamID represents a Steam identifier

Directories

Path Synopsis
generated

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL