Files
mxaccessgw/src/MxGateway.Server/Security/Authentication/ApiKeySecretGenerator.cs
T
2026-04-26 16:56:12 -04:00

18 lines
410 B
C#

using System.Security.Cryptography;
namespace MxGateway.Server.Security.Authentication;
public static class ApiKeySecretGenerator
{
public static string Generate()
{
Span<byte> bytes = stackalloc byte[32];
RandomNumberGenerator.Fill(bytes);
return Convert.ToBase64String(bytes)
.TrimEnd('=')
.Replace('+', '-')
.Replace('/', '_');
}
}