Documentation ¶
Index ¶
- Constants
- Variables
- func AlignTime() error
- func GetSteamTime() int64
- func MobileLoginRequest(queryUrl, method string, params *url.Values, cookies *cookiejar.Jar, ...) ([]byte, error)
- func WebRequest(queryUrl, method string, params *url.Values, cookies *cookiejar.Jar, ...) ([]byte, error)
- type AuthenticatorLinker
- type Confirmation
- type SessionData
- type SteamGuardAccount
- func (a *SteamGuardAccount) AcceptConfirmation(cn *Confirmation) error
- func (a *SteamGuardAccount) DeactivateAuthenticator() error
- func (a *SteamGuardAccount) DenyConfirmation(cn *Confirmation) error
- func (a *SteamGuardAccount) FetchConfirmations() ([]*Confirmation, error)
- func (a *SteamGuardAccount) GenerateConfirmationQueryParams(tag string) (url.Values, error)
- func (a *SteamGuardAccount) GenerateSteamGuardCode() (string, error)
- func (a *SteamGuardAccount) GenerateSteamGuardCodeForTime(t int64) (string, error)
- func (a *SteamGuardAccount) RefreshSession() error
- type UserLogin
Constants ¶
const UrlCommunityBase string = "https://steamcommunity.com"
const UrlConfirmationService string = UrlCommunityBase + "/mobileconf"
const UrlMobileAuthService string = UrlSteamApiBase + "/IMobileAuthService"
const UrlSteamApiBase string = "https://api.steampowered.com"
const UrlTwoFactorService string = UrlSteamApiBase + "/ITwoFactorService"
Variables ¶
var ErrAuthenticatorPresent = errors.New("authenticator already present")
ErrAuthenticatorPresent is returned by AddAuthenticator
var ErrBadCredentials = errors.New("bad credentials")
ErrBadCredentials is returned by DoLogin when steam fails to authenticate us
var ErrBadRSA = errors.New("bad RSA")
ErrBadRSA is returned by DoLogin when steam returns success false to rsa public key request
var ErrBadSMSCode = errors.New("bad sms code")
ErrBadSMSCode is returned by FinalizeAddAuthenticator when steam rejects supplied SMS code
var ErrMustProvidePhoneNumber = errors.New("no phone number on the account")
ErrMustProvidePhoneNumber is returned by AddAuthenticator when no phone set on both authentication linker and account
var ErrMustRemovePhoneNumber = errors.New("a phone number is already on the account")
ErrMustRemovePhoneNumber is returned by AddAuthenticator when phone is set on both authentication linker and account
var ErrNeed2FA = errors.New("need 2FA")
ErrNeed2FA is returned by DoLogin when mobile code is required
var ErrNeedCaptcha = errors.New("need captcha")
ErrNeedCaptcha is returned by DoLogin when captcha code is required
var ErrNeedEmail = errors.New("need email")
ErrNeedEmail is returned by DoLogin when email code is required
var ErrTooManyFailedLogins = errors.New("two many failed logins")
ErrNeedTooManyFailedLogins is returned by DoLogin
var ErrUnableToGenerateCorrectCodes = errors.New("unable to generate correct codes")
ErrUnableToGenerateCorrectCodes is returned by FinalizeAddAuthenticator
Functions ¶
func AlignTime ¶
func AlignTime() error
Aligns system time with the Steam server time. Not super advanced; probably not taking some things into account that it should. Necessary to generate up-to-date codes. In general, this will have an error of less than a second, assuming Steam is operational.
func GetSteamTime ¶
func GetSteamTime() int64
Types ¶
type AuthenticatorLinker ¶
type AuthenticatorLinker struct { // Set to register a new phone number when linking. // If a phone number is not set on the account, this must be set. // If a phone number is set on the account, this must be null. PhoneNumber string // Randomly-generated device ID. Should only be generated once per linker. DeviceID string // After the initial link step, if successful, this will be // the SteamGuard data for the account. PLEASE save this somewhere // after generating it; it's vital data. LinkedAccount *SteamGuardAccount // contains filtered or unexported fields }
Handles the linking process for a new mobile authenticator
func NewAuthenticatorLinker ¶
func NewAuthenticatorLinker(session *SessionData) *AuthenticatorLinker
func (*AuthenticatorLinker) AddAuthenticator ¶
func (al *AuthenticatorLinker) AddAuthenticator() error
func (*AuthenticatorLinker) FinalizeAddAuthenticator ¶
func (al *AuthenticatorLinker) FinalizeAddAuthenticator(smsCode string) error
type Confirmation ¶
type SessionData ¶
type SessionData struct { SessionID string SteamLogin string SteamLoginSecure string WebCookie string OAuthToken string SteamID uint64 }
func (*SessionData) AddCookies ¶
func (sd *SessionData) AddCookies(cookies *cookiejar.Jar)
type SteamGuardAccount ¶
type SteamGuardAccount struct { SerialNumber string `json:"serial_number"` RevocationCode string `json:"revocation_code"` URI string `json:"uri"` ServerTime int64 `json:"server_time,string"` AccountName string `json:"account_name"` TokenGID string `json:"token_gid"` IdentitySecret string `json:"identity_secret"` Secret1 string `json:"secret_1"` Status int32 `json:"status"` DeviceID string `json:"device_id"` // Set to true if the authenticator has actually been applied to the account. FullyEnrolled bool `json:"fully_enrolled"` Session *SessionData `json:"session"` }
func (*SteamGuardAccount) AcceptConfirmation ¶
func (a *SteamGuardAccount) AcceptConfirmation(cn *Confirmation) error
func (*SteamGuardAccount) DeactivateAuthenticator ¶
func (a *SteamGuardAccount) DeactivateAuthenticator() error
func (*SteamGuardAccount) DenyConfirmation ¶
func (a *SteamGuardAccount) DenyConfirmation(cn *Confirmation) error
func (*SteamGuardAccount) FetchConfirmations ¶
func (a *SteamGuardAccount) FetchConfirmations() ([]*Confirmation, error)
func (*SteamGuardAccount) GenerateConfirmationQueryParams ¶
func (a *SteamGuardAccount) GenerateConfirmationQueryParams(tag string) (url.Values, error)
func (*SteamGuardAccount) GenerateSteamGuardCode ¶
func (a *SteamGuardAccount) GenerateSteamGuardCode() (string, error)
func (*SteamGuardAccount) GenerateSteamGuardCodeForTime ¶
func (a *SteamGuardAccount) GenerateSteamGuardCodeForTime(t int64) (string, error)
func (*SteamGuardAccount) RefreshSession ¶
func (a *SteamGuardAccount) RefreshSession() error
Refreshes the Steam session. Necessary to perform confirmations if your session has expired or changed.
type UserLogin ¶
type UserLogin struct { Username string Password string SteamID uint64 RequiresCaptcha bool CaptchaGID string CaptchaText string RequiresEmail bool EmailDomain string EmailCode string Requires2FA bool TwoFactorCode string Session *SessionData LoggedIn bool // contains filtered or unexported fields }
Handles logging the user into the mobile Steam website. Necessary to generate OAuth token and session cookies.