X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=ts%2Fstructs%2FKeysInterface.ts;h=46543e46aee58fa82a6aa638430ab057f6bbdfa6;hb=f3e670e9341decac613d33fc52febf19cea32f20;hp=c51f0b8b59d2aa323f2fa0936afaf86805a5a271;hpb=acecce750cf1159a51f9d1a4dbfd717520739e92;p=ldk-java diff --git a/ts/structs/KeysInterface.ts b/ts/structs/KeysInterface.ts index c51f0b8b..46543e46 100644 --- a/ts/structs/KeysInterface.ts +++ b/ts/structs/KeysInterface.ts @@ -34,7 +34,8 @@ import * as bindings from '../bindings' // TODO: figure out location // todo: in-line interface filling get_node_secret (): Uint8Array { Uint8Array ret = arg.get_node_secret(); - return ret; + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); + return result; }, get_destination_script (): Uint8Array { @@ -42,26 +43,34 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; }, - get_shutdown_pubkey (): Uint8Array { - Uint8Array ret = arg.get_shutdown_pubkey(); - return ret; + get_shutdown_scriptpubkey (): number { + ShutdownScript ret = arg.get_shutdown_scriptpubkey(); + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; }, - get_channel_keys (inbound: boolean, channel_value_satoshis: number): number { - ChannelKeys ret = arg.get_channel_keys(inbound, channel_value_satoshis); - result: number = ret == null ? 0 : ret.ptr; + get_channel_signer (inbound: boolean, channel_value_satoshis: number): number { + Sign ret = arg.get_channel_signer(inbound, channel_value_satoshis); + result: number = ret == null ? 0 : ret.clone_ptr(); impl_holder.held.ptrs_to.add(ret); return result; }, get_secure_random_bytes (): Uint8Array { Uint8Array ret = arg.get_secure_random_bytes(); - return ret; + result: Uint8Array = InternalUtils.check_arr_len(ret, 32); + return result; }, read_chan_signer (reader: Uint8Array): number { - Result_ChanKeySignerDecodeErrorZ ret = arg.read_chan_signer(reader); - result: number = ret != null ? ret.ptr : 0; + Result_SignDecodeErrorZ ret = arg.read_chan_signer(reader); + result: number = ret == null ? 0 : ret.clone_ptr(); + return result; + }, + + sign_invoice (invoice_preimage: Uint8Array): number { + Result_RecoverableSignatureNoneZ ret = arg.sign_invoice(invoice_preimage); + result: number = ret == null ? 0 : ret.clone_ptr(); return result; }, @@ -74,10 +83,11 @@ import * as bindings from '../bindings' // TODO: figure out location export interface KeysInterfaceInterface { get_node_secret(): Uint8Array; get_destination_script(): Uint8Array; - get_shutdown_pubkey(): Uint8Array; - get_channel_keys(inbound: boolean, channel_value_satoshis: number): ChannelKeys; + get_shutdown_scriptpubkey(): ShutdownScript; + get_channel_signer(inbound: boolean, channel_value_satoshis: number): Sign; get_secure_random_bytes(): Uint8Array; - read_chan_signer(reader: Uint8Array): Result_ChanKeySignerDecodeErrorZ; + read_chan_signer(reader: Uint8Array): Result_SignDecodeErrorZ; + sign_invoice(invoice_preimage: Uint8Array): Result_RecoverableSignatureNoneZ; } @@ -94,14 +104,16 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public Uint8Array get_shutdown_pubkey() { - Uint8Array ret = bindings.KeysInterface_get_shutdown_pubkey(this.ptr); - return ret; + public ShutdownScript get_shutdown_scriptpubkey() { + number ret = bindings.KeysInterface_get_shutdown_scriptpubkey(this.ptr); + const ret_hu_conv: ShutdownScript = new ShutdownScript(null, ret); + ret_hu_conv.ptrs_to.add(this); + return ret_hu_conv; } - public ChannelKeys get_channel_keys(boolean inbound, number channel_value_satoshis) { - number ret = bindings.KeysInterface_get_channel_keys(this.ptr, inbound, channel_value_satoshis); - ChannelKeys ret_hu_conv = new ChannelKeys(null, ret); + public Sign get_channel_signer(boolean inbound, number channel_value_satoshis) { + number ret = bindings.KeysInterface_get_channel_signer(this.ptr, inbound, channel_value_satoshis); + Sign ret_hu_conv = new Sign(null, ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -111,9 +123,15 @@ import * as bindings from '../bindings' // TODO: figure out location return ret; } - public Result_ChanKeySignerDecodeErrorZ read_chan_signer(Uint8Array reader) { + public Result_SignDecodeErrorZ read_chan_signer(Uint8Array reader) { number ret = bindings.KeysInterface_read_chan_signer(this.ptr, reader); - Result_ChanKeySignerDecodeErrorZ ret_hu_conv = Result_ChanKeySignerDecodeErrorZ.constr_from_ptr(ret); + Result_SignDecodeErrorZ ret_hu_conv = Result_SignDecodeErrorZ.constr_from_ptr(ret); + return ret_hu_conv; + } + + public Result_RecoverableSignatureNoneZ sign_invoice(Uint8Array invoice_preimage) { + number ret = bindings.KeysInterface_sign_invoice(this.ptr, invoice_preimage); + Result_RecoverableSignatureNoneZ ret_hu_conv = Result_RecoverableSignatureNoneZ.constr_from_ptr(ret); return ret_hu_conv; }