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:
Awiteb
2025-07-18 21:18:26 +00:00
parent f0c20c3677
commit 4e0ecdceaf
11 changed files with 211 additions and 23 deletions

View File

@@ -16,7 +16,10 @@
use std::process::ExitCode;
use nostr::event::{Kind, builder::Error as EventBuilderError};
use nostr::{
event::{Kind, builder::Error as EventBuilderError},
signer::SignerError,
};
use nostr_sdk::client::Error as ClientError;
use crate::cli::ConfigError;
@@ -42,6 +45,10 @@ pub type N34Result<T> = Result<T, N34Error>;
pub enum N34Error {
#[error("IO: {0}")]
Io(#[from] std::io::Error),
#[error("Signer Error: {0}")]
SignerError(#[from] SignerError),
#[error("Keyring error: {0}")]
Keyring(#[from] nostr_keyring::Error),
#[error("{0}")]
Config(#[from] ConfigError),
#[error("No editor specified in the `EDITOR` environment variable")]
@@ -85,7 +92,8 @@ pub enum N34Error {
#[error("One naddr is required for this command")]
EmptyNaddrs,
#[error(
"This command requires a signer to sign events. Use `--secret-key` to provide a signer"
"This command requires a signer to sign events. Use `--secret-key` or `--bunker-url` to \
provide a signer"
)]
SignerRequired,
#[error(
@@ -124,6 +132,8 @@ pub enum N34Error {
RevisionRootNotFound,
#[error("Invalid status for the issue/patch: {0}")]
InvalidStatus(String),
#[error("Not valid bunker URL")]
NotBunkerUrl,
}
impl N34Error {