Skip to content

Commit

Permalink
Placeholder for other webhook events implementation.
Browse files Browse the repository at this point in the history
  • Loading branch information
yellowred committed Feb 6, 2024
1 parent 55da362 commit 9298169
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions examples/lightspark-remote-signing-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use actix_web::{
use futures_util::StreamExt as _;
use lightspark::key::Secp256k1SigningKey;
use lightspark::request::auth_provider::AccountAuthProvider;
use lightspark_remote_signing::lightspark::objects::webhook_event_type::WebhookEventType::RemoteSigning;
use lightspark_remote_signing::lightspark::webhooks::WebhookEvent;
use lightspark_remote_signing::{
handler::Handler,
Expand Down Expand Up @@ -50,18 +51,27 @@ async fn webhook_handler(
let event =
WebhookEvent::verify_and_parse(&bytes, signature.to_str().unwrap(), &data.webhook_secret)
.unwrap();
let response = handler
.handle_remote_signing_webhook_msg(&event)
.unwrap()
.unwrap();

debug!("Response {:?}", response);
match event.event_type {
RemoteSigning => {
let response = handler
.handle_remote_signing_webhook_msg(&event)
.unwrap()
.unwrap();

debug!("Response {:?}", response);

let result = client
.execute_graphql_request_variable(&response.query, response.variables)
.await;

let result = client
.execute_graphql_request_variable(&response.query, response.variables)
.await;
debug!("Graphql response {:?}", result);
}
_ => {
debug!("Webhook Event {} is not implemented.", event.event_type);
}
};

debug!("Graphql response {:?}", result);
HttpResponse::NoContent().finish()
}

Expand Down

0 comments on commit 9298169

Please sign in to comment.