Skip to content

Commit

Permalink
Another try fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelvds committed Jan 29, 2024
1 parent d176c14 commit f8992d0
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/fiskaltrust.Launcher/Commands/Common.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public static async Task<int> HandleAsync<O, S>(
try
{
cashboxConfiguration = CashBoxConfigurationExt.Deserialize(await File.ReadAllTextAsync(launcherConfiguration.CashboxConfigurationFile!));
cashboxConfiguration.Decrypt(launcherConfiguration, clientEcdh);
if (clientEcdh is not null) { cashboxConfiguration.Decrypt(launcherConfiguration, clientEcdh); }
}
catch (Exception e)
{
Expand Down Expand Up @@ -235,6 +235,7 @@ public static async Task<int> HandleAsync<O, S>(
Log.Debug("Cashbox Configuration File: {CashboxConfigurationFile}", launcherConfiguration.CashboxConfigurationFile);
Log.Debug("Launcher Configuration: {@LauncherConfiguration}", launcherConfiguration.Redacted());

Log.Debug("Launcher running as {ServiceType}", Enum.GetName(typeof(ServiceTypes), host.Services.GetRequiredService<ServiceType>().Type));

var dataProtectionProvider = DataProtectionExtensions.Create(launcherConfiguration.AccessToken, useFallback: launcherConfiguration.UseLegacyDataProtection!.Value);

Expand All @@ -247,12 +248,12 @@ public static async Task<int> HandleAsync<O, S>(
Log.Warning(e, "Error decrypring launcher configuration file.");
}

return await handler(options, new CommonProperties(launcherConfiguration, cashboxConfiguration, clientEcdh, dataProtectionProvider), specificOptions, host.Services.GetRequiredService<S>());
return await handler(options, new CommonProperties(launcherConfiguration, cashboxConfiguration, clientEcdh!, dataProtectionProvider), specificOptions, host.Services.GetRequiredService<S>());
}

private static async Task EnsureServiceDirectoryExists(LauncherConfiguration config)
{
var serviceDirectory = config.ServiceFolder;
var serviceDirectory = config.ServiceFolder!;
try
{
if (!Directory.Exists(serviceDirectory))
Expand Down Expand Up @@ -333,7 +334,8 @@ public static async Task<ECDiffieHellman> LoadCurve(Guid cashboxId, string acces
await File.WriteAllTextAsync(clientEcdhPath, dataProtector.Protect(newClientEcdh.Serialize()));
}

return newClientEcdh;
return clientEcdh;
}
}
}
}
}

0 comments on commit f8992d0

Please sign in to comment.