diff --git a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt index fea9662..8d8fc73 100644 --- a/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt +++ b/singlefactorauth/src/main/java/com/web3auth/singlefactorauth/SingleFactorAuth.kt @@ -214,12 +214,17 @@ class SingleFactorAuth( } } - fun logout(context: Context) { - sessionManager.invalidateSession(context).whenComplete { res, _ -> + fun logout(context: Context): CompletableFuture { + val logoutCF = CompletableFuture() + sessionManager.invalidateSession(context).whenComplete { res, err -> if (res) { SessionManager.deleteSessionIdFromStorage() this.state = null + logoutCF.complete(null) + } else { + logoutCF.completeExceptionally(err) } } + return logoutCF } } \ No newline at end of file