mirror of
https://github.com/JKorf/CryptoExchange.Net
synced 2025-12-13 17:20:26 +00:00
wip
This commit is contained in:
parent
8dd93e2929
commit
18ed614ff0
@ -48,13 +48,45 @@ namespace CryptoExchange.Net.Authentication
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Load a private key from a file path
|
/// Create API credentials using an API key and secret generated by the server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public async Task<string> LoadPrivateKey(string path)
|
public static ApiCredentials HmacCredentials(string apiKey, string apiSecret, string? pass)
|
||||||
{
|
{
|
||||||
using var filestream = File.OpenRead(path);
|
return new ApiCredentials(apiKey, apiSecret, pass, ApiCredentialsType.Hmac);
|
||||||
using var streamReader = new StreamReader(filestream);
|
}
|
||||||
return await streamReader.ReadToEndAsync().ConfigureAwait(false);
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create API credentials using an API key and an RSA private key in PEM format
|
||||||
|
/// </summary>
|
||||||
|
public static ApiCredentials RsaPemCredentials(string apiKey, string privateKey)
|
||||||
|
{
|
||||||
|
return new ApiCredentials(apiKey, privateKey, credentialType: ApiCredentialsType.RsaPem);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create API credentials using an API key and an RSA private key in XML format
|
||||||
|
/// </summary>
|
||||||
|
public static ApiCredentials RsaXmlCredentials(string apiKey, string privateKey)
|
||||||
|
{
|
||||||
|
return new ApiCredentials(apiKey, privateKey, credentialType: ApiCredentialsType.RsaXml);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create API credentials using an API key and an Ed25519 private key
|
||||||
|
/// </summary>
|
||||||
|
public static ApiCredentials Ed25519Credentials(string apiKey, string privateKey)
|
||||||
|
{
|
||||||
|
return new ApiCredentials(apiKey, privateKey, credentialType: ApiCredentialsType.Ed25519);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Load a key from a file
|
||||||
|
/// </summary>
|
||||||
|
public string ReadFromFile(string path)
|
||||||
|
{
|
||||||
|
using var fileStream = File.OpenRead(path);
|
||||||
|
using var streamReader = new StreamReader(fileStream);
|
||||||
|
return streamReader.ReadToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user