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
+10 -2
View File
@@ -40,6 +40,13 @@ public sealed class E2eeController(
[HttpGet("recovery")]
public async Task<IActionResult> Recovery() => Ok(await e2ee.GetRecoveryAsync(user.GetCurrentUserId()));
[HttpGet("identities/{peer:guid}/changes")]
public async Task<IActionResult> IdentityChanges(Guid peer)
{
try { return Ok(await e2ee.GetIdentityChangesAsync(user.GetCurrentUserId(), peer)); }
catch (UnauthorizedAccessException) { return Forbid(); }
}
[HttpGet("devices")]
public async Task<IActionResult> Devices() => Ok(await e2ee.GetOwnDevicesAsync(user.GetCurrentUserId()));
@@ -55,12 +62,13 @@ public sealed class E2eeController(
}
[HttpGet("conversations/{type:int}/{conversationId:guid}/signers/{deviceSession:guid}")]
public async Task<IActionResult> HistoricalSigner(int type, Guid conversationId, Guid deviceSession)
public async Task<IActionResult> HistoricalSigner(int type, Guid conversationId, Guid deviceSession, [FromQuery] string identityKey = null)
{
if (type is < 0 or > 1) return BadRequest();
try
{
var key = await e2ee.GetHistoricalSignerAsync(user.GetCurrentUserId(), conversationId, (RecipientType)type, deviceSession);
if (identityKey?.Length > 1000) return BadRequest();
var key = await e2ee.GetHistoricalSignerAsync(user.GetCurrentUserId(), conversationId, (RecipientType)type, deviceSession, identityKey);
return key is null ? NotFound() : Ok(key);
}
catch (UnauthorizedAccessException) { return Forbid(); }