lightspark_remote_signing/
lib.rs1use std::fmt;
11
12pub extern crate lightspark;
13pub mod handler;
14pub mod invoice;
15pub mod response;
16pub mod signer;
17pub mod validation;
18
19#[derive(Debug)]
20pub enum Error {
21 WebhookEventNotRemoteSigning,
22 WebhookEventDataMissing,
23 UnknownSubEventType,
24 PublicKeyDecodeError(hex::FromHexError),
25 HexEncodingError,
26 SignerError(signer::Error),
27}
28
29impl fmt::Display for Error {
30 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
31 let msg = match self {
32 Error::WebhookEventNotRemoteSigning => {
33 "Webhook event is not a remote signing event".to_string()
34 }
35 Error::WebhookEventDataMissing => "Webhook event data is missing".to_string(),
36 Error::UnknownSubEventType => "Unknown sub event type".to_string(),
37 Error::PublicKeyDecodeError(e) => format!("Error decoding public key: {}", e),
38 Error::HexEncodingError => "Error encoding hex".to_string(),
39 Error::SignerError(e) => format!("Error signing: {}", e),
40 };
41 write!(f, "{}", msg)
42 }
43}