initial refactor in preparation for routing

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-05-27 12:22:40 -07:00
parent df0377cb89
commit 31b2b5c950
19 changed files with 332 additions and 587 deletions

View File

@@ -1,4 +1,4 @@
use enostr::FullKeypair;
use enostr::Keypair;
#[cfg(target_os = "macos")]
use crate::macos_key_storage::MacOSKeyStorage;
@@ -17,15 +17,15 @@ pub enum KeyStorage {
}
impl KeyStorage {
pub fn get_keys(&self) -> Result<Vec<FullKeypair>, KeyStorageError> {
pub fn get_keys(&self) -> Result<Vec<Keypair>, KeyStorageError> {
match self {
Self::None => Ok(Vec::new()),
#[cfg(target_os = "macos")]
Self::MacOS => Ok(MacOSKeyStorage::new(SERVICE_NAME).get_all_fullkeypairs()),
Self::MacOS => Ok(MacOSKeyStorage::new(SERVICE_NAME).get_all_keypairs()),
}
}
pub fn add_key(&self, key: &FullKeypair) -> Result<(), KeyStorageError> {
pub fn add_key(&self, key: &Keypair) -> Result<(), KeyStorageError> {
let _ = key;
match self {
Self::None => Ok(()),
@@ -34,7 +34,7 @@ impl KeyStorage {
}
}
pub fn remove_key(&self, key: &FullKeypair) -> Result<(), KeyStorageError> {
pub fn remove_key(&self, key: &Keypair) -> Result<(), KeyStorageError> {
let _ = key;
match self {
Self::None => Ok(()),