New project file, added Aspire, moved security

This commit is contained in:
James Wampler
2026-06-03 18:44:48 -07:00
parent 4c6df1f037
commit d3b36956e4
78 changed files with 2786 additions and 21210 deletions

View File

@@ -0,0 +1,22 @@
using System.Security.Cryptography;
using System.Text;
namespace MicCheck.Api.Common.Security.ApiKeys;
public static class ApiKeyHasher
{
public static string Hash(string key)
{
var bytes = SHA256.HashData(Encoding.UTF8.GetBytes(key));
return Convert.ToHexString(bytes).ToLowerInvariant();
}
public static string GenerateKey()
{
var bytes = RandomNumberGenerator.GetBytes(32);
return Convert.ToBase64String(bytes)
.TrimEnd('=')
.Replace('+', '-')
.Replace('/', '_');
}
}