hot fixes to utc-6
This commit is contained in:
@@ -2,12 +2,25 @@ use super::RpcHandler;
|
||||
use crate::{backup, identity, nostr_discovery};
|
||||
use crate::container::docker_packages;
|
||||
use anyhow::Result;
|
||||
use nostr_sdk::ToBech32;
|
||||
|
||||
impl RpcHandler {
|
||||
pub(super) async fn handle_node_did(&self) -> Result<serde_json::Value> {
|
||||
let (data, _) = self.state_manager.get_snapshot().await;
|
||||
let did = identity::did_key_from_pubkey_hex(&data.server_info.pubkey)?;
|
||||
Ok(serde_json::json!({ "did": did, "pubkey": data.server_info.pubkey }))
|
||||
let identity_dir = self.config.data_dir.join("identity");
|
||||
let nostr_pubkey = nostr_discovery::get_nostr_pubkey(&identity_dir).await.ok();
|
||||
let nostr_npub = nostr_pubkey.as_ref().and_then(|hex| {
|
||||
nostr_sdk::PublicKey::from_hex(hex)
|
||||
.ok()
|
||||
.and_then(|pk| pk.to_bech32().ok())
|
||||
});
|
||||
Ok(serde_json::json!({
|
||||
"did": did,
|
||||
"pubkey": data.server_info.pubkey,
|
||||
"nostr_pubkey": nostr_pubkey,
|
||||
"nostr_npub": nostr_npub,
|
||||
}))
|
||||
}
|
||||
|
||||
/// Sign a challenge to prove control of the node DID (proof-of-control for onboarding).
|
||||
@@ -91,8 +104,14 @@ impl RpcHandler {
|
||||
|
||||
pub(super) async fn handle_node_nostr_pubkey(&self) -> Result<serde_json::Value> {
|
||||
let identity_dir = self.config.data_dir.join("identity");
|
||||
let pubkey = nostr_discovery::get_nostr_pubkey(&identity_dir).await?;
|
||||
Ok(serde_json::json!({ "nostr_pubkey": pubkey }))
|
||||
let pubkey_hex = nostr_discovery::get_nostr_pubkey(&identity_dir).await?;
|
||||
let npub = nostr_sdk::PublicKey::from_hex(&pubkey_hex)
|
||||
.ok()
|
||||
.and_then(|pk| pk.to_bech32().ok());
|
||||
Ok(serde_json::json!({
|
||||
"nostr_pubkey": pubkey_hex,
|
||||
"nostr_npub": npub,
|
||||
}))
|
||||
}
|
||||
|
||||
pub(super) async fn handle_node_nostr_verify_revoked(&self) -> Result<serde_json::Value> {
|
||||
|
||||
Reference in New Issue
Block a user