Ejemplo n.º 1
0
 /// <summary>
 /// Generates the URI for provisioning
 /// </summary>
 /// <param name="identifier">The string that presents identity (username or email)</param>
 /// <param name="secret">The secret key</param>
 /// <param name="issuer">The string that presents name of issuer</param>
 /// <returns></returns>
 public static string GenerateProvisioningUri(string identifier, string secret, string issuer = null)
 => OTPService.GenerateProvisioningUri(identifier, secret.ToBytes(), issuer);
Ejemplo n.º 2
0
 /// <summary>
 /// Generates the time-based password (RFC 6238)
 /// </summary>
 /// <param name="secret">The secret key to generate password</param>
 /// <param name="interval">The interval length (seconds) to generate password - Authenticator app (just like Google /Microsoft) uses 30 seconds interval length</param>
 /// <param name="digits">The number of password digits</param>
 /// <returns></returns>
 public static string GeneratePassword(byte[] secret, int interval = 30, int digits = 6)
 => OTPService.GeneratePassword(secret, DateTime.Now.ToUnixTimestamp() / (interval > 0 ? interval : 30), digits);
Ejemplo n.º 3
0
 /// <summary>
 /// Generates the time-based password (RFC 6238)
 /// </summary>
 /// <param name="secret">The secret key to generate password</param>
 /// <param name="interval">The interval length (seconds) to generate password - Authenticator app (just like Google /Microsoft) uses 30 seconds interval length</param>
 /// <param name="digits">The number of password digits</param>
 /// <returns></returns>
 public static string GeneratePassword(string secret, int interval = 30, int digits = 6)
 => OTPService.GeneratePassword(secret.ToBytes(), interval, digits);
Ejemplo n.º 4
0
 /// <summary>
 /// Generates the counter-based password (RFC 4226)
 /// </summary>
 /// <param name="secret">The secret key to generate password</param>
 /// <param name="counter">The counter to generate password from the secret key</param>
 /// <param name="digits">The number of password digits</param>
 /// <returns></returns>
 public static string GeneratePassword(string secret, long counter, int digits = 6)
 => OTPService.GeneratePassword(secret.ToBytes(), counter, digits);