Coder Social home page Coder Social logo

google-authenticator-rust's People

Contributors

hanskorg avatar jtr109 avatar mourinaruto avatar ralpha avatar thoucheese avatar typr124 avatar x1957 avatar zjhmale avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

google-authenticator-rust's Issues

discrepancy works in 30s intervals?

I've been playing around with the discrepancy parameter, and it definitely doesn't work in seconds, but in a larger time interval.
I think because the time is first divided by 30, and then you create the range [x-discrepancy, x+discrepancy], then the actual discrepancy is multiplied by 30?

The description in the docs saying The parameter discrepancy indicates number of seconds ago that a code may be generated. is incorrect, as what it really indicates is the number of half-minutes ago and in the future that the code may be generated?

pub fn verify_code(&self, secret: &str, code: &str, discrepancy: u64, time_slice: u64) -> bool {
if code.len() != self.code_len {
return false;
}
let curr_time_slice = if time_slice == 0 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap()
.as_secs()
/ 30
} else {
time_slice
};
let start_time = curr_time_slice.saturating_sub(discrepancy);
let end_time = curr_time_slice.saturating_add(discrepancy + 1);
for _time_slice in start_time..end_time {
if let Ok(c) = self.get_code(secret, _time_slice) {
if code == c {
return true;
}
}
}
false
}

I think the docs or the usage of the parameter discrepancy should be modified, no?

use of undeclared crate or module `google_authenticator` for v0.4.0 release from crates.io

When I add v0.4.0 in Cargo.toml, I get the following error:

error[E0433]: failed to resolve: use of undeclared crate or module `google_authenticator`
   --> src/path/to/file.rs:229:20
    |
229 |         let totp = google_authenticator::GoogleAuthenticator::new();
    |                    ^^^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `google_authenticator`
# Cargo.toml
[dependencies]
google-authenticator = { version = "0.4" }

One thing I am confused about is there is a v0.3.0 and v0.4.0 release at crates.io, but as best I can tell, there is no commit in the history of this repo where Cargo.toml had a version of v0.3.0 or v0.4.0.

I don't get the same error for v0.3.0 or v0.2.0.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.