This commit is contained in:
Artemy
2025-07-30 12:41:57 +07:00
parent 751c30dedd
commit dc560ba698
4 changed files with 74 additions and 17 deletions
@@ -1,3 +1,5 @@
using Govor.Application.Interfaces.Infrastructure.Extensions;
using Govor.Contracts.Requests;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
@@ -9,9 +11,33 @@ namespace Govor.API.Controllers.Authentication;
[Authorize(Roles = "Admin, User")]
public class SessionKeysController : Controller
{
// GET
public IActionResult Index()
private readonly ILogger<SessionKeysController> _logger;
private readonly ICurrentUserSessionService _currentSession;
private readonly ICurrentUserService _currentUser;
/*
[HttpPost("keys")]
public async Task<IActionResult> UploadSessionKeys([FromBody] UploadKeysRequest request)
{
return View();
var sessionId = _currentSession.GetUserSessionId();
await _sessionKeyService.AttachKeysAsync(sessionId, request.PublicEncryptionKey, request.PublicSigningKey);
return Ok();
}
[Authorize]
[HttpGet("users/{userId}/keys")]
public async Task<IActionResult> GetUserPublicKeys(Guid userId)
{
var requesterId = _currentUserService.UserId;
if (!await _friendshipService.AreFriendsAsync(requesterId, userId))
return Forbid("You can only access keys of your friends");
var keys = await _sessionKeyService.GetAllActiveKeysAsync(userId);
return Ok(keys);
}
*/
}