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:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user