Skip to content

Commit d64c1b1

Browse files
authored
Update DataStore encoding
1 parent 1e56923 commit d64c1b1

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

MainModule/Server/Core/Core.luau

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -782,11 +782,20 @@ return function(Vargs, GetEnv)
782782
end;
783783

784784
DataStoreEncode = function(key)
785-
if Core.DS_RESET_SALTS[key] then
786-
key = Core.DS_RESET_SALTS[key] .. key
787-
end
788-
789-
return Functions.Base64Encode(Remote.Encrypt(tostring(key), ("SALT_" .. Settings.DataStoreKey):sub(1,50)))
785+
if Core.DS_RESET_SALTS[key] then
786+
key = Core.DS_RESET_SALTS[key] .. key
787+
end
788+
789+
-- Only consider salting if the key isn't a number (like a player ID) and if the setting isn't true
790+
local IsPlayer = tonumber(key) ~= nil
791+
local SettingIsTrue = server.Settings.DontSaltDataStoreKey == true
792+
local ShouldSaltKey = not IsPlayer and not SettingIsTrue
793+
local EncryptionKey = Settings.DataStoreKey
794+
if ShouldSaltKey then
795+
EncryptionKey = ("SALT_" .. Settings.DataStoreKey):sub(1,50)
796+
end
797+
798+
return Functions.Base64Encode(Remote.Encrypt(tostring(key), EncryptionKey))
790799
end;
791800

792801
SaveData = function(...)

0 commit comments

Comments
 (0)