Skip to main content

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;
32pub mod metrics;
33
34pub mod lnurl;
35
36/// The pairing service that pairs signer-less clients with existing
37/// signers.
38pub mod pairing;
39/// Helpers to configure the mTLS connection authentication.
40///
41/// mTLS configuration for greenlight clients. Clients are
42/// authenticated by presenting a valid mTLS certificate to the
43/// node. Each node has its own CA. This CA is used to sign both the
44/// device certificates, as well as the node certificate itself. This
45/// ensures that only clients that are authorized can open a
46/// connection to the node.
47pub mod tls;
48
49#[cfg(feature = "export")]
50pub mod export;
51
52/// Tools to interact with a node running on greenlight.
53pub mod utils;
54
55pub mod credentials;
56
57pub mod util;
58
59use thiserror::Error;
60
61#[derive(Error, Debug)]
62pub enum Error {
63    #[error("The signature request does not match any authorized RPC calls")]
64    MissingAuthorization,
65
66    #[error("Illegal argument: {0}")]
67    IllegalArgument(String),
68}
69
70pub use lightning_signer::bitcoin;
71pub use lightning_signer::lightning;
72pub use lightning_signer::lightning_invoice;
73
74pub(crate) const TCP_KEEPALIVE: Duration = Duration::from_secs(1);
75pub(crate) const TCP_KEEPALIVE_TIMEOUT: Duration = Duration::from_secs(5);
76
77pub mod runes;