Skip to content

Commit

Permalink
update AuthManager hashing_key derivation algorithm to follow joyid w…
Browse files Browse the repository at this point in the history
…allet's
  • Loading branch information
EthanYuan committed Dec 20, 2024
1 parent e1efd71 commit 017e63e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mutiny-core/src/authclient.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ impl MutinyAuthClient {
.json(&serde_json::json!({
"public_key": pubkey_hex,
"signature": sig_hex,
"challenge": challenge.to_string(),
"challenge": challenge,
}))
.send()
.await
Expand Down
11 changes: 8 additions & 3 deletions mutiny-core/src/authmanager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,14 @@ impl AuthManager {
pub fn new(xprivkey: Xpriv) -> Result<Self, MutinyError> {
let context = Secp256k1::new();

let base_path = DerivationPath::from_str("m/138'/0")?;
let key = xprivkey.derive_priv(&context, &base_path)?;
let hashing_key = key.private_key;
let joyid_master_path = DerivationPath::from_str("m/0'/0'").unwrap();
let joyid_master_key = xprivkey.derive_priv(&context, &joyid_master_path).unwrap();

let joyid_lightning_key_path = DerivationPath::from_str("m/0'").unwrap();
let joyid_lightning_key = joyid_master_key
.derive_priv(&context, &joyid_lightning_key_path)
.unwrap();
let hashing_key = joyid_lightning_key.private_key;

Ok(Self {
hashing_key,
Expand Down

0 comments on commit 017e63e

Please sign in to comment.