feat: nip4e (#188)

* encryption keys

* .

* .

* move nip4e to device crate

* .

* .

* use i18n for device crate

* refactor

* refactor

* .

* add reset button

* send message with encryption keys

* clean up

* .

* choose signer

* fix

* update i18n

* fix sending
This commit is contained in:
reya
2025-10-26 18:10:40 +07:00
committed by GitHub
parent 83687e5448
commit 15bbe82a87
29 changed files with 1856 additions and 851 deletions
+12
View File
@@ -1,7 +1,9 @@
use std::sync::OnceLock;
use nostr_sdk::prelude::*;
use whoami::{devicename, platform};
use crate::constants::CLIENT_NAME;
use crate::state::AppState;
pub mod constants;
@@ -9,6 +11,7 @@ pub mod paths;
pub mod state;
static APP_STATE: OnceLock<AppState> = OnceLock::new();
static APP_NAME: OnceLock<String> = OnceLock::new();
static NIP65_RELAYS: OnceLock<Vec<(RelayUrl, Option<RelayMetadata>)>> = OnceLock::new();
static NIP17_RELAYS: OnceLock<Vec<RelayUrl>> = OnceLock::new();
@@ -17,6 +20,15 @@ pub fn app_state() -> &'static AppState {
APP_STATE.get_or_init(AppState::new)
}
pub fn app_name() -> &'static String {
APP_NAME.get_or_init(|| {
let devicename = devicename();
let platform = platform();
format!("{CLIENT_NAME} on {platform} ({devicename})")
})
}
/// Default NIP-65 Relays. Used for new account
pub fn default_nip65_relays() -> &'static Vec<(RelayUrl, Option<RelayMetadata>)> {
NIP65_RELAYS.get_or_init(|| {