This commit is contained in:
2026-09-03 16:38:52 +07:00
parent 018395d0c5
commit 212f35d6bb
69 changed files with 2130 additions and 2373 deletions
+4 -5
View File
@@ -12,11 +12,10 @@ use nostr_sdk::prelude::*;
use crate::signer::UniversalSigner;
/// Open (or create) the LMDB database at `db_path` and build a client
/// configured for Signed, together with a fresh signer.
///
/// Open or create the LMDB database at `db_path`.
/// Build a Signed client and a fresh signer for it.
/// The SDK manages its own internal tokio runtime.
/// the returned client can be driven by GPUI's executors.
/// The returned client can be driven by GPUI's executors.
#[cfg(not(target_arch = "wasm32"))]
pub async fn new_backend(db_path: impl AsRef<Path>) -> Result<(Client, UniversalSigner)> {
let signer = UniversalSigner::new(Keys::generate());
@@ -26,7 +25,7 @@ pub async fn new_backend(db_path: impl AsRef<Path>) -> Result<(Client, Universal
Ok(with_database(signer, database))
}
/// In-memory database on wasm (no LMDB available).
/// In-memory database on wasm, LMDB is unavailable there.
#[cfg(target_arch = "wasm32")]
pub fn new_backend() -> Result<(Client, UniversalSigner)> {
let signer = UniversalSigner::new(Keys::generate());
+3 -2
View File
@@ -31,8 +31,9 @@ impl UniversalSignerError {
}
}
/// A type-erased signer whose inner signer can be swapped in-place
/// (e.g. after login/logout). All clones see the swap.
/// A type-erased signer whose inner signer can be swapped in-place.
/// Swaps happen after login or logout.
/// All clones see the swap.
#[derive(Clone, Debug)]
pub struct UniversalSigner {
inner: Arc<RwLock<Arc<dyn InnerSigner>>>,
+3 -4
View File
@@ -1,12 +1,11 @@
use nostr_sdk::prelude::*;
/// A lightweight "something changed" signal for the UI.
///
/// Heavy data stays in the database; consumers re-query on receipt.
/// A lightweight change notification for the UI.
/// Heavy data stays in the database, consumers re-query on receipt.
#[derive(Debug, Clone)]
pub struct Update {
pub kind: Kind,
/// First `a` tag value of the event, if any (e.g. the repository coordinate).
/// First `a` tag value of the event, if any, for example the repository coordinate.
pub coordinate: Option<Coordinate>,
pub author: PublicKey,
pub event_id: EventId,