mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-22 22:02:59 +00:00
Encrypted private keys can now be passed in Api Credentials
This commit is contained in:
@@ -18,33 +18,17 @@ namespace CryptoExchange.Net.Authentication
|
||||
/// <summary>
|
||||
/// The private key to authenticate requests
|
||||
/// </summary>
|
||||
public SecureString PrivateKey { get; }
|
||||
public PrivateKey PrivateKey { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Create Api credentials providing a private key for authenication
|
||||
/// Create Api credentials providing a private key for authentication
|
||||
/// </summary>
|
||||
/// <param name="privateKey">The private key used for signing</param>
|
||||
public ApiCredentials(SecureString privateKey)
|
||||
public ApiCredentials(PrivateKey privateKey)
|
||||
{
|
||||
PrivateKey = privateKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create Api credentials providing a private key for authenication
|
||||
/// </summary>
|
||||
/// <param name="privateKey">The private key used for signing</param>
|
||||
public ApiCredentials(string privateKey)
|
||||
{
|
||||
if(string.IsNullOrEmpty(privateKey))
|
||||
throw new ArgumentException("Private key can't be null/empty");
|
||||
|
||||
var securePrivateKey = new SecureString();
|
||||
foreach (var c in privateKey)
|
||||
securePrivateKey.AppendChar(c);
|
||||
securePrivateKey.MakeReadOnly();
|
||||
PrivateKey = securePrivateKey;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create Api credentials providing a api key and secret for authenciation
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user