mirror of
https://github.com/aljazceru/pubky-core.git
synced 2026-01-09 01:04:26 +01:00
refactor(pubky): simplify internals mod after using pkarr client
This commit is contained in:
@@ -1,28 +1,12 @@
|
||||
use pkarr::SignedPacket;
|
||||
use pubky_common::crypto::PublicKey;
|
||||
use reqwest::RequestBuilder;
|
||||
use url::Url;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::PubkyClient;
|
||||
|
||||
mod endpoints;
|
||||
pub mod resolver;
|
||||
|
||||
impl PubkyClient {
|
||||
// === Pkarr ===
|
||||
|
||||
pub(crate) async fn pkarr_resolve(
|
||||
&self,
|
||||
public_key: &PublicKey,
|
||||
) -> Result<Option<SignedPacket>> {
|
||||
Ok(self.pkarr.resolve(public_key).await?)
|
||||
}
|
||||
|
||||
pub(crate) async fn pkarr_publish(&self, signed_packet: &SignedPacket) -> Result<()> {
|
||||
Ok(self.pkarr.publish(signed_packet).await?)
|
||||
}
|
||||
|
||||
// === HTTP ===
|
||||
|
||||
pub(crate) fn inner_request(&self, method: reqwest::Method, url: Url) -> RequestBuilder {
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
pub mod http;
|
||||
pub mod pkarr;
|
||||
@@ -1,20 +0,0 @@
|
||||
use pkarr::SignedPacket;
|
||||
use pubky_common::crypto::PublicKey;
|
||||
|
||||
use crate::error::Result;
|
||||
use crate::PubkyClient;
|
||||
|
||||
impl PubkyClient {
|
||||
// === Pkarr ===
|
||||
|
||||
pub(crate) async fn pkarr_resolve(
|
||||
&self,
|
||||
public_key: &PublicKey,
|
||||
) -> Result<Option<SignedPacket>> {
|
||||
Ok(self.pkarr.resolve(public_key).await?)
|
||||
}
|
||||
|
||||
pub(crate) async fn pkarr_publish(&self, signed_packet: &SignedPacket) -> Result<()> {
|
||||
Ok(self.pkarr.publish(signed_packet).await?)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user