feat: scaffold backend and shared library

This commit is contained in:
Andre Beging
2026-01-29 10:17:16 +01:00
commit b6ce21b1b8
15 changed files with 763 additions and 0 deletions

View File

@@ -0,0 +1,22 @@
using System.Security.Cryptography;
using System.Text;
namespace ASTRAIN.Api.Services;
public static class UserKeyGenerator
{
private const string Alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
public static string Generate(int length = 8)
{
var buffer = new byte[length];
RandomNumberGenerator.Fill(buffer);
var chars = new char[length];
for (var i = 0; i < length; i++)
{
chars[i] = Alphabet[buffer[i] % Alphabet.Length];
}
return new string(chars);
}
}