Skip to content

Commit 44a916a

Browse files
committed
sdk: remove Client::send_direct_msg
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent b97bb93 commit 44a916a

File tree

4 files changed

+1
-67
lines changed

4 files changed

+1
-67
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
* nostr: remove support for `nrelay` NIP-19 entity ([Yuki Kishimoto])
7171
* nostr: remove support for NIP-44 v1 ([Yuki Kishimoto])
7272
* nostr: remove `EventBuilder::encrypted_direct_msg` ([Yuki Kishimoto])
73+
* sdk: remove `Client::send_direct_msg` ([Yuki Kishimoto])
7374
* cli: remove `tracing-subscriber` dep
7475

7576
## [v0.33.0]

bindings/nostr-sdk-ffi/src/client/mod.rs

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -474,25 +474,6 @@ impl Client {
474474
.into())
475475
}
476476

477-
/// Encrypted direct msg
478-
///
479-
/// <div class="warning"><strong>Unsecure!</strong> Use `send_private_msg` instead!</div>
480-
///
481-
/// <https://github.com/nostr-protocol/nips/blob/master/04.md>
482-
pub async fn send_direct_msg(
483-
&self,
484-
receiver: &PublicKey,
485-
msg: String,
486-
reply: Option<Arc<EventId>>,
487-
) -> Result<SendEventOutput> {
488-
#[allow(deprecated)]
489-
Ok(self
490-
.inner
491-
.send_direct_msg(**receiver, msg, reply.map(|r| **r))
492-
.await?
493-
.into())
494-
}
495-
496477
/// Send private direct message to all relays
497478
///
498479
/// <https://github.com/nostr-protocol/nips/blob/master/17.md>

bindings/nostr-sdk-js/src/client/mod.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -517,26 +517,6 @@ impl JsClient {
517517
.map(|id| id.into())
518518
}
519519

520-
/// Send encrypted direct message
521-
///
522-
/// <div class="warning"><strong>Unsecure!</strong> Use `sendPrivateMsg` instead!</div>
523-
///
524-
/// <https://github.com/nostr-protocol/nips/blob/master/04.md>
525-
#[wasm_bindgen(js_name = sendDirectMsg)]
526-
pub async fn send_direct_msg(
527-
&self,
528-
receiver: &JsPublicKey,
529-
msg: &str,
530-
reply: Option<JsEventId>,
531-
) -> Result<JsSendEventOutput> {
532-
#[allow(deprecated)]
533-
self.inner
534-
.send_direct_msg(**receiver, msg, reply.map(|id| id.into()))
535-
.await
536-
.map_err(into_err)
537-
.map(|id| id.into())
538-
}
539-
540520
/// Send private direct message to all relays
541521
///
542522
/// <https://github.com/nostr-protocol/nips/blob/master/17.md>

crates/nostr-sdk/src/client/mod.rs

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1215,34 +1215,6 @@ impl Client {
12151215
Ok(contacts)
12161216
}
12171217

1218-
/// Send encrypted direct message
1219-
///
1220-
/// <https://github.com/nostr-protocol/nips/blob/master/04.md>
1221-
#[deprecated(note = "Unsecure! Use `send_private_msg` instead.")]
1222-
#[cfg(feature = "nip04")]
1223-
pub async fn send_direct_msg<S>(
1224-
&self,
1225-
receiver: PublicKey,
1226-
msg: S,
1227-
reply_to: Option<EventId>,
1228-
) -> Result<Output<EventId>, Error>
1229-
where
1230-
S: Into<String>,
1231-
{
1232-
let signer = self.signer().await?;
1233-
let content: String = signer.nip04_encrypt(receiver, msg.into()).await?;
1234-
1235-
let mut tags: Vec<Tag> = Vec::with_capacity(1 + usize::from(reply_to.is_some()));
1236-
tags.push(Tag::public_key(receiver));
1237-
if let Some(id) = reply_to {
1238-
tags.push(Tag::event(id));
1239-
}
1240-
1241-
let builder: EventBuilder = EventBuilder::new(Kind::EncryptedDirectMessage, content, tags);
1242-
1243-
self.send_event_builder(builder).await
1244-
}
1245-
12461218
/// Send private direct message to all relays
12471219
///
12481220
/// <https://github.com/nostr-protocol/nips/blob/master/17.md>

0 commit comments

Comments
 (0)