Registration: sign-up form with proof-of-work and a no-JS time-lock fallback (#56)

This commit is contained in:
Heimdall 2026-11-11 11:17:25 +00:00
commit 028bc2fdf6
16 changed files with 1674 additions and 121 deletions

View file

@ -7,7 +7,11 @@ public sealed class RegistrationOptions
public const int MinDifficulty = 1;
public const int MaxDifficulty = 30;
public const int MaxDifficulty = 24;
public const int MinFallbackWaitSeconds = 5;
public const int MaxFallbackWaitSeconds = 300;
public RegistrationCaptchaOptions Captcha { get; init; } = new();
@ -22,10 +26,18 @@ public sealed class RegistrationLimitsOptions
public TimeSpan Window { get; init; } = TimeSpan.FromMinutes(1);
public int MaxTrackedKeys { get; init; } = 10_000;
/// <summary>Time-lock submissions (no script, no proof of work) per address per <see cref="FallbackWindow"/>; far tighter than <see cref="PerAddressPermits"/> because they cost the client nothing.</summary>
public int FallbackPermits { get; init; } = 3;
public TimeSpan FallbackWindow { get; init; } = TimeSpan.FromHours(1);
}
public sealed class RegistrationCaptchaOptions
{
/// <summary>Leading zero bits the SHA-256 of <c>challenge:nonce</c> must have. 18 is about 262k hashes, a second or two in a browser.</summary>
public int Difficulty { get; init; } = 18;
/// <summary>Seconds after the challenge was issued before a <c>waited</c> (no proof of work) submission is accepted.</summary>
public int FallbackWaitSeconds { get; init; } = 30;
}