nadeo

package module
v0.0.0-...-750147f Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: MIT Imports: 11 Imported by: 0

README

gonadeo

Go library to authenticate and communicate with Nadeo's live services.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncResponse

type AsyncResponse struct {
	Buf []byte
	Err error
}

AsyncResponse contains the result of an asynchronous API request.

type Nadeo

type Nadeo interface {
	AuthenticateUbi(email, password string) error
	AuthenticateUbiTicket(ticket string) error
	AuthenticateBasic(username, password string) error
	AuthenticateBasicEmail(email, password, region string) error
	GetTokenInfo() TokenInfo

	Get(url string, cacheTime time.Duration) ([]byte, error)
	Options(url string, cacheTime time.Duration) ([]byte, error)
	Head(url string, cacheTime time.Duration) ([]byte, error)
	Post(url string, data []byte) ([]byte, error)
	Put(url string, data []byte) ([]byte, error)
	Patch(url string, data []byte) ([]byte, error)
	Delete(url string) ([]byte, error)

	GetUncached(url string) ([]byte, error)
	OptionsUncached(url string) ([]byte, error)
	HeadUncached(url string) ([]byte, error)

	AsyncGet(url string, cacheTime time.Duration) chan AsyncResponse
	AsyncOptions(url string, cacheTime time.Duration) chan AsyncResponse
	AsyncHead(url string, cacheTime time.Duration) chan AsyncResponse
	AsyncPost(url string, data []byte) chan AsyncResponse
	AsyncPut(url string, data []byte) chan AsyncResponse
	AsyncPatch(url string, data []byte) chan AsyncResponse
	AsyncDelete(url string) chan AsyncResponse

	AsyncGetUncached(url string) chan AsyncResponse
	AsyncOptionsUncached(url string) chan AsyncResponse
	AsyncHeadUncached(url string) chan AsyncResponse

	CheckRefresh() error

	SetUserAgent(userAgent string)
	SetLogging(enabled bool)
	GetRequestCount() uint64
	SetIdempotency(enabled bool)
	SetTimeout(timeout time.Duration)
}

Nadeo provides access to Nadeo Services.

func NewNadeo

func NewNadeo() Nadeo

NewNadeo creates a new Nadeo object ready for authentication.

func NewNadeoWithAudience

func NewNadeoWithAudience(audience string) Nadeo

NewNadeoWithAudience creates a new Nadeo object ready for authentication with the given audience.

func NewNadeoWithCoreAndAudience

func NewNadeoWithCoreAndAudience(core, audience string) Nadeo

NewNadeoWithCoreAndAudience creates a new Nadeo object ready for authentication with the given core API base URL and audience.

type TokenInfo

type TokenInfo struct {
	Header struct {
		Alg string // "HS256"
		Env string // "trackmania-prod"
		Ver string // "1"
	}

	Payload struct {
		Jti string // Json Web Token ID
		Iss string // "NadeoServices"
		Iat uint32 // Issued At Time
		Rat uint32 // Refresh At Time
		Exp uint32 // Expiration time
		Aud string // "NadeoLiveServices"
		Usg string // "Server"
		Sid string // ?? UUID
		Sub string // ?? UUID
		Aun string // Authenticated login
		Rtk bool   // false
		Pce bool   // false
	}

	Signature []byte
}

TokenInfo contains information about the access token.

type Ubi

type Ubi interface {
	Authenticate(email, password string) error

	Get(url string, useCache bool) (string, error)
	Post(url, data string) (string, error)

	CheckRefresh() error

	GetTicket() string
}

Ubi provides access to the Ubisoft API.

func NewUbi

func NewUbi(appID string) Ubi

NewUbi creates a new Ubi object ready for authentication.

Jump to

Keyboard shortcuts

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