We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1eec5c1 commit ef759feCopy full SHA for ef759fe
src/lib.rs
@@ -80,3 +80,4 @@
80
pub mod hotp;
81
pub mod totp;
82
pub mod util;
83
+pub mod otp_result;
src/otp_result.rs
@@ -0,0 +1,26 @@
1
+use std::time::{SystemTime, UNIX_EPOCH};
2
+
3
+struct OTPResult {
4
+ digits: u32,
5
+ code: u32,
6
+}
7
8
+impl OTPResult {
9
+ pub fn new(digits: u32, code: u32 ) -> Self {
10
+ OTPResult { digits, code }
11
+ }
12
13
14
15
+ pub fn get_digits(&self) -> u32 { self.digits }
16
17
18
19
+ pub fn as_string(&self) -> String {
20
+ format!("{:01$}", self.code as usize, self.digits as usize)
21
22
23
+ pub fn as_u32(&self) -> u32 {
24
+ self.code
25
26
0 commit comments