don't send hardware hash, calc on the api

This commit is contained in:
Alex Bezdieniezhnykh
2025-02-26 16:02:09 +02:00
parent 6d28085b7e
commit 503ddc8c41
9 changed files with 32 additions and 42 deletions
+5 -1
View File
@@ -1,5 +1,6 @@
using System.Security.Cryptography;
using System.Text;
using Azaion.Common.Entities;
namespace Azaion.Services;
@@ -10,7 +11,10 @@ public static class Security
public static string ToHash(this string str) =>
Convert.ToBase64String(SHA384.HashData(Encoding.UTF8.GetBytes(str)));
public static string MakeEncryptionKey(string email, string password, string? hardwareHash) =>
public static string GetHWHash(HardwareInfo hardware) =>
$"Azaion_{hardware.MacAddress}_{hardware.CPU}_{hardware.GPU}".ToHash();
public static string GetApiEncryptionKey(string email, string password, string? hardwareHash) =>
$"{email}-{password}-{hardwareHash}-#%@AzaionKey@%#---".ToHash();
public static async Task EncryptTo(this Stream stream, Stream toStream, string key, CancellationToken cancellationToken = default)