diff --git a/README.md b/README.md index a429df3..3a98c74 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,14 @@ Comprehensive examples are available in the [`examples`](examples) directory. go get github.com/dank/rlapi ``` +### Game Version +The SDK ships with the game version, feature set, and build secret of the latest known build. These change with every game update, so they can be overridden without waiting for a new release: +```go +psynet := rlapi.NewPsyNet() +psynet.SetVersion("", "") +psynet.SetBuildSecret("") +``` + ### Authentication Rocket League authentication always goes through [Epic Online Services (EOS)](https://dev.epicgames.com/docs/web-api-ref/authentication), either via the Epic Games Store (EGS) or by exchanging a Steam session ticket for an EOS token. @@ -86,6 +94,7 @@ _(Values may be outdated)_ | PsySig | ✅ | ✅ | | Base64-encoded HMAC signature of the body | | PsyBuildID | ✅ | ✅ | 151471783 | Varies by build | | PsyEnvironment | ✅ | ✅ | Prod | Varies by build | +| PsyBuildSecret | ✅ | | | Varies by build | | FeatureSet | ✅ | | PrimeUpdate55_1 | Varies by build | | User-Agent | | ✅ | RL Win/250811.43331.492665 gzip | Varies by build | | User-Agent | ✅ | | RL Win/250811.43331.492665 gzip (x86_64-pc-win32) curl-7.67.0 Schannel | Varies by build | @@ -110,6 +119,7 @@ The base URL for HTTP requests is: `https://api.rlpp.psynet.gg/rpc/`. PsyRequestID: PsyNetMessage_X_0 PsyBuildID: 151471783 PsyEnvironment: Prod +PsyBuildSecret: User-Agent: User-Agent: RL Win/250811.43331.492665 gzip (x86_64-pc-win32) curl-7.67.0 Schannel PsySig: Content-Type: application/x-www-form-urlencoded diff --git a/psynet.go b/psynet.go index a106c1e..b963f05 100644 --- a/psynet.go +++ b/psynet.go @@ -44,6 +44,7 @@ type PsyNet struct { gameVersion string featureSet string buildID string + buildSecret string } type PsyRequest struct { @@ -74,6 +75,7 @@ func NewPsyNet() *PsyNet { gameVersion: gameVersion, featureSet: featureSet, buildID: strconv.Itoa(int(decodeBuildID(gameVersion))), + buildSecret: buildSecret, } } @@ -86,6 +88,7 @@ func NewPsyNetWithLogger(logger *slog.Logger) *PsyNet { gameVersion: gameVersion, featureSet: featureSet, buildID: strconv.Itoa(int(decodeBuildID(gameVersion))), + buildSecret: buildSecret, } } @@ -105,6 +108,16 @@ func (p *PsyNet) GetVersion() (gameVersion, featureSet string) { return p.gameVersion, p.featureSet } +// SetBuildSecret overrides the default PsyBuildSecret sent with HTTP requests. +func (p *PsyNet) SetBuildSecret(buildSecret string) { + p.buildSecret = buildSecret +} + +// GetBuildSecret returns the current build secret. +func (p *PsyNet) GetBuildSecret() string { + return p.buildSecret +} + func (p *PsyNet) establishSocket(url string, playerID PlayerID, psyToken string, sessionID string) (*PsyNetRPC, error) { p.logger.Debug("establishing websocket connection", slog.String("url", url)) @@ -144,7 +157,7 @@ func (p *PsyNet) postJSON(path []string, params interface{}, result interface{}) req.Header.Set("PsyEnvironment", "Prod") req.Header.Set("PsyRequestID", p.requestID.getID()) req.Header.Set("PsySig", generatePsySig(body)) - req.Header.Set("PsyBuildSecret", buildSecret) + req.Header.Set("PsyBuildSecret", p.buildSecret) resp, err := p.client.Do(req) if err != nil {