Class MfaSecretProtector

Assembly: redb.Identity.Core.dll

Encrypts/decrypts TOTP secrets at rest using ASP.NET DataProtection.
Unlike , no TTL — secrets live until user disables MFA.

public sealed class MfaSecretProtector

Inheritance

Object→MfaSecretProtector

Methods

Protect(string)

Encrypts a plaintext secret (e.g. base32-encoded TOTP key).

public string Protect(string plainSecret)

Unprotect(string)

Decrypts a protected secret. Returns null if decryption fails (tampered/rotated keys).

public string? Unprotect(string protectedSecret)

Constructors