notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit 343d3dc569f6ca9ac7c97ab01027b84d403b71d0
parent 83197bac78303ce588f2b75f67ee80f18f005a81
Author: kernelkind <kernelkind@gmail.com>
Date:   Mon,  1 Apr 2024 11:04:47 -0400

Add login manager

Signed-off-by: kernelkind <kernelkind@gmail.com>

Diffstat:
Msrc/lib.rs | 1+
Asrc/login_manager.rs | 23+++++++++++++++++++++++
2 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/src/lib.rs b/src/lib.rs @@ -19,6 +19,7 @@ mod timeline; mod colors; mod profile; mod key_parsing; +mod login_manager; #[cfg(test)] #[macro_use] diff --git a/src/login_manager.rs b/src/login_manager.rs @@ -0,0 +1,23 @@ +use crate::key_parsing::LoginError; +use nostr_sdk::Keys; +use poll_promise::Promise; + +/// Helper storage object for retrieving the plaintext key from the user and converting it into a +/// nostr-sdk Keys object if possible. +pub struct LoginManager { + pub login_key: String, + pub promise: Option<Promise<Result<Keys, LoginError>>>, + pub error: Option<LoginError>, + pub key_on_error: Option<String> +} + +impl LoginManager { + pub fn new() -> Self { + LoginManager { + login_key: String::new(), + promise: None, + error: None, + key_on_error: None + } + } +}