6 namespace org { namespace ldk { namespace structs {
10 * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340]
11 * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12].
13 * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
14 * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation
16 public class TaggedHash : CommonBase {
17 internal TaggedHash(object _dummy, long ptr) : base(ptr) { }
19 if (ptr != 0) { bindings.TaggedHash_free(ptr); }
22 internal long clone_ptr() {
23 long ret = bindings.TaggedHash_clone_ptr(this.ptr);
29 * Creates a copy of the TaggedHash
31 public TaggedHash clone() {
32 long ret = bindings.TaggedHash_clone(this.ptr);
34 if (ret >= 0 && ret <= 4096) { return null; }
35 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
36 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
41 * Returns the digest to sign.
43 public byte[] as_digest() {
44 long ret = bindings.TaggedHash_as_digest(this.ptr);
46 if (ret >= 0 && ret <= 4096) { return null; }
47 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
52 * Returns the tag used in the tagged hash.
55 long ret = bindings.TaggedHash_tag(this.ptr);
57 if (ret >= 0 && ret <= 4096) { return null; }
58 string ret_conv = InternalUtils.decodeString(ret);
63 * Returns the merkle root used in the tagged hash.
65 public byte[] merkle_root() {
66 long ret = bindings.TaggedHash_merkle_root(this.ptr);
68 if (ret >= 0 && ret <= 4096) { return null; }
69 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);