gl_client/
lib.rs

1//! Greenlight client library to schedule nodes, interact with them
2//! and sign off on signature requests.
3//!
4
5/// Interact with a node running on greenlight.
6///
7/// The node must be scheduled using [`crate::scheduler::Scheduler`]:
8///
9///
10pub mod node;
11
12/// Generated protobuf messages and client stubs.
13///
14/// Since the client needs to be configured correctly, don't use
15/// [`pb::node_client::NodeClient`] directly, rather use
16/// [`node::Node`] to create a correctly configured client.
17pub mod pb;
18
19use std::time::Duration;
20
21/// Register, recover and schedule your nodes on greenlight.
22pub mod scheduler;
23
24/// Your keys, your coins!
25///
26/// This module implements the logic to stream, verify and respond to
27/// signature requests from the node. Without this the node cannot
28/// move your funds.
29pub mod signer;
30
31pub mod persist;
32
33pub mod lnurl;
34
35/// The pairing service that pairs signer-less clients with existing
36/// signers.
37pub mod pairing;
38/// Helpers to configure the mTLS connection authentication.
39///
40/// mTLS configuration for greenlight clients. Clients are
41/// authenticated by presenting a valid mTLS certificate to the
42/// node. Each node has its own CA. This CA is used to sign both the
43/// device certificates, as well as the node certificate itself. This
44/// ensures that only clients that are authorized can open a
45/// connection to the node.
46pub mod tls;
47
48#[cfg(feature = "export")]
49pub mod export;
50
51/// Tools to interact with a node running on greenlight.
52pub mod utils;
53
54pub mod credentials;
55
56/// Functionality to integrate greenlight with a Lightning Service Provider
57pub mod lsps;
58
59pub mod util;
60
61use thiserror::Error;
62
63#[derive(Error, Debug)]
64pub enum Error {
65    #[error("The signature request does not match any authorized RPC calls")]
66    MissingAuthorization,
67}
68
69pub use lightning_signer::bitcoin;
70pub use lightning_signer::lightning;
71pub use lightning_signer::lightning_invoice;
72
73pub(crate) const TCP_KEEPALIVE: Duration = Duration::from_secs(1);
74pub(crate) const TCP_KEEPALIVE_TIMEOUT: Duration = Duration::from_secs(5);
75
76pub mod runes;