remove wasm support and drop unused code paths

This commit is contained in:
2026-10-03 10:53:26 +07:00
parent 855f7f5659
commit 24070cc2cd
18 changed files with 51 additions and 1228 deletions
+1 -6
View File
@@ -8,12 +8,7 @@ publish.workspace = true
nostr-sdk.workspace = true
nostr-connect.workspace = true
nostr-gossip-memory.workspace = true
nostr-lmdb.workspace = true
anyhow.workspace = true
webbrowser.workspace = true
[target.'cfg(target_arch = "wasm32")'.dependencies]
nostr-memory.workspace = true
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
nostr-lmdb.workspace = true
-12
View File
@@ -1,18 +1,13 @@
#[cfg(not(target_arch = "wasm32"))]
use std::path::Path;
use std::time::Duration;
use anyhow::{Context, Result};
use nostr_gossip_memory::prelude::*;
#[cfg(not(target_arch = "wasm32"))]
use nostr_lmdb::prelude::*;
#[cfg(target_arch = "wasm32")]
use nostr_memory::prelude::*;
use nostr_sdk::prelude::*;
use crate::signer::UniversalSigner;
#[cfg(not(target_arch = "wasm32"))]
pub async fn new_backend(db_path: impl AsRef<Path>) -> Result<(Client, UniversalSigner)> {
let signer = UniversalSigner::new(Keys::generate());
let database = NostrLmdb::open(db_path)
@@ -21,13 +16,6 @@ pub async fn new_backend(db_path: impl AsRef<Path>) -> Result<(Client, Universal
Ok(with_database(signer, database))
}
/// 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());
Ok(with_database(signer, MemoryDatabase::unbounded()))
}
fn with_database<D>(signer: UniversalSigner, database: D) -> (Client, UniversalSigner)
where
D: IntoNostrDatabase,