mobileauth

package module
v0.0.0-...-589e48e Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2016 License: MIT Imports: 20 Imported by: 4

README

GoDoc

A Go library that provides Steam Mobile Authenticator functionality

This is a Go port of C# SteamAuth library

Documentation

Index

Constants

View Source
const UrlCommunityBase string = "https://steamcommunity.com"
View Source
const UrlConfirmationService string = UrlCommunityBase + "/mobileconf"
View Source
const UrlMobileAuthService string = UrlSteamApiBase + "/IMobileAuthService"
View Source
const UrlSteamApiBase string = "https://api.steampowered.com"
View Source
const UrlTwoFactorService string = UrlSteamApiBase + "/ITwoFactorService"

Variables

View Source
var ErrAuthenticatorPresent = errors.New("authenticator already present")

ErrAuthenticatorPresent is returned by AddAuthenticator

View Source
var ErrBadCredentials = errors.New("bad credentials")

ErrBadCredentials is returned by DoLogin when steam fails to authenticate us

View Source
var ErrBadRSA = errors.New("bad RSA")

ErrBadRSA is returned by DoLogin when steam returns success false to rsa public key request

View Source
var ErrBadSMSCode = errors.New("bad sms code")

ErrBadSMSCode is returned by FinalizeAddAuthenticator when steam rejects supplied SMS code

View Source
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

View Source
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

View Source
var ErrNeed2FA = errors.New("need 2FA")

ErrNeed2FA is returned by DoLogin when mobile code is required

View Source
var ErrNeedCaptcha = errors.New("need captcha")

ErrNeedCaptcha is returned by DoLogin when captcha code is required

View Source
var ErrNeedEmail = errors.New("need email")

ErrNeedEmail is returned by DoLogin when email code is required

View Source
var ErrTooManyFailedLogins = errors.New("two many failed logins")

ErrNeedTooManyFailedLogins is returned by DoLogin

View Source
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

func MobileLoginRequest

func MobileLoginRequest(queryUrl, method string, params *url.Values, cookies *cookiejar.Jar, headers *map[string]string) ([]byte, error)

Perform a mobile login request Method must be GET or POST Returns response body

func WebRequest

func WebRequest(queryUrl, method string, params *url.Values, cookies *cookiejar.Jar, headers *map[string]string, referer *string) ([]byte, error)

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 Confirmation struct {
	ConfirmationID          string
	ConfirmationKey         string
	ConfirmationDescription string
}

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 {
	SharedSecret   string `json:"shared_secret"`
	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.

func NewUserLogin

func NewUserLogin(username, password string) *UserLogin

func (*UserLogin) DoLogin

func (ul *UserLogin) DoLogin() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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