LSPS5ServiceHandler

Struct LSPS5ServiceHandler 

Source
pub struct LSPS5ServiceHandler<CM: Deref, NS: Deref, K: Deref + Clone, TP: Deref>{ /* private fields */ }
Expand description

Service-side handler for the bLIP-55 / LSPS5 webhook registration protocol.

Runs on the LSP (server) side. Stores and manages client-registered webhooks, enforces per-client limits and retention policies, and emits signed JSON-RPC notifications to each webhook endpoint when events occur.

§Core Responsibilities

§Security & Spec Compliance

  • All notifications are signed with the LSP’s node key according to bLIP-50/LSPS0.
  • Clients must validate signature, timestamp (±10 min), and replay protection via LSPS5ClientHandler::parse_webhook_notification.
  • Webhook endpoints use only HTTPS and must guard against unauthorized calls.

Implementations§

Source§

impl<CM: Deref, NS: Deref, K: Deref + Clone, TP: Deref> LSPS5ServiceHandler<CM, NS, K, TP>

Source

pub fn notify_payment_incoming( &self, client_id: PublicKey, ) -> Result<(), LSPS5ProtocolError>

Notify the LSP service that the client has one or more incoming payments pending.

SHOULD be called by your LSP application logic as soon as you detect an incoming payment (HTLC or future mechanism) for client_id. This builds a WebhookNotificationMethod::LSPS5PaymentIncoming webhook notification, signs it with your node key, and enqueues HTTP POSTs to all registered webhook URLs for that client.

This may fail if a similar notification was sent too recently, violating the notification cooldown period defined in NOTIFICATION_COOLDOWN_TIME.

§Parameters
  • client_id: the client’s node-ID whose webhooks should be invoked.
Source

pub fn notify_expiry_soon( &self, client_id: PublicKey, timeout: u32, ) -> Result<(), LSPS5ProtocolError>

Notify that an HTLC or other time-bound contract is expiring soon.

SHOULD be called by your LSP application logic when a channel contract for client_id is within 24 blocks of timeout, and the timeout would cause a channel closure. Builds a WebhookNotificationMethod::LSPS5ExpirySoon notification including the timeout block height, signs it, and enqueues HTTP POSTs to the client’s registered webhooks.

This may fail if a similar notification was sent too recently, violating the notification cooldown period defined in NOTIFICATION_COOLDOWN_TIME.

§Parameters
  • client_id: the client’s node-ID whose webhooks should be invoked.
  • timeout: the block height at which the channel contract will expire.
Source

pub fn notify_liquidity_management_request( &self, client_id: PublicKey, ) -> Result<(), LSPS5ProtocolError>

Notify that the LSP intends to manage liquidity (e.g. close or splice) on client channels.

SHOULD be called by your LSP application logic when you decide to reclaim or adjust liquidity for client_id. Builds a WebhookNotificationMethod::LSPS5LiquidityManagementRequest notification, signs it, and sends it to all of the client’s registered webhook URLs.

This may fail if a similar notification was sent too recently, violating the notification cooldown period defined in NOTIFICATION_COOLDOWN_TIME.

§Parameters
  • client_id: the client’s node-ID whose webhooks should be invoked.
Source

pub fn notify_onion_message_incoming( &self, client_id: PublicKey, ) -> Result<(), LSPS5ProtocolError>

Notify that the client has one or more pending BOLT Onion Messages.

SHOULD be called by your LSP application logic when you receive Onion Messages for client_id while the client is offline. Builds a WebhookNotificationMethod::LSPS5OnionMessageIncoming notification, signs it, and enqueues HTTP POSTs to each registered webhook.

This may fail if a similar notification was sent too recently, violating the notification cooldown period defined in NOTIFICATION_COOLDOWN_TIME.

§Parameters
  • client_id: the client’s node-ID whose webhooks should be invoked.

Auto Trait Implementations§

§

impl<CM, NS, K, TP> !Freeze for LSPS5ServiceHandler<CM, NS, K, TP>

§

impl<CM, NS, K, TP> RefUnwindSafe for LSPS5ServiceHandler<CM, NS, K, TP>

§

impl<CM, NS, K, TP> Send for LSPS5ServiceHandler<CM, NS, K, TP>
where TP: Send, CM: Send, NS: Send, K: Send + Sync,

§

impl<CM, NS, K, TP> Sync for LSPS5ServiceHandler<CM, NS, K, TP>
where TP: Sync, CM: Sync, NS: Sync, K: Sync + Send,

§

impl<CM, NS, K, TP> Unpin for LSPS5ServiceHandler<CM, NS, K, TP>
where TP: Unpin, CM: Unpin, NS: Unpin, K: Unpin,

§

impl<CM, NS, K, TP> UnwindSafe for LSPS5ServiceHandler<CM, NS, K, TP>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.