Skip to content

Commit 96567d8

Browse files
author
Antoine Riard
committed
Add a KeysInterface to bridge between user wallet and others lightning
componenets, responsible to get seed from the former and derive appropriate keyring materials
1 parent f31daad commit 96567d8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

src/ln/keysinterface.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
//! appropriate keyring materials to others lightning components, as such node_id, destination_script.
77
//!
88
9+
10+
use bitcoin::blockdata::script::Script;
11+
12+
use secp256k1::key::SecretKey;
13+
914
use ln::msgs;
1015

1116
/// A trait to describe a wallet which sould receive data to be able to spend onchain outputs
@@ -19,6 +24,17 @@ pub trait WalletInterface: Send + Sync {
1924
fn handle_spendable_output(&self, msg: &msgs::SpendableOutputs);
2025
}
2126

27+
/// A trait to describe an object which should get secrets from user wallet and apply derivation
28+
/// to provide keys materials downstream
29+
pub trait KeysInterface: Send + Sync {
30+
/// User wallet has to provide this KeysInterface with a master seed used to derive
31+
/// node_id as /0' and destination_script as /N'
32+
fn provide_master_seed(&self, seed : [u8; 32]);
33+
/// Get node secret key to derive node_id
34+
fn get_node_secret(&self) -> Option<SecretKey>;
35+
/// Get destination script to encumber protocol exit points
36+
fn get_destination_script(&self) -> Option<Script>;
37+
}
2238

2339
//pub struct KeysManager {
2440
// genesis_hash: Sha256dHash,

0 commit comments

Comments
 (0)