using Microsoft.AspNetCore.Mvc;
using ServiceShared.Crypto;
using ServiceShared.Models.Response;
namespace ServiceInside.Controllers
{
[ApiController]
[Route("[controller]")]
public class ExchangeController : BaseController
{
///
/// Constructor of ExchangeController, that getting instance of configuration and KeyPair
///
/// Configuration from appsettings.json
/// Server Curve25519 KeyPair
public ExchangeController(IConfiguration configuration, KeyPair keyPair) : base(configuration, 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);
}
}
}