Skip to content

Commit 4c53b79

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 85cbf1d commit 4c53b79

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/ln/keysinterface.rs

Lines changed: 17 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
@@ -18,3 +23,15 @@ pub trait WalletInterface: Send + Sync {
1823
/// BOTL 3 derivation scheme.
1924
fn handle_spendable_output(&self, msg: &msgs::SpendableOutputs);
2025
}
26+
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+
}

0 commit comments

Comments
 (0)