feat: Support signing using NIP-46 bunker
Suggested-by: DanConwayDev <DanConwayDev@protonmail.com> Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
@@ -24,8 +24,11 @@ use nostr::{
|
||||
nip19::{self, FromBech32, Nip19Coordinate},
|
||||
},
|
||||
types::RelayUrl,
|
||||
util::BoxedFuture,
|
||||
};
|
||||
use nostr_connect::client::AuthUrlHandler;
|
||||
use tokio::runtime::Handle;
|
||||
use url::Url;
|
||||
|
||||
use super::{RepoRelaySetsExt, parsers};
|
||||
use crate::{
|
||||
@@ -61,6 +64,18 @@ pub struct NostrEvent {
|
||||
pub relays: Vec<RelayUrl>,
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct EchoAuthUrl;
|
||||
|
||||
impl AuthUrlHandler for EchoAuthUrl {
|
||||
fn on_auth_url(&self, auth_url: Url) -> BoxedFuture<Result<(), Box<dyn std::error::Error>>> {
|
||||
Box::pin(async move {
|
||||
println!("The bunker requires authentication. Please open this URL: {auth_url}");
|
||||
Ok(())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
impl NaddrOrSet {
|
||||
/// Returns the naddr if `Naddr` or try to get the relays from the set.
|
||||
/// Returns error if the set naddrs are empty or the set not found.
|
||||
|
||||
Reference in New Issue
Block a user