only seal gift wraps when the receiver announced encryption support

This commit is contained in:
2026-10-04 13:32:33 +07:00
parent 5cceaa0fc8
commit 417829dbe9
+4 -3
View File
@@ -626,9 +626,10 @@ where
rumor.ensure_id(); rumor.ensure_id();
let rumor_json = rumor.as_json(); let rumor_json = rumor.as_json();
let has_encryption_announcement = receiver.announcement().is_some();
let seal: Event = match encryption_signer { let seal: Event = match (encryption_signer, has_encryption_announcement) {
Some(encryption_signer) => { (Some(encryption_signer), true) => {
let encryption_pubkey = encryption_signer.get_public_key_async().await?; let encryption_pubkey = encryption_signer.get_public_key_async().await?;
let content = encryption_signer let content = encryption_signer
.nip44_encrypt_async(&receiver_key, &rumor_json) .nip44_encrypt_async(&receiver_key, &rumor_json)
@@ -640,7 +641,7 @@ where
.finalize_async(user_signer) .finalize_async(user_signer)
.await? .await?
} }
None => { _ => {
let content = user_signer let content = user_signer
.nip44_encrypt_async(&receiver_key, &rumor_json) .nip44_encrypt_async(&receiver_key, &rumor_json)
.await?; .await?;