chore: update to rust-nostr 0.31

This commit is contained in:
reya
2024-05-18 07:52:28 +07:00
parent 10ca4e6ff4
commit 60afbf090b
4 changed files with 92 additions and 92 deletions

View File

@@ -195,7 +195,7 @@ pub async fn load_selected_account(npub: &str, state: State<'_, Nostr>) -> Resul
let relay_url = item.0.to_string();
let opts = match item.1 {
Some(val) => {
if val == RelayMetadata::Read {
if val == &RelayMetadata::Read {
RelayOptions::new().read(true).write(false)
} else {
RelayOptions::new().write(true).read(false)
@@ -251,7 +251,7 @@ pub fn to_npub(hex: &str) -> Result<String, ()> {
#[tauri::command]
pub async fn verify_nip05(key: &str, nip05: &str) -> Result<bool, ()> {
let public_key = PublicKey::from_str(key).unwrap();
let status = nip05::verify(public_key, nip05, None).await;
let status = nip05::verify(&public_key, nip05, None).await;
Ok(status.is_ok())
}

View File

@@ -91,12 +91,12 @@ pub async fn friend_to_friend(npub: &str, state: State<'_, Nostr>) -> Result<boo
if let Ok(contact_list_events) = client.get_events_of(vec![contact_list_filter], None).await {
for event in contact_list_events.into_iter() {
for tag in event.into_iter_tags() {
if let Tag::PublicKey {
if let Some(TagStandard::PublicKey {
public_key,
relay_url,
alias,
uppercase: false,
} = tag
}) = tag.to_standardized()
{
contact_list.push(Contact::new(public_key, relay_url, alias))
}
@@ -300,7 +300,7 @@ pub async fn set_nstore(
let public_key = signer.public_key().await.unwrap();
let encrypted = signer.nip44_encrypt(public_key, content).await.unwrap();
let tag = Tag::Identifier(key.into());
let tag = Tag::identifier(key);
let builder = EventBuilder::new(Kind::ApplicationSpecificData, encrypted, vec![tag]);
match client.send_event_builder(builder).await {