6 namespace org { namespace ldk { namespace structs {
10 * An implementation of [`EntropySource`] using ChaCha20.
12 public class RandomBytes : CommonBase {
13 internal RandomBytes(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.RandomBytes_free(ptr); }
19 * Creates a new instance using the given seed.
21 public static RandomBytes of(byte[] seed) {
22 long ret = bindings.RandomBytes_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(seed, 32)));
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.RandomBytes ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RandomBytes(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
31 * Constructs a new EntropySource which calls the relevant methods on this_arg.
32 * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
34 public EntropySource as_EntropySource() {
35 long ret = bindings.RandomBytes_as_EntropySource(this.ptr);
37 if (ret >= 0 && ret <= 4096) { return null; }
38 EntropySource ret_hu_conv = new EntropySource(null, ret);
39 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };