[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / TaggedHash.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
9
10
11 /**
12  * A hash for use in a specific context by tweaking with a context-dependent tag as per [BIP 340]
13  * and computed over the merkle root of a TLV stream to sign as defined in [BOLT 12].
14  * 
15  * [BIP 340]: https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
16  * [BOLT 12]: https://github.com/rustyrussell/lightning-rfc/blob/guilt/offers/12-offer-encoding.md#signature-calculation
17  */
18 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
19 public class TaggedHash extends CommonBase {
20         TaggedHash(Object _dummy, long ptr) { super(ptr); }
21         @Override @SuppressWarnings("deprecation")
22         protected void finalize() throws Throwable {
23                 super.finalize();
24                 if (ptr != 0) { bindings.TaggedHash_free(ptr); }
25         }
26
27         long clone_ptr() {
28                 long ret = bindings.TaggedHash_clone_ptr(this.ptr);
29                 Reference.reachabilityFence(this);
30                 return ret;
31         }
32
33         /**
34          * Creates a copy of the TaggedHash
35          */
36         public TaggedHash clone() {
37                 long ret = bindings.TaggedHash_clone(this.ptr);
38                 Reference.reachabilityFence(this);
39                 if (ret >= 0 && ret <= 4096) { return null; }
40                 org.ldk.structs.TaggedHash ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.TaggedHash(null, ret); }
41                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
42                 return ret_hu_conv;
43         }
44
45         /**
46          * Returns the digest to sign.
47          */
48         public byte[] as_digest() {
49                 byte[] ret = bindings.TaggedHash_as_digest(this.ptr);
50                 Reference.reachabilityFence(this);
51                 return ret;
52         }
53
54         /**
55          * Returns the tag used in the tagged hash.
56          */
57         public String tag() {
58                 String ret = bindings.TaggedHash_tag(this.ptr);
59                 Reference.reachabilityFence(this);
60                 return ret;
61         }
62
63         /**
64          * Returns the merkle root used in the tagged hash.
65          */
66         public byte[] merkle_root() {
67                 byte[] ret = bindings.TaggedHash_merkle_root(this.ptr);
68                 Reference.reachabilityFence(this);
69                 return ret;
70         }
71
72 }