api: add encryption verifier

encryption verifier is used for verifying the encryption key during password resets. It can be any encrypted item.
This commit is contained in:
Abdullah Atta
2026-08-18 08:36:02 +05:00
parent 768384011d
commit 0a3ee07b95
4 changed files with 41 additions and 0 deletions
@@ -127,6 +127,24 @@ namespace Notesnook.API.Controllers
}
}
[HttpGet("verifier")]
public async Task<IActionResult> GetEncryptionVerifier()
{
var userId = User.GetUserId();
try
{
var response = await UserService.GetEncryptionVerifier(userId);
if (response == null) return NotFound();
return Ok(response);
}
catch (Exception ex)
{
logger.LogError(ex, "Failed to get encryption verifier for user id: {UserId}", userId);
return BadRequest(new { error = ex.Message });
}
}
[HttpPost("reset")]
public async Task<IActionResult> Reset([FromForm] bool removeAttachments)
{