X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=c_sharp%2Fsrc%2Forg%2Fldk%2Fstructs%2FBlindedHop.cs;h=95bbe09eee7fe40388f131920b00288480190ee1;hb=8de7213fbf663ff60322896282dad51e8ab2f001;hp=170decf95198d6ac24e6c0eafb4557a20a3c3996;hpb=afc50e5d491a11364849383b75a8f939df703bac;p=ldk-java diff --git a/c_sharp/src/org/ldk/structs/BlindedHop.cs b/c_sharp/src/org/ldk/structs/BlindedHop.cs index 170decf9..95bbe09e 100644 --- a/c_sharp/src/org/ldk/structs/BlindedHop.cs +++ b/c_sharp/src/org/ldk/structs/BlindedHop.cs @@ -7,8 +7,9 @@ namespace org { namespace ldk { namespace structs { /** - * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified - * by outside observers and thus can be used to hide the identity of the recipient. + * An encrypted payload and node id corresponding to a hop in a payment or onion message path, to + * be encoded in the sender's onion packet. These hops cannot be identified by outside observers + * and thus can be used to hide the identity of the recipient. */ public class BlindedHop : CommonBase { internal BlindedHop(object _dummy, long ptr) : base(ptr) { } @@ -16,6 +17,61 @@ public class BlindedHop : CommonBase { if (ptr != 0) { bindings.BlindedHop_free(ptr); } } + /** + * The blinded node id of this hop in a [`BlindedPath`]. + */ + public byte[] get_blinded_node_id() { + long ret = bindings.BlindedHop_get_blinded_node_id(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; + } + + /** + * The blinded node id of this hop in a [`BlindedPath`]. + */ + public void set_blinded_node_id(byte[] val) { + bindings.BlindedHop_set_blinded_node_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 33))); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + * + * Returns a copy of the field. + */ + public byte[] get_encrypted_payload() { + long ret = bindings.BlindedHop_get_encrypted_payload(this.ptr); + GC.KeepAlive(this); + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; + } + + /** + * The encrypted payload intended for this hop in a [`BlindedPath`]. + */ + public void set_encrypted_payload(byte[] val) { + bindings.BlindedHop_set_encrypted_payload(this.ptr, InternalUtils.encodeUint8Array(val)); + GC.KeepAlive(this); + GC.KeepAlive(val); + } + + /** + * Constructs a new BlindedHop given each field + */ + public static BlindedHop of(byte[] blinded_node_id_arg, byte[] encrypted_payload_arg) { + long ret = bindings.BlindedHop_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(blinded_node_id_arg, 33)), InternalUtils.encodeUint8Array(encrypted_payload_arg)); + GC.KeepAlive(blinded_node_id_arg); + GC.KeepAlive(encrypted_payload_arg); + if (ret >= 0 && ret <= 4096) { return null; } + org.ldk.structs.BlindedHop ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.BlindedHop(null, ret); } + if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); }; + return ret_hu_conv; + } + internal long clone_ptr() { long ret = bindings.BlindedHop_clone_ptr(this.ptr); GC.KeepAlive(this); @@ -67,16 +123,18 @@ public class BlindedHop : CommonBase { * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read */ public byte[] write() { - byte[] ret = bindings.BlindedHop_write(this.ptr); + long ret = bindings.BlindedHop_write(this.ptr); GC.KeepAlive(this); - return ret; + if (ret >= 0 && ret <= 4096) { return null; } + byte[] ret_conv = InternalUtils.decodeUint8Array(ret); + return ret_conv; } /** * Read a BlindedHop from a byte array, created by BlindedHop_write */ public static Result_BlindedHopDecodeErrorZ read(byte[] ser) { - long ret = bindings.BlindedHop_read(ser); + long ret = bindings.BlindedHop_read(InternalUtils.encodeUint8Array(ser)); GC.KeepAlive(ser); if (ret >= 0 && ret <= 4096) { return null; } Result_BlindedHopDecodeErrorZ ret_hu_conv = Result_BlindedHopDecodeErrorZ.constr_from_ptr(ret);