Testing more garbage encryption

This commit is contained in:
gamer147
2024-09-07 22:14:24 -04:00
parent f7657c2ec4
commit 7e4bce9ac5
32 changed files with 783 additions and 51 deletions

View File

@@ -0,0 +1,30 @@
using SVSim.EmulatedEntrypoint.Constants;
using SVSim.EmulatedEntrypoint.Security;
using SVSim.EmulatedEntrypoint.Services;
namespace SVSim.EmulatedEntrypoint.Middlewares;
/// <summary>
/// Maps an incoming request's session id to a udid if both are present.
/// </summary>
public class SessionidMappingMiddleware : IMiddleware
{
private readonly ShadowverseSessionService _shadowverseSessionService;
public SessionidMappingMiddleware(ShadowverseSessionService shadowverseSessionService)
{
_shadowverseSessionService = shadowverseSessionService;
}
public async Task InvokeAsync(HttpContext context, RequestDelegate next)
{
bool hasSessionId = context.Request.Headers.TryGetValue(NetworkConstants.UdidHeaderName, out var udid);
bool hasUdid = context.Request.Headers.TryGetValue(NetworkConstants.SessionIdHeaderName, out var sid);
if (hasSessionId && hasUdid)
{
_shadowverseSessionService.StoreUdidForSessionId(sid.FirstOrDefault(), Guid.Parse(Encryption.Decode(udid.FirstOrDefault())));
}
await next.Invoke(context);
}
}