Commit c2ba6d190b2a4f626d93ace26bddf3974e041889

Cléo REBERT 2023-03-28T10:58:39

Replace deprecated base64 call Signed-off-by: Cléo REBERT <cleo.rebert-ext@treezor.com>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
diff --git a/src/lib.rs b/src/lib.rs
index 4c21243..c6a9b14 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -699,6 +699,7 @@ impl TOTP {
     #[cfg(feature = "qr")]
     pub fn get_qr(&self) -> Result<String, String> {
         use image::ImageEncoder;
+        use base64::{Engine as _, engine::general_purpose};
 
         let url = self.get_url();
         let mut vec = Vec::new();
@@ -729,7 +730,7 @@ impl TOTP {
             image_size,
             image::ColorType::L8,
         ) {
-            Ok(_) => Ok(base64::encode(vec)),
+            Ok(_) => Ok(general_purpose::STANDARD.encode(vec)),
             Err(err) => Err(err.to_string()),
         }
     }