Skip to content

Commit 62b5118

Browse files
author
Antoine Riard
committed
Add a KeysInterface to bridge between user wallet and others lightning
componenents, responsible to get seed from the former and derive appropriate keyring materials
1 parent 89c295e commit 62b5118

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/ln/keysinterface.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use bitcoin::blockdata::script::Script;
1111

1212
use secp256k1::key::SecretKey;
1313

14+
use ln::channel::ChannelKeys;
1415
use util::events;
1516

1617
/// A trait to describe a wallet which sould receive data to be able to spend onchain outputs
@@ -68,3 +69,21 @@ impl CustomOutputScriptDescriptor {
6869
}
6970
}
7071
}
72+
73+
/// A trait to describe an object which should get secrets from user wallet and apply derivation
74+
/// to provide keys materials downstream
75+
pub trait KeysInterface: Send + Sync {
76+
/// User wallet has to provide this KeysInterface with a master seed used to derive
77+
/// node_id as /0' and destination_script as /N'
78+
fn provide_master_seed(&mut self, seed : &[u8; 32]);
79+
/// Get node secret key to derive node_id
80+
fn get_node_secret(&self) -> Option<SecretKey>;
81+
/// Get destination redeemScript to encumber static protocol exit points. For now
82+
/// redeemScript is a pay-2-public-key-hash.
83+
fn get_destination_script(&self) -> Option<Script>;
84+
/// Get shutdown_pubkey to use as PublicKey at channel closure
85+
fn get_shutdown_pubkey(&self) -> Option<PublicKey>;
86+
/// Get a new set of ChannelKeys from per-channel random key /3/N'
87+
/// For Channel N, keys correspond to ChannelKeys::new_from_seed(/3/N')
88+
fn get_channel_keys(&mut self) -> Option<ChannelKeys>;
89+
}

0 commit comments

Comments
 (0)