pub struct LSPS5ClientHandler<ES: Deref, K: Deref + Clone>{ /* private fields */ }Expand description
Client-side handler for the LSPS5 (bLIP-55) webhook registration protocol.
LSPS5ClientHandler is the primary interface for LSP clients
to register, list, and remove webhook endpoints with an LSP.
This handler is intended for use on the client-side (e.g., a mobile app) which has access to the node’s keys and can send/receive peer messages.
For validating incoming webhook notifications on a server, see LSPS5Validator.
§Core Capabilities
set_webhook(peer, app_name, url)-> register or update a webhooklsps5.set_webhooklist_webhooks(peer)-> retrieve all registered webhookslsps5.list_webhooksremove_webhook(peer, name)-> delete a webhooklsps5.remove_webhook
Implementations§
Source§impl<ES: Deref, K: Deref + Clone> LSPS5ClientHandler<ES, K>
impl<ES: Deref, K: Deref + Clone> LSPS5ClientHandler<ES, K>
Sourcepub fn set_webhook(
&self,
counterparty_node_id: PublicKey,
app_name: String,
webhook_url: String,
) -> Result<LSPSRequestId, LSPS5Error>
pub fn set_webhook( &self, counterparty_node_id: PublicKey, app_name: String, webhook_url: String, ) -> Result<LSPSRequestId, LSPS5Error>
Register or update a webhook endpoint under a human-readable name.
Sends a lsps5.set_webhook JSON-RPC request to the given LSP peer.
§Parameters
counterparty_node_id: The LSP node ID to contact.app_name: A UTF-8 name for this webhook.webhook_url: HTTPS URL for push notifications.
§Returns
A unique LSPSRequestId for correlating the asynchronous response.
Response from the LSP peer will be provided asynchronously through a
LSPS5Response::SetWebhook or LSPS5Response::SetWebhookError message, and this client
will then enqueue either a WebhookRegistered or WebhookRegistrationFailed event.
Note: Ensure the app name is valid and its length does not exceed MAX_APP_NAME_LENGTH.
Also ensure the URL is valid, has HTTPS protocol, its length does not exceed MAX_WEBHOOK_URL_LENGTH
and that the URL points to a public host.
Your request may fail if you recently opened a channel or started an LSPS1 / LSPS2 flow. Please retry shortly.
Sourcepub fn list_webhooks(&self, counterparty_node_id: PublicKey) -> LSPSRequestId
pub fn list_webhooks(&self, counterparty_node_id: PublicKey) -> LSPSRequestId
List all webhook names currently registered with the LSP.
Sends a lsps5.list_webhooks JSON-RPC request to the peer.
§Parameters
counterparty_node_id: The LSP node ID to query.
§Returns
A unique LSPSRequestId for correlating the asynchronous response.
Response from the LSP peer will be provided asynchronously through a
LSPS5Response::ListWebhooks message, and this client
will then enqueue a WebhooksListed event.
Sourcepub fn remove_webhook(
&self,
counterparty_node_id: PublicKey,
app_name: String,
) -> Result<LSPSRequestId, LSPS5Error>
pub fn remove_webhook( &self, counterparty_node_id: PublicKey, app_name: String, ) -> Result<LSPSRequestId, LSPS5Error>
Remove a previously registered webhook by its name.
Sends a lsps5.remove_webhook JSON-RPC request to the peer.
§Parameters
counterparty_node_id: The LSP node ID to contact.app_name: The name of the webhook to remove.
§Returns
A unique LSPSRequestId for correlating the asynchronous response.
Response from the LSP peer will be provided asynchronously through a
LSPS5Response::RemoveWebhook or LSPS5Response::RemoveWebhookError message, and this client
will then enqueue either a WebhookRemoved or WebhookRemovalFailed event.