using System;
using System.IO;
using CryptoExchange.Net.Converters.SystemTextJson;
using CryptoExchange.Net.Converters.MessageParsing;
namespace CryptoExchange.Net.Authentication
{
///
/// Api credentials, used to sign requests accessing private endpoints
///
public class ApiCredentials
{
///
/// The api key / label to authenticate requests
///
public string Key { get; set; }
///
/// The api secret or private key to authenticate requests
///
public string Secret { get; set; }
///
/// The api passphrase. Not needed on all exchanges
///
public string? Pass { get; set; }
///
/// Type of the credentials
///
public ApiCredentialsType CredentialType { get; set; }
///
/// Create Api credentials providing an api key and secret for authentication
///
/// The api key / label used for identification
/// The api secret or private key used for signing
/// The api pass for the key. Not always needed
/// The type of credentials
public ApiCredentials(string key, string secret, string? pass = null, ApiCredentialsType credentialType = ApiCredentialsType.Hmac)
{
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret))
throw new ArgumentException("Key and secret can't be null/empty");
CredentialType = credentialType;
Key = key;
Secret = secret;
Pass = pass;
}
///
/// Copy the credentials
///
///
public virtual ApiCredentials Copy()
{
return new ApiCredentials(Key, Secret, Pass, CredentialType);
}
}
}