X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoiceRequest.java;fp=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoiceRequest.java;h=8fed3238317c5d8f2c7a22f78c34b4ceb9e74230;hb=8fa2bcb208a51fa352d04981f1387d8bceced107;hp=500843a4b47c2f77977ec5107b6b7b6d3f77106b;hpb=7da1092518e5ea1518255a4473c178f52549fd81;p=ldk-java diff --git a/src/main/java/org/ldk/structs/InvoiceRequest.java b/src/main/java/org/ldk/structs/InvoiceRequest.java index 500843a4..8fed3238 100644 --- a/src/main/java/org/ldk/structs/InvoiceRequest.java +++ b/src/main/java/org/ldk/structs/InvoiceRequest.java @@ -9,12 +9,12 @@ import javax.annotation.Nullable; /** - * An `InvoiceRequest` is a request for an [`Invoice`] formulated from an [`Offer`]. + * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. * * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request * specifies these such that its recipient can send an invoice for payment. * - * [`Invoice`]: crate::offers::invoice::Invoice + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice * [`Offer`]: crate::offers::offer::Offer */ @SuppressWarnings("unchecked") // We correctly assign various generic arrays @@ -129,6 +129,23 @@ public class InvoiceRequest extends CommonBase { return ret_hu_conv; } + /** + * Verifies that the request was for an offer created using the given key. Returns the derived + * keys need to sign an [`Bolt12Invoice`] for the request if they could be extracted from the + * metadata. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ + public Result_COption_KeyPairZNoneZ verify(org.ldk.structs.ExpandedKey key) { + long ret = bindings.InvoiceRequest_verify(this.ptr, key == null ? 0 : key.ptr); + Reference.reachabilityFence(this); + Reference.reachabilityFence(key); + if (ret >= 0 && ret <= 4096) { return null; } + Result_COption_KeyPairZNoneZ ret_hu_conv = Result_COption_KeyPairZNoneZ.constr_from_ptr(ret); + if (this != null) { this.ptrs_to.add(key); }; + return ret_hu_conv; + } + /** * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read */