Merge pull request #5 from underdiskdev/master Changed a bunch of to_string() to to_owned()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114
diff --git a/Cargo.toml b/Cargo.toml
index 763c1dc..9ac0b71 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "totp-rs"
-version = "0.3.0"
+version = "0.3.1"
authors = ["Cleo Rebert <cleo.rebert@gmail.com>"]
edition = "2018"
readme = "README.md"
diff --git a/README.md b/README.md
index a837f0a..f372113 100644
--- a/README.md
+++ b/README.md
@@ -14,18 +14,18 @@ You can then do something like:
use std::time::SystemTime;
use totp_rs::{Algorithm, TOTP};
-let username = "example".to_string();
+let username = "example".to_owned();
let totp = TOTP::new(
Algorithm::SHA1,
6,
1,
30,
- "supersecret".to_string().into_bytes(),
+ "supersecret".to_owned().into_bytes(),
);
let time = SystemTime::now()
.duration_since(SystemTime::UNIX_EPOCH).unwrap()
.as_secs();
-let url = totp.get_url(format!("account:{}", username), "my-org.com".to_string());
+let url = totp.get_url(format!("account:{}", username), "my-org.com".to_owned());
println!("{}", url);
let token = totp.generate(time);
println!("{}", token);
@@ -43,14 +43,14 @@ You can then do something like:
```Rust
use totp_rs::{Algorithm, TOTP};
-let username = "example".to_string();
+let username = "example".to_owned();
let totp = TOTP::new(
Algorithm::SHA1,
6,
1,
30,
- "supersecret".to_string().into_bytes(),
+ "supersecret".to_owned().into_bytes(),
);
-let code = totp.get_qr(format!("account:{}", username), "my-org.com".to_string())?;
+let code = totp.get_qr(format!("account:{}", username), "my-org.com".to_owned())?;
println!("{}", code);
```
diff --git a/src/lib.rs b/src/lib.rs
index 100cd4d..1cb959f 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -6,18 +6,18 @@
//! use std::time::SystemTime;
//! use totp_rs::{Algorithm, TOTP};
//!
-//! let username = "example".to_string();
+//! let username = "example".to_owned();
//! let totp = TOTP::new(
//! Algorithm::SHA1,
//! 6,
//! 1,
//! 30,
-//! "supersecret".to_string().into_bytes(),
+//! "supersecret".to_owned().into_bytes(),
//! );
//! let time = SystemTime::now()
//! .duration_since(SystemTime::UNIX_EPOCH).unwrap()
//! .as_secs();
-//! let url = totp.get_url(format!("account:{}", username), "my-org.com".to_string());
+//! let url = totp.get_url(format!("account:{}", username), "my-org.com".to_owned());
//! println!("{}", url);
//! let token = totp.generate(time);
//! println!("{}", token);
@@ -26,15 +26,15 @@
//! ```
//! use totp_rs::{Algorithm, TOTP};
//!
-//! let username = "example".to_string();
+//! let username = "example".to_owned();
//! let totp = TOTP::new(
//! Algorithm::SHA1,
//! 6,
//! 1,
//! 30,
-//! "supersecret".to_string().into_bytes(),
+//! "supersecret".to_owned().into_bytes(),
//! );
-//! let code = totp.get_qr(format!("account:{}", username), "my-org.com".to_string())?;
+//! let code = totp.get_qr(format!("account:{}", username), "my-org.com".to_owned())?;
//! println!("{}", code);
//! ```
@@ -143,9 +143,9 @@ impl TOTP {
pub fn get_url(&self, label: String, issuer: String) -> String {
let algorithm: String;
match self.algorithm {
- Algorithm::SHA1 => algorithm = "SHA1".to_string(),
- Algorithm::SHA256 => algorithm = "SHA256".to_string(),
- Algorithm::SHA512 => algorithm = "SHA512".to_string(),
+ Algorithm::SHA1 => algorithm = "SHA1".to_owned(),
+ Algorithm::SHA256 => algorithm = "SHA256".to_owned(),
+ Algorithm::SHA512 => algorithm = "SHA512".to_owned(),
}
format!(
"otpauth://totp/{}?secret={}&issuer={}&digits={}&algorithm={}",