auth

package
v0.0.0-...-5d32165 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AndroidUnknownOsType    int32 = -500
	DefaultGamingDeviceType       = 528
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Api

type Api interface {
	GetPublicRsaKey(ctx context.Context, accountName string) (PublicRsaKey, error)
	EncryptAccountPassword(ctx context.Context, accountName string, password string) (EncryptedPassword, error)
	StartSessionWithCredentials(
		ctx context.Context,
		accountName string,
		password EncryptedPassword,
		deviceDetails DeviceDetails,
	) (*steamproto.CAuthentication_BeginAuthSessionViaCredentials_Response, error)
	SubmitSteamGuardCode(ctx context.Context, clientID string, steamID steamid.SteamID, code string) error
	PollSessionStatus(ctx context.Context, clientID string, requestID string) (PollSessionStatusResponse, error)
	GenerateAccessTokenForApp(ctx context.Context, refreshToken string, renew bool) (GenerateAccessTokenResponse, error)
}

type Client

type Client struct {
	Transport api.Transport
}

func (*Client) EncryptAccountPassword

func (c *Client) EncryptAccountPassword(
	ctx context.Context,
	accountName string,
	password string,
) (EncryptedPassword, error)

EncryptAccountPassword Retrieves the RSA key for the specified accountName, and encrypted the given password using the RSA key.

func (*Client) GenerateAccessTokenForApp

func (c *Client) GenerateAccessTokenForApp(
	ctx context.Context,
	refreshToken string,
	renew bool,
) (*steamproto.CAuthentication_AccessToken_GenerateForApp_Response, error)

func (*Client) GetPublicRsaKey

func (c *Client) GetPublicRsaKey(ctx context.Context, accountName string) (*PublicRsaKey, error)

func (*Client) PollSessionStatus

func (c *Client) PollSessionStatus(
	ctx context.Context,
	clientID uint64,
	requestID []byte,
) (*steamproto.CAuthentication_PollAuthSessionStatus_Response, error)

func (*Client) StartSessionWithCredentials

func (c *Client) StartSessionWithCredentials(
	ctx context.Context,
	accountName string,
	password EncryptedPassword,
	deviceDetails DeviceDetails,
) (*steamproto.CAuthentication_BeginAuthSessionViaCredentials_Response, error)

func (*Client) SubmitSteamGuardCode

func (c *Client) SubmitSteamGuardCode(
	ctx context.Context,
	clientID uint64,
	steamID steamid.SteamID,
	code string,
) error

type DeviceDetails

type DeviceDetails struct {
	FriendlyName     string                            `json:"device_friendly_name"`
	PlatformType     steamproto.EAuthTokenPlatformType `json:"platform_type"`
	OsType           int32                             `json:"os_type"`
	GamingDeviceType uint32                            `json:"gaming_device_type"`
}

type EncryptedPassword

type EncryptedPassword struct {
	Base64    string
	TimeStamp uint64
}

type GenerateAccessTokenRequest

type GenerateAccessTokenRequest struct {
	RefreshToken string           `json:"refresh_token"`
	SteamID      steamid.SteamID  `json:"steamid"`
	RenewalType  TokenRenewalType `json:"renewal_type"`
}

func (GenerateAccessTokenRequest) CacheTTL

func (GenerateAccessTokenRequest) EnsureResponseSuccess

func (r GenerateAccessTokenRequest) EnsureResponseSuccess(httpResponse *http.Response) error

func (GenerateAccessTokenRequest) Headers

func (GenerateAccessTokenRequest) Method

func (GenerateAccessTokenRequest) OldValues

func (r GenerateAccessTokenRequest) OldValues() (url.Values, error)

func (GenerateAccessTokenRequest) RequiresApiKey

func (r GenerateAccessTokenRequest) RequiresApiKey() bool

func (GenerateAccessTokenRequest) Retryable

func (r GenerateAccessTokenRequest) Retryable() bool

func (GenerateAccessTokenRequest) Url

func (GenerateAccessTokenRequest) Values

type GenerateAccessTokenResponse

type GenerateAccessTokenResponse struct {
	Response struct {
		AccessToken  string `json:"accessToken"`
		RefreshToken string `json:"refreshToken"`
	} `json:"response"`
}

type GetRsaKeyRequest

type GetRsaKeyRequest struct {
	// contains filtered or unexported fields
}

func (GetRsaKeyRequest) CacheTTL

func (g GetRsaKeyRequest) CacheTTL() time.Duration

func (GetRsaKeyRequest) EnsureResponseSuccess

func (g GetRsaKeyRequest) EnsureResponseSuccess(httpResponse *http.Response) error

func (GetRsaKeyRequest) Headers

func (g GetRsaKeyRequest) Headers() (http.Header, error)

func (GetRsaKeyRequest) Method

func (g GetRsaKeyRequest) Method() string

func (GetRsaKeyRequest) OldValues

func (g GetRsaKeyRequest) OldValues() (url.Values, error)

func (GetRsaKeyRequest) RequiresApiKey

func (g GetRsaKeyRequest) RequiresApiKey() bool

func (GetRsaKeyRequest) Retryable

func (g GetRsaKeyRequest) Retryable() bool

func (GetRsaKeyRequest) Url

func (g GetRsaKeyRequest) Url() string

func (GetRsaKeyRequest) Values

func (g GetRsaKeyRequest) Values() (url.Values, error)

type GetRsaKeyResponse

type GetRsaKeyResponse struct {
	Response struct {
		PublicKeyMod string `json:"publickey_mod"`
		PublicKeyExp string `json:"publickey_exp"`
		Timestamp    string `json:"timestamp"`
	} `json:"response"`
}

type GuardType

type GuardType int
const (
	UnknownGuardType GuardType = iota
	NoneGuardType
	EmailCodeGuardType
	DeviceCodeGuardType
	DeviceConfirmationGuardType
	EmailConfirmationGuardType
	MachineTokenGuardType
	LegacyMachineAuthGuardType
)

type Persistence

type Persistence int
const (
	InvalidSessionPersistence    Persistence = -1
	EphemeralSessionPersistence  Persistence = 0
	PersistentSessionPersistence Persistence = 1
)

type PlatformType

type PlatformType int
const (
	UnknownPlatformType PlatformType = iota
	SteamClientPlatformType
	WebBrowserPlatformType
	MobileAppPlatformType
)

type PollSessionStatusRequest

type PollSessionStatusRequest struct {
	ClientID  uint64
	RequestID []byte
}

func (PollSessionStatusRequest) CacheTTL

func (r PollSessionStatusRequest) CacheTTL() time.Duration

func (PollSessionStatusRequest) EnsureResponseSuccess

func (r PollSessionStatusRequest) EnsureResponseSuccess(httpResponse *http.Response) error

func (PollSessionStatusRequest) Headers

func (r PollSessionStatusRequest) Headers() (http.Header, error)

func (PollSessionStatusRequest) Method

func (r PollSessionStatusRequest) Method() string

func (PollSessionStatusRequest) OldValues

func (r PollSessionStatusRequest) OldValues() (url.Values, error)

func (PollSessionStatusRequest) RequiresApiKey

func (r PollSessionStatusRequest) RequiresApiKey() bool

func (PollSessionStatusRequest) Retryable

func (r PollSessionStatusRequest) Retryable() bool

func (PollSessionStatusRequest) Url

func (PollSessionStatusRequest) Values

func (r PollSessionStatusRequest) Values() (url.Values, error)

type PollSessionStatusResponse

type PollSessionStatusResponse struct {
	Response struct {
		NewClientID          string `json:"new_client_id,omitempty"`
		NewChallenge         string `json:"new_challenge,omitempty"`
		RefreshToken         string `json:"refresh_token,omitempty"`
		AccessToken          string `json:"access_token,omitempty"`
		HadRemoteInteraction bool   `json:"had_remote_interaction,omitempty"`
		AccountName          string `json:"account_name,omitempty"`
	} `json:"response"`
}

type PublicRsaKey

type PublicRsaKey struct {
	PublicKey rsa.PublicKey
	Timestamp uint64
}

type RefreshJwt

type RefreshJwt struct {
	Sub string `json:"sub"`
	Iat int64  `json:"iat,omitempty"`
	Exp int64  `json:"exp,omitempty"`
}

func DecodeSimpleJwt

func DecodeSimpleJwt(jwtString string) (RefreshJwt, error)

type StartSessionRequest

type StartSessionRequest struct {
	AccountName         string
	EncryptedPassword   string
	EncryptionTimestamp uint64
	Persistence         steamproto.ESessionPersistence
	DeviceDetails       DeviceDetails
	Language            uint32
	QosLevel            int32
}

func (StartSessionRequest) CacheTTL

func (r StartSessionRequest) CacheTTL() time.Duration

func (StartSessionRequest) EnsureResponseSuccess

func (r StartSessionRequest) EnsureResponseSuccess(httpResponse *http.Response) error

func (StartSessionRequest) Headers

func (r StartSessionRequest) Headers() (http.Header, error)

func (StartSessionRequest) Method

func (r StartSessionRequest) Method() string

func (StartSessionRequest) OldValues

func (r StartSessionRequest) OldValues() (url.Values, error)

func (StartSessionRequest) RequiresApiKey

func (r StartSessionRequest) RequiresApiKey() bool

func (StartSessionRequest) Retryable

func (r StartSessionRequest) Retryable() bool

func (StartSessionRequest) Url

func (r StartSessionRequest) Url() string

func (StartSessionRequest) Values

func (r StartSessionRequest) Values() (url.Values, error)

type StartSessionResponse

type StartSessionResponse struct {
	Response struct {
		ClientId             string `json:"client_id"`
		RequestId            string `json:"request_id"`
		Interval             int    `json:"interval"`
		SteamId              string `json:"steam_id"`
		WeakToken            string `json:"weak_token,omitempty"`
		AgreementSessionUrl  string `json:"agreement_session_url,omitempty"`
		ExtendedErrorMessage string `json:"extended_error_message,omitempty"`
		AllowedConfirmations []struct {
			ConfirmationType  GuardType `json:"confirmation_type"`
			AssociatedMessage string    `json:"associated_message,omitempty"`
		} `json:"allowed_confirmations,omitempty"`
	} `json:"response"`
}

type TokenRenewalType

type TokenRenewalType int
const (
	NoneRenewalType TokenRenewalType = iota
	AllowRenewalType
)

type UpdateSessionWithSteamGuardCodeRequest

type UpdateSessionWithSteamGuardCodeRequest struct {
	ClientID uint64
	SteamID  string
	Code     string
	CodeType GuardType
}

func (UpdateSessionWithSteamGuardCodeRequest) CacheTTL

func (UpdateSessionWithSteamGuardCodeRequest) EnsureResponseSuccess

func (r UpdateSessionWithSteamGuardCodeRequest) EnsureResponseSuccess(httpResponse *http.Response) error

func (UpdateSessionWithSteamGuardCodeRequest) Headers

func (UpdateSessionWithSteamGuardCodeRequest) Method

func (UpdateSessionWithSteamGuardCodeRequest) OldValues

func (UpdateSessionWithSteamGuardCodeRequest) RequiresApiKey

func (r UpdateSessionWithSteamGuardCodeRequest) RequiresApiKey() bool

func (UpdateSessionWithSteamGuardCodeRequest) Retryable

func (UpdateSessionWithSteamGuardCodeRequest) Url

func (UpdateSessionWithSteamGuardCodeRequest) Values

Jump to

Keyboard shortcuts

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