prevent user keys override, will add this later with password change
All checks were successful
Server Build / publish (push) Successful in 29s
Voice Build / publish (push) Successful in 25s

This commit is contained in:
olcxja 2026-05-30 11:01:51 +02:00
commit bcd0e2c0ec

View file

@ -488,8 +488,20 @@ public static async Task Auth(HttpContext context, Func<Task> next, IQueryCollec
body,
AppJsonSerializerContext.Default.Universal2String
);
//string publicKey = serializedBody.string1;
//string privateEncryptedKey = serializedBody.string2;
string existingRaw = await Utils.GetUserKeys(id);
if (!string.IsNullOrWhiteSpace(existingRaw))
{
Universal2String existing = JsonSerializer.Deserialize(
existingRaw,
AppJsonSerializerContext.Default.Universal2String
);
string existingPub = existing.string2?.Trim() ?? "";
string newPub = serializedBody.string2?.Trim() ?? "";
if (!string.IsNullOrEmpty(existingPub) && !string.IsNullOrEmpty(newPub) && existingPub != newPub)
{
return "error:keys.public.mismatch";
}
}
await Utils.UpdateUserKeys(id, body);
return "success:keys.updated";
}