1
0
mirror of https://github.com/JKorf/CryptoExchange.Net synced 2025-06-07 16:06:15 +00:00

Added Pass property to ApiCredentials

This commit is contained in:
Jkorf 2025-03-05 14:47:13 +01:00
parent e138d7d263
commit 1999a27b41

View File

@ -20,6 +20,11 @@ namespace CryptoExchange.Net.Authentication
/// </summary> /// </summary>
public string Secret { get; set; } public string Secret { get; set; }
/// <summary>
/// The api passphrase. Not needed on all exchanges
/// </summary>
public string? Pass { get; set; }
/// <summary> /// <summary>
/// Type of the credentials /// Type of the credentials
/// </summary> /// </summary>
@ -32,6 +37,18 @@ namespace CryptoExchange.Net.Authentication
/// <param name="secret">The api secret or private key used for signing</param> /// <param name="secret">The api secret or private key used for signing</param>
/// <param name="credentialType">The type of credentials</param> /// <param name="credentialType">The type of credentials</param>
public ApiCredentials(string key, string secret, ApiCredentialsType credentialType = ApiCredentialsType.Hmac) public ApiCredentials(string key, string secret, ApiCredentialsType credentialType = ApiCredentialsType.Hmac)
: this(key, secret, null, credentialType)
{
}
/// <summary>
/// Create Api credentials providing an api key, secret and pass for authentication
/// </summary>
/// <param name="key">The api key / label used for identification</param>
/// <param name="secret">The api secret or private key used for signing</param>
/// <param name="pass">The api pass for the key. Not always needed</param>
/// <param name="credentialType">The type of credentials</param>
public ApiCredentials(string key, string secret, string? pass, ApiCredentialsType credentialType = ApiCredentialsType.Hmac)
{ {
if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret)) if (string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret))
throw new ArgumentException("Key and secret can't be null/empty"); throw new ArgumentException("Key and secret can't be null/empty");
@ -39,6 +56,7 @@ namespace CryptoExchange.Net.Authentication
CredentialType = credentialType; CredentialType = credentialType;
Key = key; Key = key;
Secret = secret; Secret = secret;
Pass = pass;
} }
/// <summary> /// <summary>
@ -47,7 +65,7 @@ namespace CryptoExchange.Net.Authentication
/// <returns></returns> /// <returns></returns>
public virtual ApiCredentials Copy() public virtual ApiCredentials Copy()
{ {
return new ApiCredentials(Key, Secret, CredentialType); return new ApiCredentials(Key, Secret, Pass, CredentialType);
} }
} }
} }