diff --git a/src/api/SIGCM2.Infrastructure/Security/RefreshTokenGenerator.cs b/src/api/SIGCM2.Infrastructure/Security/RefreshTokenGenerator.cs new file mode 100644 index 0000000..6bc2c19 --- /dev/null +++ b/src/api/SIGCM2.Infrastructure/Security/RefreshTokenGenerator.cs @@ -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 bytes = stackalloc byte[32]; + RandomNumberGenerator.Fill(bytes); + return Convert.ToBase64String(bytes) + .TrimEnd('=') + .Replace('+', '-') + .Replace('/', '_'); + } +}