After /tool/signup the client switches to SID-only headers (no UDID), so the next request's body can't be decrypted unless the server already knows the SID's UDID. ShadowverseSessionService now mirrors the client's Cute/Cryptographer.MakeMd5(viewerId + udid) formula (salt "r!I@ws8e5i="), and ToolController.Signup prestores the mapping at the end. Verified against a live signup capture: viewerId=1 + udid=62747917-93bc-454c-abb4-ef423b3c9317 produces the captured SID dc4aac79d35fe15dfb6262e0071bb03c. Note: this only fixes the fresh-signup path. Clients restarting with a cached viewer_id (which skip /tool/signup entirely) still hit the same issue — separate follow-up. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
39 lines
1.4 KiB
C#
39 lines
1.4 KiB
C#
using NUnit.Framework;
|
|
using SVSim.EmulatedEntrypoint.Services;
|
|
|
|
namespace SVSim.UnitTests.Services;
|
|
|
|
public class ShadowverseSessionServiceTests
|
|
{
|
|
/// <summary>
|
|
/// Fixture captured live from a fresh signup against this server. The client computed this
|
|
/// exact SID locally and sent it on the next /check/game_start request. Pinning the formula
|
|
/// here means any future refactor of <see cref="ShadowverseSessionService.ComputeClientSessionId"/>
|
|
/// that drifts from <c>Cute/Cryptographer.MakeMd5(viewerId + udid)</c> will fail this test
|
|
/// before the user discovers it as a decrypt failure on game_start.
|
|
/// </summary>
|
|
[Test]
|
|
public void ComputeClientSessionId_matches_captured_fixture()
|
|
{
|
|
var svc = new ShadowverseSessionService();
|
|
const long viewerId = 1;
|
|
var udid = new System.Guid("62747917-93bc-454c-abb4-ef423b3c9317");
|
|
|
|
string sid = svc.ComputeClientSessionId(viewerId, udid);
|
|
|
|
Assert.That(sid, Is.EqualTo("dc4aac79d35fe15dfb6262e0071bb03c"));
|
|
}
|
|
|
|
[Test]
|
|
public void StoreSessionForViewer_makes_sid_resolvable_to_udid()
|
|
{
|
|
var svc = new ShadowverseSessionService();
|
|
const long viewerId = 1;
|
|
var udid = new System.Guid("62747917-93bc-454c-abb4-ef423b3c9317");
|
|
|
|
svc.StoreSessionForViewer(viewerId, udid);
|
|
|
|
Assert.That(svc.GetUdidFromSessionId("dc4aac79d35fe15dfb6262e0071bb03c"), Is.EqualTo(udid));
|
|
}
|
|
}
|