* Changed version to 0.4.0 and updated docs

This commit is contained in:
Mark Nijboer 2020-06-22 16:16:05 +02:00
parent 66ef16fb45
commit 2c12f47652
3 changed files with 5 additions and 9 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "totp-rs"
version = "0.3.2"
version = "0.4.0"
authors = ["Cleo Rebert <cleo.rebert@gmail.com>"]
edition = "2018"
readme = "README.md"

View File

@ -14,7 +14,6 @@ You can then do something like:
use std::time::SystemTime;
use totp_rs::{Algorithm, TOTP};
let username = "example".to_owned();
let totp = TOTP::new(
Algorithm::SHA1,
6,
@ -25,7 +24,7 @@ let totp = TOTP::new(
let time = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH).unwrap()
.as_secs();
let url = totp.get_url(format!("account:{}", username), "my-org.com".to_owned());
let url = totp.get_url("user@example.com", "my-org.com");
println!("{}", url);
let token = totp.generate(time);
println!("{}", token);
@ -43,7 +42,6 @@ You can then do something like:
```Rust
use totp_rs::{Algorithm, TOTP};
let username = "example".to_owned();
let totp = TOTP::new(
Algorithm::SHA1,
6,
@ -51,6 +49,6 @@ let totp = TOTP::new(
30,
"supersecret".to_owned().into_bytes(),
);
let code = totp.get_qr(format!("account:{}", username), "my-org.com".to_owned())?;
let code = totp.get_qr("user@example.com", "my-org.com")?;
println!("{}", code);
```

View File

@ -6,7 +6,6 @@
//! use std::time::SystemTime;
//! use totp_rs::{Algorithm, TOTP};
//!
//! let username = "example";
//! let totp = TOTP::new(
//! Algorithm::SHA1,
//! 6,
@ -17,7 +16,7 @@
//! let time = SystemTime::now()
//! .duration_since(SystemTime::UNIX_EPOCH).unwrap()
//! .as_secs();
//! let url = totp.get_url(username, "my-org.com");
//! let url = totp.get_url("user@example.com", "my-org.com");
//! println!("{}", url);
//! let token = totp.generate(time);
//! println!("{}", token);
@ -26,7 +25,6 @@
//! ```rust
//! use totp_rs::{Algorithm, TOTP};
//!
//! let username = "example";
//! let totp = TOTP::new(
//! Algorithm::SHA1,
//! 6,
@ -34,7 +32,7 @@
//! 30,
//! "supersecret".to_owned().into_bytes(),
//! );
//! let code = totp.get_qr(username, "my-org.com").unwrap();
//! let code = totp.get_qr("user@example.com", "my-org.com").unwrap();
//! println!("{}", code);
//! ```