public void ShouldHandleSha512()
        {
            var generator = new PskGenerator(_options);
            var hash      = generator.Generate();

            hash.Should().NotBeEmpty();
        }
        public void ShouldHandleSha384()
        {
            var generator = new PskGenerator(_options).UseAlgorithm(SHA384.Create());
            var hash      = generator.Generate();

            hash.Should().NotBeEmpty();
        }
        public static HttpClient AddPskAuthentication(this HttpClient client, string iv, string key, string salt, string secret, int ttl = 900)
        {
            var hash = new PskGenerator(iv, key).Generate(salt, secret, ttl);

            client.DefaultRequestHeaders.Add("X-PSK-Authorization", hash);

            return(client);
        }
        public static HttpClient AddPskAuthentication(this HttpClient client, PskAuthenticationOptions options)
        {
            var hash = new PskGenerator(options).Generate();

            client.DefaultRequestHeaders.Add("X-PSK-Authorization", hash);

            return(client);
        }
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            var ttl     = 315360000; // 10 years in seconds
            var options = new PskAuthenticationOptions
            {
                RijndaelIV  = _configuration.GetValue <string>("Security:RijndaelIV"),
                RijndaelKey = _configuration.GetValue <string>("Security:RijndaelKey"),
                Salt        = _configuration.GetValue <string>("Security:Salt"),
                Secret      = _configuration.GetValue <string>("Security:Secret"),
                Ttl         = 315360000
            };
            var generator = new PskGenerator(options);
            var psk       = generator.Generate();

            Log.Information("PSK:");
            Log.Information(psk);

            Log.Information("Done!!!");
        }