返回提交历史
Modified
src/controllers/api/loginController.ts
+8
-2
XFEstudio/XFESpaceNinjaServer
chore: smuggle username in NatHash (#3657)
Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/3657 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
a6d2e01c
代码差异
1 个文件
+8
-2
@@ -164,8 +164,14 @@ const createLoginResponse = (request: Request, account: IDatabaseAccountJson, bu
164
164
resp.CountryCode = account.CountryCode;
165
165
} else {
166
166
// U12 and down
167
resp.NatHash =
168
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
167
168
// The NatHash is a 64 byte (128 hexit) value which was presumably used for NRS authentication.
169
// (OpenWF-specific) We can use this to smuggle custom data like the username to NRS.
170
resp.NatHash = Array.from(new TextEncoder().encode("OWF1" + account.DisplayName))
171
.map(byte => byte.toString(16).padStart(2, "0"))
172
.join("")
173
.padEnd(128, "0");
174
169
175
if (version_compare(buildLabel, gameToBuildVersion["7.3.0"]) >= 0) {
170
176
resp.SteamId = "0"; // U5 no likey
171
177
}