using System.Net;
using System.Net.Http.Headers;
using System.Text;
namespace LeagueAPI;
///
/// Repesents authentication for the League Client.
///
///
public class RiotAuthentication(string RemotingAuthToken)
{
///
/// Username component of the authentication;
///
public string Username { get; } = "riot";
///
/// Password component of the authentication.
///
public string Password { get; } = RemotingAuthToken;
///
/// Authentication value before Base64 conversion.
///
public string RawValue => Username + ":" + Password;
///
/// Authentication value in Base64 format.
///
public string Value => Convert.ToBase64String(Encoding.UTF8.GetBytes(RawValue));
///
/// Get an AuthenticationHeaderValue instance.
///
public AuthenticationHeaderValue ToAuthenticationHeaderValue()
{
return new AuthenticationHeaderValue("Basic", Value);
}
///
/// Get an NetworkCredential instance.
///
public NetworkCredential ToNetworkCredential()
{
return new NetworkCredential(Username, Password);
}
}