* Changed version to 0.4.0 and updated docs
This commit is contained in:
parent
66ef16fb45
commit
2c12f47652
|
@ -1,6 +1,6 @@
|
||||||
[package]
|
[package]
|
||||||
name = "totp-rs"
|
name = "totp-rs"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
authors = ["Cleo Rebert <cleo.rebert@gmail.com>"]
|
authors = ["Cleo Rebert <cleo.rebert@gmail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -14,7 +14,6 @@ You can then do something like:
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
use totp_rs::{Algorithm, TOTP};
|
use totp_rs::{Algorithm, TOTP};
|
||||||
|
|
||||||
let username = "example".to_owned();
|
|
||||||
let totp = TOTP::new(
|
let totp = TOTP::new(
|
||||||
Algorithm::SHA1,
|
Algorithm::SHA1,
|
||||||
6,
|
6,
|
||||||
|
@ -25,7 +24,7 @@ let totp = TOTP::new(
|
||||||
let time = SystemTime::now()
|
let time = SystemTime::now()
|
||||||
.duration_since(SystemTime::UNIX_EPOCH).unwrap()
|
.duration_since(SystemTime::UNIX_EPOCH).unwrap()
|
||||||
.as_secs();
|
.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);
|
println!("{}", url);
|
||||||
let token = totp.generate(time);
|
let token = totp.generate(time);
|
||||||
println!("{}", token);
|
println!("{}", token);
|
||||||
|
@ -43,7 +42,6 @@ You can then do something like:
|
||||||
```Rust
|
```Rust
|
||||||
use totp_rs::{Algorithm, TOTP};
|
use totp_rs::{Algorithm, TOTP};
|
||||||
|
|
||||||
let username = "example".to_owned();
|
|
||||||
let totp = TOTP::new(
|
let totp = TOTP::new(
|
||||||
Algorithm::SHA1,
|
Algorithm::SHA1,
|
||||||
6,
|
6,
|
||||||
|
@ -51,6 +49,6 @@ let totp = TOTP::new(
|
||||||
30,
|
30,
|
||||||
"supersecret".to_owned().into_bytes(),
|
"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);
|
println!("{}", code);
|
||||||
```
|
```
|
||||||
|
|
|
@ -6,7 +6,6 @@
|
||||||
//! use std::time::SystemTime;
|
//! use std::time::SystemTime;
|
||||||
//! use totp_rs::{Algorithm, TOTP};
|
//! use totp_rs::{Algorithm, TOTP};
|
||||||
//!
|
//!
|
||||||
//! let username = "example";
|
|
||||||
//! let totp = TOTP::new(
|
//! let totp = TOTP::new(
|
||||||
//! Algorithm::SHA1,
|
//! Algorithm::SHA1,
|
||||||
//! 6,
|
//! 6,
|
||||||
|
@ -17,7 +16,7 @@
|
||||||
//! let time = SystemTime::now()
|
//! let time = SystemTime::now()
|
||||||
//! .duration_since(SystemTime::UNIX_EPOCH).unwrap()
|
//! .duration_since(SystemTime::UNIX_EPOCH).unwrap()
|
||||||
//! .as_secs();
|
//! .as_secs();
|
||||||
//! let url = totp.get_url(username, "my-org.com");
|
//! let url = totp.get_url("user@example.com", "my-org.com");
|
||||||
//! println!("{}", url);
|
//! println!("{}", url);
|
||||||
//! let token = totp.generate(time);
|
//! let token = totp.generate(time);
|
||||||
//! println!("{}", token);
|
//! println!("{}", token);
|
||||||
|
@ -26,7 +25,6 @@
|
||||||
//! ```rust
|
//! ```rust
|
||||||
//! use totp_rs::{Algorithm, TOTP};
|
//! use totp_rs::{Algorithm, TOTP};
|
||||||
//!
|
//!
|
||||||
//! let username = "example";
|
|
||||||
//! let totp = TOTP::new(
|
//! let totp = TOTP::new(
|
||||||
//! Algorithm::SHA1,
|
//! Algorithm::SHA1,
|
||||||
//! 6,
|
//! 6,
|
||||||
|
@ -34,7 +32,7 @@
|
||||||
//! 30,
|
//! 30,
|
||||||
//! "supersecret".to_owned().into_bytes(),
|
//! "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);
|
//! println!("{}", code);
|
||||||
//! ```
|
//! ```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue