feat(site-runtime): CertStoreActor exports trusted certs (thumbprint+DER) for node reconciliation (UA1 groundwork)

This commit is contained in:
Joseph Doherty
2026-07-09 01:15:51 -04:00
parent 667d863e58
commit 39976772d9
3 changed files with 87 additions and 0 deletions
@@ -106,6 +106,27 @@ public class CertStoreActorTests : TestKit, IDisposable
emptyAck.Certs!.Should().NotContain(c => c.Thumbprint == thumbprint);
}
[Fact]
public void ExportLocalTrustedCerts_ReturnsThumbprintAndDerBytes()
{
var (derBase64, thumbprint) = BuildSelfSignedCert();
var expectedDer = Convert.FromBase64String(derBase64);
var actor = Sys.ActorOf(Props.Create(() => new CertStoreActor(_options)));
// Seed one trusted cert via the normal write path.
actor.Tell(new WriteCertToLocalStore(derBase64, thumbprint));
ExpectMsg<LocalCertOpAck>().Success.Should().BeTrue();
// Export — thumbprint + raw DER bytes come back for reconciliation.
actor.Tell(new ExportLocalTrustedCerts());
var export = ExpectMsg<LocalCertExport>();
export.Success.Should().BeTrue();
export.Error.Should().BeNull();
var entry = export.Certs.Should().ContainSingle().Subject;
entry.Thumbprint.Should().Be(thumbprint);
entry.DerBytes.Should().Equal(expectedDer);
}
[Fact]
public void Write_InvalidBase64_ReturnsFailureAck()
{