Skip to content

Commit 979f398

Browse files
committed
Add UpdatedBy property to manifest
1 parent 2cbea14 commit 979f398

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/EasySign.Cli/BundleCommandProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public BundleCommandProvider(string appDirectory, ILogger logger, ILogger bundle
1515
_bundleLogger = bundleLogger;
1616
}
1717

18-
public override void InitializeBundle(string bundlePath)
18+
protected override void InitializeBundle(string bundlePath)
1919
{
2020
Logger.LogInformation("Initializing bundle at {bundlePath}", bundlePath);
2121
Bundle = new Bundle(bundlePath, _bundleLogger);

src/EasySign/Bundle.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ public void Sign(X509Certificate2 certificate, RSA privateKey)
454454
string pemContents = pemBuilder.ToString();
455455

456456
Logger.LogDebug("Signing manifest");
457-
byte[] manifestData = Export(Manifest, SourceGenerationManifestContext.Default);
457+
byte[] manifestData = GetManifestData();
458458
byte[] signature = privateKey.SignData(manifestData, HashAlgorithmName.SHA512, RSASignaturePadding.Pkcs1);
459459

460460
Logger.LogDebug("Pending file: {name} for embedding in the bundle", name);
@@ -707,7 +707,7 @@ public void Update()
707707
Updating?.Invoke(zip);
708708

709709
Logger.LogDebug("Writing manifest to the bundle");
710-
byte[] manifestData = Export(Manifest, SourceGenerationManifestContext.Default);
710+
byte[] manifestData = GetManifestData();
711711
WriteEntry(zip, ".manifest.ec", manifestData);
712712

713713
Logger.LogDebug("Writing signatures to the bundle");
@@ -726,6 +726,19 @@ public void Update()
726726
}
727727
}
728728

729+
/// <summary>
730+
/// Gets the manifest data as a byte array.
731+
/// </summary>
732+
/// <returns>
733+
/// A byte array containing the manifest data.
734+
/// </returns>
735+
protected virtual byte[] GetManifestData()
736+
{
737+
Manifest.UpdatedBy = GetType().FullName;
738+
739+
return Export(Manifest, SourceGenerationManifestContext.Default);
740+
}
741+
729742
/// <summary>
730743
/// Exports the specified structured data to a byte array.
731744
/// </summary>

src/EasySign/Manifest.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ public class Manifest
1111
{
1212
private ConcurrentDictionary<string, byte[]> entries = new ConcurrentDictionary<string, byte[]>();
1313

14+
/// <summary>
15+
/// Gets or sets the full name of the class that updated the manifest.
16+
/// </summary>
17+
public string? UpdatedBy { get; set; }
18+
1419
/// <summary>
1520
/// Gets or sets the entries in the manifest as a sorted dictionary.
1621
/// </summary>

0 commit comments

Comments
 (0)