Added API benchmark, hash device_id, handled null cases in GET/PUT

This commit is contained in:
Tyler Kenney 2025-05-20 09:35:39 -04:00
parent e84aed357a
commit f30e3b17d6
7 changed files with 79 additions and 11 deletions

View file

@ -1,3 +1,5 @@
using System.Security.Cryptography;
using System.Text;
using API.DTOs.Koreader;
namespace API.Helpers.Builders;
@ -36,7 +38,9 @@ public class KoreaderBookDtoBuilder : IEntityBuilder<KoreaderBookDto>
public KoreaderBookDtoBuilder WithDeviceId(string installId, int userId)
{
_dto.Device_id = installId;
using var sha256 = SHA256.Create();
var hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(installId + userId));
_dto.Device_id = hash.ToString();
return this;
}
}