1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * A set of keys that were HKDF-expanded from an initial call to
13 * [`NodeSigner::get_inbound_payment_key_material`].
15 * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
17 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
18 public class ExpandedKey extends CommonBase {
19 ExpandedKey(Object _dummy, long ptr) { super(ptr); }
20 @Override @SuppressWarnings("deprecation")
21 protected void finalize() throws Throwable {
23 if (ptr != 0) { bindings.ExpandedKey_free(ptr); }
27 * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret.
29 * It is recommended to cache this value and not regenerate it for each new inbound payment.
31 public static ExpandedKey of(byte[] key_material) {
32 long ret = bindings.ExpandedKey_new(InternalUtils.check_arr_len(key_material, 32));
33 Reference.reachabilityFence(key_material);
34 if (ret >= 0 && ret <= 4096) { return null; }
35 org.ldk.structs.ExpandedKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ExpandedKey(null, ret); }
36 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };