@@ -69,7 +69,7 @@ impl OTPElement {
69
69
pub fn read_from_file ( ) -> Result < Vec < OTPElement > , String > {
70
70
let encrypted_contents = read_to_string ( & get_db_path ( ) ) . unwrap ( ) ;
71
71
//rust close files at the end of the function
72
- let contents = cryptograpy:: decrypt_string ( & encrypted_contents, & cryptograpy:: prompt_for_passwords ( "Password: " ) ) ;
72
+ let contents = cryptograpy:: decrypt_string ( & encrypted_contents, & cryptograpy:: prompt_for_passwords ( "Password: " , 8 ) ) ;
73
73
match contents {
74
74
Ok ( contents) => {
75
75
let vector: Vec < OTPElement > = serde_json:: from_str ( & contents) . unwrap ( ) ;
@@ -174,7 +174,7 @@ pub fn export_database() -> Result<String, String> {
174
174
exported_path. push_str ( "/exported.cotp" ) ;
175
175
let mut file = File :: create ( & exported_path) . expect ( "Cannot create file" ) ;
176
176
let encrypted_contents = read_to_string ( & get_db_path ( ) ) . unwrap ( ) ;
177
- let contents = cryptograpy:: decrypt_string ( & encrypted_contents, & cryptograpy:: prompt_for_passwords ( "Password: " ) ) ;
177
+ let contents = cryptograpy:: decrypt_string ( & encrypted_contents, & cryptograpy:: prompt_for_passwords ( "Password: " , 8 ) ) ;
178
178
match contents {
179
179
Ok ( contents) => {
180
180
if contents == "[]" {
@@ -195,7 +195,7 @@ pub fn overwrite_database(elements: Vec<OTPElement>){
195
195
}
196
196
197
197
pub fn overwrite_database_json ( json : & str ) {
198
- let encrypted = cryptograpy:: encrypt_string ( json. to_string ( ) , & cryptograpy:: prompt_for_passwords ( "Insert password for database encryption: " ) ) ;
198
+ let encrypted = cryptograpy:: encrypt_string ( json. to_string ( ) , & cryptograpy:: prompt_for_passwords ( "Insert password for database encryption: " , 8 ) ) ;
199
199
utils:: write_to_file ( & encrypted, & mut File :: create ( utils:: get_db_path ( ) ) . expect ( "Failed to open file" ) ) ;
200
200
}
201
201
0 commit comments