feat(infra): implement RefreshTokenGenerator with cryptographic random bytes

This commit is contained in:
2026-04-14 13:28:24 -03:00
parent 2806e8dfa6
commit d326dd87e0

View File

@@ -0,0 +1,17 @@
using System.Security.Cryptography;
using SIGCM2.Application.Abstractions.Security;
namespace SIGCM2.Infrastructure.Security;
public sealed class RefreshTokenGenerator : IRefreshTokenGenerator
{
public string Generate()
{
Span<byte> bytes = stackalloc byte[32];
RandomNumberGenerator.Fill(bytes);
return Convert.ToBase64String(bytes)
.TrimEnd('=')
.Replace('+', '-')
.Replace('/', '_');
}
}