Add SRP password recovery and E2EE reset

Add proof-based password registration, login, enrollment, and change flows, with rate limiting and encrypted recovery-key envelopes. Support explicit E2EE identity resets while preserving historical signer verification, and document and test the new recovery workflows.
This commit is contained in:
Artemy
2026-10-24 22:19:08 +07:00
parent 55cc9538f7
commit a3401ceedf
29 changed files with 4322 additions and 36 deletions
@@ -3,17 +3,31 @@ using Govor.Domain.Common.Constants;
namespace Govor.Contracts.Requests;
public record RegistrationRequest
public record RegistrationRequest : IValidatableObject
{
[Required]
[StringLength(UserConstants.MAX_LENGHT_OF_NAME,
MinimumLength = UserConstants.MIN_LENGHT_OF_NAME,
ErrorMessage = "Username must be between 4 and 44 characters.")]
public string Name { get; init; }
[Required]
[MinLength(8)]
public string Password { get; init; }
public string? Password { get; init; }
public string? SrpSalt { get; init; }
public string? SrpIdentity { get; init; }
public string? SrpVerifier { get; init; }
[MinLength(InvitationConstants.MIN_INVITATION_LENGTH)]
public string InviteLink { get; init; }
public string DeviceInfo { get; init; }
public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
{
var proofRegistration = SrpSalt is not null || SrpIdentity is not null || SrpVerifier is not null;
if (proofRegistration)
{
if (Password is not null || SrpSalt is null || SrpIdentity is null || SrpVerifier is null)
yield return new ValidationResult("Provide complete SRP credentials without a plaintext password.");
}
else if (string.IsNullOrWhiteSpace(Password))
yield return new ValidationResult("Password is required.", [nameof(Password)]);
}
}