77
88namespace BootstrapBlazor . Components ;
99
10- class DefaultTOTPServices ( IOptionsMonitor < AuthenticatorOptions > optionsMonitor ) : ITOTPService
10+ class DefaultTotpServices ( IOptionsMonitor < AuthenticatorOptions > optionsMonitor ) : ITotpService
1111{
12- public TOTPInstanceBase ? TOTPInstance { get ; private set ; }
12+ public TotpInstanceBase ? Instance { get ; private set ; }
1313
1414 public string GenerateOtpUri ( AuthenticatorOptions ? options = null )
1515 {
@@ -23,15 +23,15 @@ public string GenerateOtpUri(AuthenticatorOptions? options = null)
2323 public string Compute ( string secretKey , DateTime ? timestamp = null )
2424 {
2525 var instance = new Totp ( Base32Encoding . ToBytes ( secretKey ) ) ;
26- TOTPInstance = new DefaultTOTPInstance ( instance ) ;
26+ Instance = new DefaultTOTPInstance ( instance ) ;
2727 return timestamp == null ? instance . ComputeTotp ( ) : instance . ComputeTotp ( timestamp . Value ) ;
2828 }
2929
3030 public int GetRemainingSeconds ( DateTime ? timestamp = null )
3131 {
32- if ( TOTPInstance != null )
32+ if ( Instance != null )
3333 {
34- return timestamp == null ? TOTPInstance . GetRemainingSeconds ( ) : TOTPInstance . GetRemainingSeconds ( timestamp . Value ) ;
34+ return timestamp == null ? Instance . GetRemainingSeconds ( ) : Instance . GetRemainingSeconds ( timestamp . Value ) ;
3535 }
3636 var instance = new Totp ( Base32Encoding . ToBytes ( "OMM2LVLFX6QJHMYI" ) ) ;
3737 return timestamp == null ? instance . RemainingSeconds ( ) : instance . RemainingSeconds ( timestamp . Value ) ;
@@ -50,16 +50,16 @@ public byte[] GetSecretKeyBytes(string input)
5050
5151 public bool Verify ( string code , DateTime ? timestamp = null )
5252 {
53- if ( TOTPInstance != null )
53+ if ( Instance != null )
5454 {
55- return timestamp == null ? TOTPInstance . Verify ( code ) : TOTPInstance . Verify ( code , timestamp . Value ) ;
55+ return timestamp == null ? Instance . Verify ( code ) : Instance . Verify ( code , timestamp . Value ) ;
5656 }
5757 var instance = new Totp ( Base32Encoding . ToBytes ( "OMM2LVLFX6QJHMYI" ) ) ;
5858 return timestamp == null ? instance . VerifyTotp ( code , out _ ) : instance . VerifyTotp ( timestamp . Value , code , out _ ) ;
5959 }
6060}
6161
62- class DefaultTOTPInstance ( Totp instance ) : TOTPInstanceBase
62+ class DefaultTOTPInstance ( Totp instance ) : TotpInstanceBase
6363{
6464 public override int GetRemainingSeconds ( DateTime ? timestamp = null )
6565 {
0 commit comments