using NETCore.Encrypt;

namespace Hotline.Tests.Application;
public class ThirdIdentifyApplicationTest
{
    [Fact]
    public async Task ThirdSystem_Test()
    {
        var appId = "companyName";
        var secret = "4x1q6YCWLDnHkpLTCWMwx3XQF7bA5QAd";


        var iv = Guid.NewGuid().ToString().Substring(0, 16);


        var unixTimespan = DateTimeOffset.Now.ToUnixTimeSeconds();
        var strString = appId + unixTimespan;
        var entrypted = EncryptProvider.AESEncrypt(strString, secret, iv);
        var token = appId + iv + entrypted;

        var decrypted = EncryptProvider.AESDecrypt(entrypted, secret, iv);
        Console.WriteLine(decrypted);


                                                        //"4x1q6YCWLDnHkpLTCWMwx3XQF7bA5QAd   WD7MEjbCySsniwKz
        entrypted = EncryptProvider.AESEncrypt(strString, "NBdabUfdsabwB7382fdsab18v321udab");
        decrypted = EncryptProvider.AESDecrypt(entrypted, "NBdabUfdsabwB7382fdsab18v321udab");
        Console.WriteLine(decrypted);
    }
}
