lightningdevkit
Version:
Lightning Development Kit
55 lines • 1.93 kB
JavaScript
import { CommonBase } from './CommonBase.mjs';
import * as bindings from '../bindings.mjs';
/**
* A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_inbound_payment_key`].
*
* [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key
*/
export class ExpandedKey extends CommonBase {
/* @internal */
constructor(_dummy, ptr) {
super(ptr, bindings.ExpandedKey_free);
}
/**
* Generates a non-cryptographic 64-bit hash of the ExpandedKey.
*/
hash() {
const ret = bindings.ExpandedKey_hash(this.ptr);
return ret;
}
clone_ptr() {
const ret = bindings.ExpandedKey_clone_ptr(this.ptr);
return ret;
}
/**
* Creates a copy of the ExpandedKey
*/
clone() {
const ret = bindings.ExpandedKey_clone(this.ptr);
const ret_hu_conv = new ExpandedKey(null, ret);
CommonBase.add_ref_from(ret_hu_conv, this);
return ret_hu_conv;
}
/**
* Checks if two ExpandedKeys contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
* Two objects with NULL inner values will be considered "equal" here.
*/
eq(b) {
const ret = bindings.ExpandedKey_eq(this.ptr, CommonBase.get_ptr_of(b));
CommonBase.add_ref_from(this, b);
return ret;
}
/**
* Create a new [`ExpandedKey`] for generating an inbound payment hash and secret.
*
* It is recommended to cache this value and not regenerate it for each new inbound payment.
*/
static constructor_new(key_material) {
const ret = bindings.ExpandedKey_new(bindings.encodeUint8Array(key_material));
const ret_hu_conv = new ExpandedKey(null, ret);
CommonBase.add_ref_from(ret_hu_conv, ret_hu_conv);
return ret_hu_conv;
}
}
//# sourceMappingURL=ExpandedKey.mjs.map