using Microsoft.AspNetCore.Mvc;
using ServiceShared.Database;
using ServiceShared.Crypto;
using ServiceShared.Models.Response;
using ServiceShared.Models.Response.Exception;
namespace ServiceOutside.Controllers
{
[ApiController]
[Route("[controller]")]
public class ExchangeController : BaseController
{
///
/// Constructor of ExchangeController, that getting instance of configuration, dbcontext and KeyPair
///
/// Configuration from appsettings.json
/// DbContext
/// Server Curve25519 KeyPair
public ExchangeController(IConfiguration configuration, DbContext dbContext, KeyPair keyPair) : base(configuration, dbContext, keyPair)
{
}
///
/// Returns Public Key of outside service as json
///
/// Json Response
[Route("key")]
[HttpPost]
public JsonResult key()
{
PublicKey response = new PublicKey() { key = this._KeyPair.PublicKey };
this.Debug(response, "RESPONSE");
return new JsonResult(response);
}
}
}