Initial Files initial files Add git LFS for meilisearch binaries Update README.md fix
22 lines
522 B
C#
22 lines
522 B
C#
using System.Text;
|
|
|
|
namespace meilisearch.NET;
|
|
|
|
public class ApiKeyGenerator
|
|
{
|
|
private static readonly char[] Chars =
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".ToCharArray();
|
|
|
|
public static string GenerateApiKey(int length = 64)
|
|
{
|
|
var random = new Random();
|
|
var apiKey = new StringBuilder(length);
|
|
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
apiKey.Append(Chars[random.Next(Chars.Length)]);
|
|
}
|
|
|
|
return apiKey.ToString();
|
|
}
|
|
} |