mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Closes #1950
This commit is contained in:
@@ -33,6 +33,27 @@ using Newtonsoft.Json.Linq;
|
||||
namespace ArchiSteamFarm.IPC.Controllers.Api {
|
||||
[Route("Api/ASF")]
|
||||
public sealed class ASFController : ArchiController {
|
||||
/// <summary>
|
||||
/// Encrypts data with ASF encryption mechanisms using provided details.
|
||||
/// </summary>
|
||||
[Consumes("application/json")]
|
||||
[HttpPost("Encrypt")]
|
||||
[ProducesResponseType(typeof(GenericResponse<string>), (int) HttpStatusCode.OK)]
|
||||
[ProducesResponseType(typeof(GenericResponse), (int) HttpStatusCode.BadRequest)]
|
||||
public ActionResult<GenericResponse> ASFEncryptPost([FromBody] ASFEncryptRequest request) {
|
||||
if (request == null) {
|
||||
throw new ArgumentNullException(nameof(request));
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(request.StringToEncrypt)) {
|
||||
return BadRequest(new GenericResponse(false, string.Format(Strings.ErrorIsEmpty, nameof(request.StringToEncrypt))));
|
||||
}
|
||||
|
||||
string? encryptedString = Actions.Encrypt(request.CryptoMethod, request.StringToEncrypt!);
|
||||
|
||||
return Ok(new GenericResponse<string>(encryptedString));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fetches common info related to ASF as a whole.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user