From 8da01725632f4f6a2804b06d337315241365df80 Mon Sep 17 00:00:00 2001 From: dingo Date: Mon, 2 Mar 2026 07:15:30 -0500 Subject: [PATCH] =?UTF-8?q?fix:=20PackedByteArray=20cannot=20be=20const=20?= =?UTF-8?q?in=20GDScript=20=E2=80=94=20move=20key=20halves=20inline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude Co-Authored-By: Happy --- .../scenes/login/login_screen.gd | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Client/origin-client/scenes/login/login_screen.gd b/Client/origin-client/scenes/login/login_screen.gd index 5a1b762..2b99173 100644 --- a/Client/origin-client/scenes/login/login_screen.gd +++ b/Client/origin-client/scenes/login/login_screen.gd @@ -32,16 +32,6 @@ extends Control const _CREDS_PATH := "user://creds.dat" -# Key halves — XOR'd together at runtime so the plaintext key is never a -# contiguous literal in the binary. Both halves must be exactly 16 bytes. -const _KEY_A := PackedByteArray([ - 0x7A, 0x4D, 0x9F, 0x2C, 0xB8, 0x61, 0xE3, 0x5A, - 0x0F, 0xC7, 0x94, 0x3B, 0xD6, 0x2E, 0x81, 0xF5, -]) -const _KEY_B := PackedByteArray([ - 0x4C, 0xA9, 0x73, 0x1E, 0x5B, 0xD8, 0x06, 0x92, - 0xE7, 0x3F, 0xC4, 0x6A, 0x17, 0x85, 0xB0, 0x2D, -]) # ── State ───────────────────────────────────────────────────────────────────── @@ -174,11 +164,21 @@ func _friendly_error(code: String, message: String) -> String: # ── Credential storage (AES-256-CBC) ───────────────────────────────────────── func _build_key() -> PackedByteArray: + # Key halves XOR'd at runtime so the plaintext key is never a contiguous + # literal in the binary. + var a := PackedByteArray([ + 0x7A, 0x4D, 0x9F, 0x2C, 0xB8, 0x61, 0xE3, 0x5A, + 0x0F, 0xC7, 0x94, 0x3B, 0xD6, 0x2E, 0x81, 0xF5, + ]) + var b := PackedByteArray([ + 0x4C, 0xA9, 0x73, 0x1E, 0x5B, 0xD8, 0x06, 0x92, + 0xE7, 0x3F, 0xC4, 0x6A, 0x17, 0x85, 0xB0, 0x2D, + ]) var key := PackedByteArray() key.resize(32) for i in 16: - key[i] = _KEY_A[i] ^ (i * 0x11) - key[i + 16] = _KEY_B[i] ^ (i * 0x11) + key[i] = a[i] ^ (i * 0x11) + key[i + 16] = b[i] ^ (i * 0x11) return key