namespace Bifrost.Web.Configuration;
/// Gates on the anonymous native registration (section Bifrost:Registration).
public sealed class RegistrationOptions
{
public const string SectionName = "Bifrost:Registration";
public const int MinDifficulty = 1;
public const int MaxDifficulty = 30;
public RegistrationCaptchaOptions Captcha { get; init; } = new();
public RegistrationLimitsOptions Limits { get; init; } = new();
}
/// One budget on GET /auth/bifrost/challenge and POST /auth/bifrost/register together, per source address in one fixed window.
public sealed class RegistrationLimitsOptions
{
public int PerAddressPermits { get; init; } = 10;
public TimeSpan Window { get; init; } = TimeSpan.FromMinutes(1);
public int MaxTrackedKeys { get; init; } = 10_000;
}
public sealed class RegistrationCaptchaOptions
{
/// Leading zero bits the SHA-256 of challenge:nonce must have. 18 is about 262k hashes, a second or two in a browser.
public int Difficulty { get; init; } = 18;
}