Move check function to WasabiSignerHelpers
MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -201,7 +201,7 @@ public static class Program
await WasabiSignerHelpers.VerifySha256SumsFileAsync(sha256sumAscFilePath).ConfigureAwait(false);
// Verify back Wasabi installer's hashes
- await VerifyInstallerFileHashesAsync(finalFiles, sha256SumsFilePath).ConfigureAwait(false);
+ await WasabiSignerHelpers.VerifyInstallerFileHashesAsync(finalFiles, sha256SumsFilePath).ConfigureAwait(false);
IoHelpers.OpenFolderInFileExplorer(BinDistDirectory);
}
@@ -588,26 +588,6 @@ public static class Program
}
}
- private static async Task VerifyInstallerFileHashesAsync(string[] finalFiles, string sha256SumsFilePath)
- {
- string[] lines = await File.ReadAllLinesAsync(sha256SumsFilePath).ConfigureAwait(false);
- var hashWithFileNameLines = lines.Where(line => line.Contains("Wasabi-"));
-
- foreach (var installerFilePath in finalFiles)
- {
- string installerName = Path.GetFileName(installerFilePath);
- string installerExpectedHash = hashWithFileNameLines.Single(line => line.Contains(installerName)).Split(" ")[0];
-
- var bytes = await WasabiSignerHelpers.GetShaComputedBytesOfFileAsync(installerFilePath).ConfigureAwait(false);
- string installerRealHash = Convert.ToHexString(bytes).ToLower();
-
- if (installerExpectedHash != installerRealHash)
- {
- throw new InvalidOperationException("Installer file's hash doesn't match expected hash.");
- }
- }
- }
-
private static string? StartProcessAndWaitForExit(string command, string workingDirectory, string? writeToStandardInput = null, string? arguments = null, bool redirectStandardOutput = false)
{
var isWriteToStandardInput = !string.IsNullOrWhiteSpace(writeToStandardInput);

MODIFY
WalletWasabi/Helpers/WasabiSignerHelpers.cs
WalletWasabi/Helpers/WasabiSignerHelpers.cs
@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using System.IO;
using System.Security.Cryptography;
using System.Threading;
+using System.Linq;
namespace WalletWasabi.Helpers;
@@ -61,6 +62,26 @@ public class WasabiSignerHelpers
return secret.PrivateKey;
}
+ public static async Task VerifyInstallerFileHashesAsync(string[] finalFiles, string sha256SumsFilePath)
+ {
+ string[] lines = await File.ReadAllLinesAsync(sha256SumsFilePath).ConfigureAwait(false);
+ var hashWithFileNameLines = lines.Where(line => line.Contains("Wasabi-"));
+
+ foreach (var installerFilePath in finalFiles)
+ {
+ string installerName = Path.GetFileName(installerFilePath);
+ string installerExpectedHash = hashWithFileNameLines.Single(line => line.Contains(installerName)).Split(" ")[0];
+
+ var bytes = await GetShaComputedBytesOfFileAsync(installerFilePath).ConfigureAwait(false);
+ string installerRealHash = Convert.ToHexString(bytes).ToLower();
+
+ if (installerExpectedHash != installerRealHash)
+ {
+ throw new InvalidOperationException("Installer file's hash doesn't match expected hash.");
+ }
+ }
+ }
+
/// <summary>
/// This function returns a SHA256 computed byte array of a file on the provided file path.
/// </summary>

Move check function to WasabiSignerHelpers