Skip to content

Commit

Permalink
fix pubkey derivation
Browse files Browse the repository at this point in the history
  • Loading branch information
roeierez committed Sep 22, 2024
1 parent 76942b5 commit 778fc29
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions libs/sdk-core/src/lnurl/auth.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
use std::sync::Arc;

use gl_client::{
bitcoin::{
hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine},
secp256k1::{Message, Secp256k1},
util::bip32::ChildNumber,
},
lightning::util::ser::Writeable,
use gl_client::bitcoin::{
hashes::{sha256, Hash, HashEngine, Hmac, HmacEngine},
secp256k1::{Message, Secp256k1},
util::bip32::{ChildNumber, ExtendedPubKey},
};
use sdk_common::prelude::{LnUrlError, LnUrlResult, LnurlAuthSigner};

Expand All @@ -24,12 +21,10 @@ impl SdkLnurlAuthSigner {

impl LnurlAuthSigner for SdkLnurlAuthSigner {
fn derive_bip32_pub_key(&self, derivation_path: &[ChildNumber]) -> LnUrlResult<Vec<u8>> {
Ok(self
.node_api
.derive_bip32_key(derivation_path.to_vec())?
.to_keypair(&Secp256k1::new())
.public_key()
.encode())
let xpriv = self.node_api.derive_bip32_key(derivation_path.to_vec())?;
Ok(ExtendedPubKey::from_priv(&Secp256k1::new(), &xpriv)
.encode()
.to_vec())
}

fn sign_ecdsa(&self, msg: &[u8], derivation_path: &[ChildNumber]) -> LnUrlResult<Vec<u8>> {
Expand Down

0 comments on commit 778fc29

Please sign in to comment.