mirror of
https://github.com/Jetsparrow/jetherald.git
synced 2026-01-21 07:56:09 +03:00
18 lines
411 B
C#
18 lines
411 B
C#
using System.Security.Cryptography;
|
|
|
|
namespace JetHerald;
|
|
public static class TokenHelper
|
|
{
|
|
static readonly byte[] buf = new byte[24];
|
|
static readonly object SyncLock = new();
|
|
|
|
public static string GetToken()
|
|
{
|
|
lock (SyncLock)
|
|
{
|
|
RandomNumberGenerator.Fill(buf);
|
|
return Convert.ToBase64String(buf).Replace('+', '_').Replace('/', '_');
|
|
}
|
|
}
|
|
}
|