Skip to content

Commit daa18b3

Browse files
committed
Add build_with_vss* methods for ArcedNodeBuilder.
1 parent 2025a8d commit daa18b3

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed

src/builder.rs

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,80 @@ impl ArcedNodeBuilder {
631631
self.inner.read().unwrap().build_with_fs_store().map(Arc::new)
632632
}
633633

634+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
635+
/// previously configured.
636+
///
637+
/// Uses [LNURL-Auth] as default method for authentication/authorization.
638+
///
639+
/// The LNURL with the challenge will be retrieved by making a request to the given `lnurl_auth_server_url`.
640+
/// The returned JWT token in response to the signed LNURL request, will be used for
641+
/// authentication/authorization of all the requests made to VSS.
642+
///
643+
/// `fixed_headers` are included as it is in all the requests made to VSS and LNURL Auth server.
644+
///
645+
/// **Caution**: VSS support is in **alpha** and is considered experimental.
646+
/// Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are
647+
/// unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.
648+
///
649+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
650+
/// [LNURL-Auth]: https://github.com/lnurl/luds/blob/luds/04.md
651+
#[cfg(any(vss, vss_test))]
652+
pub fn build_with_vss_store(
653+
&self, vss_url: String, store_id: String, lnurl_auth_server_url: String,
654+
fixed_headers: HashMap<String, String>,
655+
) -> Result<Arc<Node>, BuildError> {
656+
self.inner
657+
.read()
658+
.unwrap()
659+
.build_with_vss_store(vss_url, store_id, lnurl_auth_server_url, fixed_headers)
660+
.map(Arc::new)
661+
}
662+
663+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
664+
/// previously configured.
665+
///
666+
/// Uses [`FixedHeaders`] as default method for authentication/authorization.
667+
///
668+
/// Given `fixed_headers` are included as it is in all the requests made to VSS.
669+
///
670+
/// **Caution**: VSS support is in **alpha** and is considered experimental.
671+
/// Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are
672+
/// unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.
673+
///
674+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
675+
#[cfg(any(vss, vss_test))]
676+
pub fn build_with_vss_store_and_fixed_headers(
677+
&self, vss_url: String, store_id: String, fixed_headers: HashMap<String, String>,
678+
) -> Result<Arc<Node>, BuildError> {
679+
self.inner
680+
.read()
681+
.unwrap()
682+
.build_with_vss_store_and_fixed_headers(vss_url, store_id, fixed_headers)
683+
.map(Arc::new)
684+
}
685+
686+
/// Builds a [`Node`] instance with a [VSS] backend and according to the options
687+
/// previously configured.
688+
///
689+
/// Given `header_provider` is used to attach headers to every request made
690+
/// to VSS.
691+
///
692+
/// **Caution**: VSS support is in **alpha** and is considered experimental.
693+
/// Using VSS (or any remote persistence) may cause LDK to panic if persistence failures are
694+
/// unrecoverable, i.e., if they remain unresolved after internal retries are exhausted.
695+
///
696+
/// [VSS]: https://github.com/lightningdevkit/vss-server/blob/main/README.md
697+
#[cfg(any(vss, vss_test))]
698+
pub fn build_with_vss_store_and_header_provider(
699+
&self, vss_url: String, store_id: String, header_provider: Arc<dyn VssHeaderProvider>,
700+
) -> Result<Arc<Node>, BuildError> {
701+
self.inner
702+
.read()
703+
.unwrap()
704+
.build_with_vss_store_and_header_provider(vss_url, store_id, header_provider)
705+
.map(Arc::new)
706+
}
707+
634708
/// Builds a [`Node`] instance according to the options previously configured.
635709
pub fn build_with_store(&self, kv_store: Arc<DynStore>) -> Result<Arc<Node>, BuildError> {
636710
self.inner.read().unwrap().build_with_store(kv_store).map(Arc::new)

0 commit comments

Comments
 (0)