IdentityShroud/IdentityShroud.SecretProviders/PlainSecret.cs

18 lines
382 B
C#
Raw Permalink Normal View History

using System.Security.Cryptography;
namespace IdentityShroud.SecretProviders;
public sealed class PlainSecret(byte[] secret) : IDisposable
{
private bool _disposed;
public ReadOnlySpan<byte> Secret => secret;
public void Dispose()
{
if (_disposed)
return;
_disposed = true;
CryptographicOperations.ZeroMemory(secret);
}
}