Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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("<game version>", "<feature set>")
psynet.SetBuildSecret("<build secret>")
```

### 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.

Expand Down Expand Up @@ -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 |
Expand All @@ -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: <build secret>
User-Agent: User-Agent: RL Win/250811.43331.492665 gzip (x86_64-pc-win32) curl-7.67.0 Schannel
PsySig: <HMAC signature>
Content-Type: application/x-www-form-urlencoded
Expand Down
15 changes: 14 additions & 1 deletion psynet.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type PsyNet struct {
gameVersion string
featureSet string
buildID string
buildSecret string
}

type PsyRequest struct {
Expand Down Expand Up @@ -74,6 +75,7 @@ func NewPsyNet() *PsyNet {
gameVersion: gameVersion,
featureSet: featureSet,
buildID: strconv.Itoa(int(decodeBuildID(gameVersion))),
buildSecret: buildSecret,
}
}

Expand All @@ -86,6 +88,7 @@ func NewPsyNetWithLogger(logger *slog.Logger) *PsyNet {
gameVersion: gameVersion,
featureSet: featureSet,
buildID: strconv.Itoa(int(decodeBuildID(gameVersion))),
buildSecret: buildSecret,
}
}

Expand All @@ -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))

Expand Down Expand Up @@ -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 {
Expand Down
Loading