Move path to packager
MODIFY
WalletWasabi.Packager/Program.cs
WalletWasabi.Packager/Program.cs
@@ -27,6 +27,9 @@ public static class Program
public const string PfxPath = "C:\\digicert.pfx";
public const string ExecutableName = Constants.ExecutableName;
+ private const string WasabiPrivateKeyFilePath = @"C:\wasabi\Wasabi.privkey";
+ private const string WasabiPublicKeyFilePath = @"C:\wasabi\Wasabi.pubkey";
+
/// <remarks>Only 64-bit platforms are supported for now.</remarks>
/// <seealso href="https://docs.microsoft.com/en-us/dotnet/articles/core/rid-catalog"/>
private static string[] Targets = new[]
@@ -65,7 +68,7 @@ public static class Program
if (argsProcessor.IsGeneratePrivateKey())
{
- await WasabiSignerHelpers.GeneratePrivateAndPublicKeyToFileAsync().ConfigureAwait(false);
+ await WasabiSignerHelpers.GeneratePrivateAndPublicKeyToFileAsync(WasabiPrivateKeyFilePath, WasabiPublicKeyFilePath).ConfigureAwait(false);
return;
}
@@ -175,7 +178,7 @@ public static class Program
StartProcessAndWaitForExit("cmd", BinDistDirectory, $"gpg --sign --digest-algo sha256 -a --clearsign --armor --output SHA256SUMS.asc SHA256SUMS && exit");
- using var key = await WasabiSignerHelpers.GetPrivateKeyFromFileAsync().ConfigureAwait(false);
+ using var key = await WasabiSignerHelpers.GetPrivateKeyFromFileAsync(WasabiPrivateKeyFilePath).ConfigureAwait(false);
var sha256sumAscFilePath = Path.Combine(BinDistDirectory, "SHA256SUMS.asc");
await WasabiSignerHelpers.SignSha256SumsFileAsync(sha256sumAscFilePath, key).ConfigureAwait(false);

MODIFY
WalletWasabi/Helpers/WasabiSignerHelpers.cs
WalletWasabi/Helpers/WasabiSignerHelpers.cs
@@ -8,9 +8,6 @@ namespace WalletWasabi.Helpers;
public class WasabiSignerHelpers
{
- private const string WasabiPrivateKeyFilePath = @"C:\wasabi\Wasabi.privkey";
- private const string WasabiPublicKeyFilePath = @"C:\wasabi\Wasabi.pubkey";
-
public static async Task SignSha256SumsFileAsync(string sha256SumsAscFilePath, Key wasabiPrivateKey)
{
var bytes = await File.ReadAllBytesAsync(sha256SumsAscFilePath).ConfigureAwait(false);
@@ -46,24 +43,23 @@ public class WasabiSignerHelpers
}
}
- public static async Task GeneratePrivateAndPublicKeyToFileAsync()
+ public static async Task GeneratePrivateAndPublicKeyToFileAsync(string wasabiPrivateKeyFilePath, string wasabiPublicKeyFilePath)
{
using Key key = new();
- if (File.Exists(WasabiPrivateKeyFilePath))
+ if (File.Exists(wasabiPrivateKeyFilePath))
{
throw new ArgumentException("Private key file already exists.");
}
- IoHelpers.EnsureContainingDirectoryExists(WasabiPrivateKeyFilePath);
+ IoHelpers.EnsureContainingDirectoryExists(wasabiPrivateKeyFilePath);
- await File.WriteAllTextAsync(WasabiPrivateKeyFilePath, key.ToString(Network.Main)).ConfigureAwait(false);
- await File.WriteAllTextAsync(WasabiPublicKeyFilePath, key.PubKey.ToString()).ConfigureAwait(false);
+ await File.WriteAllTextAsync(wasabiPrivateKeyFilePath, key.ToString(Network.Main)).ConfigureAwait(false);
+ await File.WriteAllTextAsync(wasabiPublicKeyFilePath, key.PubKey.ToString()).ConfigureAwait(false);
}
- public static async Task<Key> GetPrivateKeyFromFileAsync()
+ public static async Task<Key> GetPrivateKeyFromFileAsync(string wasabiPrivateKeyFilePath)
{
- string fileName = WasabiPrivateKeyFilePath;
- string keyFileContent = await File.ReadAllTextAsync(fileName).ConfigureAwait(false);
+ string keyFileContent = await File.ReadAllTextAsync(wasabiPrivateKeyFilePath).ConfigureAwait(false);
BitcoinSecret secret = new(keyFileContent, Network.Main);
return secret.PrivateKey;
}

Move path to packager