34 lines
1.1 KiB
C#
34 lines
1.1 KiB
C#
|
using Microsoft.AspNetCore.Mvc;
|
|||
|
using ServiceShared.Crypto;
|
|||
|
using ServiceShared.Models.Response;
|
|||
|
|
|||
|
namespace ServiceInside.Controllers
|
|||
|
{
|
|||
|
[ApiController]
|
|||
|
[Route("[controller]")]
|
|||
|
public class ExchangeController : BaseController
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// Constructor of ExchangeController, that getting instance of configuration and KeyPair
|
|||
|
/// </summary>
|
|||
|
/// <param name="configuration">Configuration from appsettings.json</param>
|
|||
|
/// <param name="keyPair">Server Curve25519 KeyPair</param>
|
|||
|
public ExchangeController(IConfiguration configuration, KeyPair keyPair) : base(configuration, keyPair)
|
|||
|
{
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// Returns Public Key of outside service as json
|
|||
|
/// </summary>
|
|||
|
/// <returns>Json Response</returns>
|
|||
|
[Route("key")]
|
|||
|
[HttpPost]
|
|||
|
public JsonResult key()
|
|||
|
{
|
|||
|
PublicKey response = new PublicKey() { key = this._KeyPair!.PublicKey };
|
|||
|
this.Debug(response, "RESPONSE");
|
|||
|
return new JsonResult(response);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|