chore: clean up tauri commands

This commit is contained in:
reya
2024-05-18 14:59:34 +07:00
parent 99d9c70826
commit ca06f2b6ed
11 changed files with 21 additions and 388 deletions

View File

@@ -107,17 +107,6 @@ pub async fn nostr_connect(
}
}
#[tauri::command]
pub async fn verify_signer(state: State<'_, Nostr>) -> Result<bool, ()> {
let client = &state.client;
if (client.signer().await).is_ok() {
Ok(true)
} else {
Ok(false)
}
}
#[tauri::command(async)]
pub fn get_encrypted_key(npub: &str, password: &str) -> Result<String, String> {
let keyring = Entry::new("Lume Secret Storage", npub).unwrap();
@@ -249,9 +238,12 @@ 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;
Ok(status.is_ok())
pub async fn verify_nip05(key: &str, nip05: &str) -> Result<bool, String> {
match PublicKey::from_str(key) {
Ok(public_key) => {
let status = nip05::verify(&public_key, nip05, None).await;
Ok(status.is_ok())
}
Err(err) => Err(err.to_string()),
}
}