diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/login/fresh.rs | 38 |
1 files changed, 31 insertions, 7 deletions
diff --git a/src/lib/login/fresh.rs b/src/lib/login/fresh.rs index 458b0f9..59026bd 100644 --- a/src/lib/login/fresh.rs +++ b/src/lib/login/fresh.rs | |||
| @@ -751,7 +751,6 @@ async fn display_login_help_content() { | |||
| 751 | let mut printer = Printer::default(); | 751 | let mut printer = Printer::default(); |
| 752 | let title_style = Style::new().bold().fg(console::Color::Yellow); | 752 | let title_style = Style::new().bold().fg(console::Color::Yellow); |
| 753 | printer.println("|==============================|".to_owned()); | 753 | printer.println("|==============================|".to_owned()); |
| 754 | // printer.println("| |".to_owned()); | ||
| 755 | printer.println_with_custom_formatting( | 754 | printer.println_with_custom_formatting( |
| 756 | format!( | 755 | format!( |
| 757 | "| {} |", | 756 | "| {} |", |
| @@ -759,13 +758,38 @@ async fn display_login_help_content() { | |||
| 759 | ), | 758 | ), |
| 760 | "| nostr login / sign up help |".to_string(), | 759 | "| nostr login / sign up help |".to_string(), |
| 761 | ); | 760 | ); |
| 762 | // printer.println("| |".to_owned()); | ||
| 763 | printer.println("|==============================|".to_owned()); | 761 | printer.println("|==============================|".to_owned()); |
| 764 | printer.printlns(vec![ | 762 | print_lines_with_headings( |
| 765 | "".to_string(), | 763 | vec![ |
| 766 | "login / sign up help content should go here...".to_string(), | 764 | "# What is a Nostr account?", |
| 767 | "press ctrl + c to return the login / sign up menu again...".to_string(), | 765 | "A Nostr account consists of a secret key you control, known as an 'nsec' and a corresponding public key called an 'npub.' Clients like ngit and gitworkshop.dev use your keys to sign messages and verify that other messages are signed by the correct keys.", |
| 768 | ]); | 766 | "", |
| 767 | "# How do I sign into an existing Nostr account?", | ||
| 768 | "1. Using your secret key (nsec): Export your nsec from an existing client or browser extension. Run `ngit login` and enter your nsec.", | ||
| 769 | "2. Using Nostr Connect.", | ||
| 770 | "", | ||
| 771 | "# What is Nostr Connect?", | ||
| 772 | "Nostr Connect allows you to use multiple clients without sharing your secret key. A signer app manages your secret and signs messages on behalf of connected clients. This technology is new, and as of December 2024, only Amber for Android is recommended.", | ||
| 773 | "", | ||
| 774 | "# If I create a Nostr account using ngit, how can I sign in with other Nostr clients?", | ||
| 775 | "You can export your secret key by running `ngit export-key` and import it into another client.", | ||
| 776 | "", | ||
| 777 | "press ctrl + c to return the login / sign up menu again...", | ||
| 778 | ], | ||
| 779 | &mut printer, | ||
| 780 | ); | ||
| 769 | let _ = signal::ctrl_c().await; | 781 | let _ = signal::ctrl_c().await; |
| 770 | printer.clear_all(); | 782 | printer.clear_all(); |
| 771 | } | 783 | } |
| 784 | |||
| 785 | fn print_lines_with_headings(lines: Vec<&str>, printer: &mut Printer) { | ||
| 786 | let heading_style = Style::new().bold(); | ||
| 787 | for line in lines { | ||
| 788 | if line.starts_with("# ") { | ||
| 789 | let s = line.replace("# ", "").to_string(); | ||
| 790 | printer.println_with_custom_formatting(heading_style.apply_to(&s).to_string(), s); | ||
| 791 | } else { | ||
| 792 | printer.println(line.to_string()); | ||
| 793 | } | ||
| 794 | } | ||
| 795 | } | ||