Update auto-generated bindings to latest upstream
[ldk-java] / src / main / java / org / ldk / structs / KeysInterface.java
index bbb5df9856e0c9f78ed67f9362e9d266f80bc8b1..4fdc63351cb9a387353754ef7dd2643865a94160 100644 (file)
@@ -4,6 +4,7 @@ import org.ldk.impl.bindings;
 import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
+import javax.annotation.Nullable;
 
 /**
  * A trait to describe an object which can get user secrets and key material.
@@ -68,6 +69,13 @@ public class KeysInterface extends CommonBase {
                 * you've read all of the provided bytes to ensure no corruption occurred.
                 */
                Result_SignDecodeErrorZ read_chan_signer(byte[] reader);
+               /**
+                * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
+                * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
+                * this trait to parse the invoice and make sure they're signing what they expect, rather than
+                * blindly signing the hash.
+                */
+               Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage);
        }
        private static class LDKKeysInterfaceHolder { KeysInterface held; }
        public static KeysInterface new_impl(KeysInterfaceInterface arg) {
@@ -100,6 +108,11 @@ public class KeysInterface extends CommonBase {
                                long result = ret != null ? ret.ptr : 0;
                                return result;
                        }
+                       @Override public long sign_invoice(byte[] invoice_preimage) {
+                               Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(invoice_preimage);
+                               long result = ret != null ? ret.ptr : 0;
+                               return result;
+                       }
                });
                return impl_holder.held;
        }
@@ -144,6 +157,7 @@ public class KeysInterface extends CommonBase {
         */
        public Sign get_channel_signer(boolean inbound, long channel_value_satoshis) {
                long ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis);
+               if (ret < 1024) { return null; }
                Sign ret_hu_conv = new Sign(null, ret);
                ret_hu_conv.ptrs_to.add(this);
                return ret_hu_conv;
@@ -171,8 +185,22 @@ public class KeysInterface extends CommonBase {
         */
        public Result_SignDecodeErrorZ read_chan_signer(byte[] reader) {
                long ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader);
+               if (ret < 1024) { return null; }
                Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
+       /**
+        * Sign an invoice's preimage (note that this is the preimage of the invoice, not the HTLC's
+        * preimage). By parameterizing by the preimage instead of the hash, we allow implementors of
+        * this trait to parse the invoice and make sure they're signing what they expect, rather than
+        * blindly signing the hash.
+        */
+       public Result_RecoverableSignatureNoneZ sign_invoice(byte[] invoice_preimage) {
+               long ret = bindings.KeysInterface_sign_invoice(this.ptr, invoice_preimage);
+               if (ret < 1024) { return null; }
+               Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
 }