21 lines
1.1 KiB
C#
21 lines
1.1 KiB
C#
using ZB.MOM.WW.Secrets.Abstractions;
|
|
using ZB.MOM.WW.Audit;
|
|
internal static class SecretsCanaryFixtures
|
|
{
|
|
public static void Register(IServiceCollection services)
|
|
{
|
|
IReadOnlyList<SecretMetadata> metadata = new[] { "fixture/alpha", "fixture/" + new string('x', 400) }.Select(name => new SecretMetadata
|
|
{
|
|
Name = new SecretName(name), Description = "Synthetic local metadata", ContentType = SecretContentType.Text,
|
|
KekId = "synthetic-key-id", Revision = 1, CreatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z"), UpdatedUtc = DateTimeOffset.Parse("2026-11-13T12:00:00Z"), UpdatedBy = "synthetic reviewer"
|
|
}).ToArray();
|
|
services.AddSingleton(ReadOnlyFixtureProxy.WithReads<ISecretStore>(new Dictionary<string, Func<object?[], object?>>
|
|
{
|
|
["ListAsync"] = _ => Task.FromResult(metadata),
|
|
["GetAsync"] = _ => throw new InvalidOperationException("Local metadata canary rejects value reads.")
|
|
}));
|
|
services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads<ISecretCipher>());
|
|
services.AddSingleton(ReadOnlyFixtureProxy.EmptyReads<IAuditWriter>());
|
|
}
|
|
}
|