@@ -184,8 +184,8 @@ pub trait PrimaryPasswordAuthenticator: Send + Sync {
184184 /// Get a primary password for authentication, otherwise return the
185185 /// AuthenticationCancelled error to cancel the authentication process.
186186 async fn get_primary_password ( & self ) -> ApiResult < String > ;
187- fn on_authentication_success ( & self ) ;
188- fn on_authentication_failure ( & self ) ;
187+ async fn on_authentication_success ( & self ) ;
188+ async fn on_authentication_failure ( & self ) ;
189189}
190190
191191/// Use the `NSSKeyManager` to use NSS for key management.
@@ -215,11 +215,11 @@ pub trait PrimaryPasswordAuthenticator: Send + Sync {
215215/// Ok("secret".to_string())
216216/// }
217217///
218- /// fn on_authentication_success(&self) {
218+ /// async fn on_authentication_success(&self) {
219219/// println!("success");
220220/// }
221221///
222- /// fn on_authentication_failure(&self) {
222+ /// async fn on_authentication_failure(&self) {
223223/// println!("this did not work, please try again:");
224224/// }
225225/// }
@@ -284,19 +284,25 @@ impl KeyManager for NSSKeyManager {
284284 let mut result = api_authenticate_with_primary_password ( & primary_password) ?;
285285
286286 if result {
287- self . primary_password_authenticator
288- . on_authentication_success ( ) ;
287+ block_on (
288+ self . primary_password_authenticator
289+ . on_authentication_success ( ) ,
290+ ) ;
289291 } else {
290292 while !result {
291- self . primary_password_authenticator
292- . on_authentication_failure ( ) ;
293+ block_on (
294+ self . primary_password_authenticator
295+ . on_authentication_failure ( ) ,
296+ ) ;
293297
294298 let primary_password =
295299 block_on ( self . primary_password_authenticator . get_primary_password ( ) ) ?;
296300 result = api_authenticate_with_primary_password ( & primary_password) ?;
297301 }
298- self . primary_password_authenticator
299- . on_authentication_success ( ) ;
302+ block_on (
303+ self . primary_password_authenticator
304+ . on_authentication_success ( ) ,
305+ ) ;
300306 }
301307 }
302308
@@ -458,8 +464,8 @@ mod keydb_test {
458464 async fn get_primary_password ( & self ) -> ApiResult < String > {
459465 Ok ( self . password . clone ( ) )
460466 }
461- fn on_authentication_success ( & self ) { }
462- fn on_authentication_failure ( & self ) { }
467+ async fn on_authentication_success ( & self ) { }
468+ async fn on_authentication_failure ( & self ) { }
463469 }
464470
465471 fn profile_path ( ) -> PathBuf {
0 commit comments