api

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2023 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	STEAM_AUTH_REQUEST_ERROR = iota + 100000
	ENCRYPT_RSA_ERROR
	GET_RSA_PUBLIC_KEY_ERROR
	BEGIN_AUTH_SESSION_VIA_CREDENTIALS_ERROR
	AUTH_INVALID_CREDENTIALS_ERROR
	UPDATE_AUTH_SESSION_WITH_STEAM_GUARD_CODE_ERROR
	POLL_AUTH_SESSION_ERROR
	CONFIRM_AUTH_SESSION_FAIL
	REQUEST_LOGIN_FROM_MOBILE_ERROR
	STEAM_COMMUNITY_DO_LOGIN_ERROR
	STEAM_COMMUNITY_FINALIZE_LOGIN_ERROR
	STEAM_COMMUNITY_FINALIZE_LOGIN_FAIL
)
View Source
const (
	STEAM_COMMUNITY_LOGIN_URL            = STEAM_COMMUNITY_WEB_BASE + "/login?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client"
	STEAM_COMMUNITY_MOBILE_REQUEST_REFER = STEAM_COMMUNITY_LOGIN_URL + "/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client"

	STEAM_COMMUNITY_LOGIN_GET_RSAKEY = STEAM_COMMUNITY_WEB_BASE + "/login/getrsakey"
	STEAM_COMMUNITY_DO_LOGIN         = STEAM_COMMUNITY_WEB_BASE + "/login/dologin"
)
View Source
const (
	STEAM_API_WEB_BASE       = "https://api.steampowered.com"
	STEAM_COMMUNITY_WEB_BASE = "https://steamcommunity.com"
	STEAM_STORE_WEB_BASE     = "https://store.steampowered.com"
	STEAM_LOGIN_WEB_BASE     = "https://login.steampowered.com"
	STEAM_HELP_WEB_BASE      = "https://help.steampowered.com"

	STEAM_MOBILE_REQUEST_REFER = STEAM_COMMUNITY_WEB_BASE + "/mobilelogin?oauth_client_id=DE45CD61&oauth_scope=read_profile%20write_profile%20read_client%20write_client"
)
View Source
const (
	STEAM_REQUEST_OK = iota
	STEAM_REQUEST_FAIL
	STEAM_REQUEST_ERROR
	STEAM_REQUEST_RETRY
	STEAM_REQUEST_FREQ
	STEAM_REQUEST_INCOMP
)
View Source
const (
	STEAM_PHONE_GUARD_WEBAPI      = STEAM_COMMUNITY_WEB_BASE + "/steamguard/phoneajax"
	STEAM_PHONE_VALIDATION_WEBAPI = STEAM_STORE_WEB_BASE + "/phone/validate"
	STEAM_PHONE_ADD_WEBAPI        = STEAM_STORE_WEB_BASE + "/phone/add_ajaxop"
)
View Source
const (
	STEAM_GUARD_REQUEST_ERROR = iota + 200000
	STEAM_GUARD_VALIDATE_PHONE_NUMBER_FAIL
	STEAM_GUARD_NO_PHONE_ATTACHED
	STEAM_GUARD_CHECK_SMS_CODE_FAIL
	STEAM_GUARD_RESEND_SMS_CODE_FAIL
	STEAM_GUARD_EMAIL_CONFIRMATION_FAIL
	STEAM_GUARD_ADD_PHONE_FAIL
)
View Source
const (
	STEAM_HELP_CHANGE_PASSWORD               = STEAM_HELP_WEB_BASE + "/wizard/HelpChangePassword?redir=store/account"
	STEAM_HELP_WITH_LOGIN_INFO_ENTER_CODE    = STEAM_HELP_WEB_BASE + "/wizard/HelpWithLoginInfoEnterCode"
	STEAM_SEND_ACCOUNT_RECOVERY_CODE         = STEAM_HELP_WEB_BASE + "/wizard/AjaxSendAccountRecoveryCode"
	STEAM_POLL_ACCOUNT_RECOVERY_CONFIRMATION = STEAM_HELP_WEB_BASE + "/wizard/AjaxPollAccountRecoveryConfirmation"
	STEAM_VERIFY_ACCOUNT_RECOVERY_CODE       = STEAM_HELP_WEB_BASE + "/wizard/AjaxVerifyAccountRecoveryCode"
	STEAM_ACCOUNT_RECOVERY_GET_NEXT_STEP     = STEAM_HELP_WEB_BASE + "/wizard/AjaxAccountRecoveryGetNextStep"
	STEAM_ACCOUNT_RECOVERY_VERIFY_PASSWORD   = STEAM_HELP_WEB_BASE + "/wizard/AjaxAccountRecoveryVerifyPassword"
	STEAM_CHECK_PASSWORD_AVAILABLE           = STEAM_HELP_WEB_BASE + "/wizard/AjaxCheckPasswordAvailable"
	STEAM_ACCOUNT_RECOVERY_CHANGE_PASSWORD   = STEAM_HELP_WEB_BASE + "/wizard/AjaxAccountRecoveryChangePassword"
)
View Source
const (
	STEAM_HELP_REQUEST_ERROR = iota + 200000
	RECEIVE_PASSWORD_CHANGE_PARAMS_ERROR
	LOGIN_INFO_ENTER_CODE_ERROR
	SEND_ACCOUNT_RECOVERY_CODE_ERROR
	POLL_ACCOUNT_RECOVERY_CONFIRMATION_ERROR
	VERIFY_ACCOUNT_RECOVERY_CODE_ERROR
	RECOVER_VERIFY_PASSWORD_ERROR
	GET_NEXT_STEP_FOR_ACCOUNT_RECOVERY_ERROR
	CHECK_PASSWORD_AVAILABLE_ERROR
	CHANGE_PASSWORD_REQUEST_ERROR
	CHANGE_PASSWORD_REQUEST_FAIL
)
View Source
const (
	STEAM_USER_DATA_WEBAPI               = STEAM_STORE_WEB_BASE + "/dynamicstore/userdata"
	STEAM_REGISTER_CDKEY_WEBAPI          = STEAM_STORE_WEB_BASE + "/account/ajaxregisterkey"
	STEAM_REDEEM_WALLET_CODE_WEBAPI      = STEAM_STORE_WEB_BASE + "/account/ajaxredeemwalletcode"
	STEAM_DEAUTHORIZE_ALL_DEVICES_WEBAPI = STEAM_STORE_WEB_BASE + "/twofactor/manage_action"
	STEAM_ADD_FREE_LICENSE_WEBAPI        = "https://checkout.steampowered.com/checkout/addfreelicense"
)
View Source
const (
	STEAM_STORE_REQUEST_ERROR = iota + 300000
	REGISTER_CDKEY_ERROR
	REGISTER_CDKEY_INCOMPATIBLE_ERROR
	REGISTER_CDKEY_ALREADY_ACTIVATED_IN_THIS_ACCOUNT
	REGISTER_CDKEY_ALREADY_ACTIVATED_IN_OTHER_ACCOUNT
	REGISTER_CDKEY_INVALID_KEY
	REGISTER_CDKEY_ACCOUNT_REGION_INCONSISTENT
	REGISTER_CDKEY_ACCOUNT_NEED_MAIN_GAME
	REGISTER_CDKEY_ACCOUNT_TOO_MANY_REQUEST
)
View Source
const (
	STEAM_CONFIRM_FROM_MOBILE_WEBAPI           = STEAM_COMMUNITY_WEB_BASE + "/mobileconf/ajaxop"
	STEAM_GET_CONFIRMATIONS_FROM_MOBILE_WEBAPI = STEAM_COMMUNITY_WEB_BASE + "/mobileconf/getlist"
)
View Source
const (
	STEAM_TRADE_REQUEST_ERROR = iota + 400000
	CONFIRM_FROM_MOBILE_ERROR
	GET_CONFIRMATIONS_FROM_MOBILE_ERROR
)
View Source
const (
	STEAM_TWOFACTOR_REQUEST_ERROR = iota + 500000
	STEAM_INVALID_SMS_CODE
	STEAM_UNABLE_TO_GENERATE_CORRECT_CODE
)
View Source
const (
	STEAM_ADD_AUTHENTICATOR_WEBAPI_V1      = STEAM_API_WEB_BASE + "/ITwoFactorService/AddAuthenticator/v0001"
	STEAM_FINALIZE_AUTHENTICATOR_WEBAPI_V1 = STEAM_API_WEB_BASE + "/ITwoFactorService/FinalizeAddAuthenticator/v0001"
	STEAM_REMOVE_AUTHENTICATOR_WEBAPI_V1   = STEAM_API_WEB_BASE + "/ITwoFactorService/RemoveAuthenticator/v0001"

	STEAM_QUERY_TIME_WEBAPI_V1 = STEAM_API_WEB_BASE + "/ITwoFactorService/QueryTime/v0001?steamid=0"
)
View Source
const STEAM_BEGIN_AUTHSESSION_VIA_CREDENTIALS_WEBAPI_V1 = STEAM_API_WEB_BASE + "/IAuthenticationService/BeginAuthSessionViaCredentials/v1"
View Source
const STEAM_GET_PASSWORD_RSAPUBLICKEY_WEBAPI_V1 = STEAM_API_WEB_BASE + "/IAuthenticationService/GetPasswordRSAPublicKey/v1"
View Source
const (
	STEAM_LOGIN_FINALIZE_LOGIN = STEAM_LOGIN_WEB_BASE + "/jwt/finalizelogin"
)
View Source
const (
	STEAM_PARENTAL_REQUEST_ERROR = iota + 600000
)
View Source
const (
	STEAM_PARENTAL_UNLOCK_WEBAPI = STEAM_COMMUNITY_WEB_BASE + "/parental/ajaxunlock"
)
View Source
const STEAM_POLL_AUTHSESSION_STATUS_WEBAPI_V1 = STEAM_API_WEB_BASE + "/IAuthenticationService/PollAuthSessionStatus/v1"
View Source
const STEAM_UPDATE_AUTHSESSION_WITH_STEAM_GUARD_CODE_WEBAPI_V1 = STEAM_API_WEB_BASE + "/IAuthenticationService/UpdateAuthSessionWithSteamGuardCode/v1"

Variables

View Source
var (
	TWO_FACTOR_BASE       = STEAM_API_WEB_BASE + "/ITwoFactorService/%s/v0001"
	TWO_FACTOR_TIME_QUERY = strings.ReplaceAll(TWO_FACTOR_BASE, "%s", "QueryTime")
)

Functions

func AddFreeLicense added in v0.0.5

func AddFreeLicense(session SteamCommunitySession, licenseId string) *status.Exception

func AddPhoneNumber

func AddPhoneNumber(session SteamCommunitySession, phoneNumber string) *status.Exception

func ChangePassword

func ChangePassword(session SteamCommunitySession, auth Authenticator, username, password, newPassword string) (bool, *status.Exception)

func CheckEmailConfirmation

func CheckEmailConfirmation(session SteamCommunitySession, repeat bool) *status.Exception

func CheckSMSCode

func CheckSMSCode(session SteamCommunitySession, smsCode string) *status.Exception

func ConfirmByTradeOfferIdFromMobile

func ConfirmByTradeOfferIdFromMobile(session SteamCommunitySession, auth Authenticator, tradeOfferId int64) (bool, *status.Exception)

func ConfirmFromMobile

func ConfirmFromMobile(session SteamCommunitySession, auth Authenticator, confirmation MobileConfirmation) (bool, *status.Exception)

func DeauthorizeAllDevices added in v0.0.3

func DeauthorizeAllDevices(session SteamCommunitySession) *status.Exception

func FinalizeAuthenticator

func FinalizeAuthenticator(request FinalizeAuthenticatorRequest) (ok bool, err *status.Exception)

func GetAccountId added in v0.0.10

func GetAccountId(session SteamCommunitySession) (accountId string, err *status.Exception)

func GetCurrentSteamChunk

func GetCurrentSteamChunk() (int64, *status.Exception)

func GetSteamTime

func GetSteamTime() (t int64, err *status.Exception)

func GetTwoFactor

func GetTwoFactor(sharedSecret string) (tfa string, err *status.Exception)

func IsNeedParentalLock

func IsNeedParentalLock(session SteamCommunitySession) (bool, *status.Exception)

func RedeemWalletCode

func RedeemWalletCode(session *SteamCommunitySession, code string) (bool, *status.Exception)

func RegisterCDKey

func RegisterCDKey(session SteamCommunitySession, cdKey string) (bool, *status.Exception)

func RemoveAuthenticator

func RemoveAuthenticator(request RemoveAuthenticatorRequest) (ok bool, err *status.Exception)

func ResendSMSCode

func ResendSMSCode(session SteamCommunitySession) *status.Exception

func UnlockParentalLock

func UnlockParentalLock(session *SteamCommunitySession, code string) (bool, *status.Exception)

func ValidatePhoneNumber

func ValidatePhoneNumber(session SteamCommunitySession, phoneNumber string) *status.Exception

Types

type AddAuthenticatorRequest

type AddAuthenticatorRequest struct {
	DeviceId    string
	SteamId     uint64
	AccessToken string
}

type Authenticator

type Authenticator struct {
	SharedSecret   string `json:"shared_secret"`
	SerialNumber   string `json:"serial_number"`
	RevocationCode string `json:"revocation_code"`
	Uri            string `json:"uri"`
	ServerTime     string `json:"server_time"`
	AccountName    string `json:"account_name"`
	TokenGid       string `json:"token_gid"`
	IdentitySecret string `json:"identity_secret"`
	Secret1        string `json:"secret_1"`
	Status         int    `json:"status"`
	DeviceId       string `json:"device_id"`
	SteamId        string `json:"steam_id"`
	FullyEnrolled  bool   `json:"fully_enrolled"`
}

func AddAuthenticator

func AddAuthenticator(request AddAuthenticatorRequest) (auth Authenticator, err *status.Exception)

type BeginLoginRequest

type BeginLoginRequest struct {
	SteamId   uint64
	ClientId  uint64
	Username  string
	Password  string
	EmailCode string
	TwoFactor string
}

type BeginLoginResponse

type BeginLoginResponse struct {
	Success            bool
	LoginComplete      bool
	SteamId            uint64
	ClientId           uint64
	RequestId          []byte
	EmailCodeNeeded    bool
	EmailConfirmation  bool
	TwoFactorNeeded    bool
	DeviceConfirmation bool
	WeakToken          string
}

func LoginFromMobile

func LoginFromMobile(request BeginLoginRequest) (response BeginLoginResponse, err *status.Exception)

type ChangePasswordResponse

type ChangePasswordResponse struct {
	Hash     string `json:"hash"`
	ErrorMsg string `json:"errorMsg"`
}

type ConfirmLoginRequest

type ConfirmLoginRequest struct {
	SessionId        string
	SteamId          uint64
	ClientId         uint64
	RequestId        []byte
	EmailCode        string
	EmailCodeNeeded  bool
	TwoFactor        string
	DeviceCodeNeeded bool
}

type ConfirmLoginResponse

type ConfirmLoginResponse struct {
	Success      bool
	SessionId    string
	SteamId      uint64
	ClientId     uint64
	AccessToken  string
	RefreshToken string
}

func ConfirmLogin

func ConfirmLogin(request ConfirmLoginRequest) (response ConfirmLoginResponse, err *status.Exception)

type ConfirmResponse

type ConfirmResponse struct {
	Success bool `json:"success"`
}

type EncryptedPasswordData

type EncryptedPasswordData struct {
	Username        string
	Password        string
	EncryptPassword string
	Timestamp       uint64
}

func EncryptPasswordWithRSA

func EncryptPasswordWithRSA(username, password string) (data EncryptedPasswordData, err *status.Exception)

type FinalizeAuthenticatorRequest

type FinalizeAuthenticatorRequest struct {
	SteamId     uint64
	SmsCode     string
	PhoneNum    string
	GuardCode   string
	AccessToken string
}

type FinalizeLoginCommunityRequest

type FinalizeLoginCommunityRequest struct {
	SessionId    string
	SteamId      uint64
	ClientId     uint64
	RefreshToken string
	AccessToken  string
}

type FinalizeLoginCommunityResponse

type FinalizeLoginCommunityResponse struct {
	SessionId string
	Cookies   []*http.Cookie
}

func FinalizeLoginCommunity added in v0.0.12

func FinalizeLoginCommunity(request FinalizeLoginCommunityRequest) (response FinalizeLoginCommunityResponse, err *status.Exception)

func FinalizeLoginCommunityFromMobile

func FinalizeLoginCommunityFromMobile(request FinalizeLoginCommunityRequest) (response FinalizeLoginCommunityResponse, err *status.Exception)

type GuardCheckResponse

type GuardCheckResponse struct {
	Success bool `json:"success"`
}

type LoginCommunityRequest

type LoginCommunityRequest struct {
	SessionId     string
	SteamId       string
	Username      string
	Password      string
	EmailCode     string
	TwoFactorCode string
	CaptchaGid    string
	CaptchaText   string
}

type LoginCommunityResponse

type LoginCommunityResponse struct {
	SessionId          string             `json:"sessionId"`
	Success            bool               `json:"success"`
	LoginComplete      bool               `json:"login_complete"`
	TransferParams     transferParameters `json:"transfer_parameters"`
	CaptchaNeeded      bool               `json:"captcha_needed"`
	EmailSteamId       string             `json:"emailsteamid"`
	EmailAuthNeeded    bool               `json:"emailauth_needed"`
	RequiresTwoFactor  bool               `json:"requires_twofactor"`
	ClearPasswordField bool               `json:"clear_password_field"`
	Message            string             `json:"message"`
	Session            SteamCommunitySession
}

func LoginCommunityFromMobile

func LoginCommunityFromMobile(request LoginCommunityRequest) (result LoginCommunityResponse, err *status.Exception)

type MobileConfirmation

type MobileConfirmation struct {
	Id        string `json:"id"`
	Type      int    `json:"type"`
	CreatorId string `json:"creator_id"`
	Nonce     string `json:"nonce"`
}

func GetMobileConfirmations

func GetMobileConfirmations(session SteamCommunitySession, auth Authenticator) ([]MobileConfirmation, *status.Exception)

type MobileConfirmationsResponse

type MobileConfirmationsResponse struct {
	Success bool                 `json:"success"`
	Conf    []MobileConfirmation `json:"conf"`
}

type PasswordChangeParams

type PasswordChangeParams struct {
	S            int `json:"s"`
	Account      int `json:"account"`
	Reset        int `json:"reset"`
	Issueid      int `json:"issueid"`
	Lost         int `json:"lost"`
	NeedPassword int `json:"need_password"`
}

type PollAccountRecoveryConfirmation

type PollAccountRecoveryConfirmation struct {
	Success  bool `json:"success"`
	Continue bool `json:"continue"`
}

type RecoveryPasswordResponse

type RecoveryPasswordResponse struct {
	Hash     string `json:"hash"`
	ErrorMsg string `json:"errorMsg"`
}

type RemoveAuthenticatorRequest

type RemoveAuthenticatorRequest struct {
	RevocationCode string
	Scheme         int
	SteamId        uint64
	AccessToken    string
}

type RsaKeyResponse

type RsaKeyResponse struct {
	Success      bool   `json:"success"`
	PublickeyMod string `json:"publickey_mod"`
	PublickeyExp string `json:"publickey_exp"`
	Timestamp    string `json:"timestamp"`
	TokenGid     string `json:"token_gid"`
}

type SendAccountRecoveryCodeResponse

type SendAccountRecoveryCodeResponse struct {
	Success bool `json:"success"`
}

type SteamCommunitySession

type SteamCommunitySession struct {
	SessionId        string `json:"sessionid"`
	SteamId          string `json:"steamid"`
	WebCookie        string `json:"webcookie"`
	WgToken          string `json:"wgtoken"`
	WgTokenSecure    string `json:"wgtoken_secure"`
	SteamLogin       string
	SteamLoginSecure string
	Cookies          []*http.Cookie
}

type TimeQuery

type TimeQuery struct {
	Response struct {
		ServerTime                        string `json:"server_time"`
		SkewToleranceSeconds              string `json:"skew_tolerance_seconds"`
		LargeTimeJink                     string `json:"large_time_jink"`
		ProbeFrequencySeconds             int    `json:"probe_frequency_seconds"`
		AdjustedTimeProbeFrequencySeconds int    `json:"adjusted_time_probe_frequency_seconds"`
		HintProbeFrequencySeconds         int    `json:"hint_probe_frequency_seconds"`
		SyncTimeout                       int    `json:"sync_timeout"`
		TryAgainSeconds                   int    `json:"try_again_seconds"`
		MaxAttempts                       int    `json:"max_attempts"`
	} `json:"response"`
}

type UserData

type UserData struct {
	OwnedApps []int `json:"rgOwnedApps"`
}

func GetUserData

func GetUserData(session SteamCommunitySession) (useData UserData, err *status.Exception)

type VerifyAccountRecoveryCodeResponse

type VerifyAccountRecoveryCodeResponse struct {
	Hash     string `json:"hash"`
	ErrorMsg string `json:"errorMsg"`
}

Jump to

Keyboard shortcuts

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