namespace VPNAuth.Server;

public static class PkceUtils
{
    private static string _codeChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789";

    public static string GenerateCode(int length = 10)
    {
        string code = "";
        for (int i = 0; i < length; i++)
            code += _codeChars[new Random().Next(_codeChars.Length)]; // TODO: Is that function random enough?
        return code;
    }

    public static string GenerateToken(int length = 20)
        => GenerateCode(length); // TODO: maybe add more possible chars then for GenerateCode
}