golt

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClientID              = "com_jagex_auth_desktop_launcher"
	StandardLoginClientID = "1fddee4e-b100-4f4e-b2b0-097f9088f9d2"
	LoginProvider         = "runescape"
	AuthUrl               = "https://account.jagex.com/oauth2/auth"
	TokenUrl              = "https://account.jagex.com/oauth2/token"
	RedirectUrl           = "https://secure.runescape.com/m=weblogin/launcher-redirect"
	ApiUrl                = "https://api.jagex.com/v1"
	ProfileApiUrl         = "https://secure.jagex.com/rs-profile/v1"
	ShieldUrl             = "https://auth.jagex.com/shield/oauth/token"
	GameSessionApiUrl     = "https://auth.jagex.com/game-session/v1"
	OsrsBasicAuthHeader   = "Basic Y29tX2phZ2V4X2F1dGhfZGVza3RvcF9vc3JzOnB1YmxpYw=="
)

Variables

This section is empty.

Functions

func Die

func Die(err error)

func Exchange

func Exchange(code string) (*oauth2.Token, error)

func GetGameSession

func GetGameSession(idToken string) (string, error)

func LaunchGame

func LaunchGame(sessionId string, account *Account) error

func Login

func Login() error

func ParseIdToken

func ParseIdToken(idToken string) (map[string]interface{}, error)

func ParseIntentPayload

func ParseIntentPayload(payload string) map[string]string

func ReadFromConfigFile

func ReadFromConfigFile(filename string) (string, error)

func WriteToConfigFile

func WriteToConfigFile(content string, filename string) error

Types

type Account

type Account struct {
	AccountId   string `json:"accountId"`
	DisplayName string `json:"displayName"`
	UserHash    string `json:"userHash"`
}

func GetAccounts

func GetAccounts(sessionId string) ([]Account, error)

func GetChosenAccount

func GetChosenAccount(user *UserDetails, accounts []Account) (*Account, error)

func (Account) FilterValue

func (i Account) FilterValue() string

type NoAccountChosenError

type NoAccountChosenError struct{}

func (*NoAccountChosenError) Error

func (e *NoAccountChosenError) Error() string

type Tuple

type Tuple[T1 any, T2 any] struct {
	First  T1
	Second T2
}

func StandardLogin

func StandardLogin(idToken string) (*Tuple[string, string], error)

type UserDetails

type UserDetails struct {
	DisplayName string `json:"displayName"`
	Id          string `json:"id"`
	Suffix      string `json:"suffix"`
	UserId      string `json:"userId"`
}

func GetUserDetails

func GetUserDetails(sub string, accessToken string) (*UserDetails, error)

Jump to

Keyboard shortcuts

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