-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Cléo REBERT <[email protected]>
- Loading branch information
1 parent
cc1474a
commit d54bd9e
Showing
4 changed files
with
70 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "totp-rs" | ||
version = "4.0.0" | ||
version = "4.1.0" | ||
authors = ["Cleo Rebert <[email protected]>"] | ||
rust-version = "1.59" | ||
edition = "2021" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#[cfg(feature = "steam")] | ||
use totp_rs::{Secret, TOTP}; | ||
|
||
#[cfg(feature = "steam")] | ||
#[cfg(feature = "otpauth")] | ||
fn main() { | ||
// create TOTP from base32 secret | ||
let secret_b32 = Secret::Encoded(String::from("OBWGC2LOFVZXI4TJNZTS243FMNZGK5BNGEZDG")); | ||
let totp_b32 = TOTP::new_steam( | ||
secret_b32.to_bytes().unwrap(), | ||
"user-account".to_string(), | ||
); | ||
|
||
println!( | ||
"base32 {} ; raw {}", | ||
secret_b32, | ||
secret_b32.to_raw().unwrap() | ||
); | ||
println!( | ||
"code from base32:\t{}", | ||
totp_b32.generate_current().unwrap() | ||
); | ||
} | ||
|
||
#[cfg(feature = "steam")] | ||
#[cfg(not(feature = "otpauth"))] | ||
fn main() { | ||
// create TOTP from base32 secret | ||
let secret_b32 = Secret::Encoded(String::from("OBWGC2LOFVZXI4TJNZTS243FMNZGK5BNGEZDG")); | ||
let totp_b32 = TOTP::new_steam(secret_b32.to_bytes().unwrap()); | ||
|
||
println!( | ||
"base32 {} ; raw {}", | ||
secret_b32, | ||
secret_b32.to_raw().unwrap() | ||
); | ||
println!( | ||
"code from base32:\t{}", | ||
totp_b32.generate_current().unwrap() | ||
); | ||
} | ||
|
||
#[cfg(not(feature = "steam"))] | ||
fn main() { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters