Skip to content
This repository was archived by the owner on Feb 3, 2025. It is now read-only.

Commit 9109707

Browse files
return error for events sent to inactive profiles
1 parent 73710b1 commit 9109707

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

mutiny-core/src/nostr/nwc.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -421,10 +421,7 @@ impl NostrWalletConnect {
421421
let mut needs_save = false;
422422
let mut needs_delete = false;
423423
let mut result = None;
424-
if self.profile.active()
425-
&& event.kind == Kind::WalletConnectRequest
426-
&& event.pubkey == client_pubkey
427-
{
424+
if event.kind == Kind::WalletConnectRequest && event.pubkey == client_pubkey {
428425
let server_key = self.server_key.secret_key()?;
429426

430427
let decrypted = decrypt(server_key, &client_pubkey, &event.content)?;
@@ -446,6 +443,18 @@ impl NostrWalletConnect {
446443
}
447444
};
448445

446+
// only respond to commands sent to active profiles
447+
if !self.profile.active() {
448+
return self
449+
.get_skipped_error_event(
450+
&event,
451+
req.method,
452+
ErrorCode::Other,
453+
"Nostr profile inactive".to_string(),
454+
)
455+
.map(Some);
456+
}
457+
449458
// only respond to commands that are allowed by the profile
450459
if !self.profile.available_commands().contains(&req.method) {
451460
return self

0 commit comments

Comments
 (0)