UNPKG

lightningdevkit

Version:
66 lines (65 loc) 2.47 kB
import { Result_PublicKeySecp256k1ErrorZ } from '../structs/Result_PublicKeySecp256k1ErrorZ.mjs'; import { Result_OnionPacketDecodeErrorZ } from '../structs/Result_OnionPacketDecodeErrorZ.mjs'; import { CommonBase } from './CommonBase.mjs'; /** * BOLT 4 onion packet including hop data for the next peer. */ export declare class OnionPacket extends CommonBase { /** * BOLT 4 version number. */ get_version(): number; /** * BOLT 4 version number. */ set_version(val: number): void; /** * In order to ensure we always return an error on onion decode in compliance with [BOLT * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd * like. * * Returns a copy of the field. */ get_public_key(): Result_PublicKeySecp256k1ErrorZ; /** * In order to ensure we always return an error on onion decode in compliance with [BOLT * #4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md), we have to * deserialize `OnionPacket`s contained in [`UpdateAddHTLC`] messages even if the ephemeral * public key (here) is bogus, so we hold a [`Result`] instead of a [`PublicKey`] as we'd * like. */ set_public_key(val: Result_PublicKeySecp256k1ErrorZ): void; /** * HMAC to verify the integrity of hop_data. */ get_hmac(): Uint8Array; /** * HMAC to verify the integrity of hop_data. */ set_hmac(val: Uint8Array): void; clone_ptr(): bigint; /** * Creates a copy of the OnionPacket */ clone(): OnionPacket; /** * Generates a non-cryptographic 64-bit hash of the OnionPacket. */ hash(): bigint; /** * Checks if two OnionPackets 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: OnionPacket): boolean; /** * Serialize the OnionPacket object into a byte array which can be read by OnionPacket_read */ write(): Uint8Array; /** * Read a OnionPacket from a byte array, created by OnionPacket_write */ static constructor_read(ser: Uint8Array): Result_OnionPacketDecodeErrorZ; }