SHA256 Hashing for AuthToken Complete

This commit is contained in:
Norman Lansing
2026-03-11 07:40:45 -04:00
parent 04f5cb37dc
commit bf2ead5f97
6 changed files with 34 additions and 344 deletions

View File

@@ -1,93 +0,0 @@
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "GameLiftValidators.generated.h"
UENUM(BlueprintType)
enum class EGameLiftParams : uint8
{
AuthToken,
FleetId,
HostId,
ServerRegion,
WebSocketUrl,
Max // Sentry to determine length of EGameLiftParams
};
UENUM(BlueprintType)
enum class EValidationError : uint8
{
None, // Valid
Empty, // Missing Parameter
TooShort, // Too Short
TooLong, // Too long
InvalidFormat, // Invalid format
NotFound // Sentinel value, any new error codes get put above this.
};
USTRUCT(BlueprintType)
struct FParamResult
{
GENERATED_BODY()
EGameLiftParams ParamType;
FString Value;
bool bValid;
FString ErrorMessage;
EValidationError ErrorCode;
};
UCLASS()
class FPSTEMPLATE_API UGameLiftValidators : public UBlueprintFunctionLibrary
{
GENERATED_BODY()
private:
static TArray<FString>& GetPatterns();
static constexpr int32 MaxLengths[static_cast<int32>(EGameLiftParams::Max)] =
{
64, //authToken
512, //FleetId
128, //HostId
128, //WebSocketUrl
16, //Region (ca-central-1)
};
static constexpr int32 MinLengths[static_cast<int32>(EGameLiftParams::Max)] =
{
1, //authToken
1, //FleetId
1, //HostId
1, //WebSocketUrl
3, //Region (ca-central-1)
};
static bool IsStringValid(const FString& Value, EGameLiftParams ParamType);
static bool IsStringShort(const FString& Value, EGameLiftParams ParamType);
static bool IsStringLong(const FString& Value, EGameLiftParams ParamType);
static bool IsMatchesRegex(const FString& Value, EGameLiftParams ParamType);
public:
UFUNCTION(BlueprintCallable, Category = "GameLift")
static FParamResult ValidateParam(const FString& Value, EGameLiftParams ParamType);
UFUNCTION(BlueprintCallable, Category = "GameLift")
static FString GetParameterFromEnum(EGameLiftParams InParam);
UFUNCTION(BlueprintCallable, Category = "GameLift")
static FString GetErrorFromEnum(EValidationError InParam);
UFUNCTION(BlueprintCallable, Category = "GameLift")
static void LogValidationErrorMessage(FParamResult ValidationResult);
};

View File

@@ -1,24 +0,0 @@
#pragma once
#include "CoreMinimal.h"
struct FParamResult
{
FString Value;
bool bValid;
FString ErrorMessage;
};
namespace GameLiftValidators2
{
enum class ECliParam
{
AuthToken, FleetId, HostId, Region, WebSocketUrl, Max
};
int32 GetMaxLength(ECliParam ParamType);
int32 GetMinLength(ECliParam ParamType);
bool IsStringValid(const FString& Value, ECliParam ParamType);
bool IsNumberValid(int32 Value, int32 Min, int32 Max);
}