chore: refactor NIP-4E implementation

This commit is contained in:
2025-03-09 18:31:29 +07:00
parent 0887970374
commit d93cecbea3
6 changed files with 380 additions and 273 deletions

View File

@@ -19,6 +19,7 @@ pub const BOOTSTRAP_RELAYS: [&str; 3] = [
/// Subscriptions
pub const NEW_MESSAGE_SUB_ID: &str = "listen_new_giftwraps";
pub const ALL_MESSAGES_SUB_ID: &str = "listen_all_giftwraps";
pub const DEVICE_SUB_ID: &str = "listen_device_announcement";
/// Image Resizer Service
pub const IMAGE_SERVICE: &str = "https://wsrv.nl";

View File

@@ -63,11 +63,11 @@ pub async fn get_device_keys() -> Option<Arc<dyn NostrSigner>> {
}
/// Set device keys
pub async fn set_device_keys<T>(signer: T)
pub async fn set_device_keys<T>(signer: Arc<T>)
where
T: NostrSigner + 'static,
{
DEVICE_KEYS.lock().await.replace(Arc::new(signer));
DEVICE_KEYS.lock().await.replace(signer);
// Re-subscribe to all messages
smol::spawn(async move {