document LSS steps

This commit is contained in:
Evan Feenstra
2023-05-16 12:17:07 +01:00
parent 36b6b68f02
commit 94b8889161
3 changed files with 68 additions and 3 deletions

6
broker/Cargo.lock generated
View File

@@ -3021,7 +3021,7 @@ dependencies = [
[[package]] [[package]]
name = "sphinx-auther" name = "sphinx-auther"
version = "0.1.12" version = "0.1.12"
source = "git+https://github.com/stakwork/sphinx-rs#82712f0be41eb460827e8db8e136a482cd595cff" source = "git+https://github.com/stakwork/sphinx-rs#763533b57dd72d18bec13c54760090c7cf302f43"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"base64", "base64",
@@ -3033,7 +3033,7 @@ dependencies = [
[[package]] [[package]]
name = "sphinx-glyph" name = "sphinx-glyph"
version = "0.1.2" version = "0.1.2"
source = "git+https://github.com/stakwork/sphinx-rs#82712f0be41eb460827e8db8e136a482cd595cff" source = "git+https://github.com/stakwork/sphinx-rs#763533b57dd72d18bec13c54760090c7cf302f43"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"hex", "hex",
@@ -3078,7 +3078,7 @@ dependencies = [
[[package]] [[package]]
name = "sphinx-signer" name = "sphinx-signer"
version = "0.1.0" version = "0.1.0"
source = "git+https://github.com/stakwork/sphinx-rs#82712f0be41eb460827e8db8e136a482cd595cff" source = "git+https://github.com/stakwork/sphinx-rs#763533b57dd72d18bec13c54760090c7cf302f43"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bip39", "bip39",

60
broker/lss.md Normal file
View File

@@ -0,0 +1,60 @@
# steps to integrate LSS
### initialization
##### broker
- check that there is an LSS url to use
- LssClient::get_server_pubkey
- send server pubkey to signer
##### signer
- let client_id = keys_manager.get_persistence_pubkey()
- let auth_token = keys_manager.get_persistence_auth_token(&server_pubkey)
- let shared_secret = keys_manager.get_persistence_shared_secret(&server_pubkey)
- create a ExternalPersistHelper locally and init `state`
- helper.new_nonce
- send the client_id, auth_token, and nonce back to the broker
##### broker
- create Auth
- LssClient::new
- let (muts, server_hmac) = client.get("".to_string(), &nonce)
- send the muts and server_hmac to signer
##### signer
- check the server hmac
- insert the muts into local state
- let handler_builder = handler_builder.lss_state(...);
- (what is the above line do it muts are already inserted???)
- let (handler, muts) = handler_builder.build();
- helper.client_hmac
- send the muts and client_hmac back to broker
##### broker
- store the muts using the LssClient (client.put(muts, &client_hmac))
### VLS
##### signer
- let (reply, muts) = handler.handle(msg)
- let client_hmac = helper.client_hmac(&muts);
- send muts and hmac to broker
##### broker
- client.put(muts, &client_hmac).await?
- send some kind of confirmation back to signer
##### signer
- finally, send the VLS reply back to broker
##### broker
- forward the VLS reply back to CLN

View File

@@ -143,6 +143,9 @@ pub fn start_broker(
let topic = topic_res.unwrap(); let topic = topic_res.unwrap();
if topic.ends_with(topics::ERROR) { if topic.ends_with(topics::ERROR) {
let _ = error_sender.send(f.publish.payload.to_vec()); let _ = error_sender.send(f.publish.payload.to_vec());
} else if topics.ends_with(topics::LSS_PUB) {
// send to LSS client here
// get the hmac back, pub to the device
} else { } else {
let ts: Vec<&str> = topic.split("/").collect(); let ts: Vec<&str> = topic.split("/").collect();
if ts.len() != 2 { if ts.len() != 2 {
@@ -175,6 +178,8 @@ fn subs(cid: &str, mut ltx: LinkTx) {
ltx.subscribe(format!("{}/{}", cid, topics::CONTROL_RETURN)) ltx.subscribe(format!("{}/{}", cid, topics::CONTROL_RETURN))
.unwrap(); .unwrap();
ltx.subscribe(format!("{}/{}", cid, topics::ERROR)).unwrap(); ltx.subscribe(format!("{}/{}", cid, topics::ERROR)).unwrap();
ltx.subscribe(format!("{}/{}", cid, topics::LSS_PUB))
.unwrap();
} }
fn unsubs(cid: &str, mut ltx: LinkTx) { fn unsubs(cid: &str, mut ltx: LinkTx) {