daegalus / dart-otp

RFC6238 Time-Based One-Time Password / Google Authenticator Library
MIT License
100 stars 25 forks source link

Error in readme and documentation #30

Closed kirasok closed 3 years ago

kirasok commented 3 years ago

In readme and code's comment it is

OTP.generateTOTPCode(String secret, int currentTime, {int length: 6, int interval: 30, Algorithm algorithm: Algorithm.SHA1, bool isGoogle: false})

OTP.generateTOTPCodeString(String secret, int currentTime, {int length: 6, int interval: 30, Algorithm algorithm: Algorithm.SHA1, bool isGoogle: false})

/// Optional parameters to change the length of the code provided (default 6), interval (default 30), and hashing algorithm (default SHA1) /// These settings are defaulted to the RFC standard but can be changed.

But actually it is SHA256:

  static int generateTOTPCode(String secret, int time,
    {int length = 6, int interval = 30, Algorithm algorithm = Algorithm.SHA256, bool isGoogle = false}) {
  static int generateTOTPCodeString(String secret, int time,
    {int length = 6, int interval = 30, Algorithm algorithm = Algorithm.SHA256, bool isGoogle = false}) {
daegalus commented 3 years ago

My apologies, I'll fix the readme shortly.

daegalus commented 3 years ago

Updated the docs, and pushed up 3.0.0 as it has been nullsafe for a while. Thanks for catching that.