feat(CodeGenerator): GenerateTotp und VerifyTotp Methoden hinzugefügt.

This commit is contained in:
Developer 02
2025-01-25 00:35:19 +01:00
parent 95efe58e1b
commit 3267acbeb3
3 changed files with 66 additions and 54 deletions

View File

@@ -62,5 +62,10 @@ namespace EnvelopeGenerator.Application.Services
totpUrlFormat: totpUrlFormat,
pixelsPerModule: pixelsPerModule);
}
public string GenerateTotp(string secretKey, int step = 30) => new Totp(Base32Encoding.ToBytes(secretKey), step).ComputeTotp();
public bool VerifyTotp(string totpCode, string secretKey, int step = 30, VerificationWindow? window = null)
=> new Totp(Base32Encoding.ToBytes(secretKey), step).VerifyTotp(totpCode, out _, window);
}
}