1
0
mirror of https://github.com/JKorf/CryptoExchange.Net.git synced 2026-08-11 16:32:57 +00:00

Initial commit

This commit is contained in:
JKorf
2018-02-28 13:53:29 +01:00
parent e2af98f2c9
commit 2bf860947a
23 changed files with 837 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
using System;
namespace CryptoExchange.Net.Authentication
{
public class ApiCredentials
{
/// <summary>
/// The api key
/// </summary>
public string Key { get; }
/// <summary>
/// The api secret
/// </summary>
public string Secret { get; }
public ApiCredentials() { }
public ApiCredentials(string key, string secret)
{
if(string.IsNullOrEmpty(key) || string.IsNullOrEmpty(secret))
throw new ArgumentException("Apikey or apisecret not provided");
Key = key;
Secret = secret;
}
}
}
+25
View File
@@ -0,0 +1,25 @@
using CryptoExchange.Net.Interfaces;
namespace CryptoExchange.Net.Authentication
{
public abstract class AuthenticationProvider
{
protected ApiCredentials credentials;
protected AuthenticationProvider(ApiCredentials credentials)
{
this.credentials = credentials;
}
public abstract string AddAuthenticationToUriString(string uri);
public abstract IRequest AddAuthenticationToRequest(IRequest request);
protected string ByteToString(byte[] buff)
{
var sbinary = "";
foreach (byte t in buff)
sbinary += t.ToString("X2"); /* hex format */
return sbinary;
}
}
}