feat(secrets): default resolver with TTL cache + audit (never logs plaintext)

This commit is contained in:
Joseph Doherty
2026-07-15 16:55:24 -04:00
parent 10455ec53b
commit 79ebd14baa
7 changed files with 435 additions and 0 deletions
@@ -0,0 +1,29 @@
namespace ZB.MOM.WW.Secrets.Tests.Fakes;
/// <summary>
/// A <see cref="TimeProvider"/> test double with a settable <see cref="GetUtcNow"/>, so a test can
/// advance the clock past a cache TTL deterministically without sleeping.
/// </summary>
public sealed class MutableTimeProvider : TimeProvider
{
private DateTimeOffset _utcNow;
/// <summary>Creates a provider starting at the given instant (defaults to the Unix epoch).</summary>
/// <param name="start">The initial <see cref="GetUtcNow"/> value.</param>
public MutableTimeProvider(DateTimeOffset? start = null) =>
_utcNow = start ?? DateTimeOffset.UnixEpoch;
/// <summary>Gets or sets the current UTC instant this provider reports.</summary>
public DateTimeOffset UtcNow
{
get => _utcNow;
set => _utcNow = value;
}
/// <summary>Moves the clock forward by <paramref name="delta"/>.</summary>
/// <param name="delta">The amount to advance.</param>
public void Advance(TimeSpan delta) => _utcNow += delta;
/// <inheritdoc />
public override DateTimeOffset GetUtcNow() => _utcNow;
}