Skip to content

Commit

Permalink
#v4.4.2203.1-rc - Plain text key supported (#99)
Browse files Browse the repository at this point in the history
* - assemblies added

* - Plain text key supported

Co-authored-by: Antonio Buedo <[email protected]>
  • Loading branch information
Antonio Buedo and Antonio Buedo authored Mar 29, 2022
1 parent b3e1d4d commit b7fa770
Show file tree
Hide file tree
Showing 30 changed files with 322 additions and 270 deletions.
Binary file modified Assemblies/BitPay.Net Setup utility/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net Setup utility/BitPaySetup.exe
Binary file not shown.
12 changes: 12 additions & 0 deletions Assemblies/BitPay.Net Setup utility/BitPaySetup.exe.config
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,17 @@
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System" publicKeyToken="b77a5c561934e089" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-4.1.1.0" newVersion="4.1.1.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Binary file modified Assemblies/BitPay.Net Setup utility/BouncyCastle.Crypto.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net452/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net46/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net461/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net462/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net47/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net471/BitPay.dll
Binary file not shown.
Binary file modified Assemblies/BitPay.Net.Lib/net472/BitPay.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Assemblies/BitPay.Net.Lib/netcoreapp2.0/BitPay.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v2.0": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"dependencies": {
"BouncyCastle": "1.8.9",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -147,7 +147,7 @@
}
},
"libraries": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified Assemblies/BitPay.Net.Lib/netcoreapp2.0/BitPay.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Assemblies/BitPay.Net.Lib/netcoreapp2.1/BitPay.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v2.1": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"dependencies": {
"BouncyCastle": "1.8.9",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -137,7 +137,7 @@
}
},
"libraries": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified Assemblies/BitPay.Net.Lib/netcoreapp2.1/BitPay.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Assemblies/BitPay.Net.Lib/netcoreapp2.2/BitPay.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v2.2": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"dependencies": {
"BouncyCastle": "1.8.9",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -137,7 +137,7 @@
}
},
"libraries": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified Assemblies/BitPay.Net.Lib/netcoreapp2.2/BitPay.dll
Binary file not shown.
4 changes: 2 additions & 2 deletions Assemblies/BitPay.Net.Lib/netstandard2.0/BitPay.deps.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"dependencies": {
"BouncyCastle": "1.8.9",
"Microsoft.CSharp": "4.7.0",
Expand Down Expand Up @@ -180,7 +180,7 @@
}
},
"libraries": {
"BitPay/4.3.2202": {
"BitPay/4.4.2203": {
"type": "project",
"serviceable": false,
"sha512": ""
Expand Down
Binary file modified Assemblies/BitPay.Net.Lib/netstandard2.0/BitPay.dll
Binary file not shown.
Binary file added Assemblies/BitPay.Net.Lib_4.3.2203.zip
Binary file not shown.
Binary file added Assemblies/BitPay.Net.Lib_4.4.2203.zip
Binary file not shown.
Binary file added Assemblies/BitPay.Net_Setup_utility_4.3.2203.zip
Binary file not shown.
4 changes: 2 additions & 2 deletions BitPay.sln
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ Global
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D88A49C3-0280-4320-B120-AE519B2DB219}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D88A49C3-0280-4320-B120-AE519B2DB219}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D88A49C3-0280-4320-B120-AE519B2DB219}.Release|Any CPU.ActiveCfg = Debug|Any CPU
{D88A49C3-0280-4320-B120-AE519B2DB219}.Release|Any CPU.Build.0 = Debug|Any CPU
{D88A49C3-0280-4320-B120-AE519B2DB219}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D88A49C3-0280-4320-B120-AE519B2DB219}.Release|Any CPU.Build.0 = Release|Any CPU
{2FCA393C-BD09-4740-ADB5-C4293C9F823D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2FCA393C-BD09-4740-ADB5-C4293C9F823D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2FCA393C-BD09-4740-ADB5-C4293C9F823D}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
37 changes: 23 additions & 14 deletions BitPay/BitPay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

/**
* @author Antonio Buedo
* @date 10.02.2022
* @version 4.3.2202
* @date 29.03.2022
* @version 4.4.2203
*
* See bitpay.com/api for more information.
*/
Expand All @@ -51,12 +51,12 @@ public class BitPay
/// Constructor for use if the keys and SIN are managed by this library.
/// </summary>
/// <param name="environment">Target environment. Options: Env.Test / Env.Prod</param>
/// <param name="privateKeyPath">Private Key file path.</param>
/// <param name="privateKey">Private Key file path or plain text key.</param>
/// <param name="tokens">Env.Tokens containing the available tokens.</param>
public BitPay(string environment, string privateKeyPath, Env.Tokens tokens)
public BitPay(string environment, string privateKey, Env.Tokens tokens)
{
_env = environment;
BuildConfig(privateKeyPath, tokens);
BuildConfig(privateKey, tokens);
InitKeys().Wait();
Init().Wait();
}
Expand Down Expand Up @@ -2139,11 +2139,11 @@ private async Task<string> ResponseToJsonString(HttpResponseMessage response)
if (jObj.TryGetValue("status", out value))
{
if (value.ToString().Equals("error"))
{
jObj.TryGetValue("code", out code);
jObj.TryGetValue("message", out value);
throw new BitPayApiCommunicationException(code.ToString(), value.ToString());
}
{
jObj.TryGetValue("code", out code);
jObj.TryGetValue("message", out value);
throw new BitPayApiCommunicationException(code.ToString(), value.ToString());
}
}

// Check for error response.
Expand Down Expand Up @@ -2229,19 +2229,28 @@ private void GetConfig()
/// Builds the configuration object
/// </summary>
/// <returns></returns>
private void BuildConfig(string privateKeyPath, Env.Tokens tokens)
private void BuildConfig(string privateKey, Env.Tokens tokens)
{
try
{
if (!File.Exists(privateKeyPath))
var keyType = "PrivateKeyPath";
if (!File.Exists(privateKey))
{
throw new Exception("Private Key file not found");
try
{
_ecKey = KeyUtils.CreateEcKeyFromString(privateKey);
keyType = "PrivateKey";
}
catch (Exception ex)
{
throw new Exception("Private Key file not found OR invalid key provided");
}
}

var config = new Dictionary<string, string>
{
{"BitPayConfiguration:Environment", _env},
{"BitPayConfiguration:EnvConfig:" + _env + ":PrivateKeyPath", privateKeyPath},
{"BitPayConfiguration:EnvConfig:" + _env + ":" + keyType, privateKey},
{"BitPayConfiguration:EnvConfig:" + _env + ":ApiTokens:merchant", tokens.Merchant},
{"BitPayConfiguration:EnvConfig:" + _env + ":ApiTokens:payout", tokens.Payout}
};
Expand Down
8 changes: 4 additions & 4 deletions BitPay/BitPay.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<TargetFrameworks>net452;net46;net461;net462;net47;net471;net472;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp2.2</TargetFrameworks>
<LangVersion>latest</LangVersion>
<!-- version numbers will be updated by build -->
<AssemblyVersion>4.3.2202.0</AssemblyVersion>
<FileVersion>4.3.2202</FileVersion>
<VersionPrefix>4.3.2202</VersionPrefix>
<Version>4.3.2202</Version>
<AssemblyVersion>4.4.2203.0</AssemblyVersion>
<FileVersion>4.4.2203</FileVersion>
<VersionPrefix>4.4.2203</VersionPrefix>
<Version>4.4.2203</Version>
<Authors>Antonio Buedo</Authors>
<Company>BitPay Inc.</Company>
<Owners>BitPay, Inc.</Owners>
Expand Down
2 changes: 1 addition & 1 deletion BitPay/Env.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ public class Env
public const string TestUrl = "https://test.bitpay.com/";
public const string ProdUrl = "https://bitpay.com/";
public const string BitpayApiVersion = "2.0.0";
public const string BitpayPluginInfo = "BitPay_DotNet_Client_v4.3.2202";
public const string BitpayPluginInfo = "BitPay_DotNet_Client_v4.4.2203";
public const string BitpayApiFrame = "std";
public const string BitpayApiFrameVersion = "1.0.0";
public class Tokens
Expand Down
Loading

0 comments on commit b7fa770

Please sign in to comment.