chore: Returns Result public key in CliOptions::pubkey

Signed-off-by: Awiteb <a@4rs.nl>
This commit is contained in:
Awiteb
2025-05-06 11:22:46 +00:00
parent 6fc59bfe59
commit 9b4dfb9374
2 changed files with 3 additions and 3 deletions

View File

@@ -115,9 +115,9 @@ impl CommandRunner for Commands {
impl CliOptions { impl CliOptions {
/// Gets the public key of the user. /// Gets the public key of the user.
pub async fn pubkey(&self) -> PublicKey { pub async fn pubkey(&self) -> N34Result<PublicKey> {
if let Some(sk) = &self.secret_key { if let Some(sk) = &self.secret_key {
return Keys::new(sk.clone()).public_key(); return Ok(Keys::new(sk.clone()).public_key());
} }
unreachable!("There is no other method until now") unreachable!("There is no other method until now")
} }

View File

@@ -62,7 +62,7 @@ pub struct AnnounceArgs {
impl CommandRunner for AnnounceArgs { impl CommandRunner for AnnounceArgs {
async fn run(self, options: CliOptions) -> N34Result<()> { async fn run(self, options: CliOptions) -> N34Result<()> {
let client = NostrClient::init(&options).await; let client = NostrClient::init(&options).await;
let user_pubk = options.pubkey().await; let user_pubk = options.pubkey().await?;
let naddr = Nip19Coordinate::new( let naddr = Nip19Coordinate::new(
Coordinate::new(Kind::GitRepoAnnouncement, user_pubk), Coordinate::new(Kind::GitRepoAnnouncement, user_pubk),
options.relays.iter().take(3), options.relays.iter().take(3),