chore: rewrite the backend (not tested) (#203)

* wip: refactor

* refactor

* clean up

* .

* rename

* add relay auth

* .

* .

* optimize

* .

* clean up

* add encryption crate

* .

* .

* .

* .

* .

* add encryption crate

* .

* refactor nip4e

* .

* fix endless loop

* fix metadata fetching
This commit is contained in:
reya
2025-11-11 09:09:33 +07:00
committed by GitHub
parent a1a0a7ecd4
commit 512834b640
68 changed files with 3503 additions and 3194 deletions

View File

@@ -6,9 +6,33 @@ use std::path::PathBuf;
use std::pin::Pin;
use anyhow::Result;
use common::config_dir;
use futures::FutureExt as _;
use gpui::AsyncApp;
use states::config_dir;
use nostr_sdk::prelude::*;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct Credential {
public_key: PublicKey,
secret: String,
}
impl Credential {
pub fn new(user: String, secret: Vec<u8>) -> Self {
Self {
public_key: PublicKey::parse(&user).unwrap(),
secret: String::from_utf8(secret).unwrap(),
}
}
pub fn public_key(&self) -> PublicKey {
self.public_key
}
pub fn secret(&self) -> &str {
&self.secret
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum KeyItem {

View File

@@ -1,11 +1,10 @@
use std::sync::{Arc, LazyLock};
pub use backend::*;
use gpui::{App, AppContext, Context, Entity, Global, Task};
use smallvec::{smallvec, SmallVec};
use crate::backend::{FileProvider, KeyBackend, KeyringProvider};
pub mod backend;
mod backend;
static DISABLE_KEYRING: LazyLock<bool> =
LazyLock::new(|| std::env::var("DISABLE_KEYRING").is_ok_and(|value| !value.is_empty()));