UNPKG

@node-dlc/core

Version:
27 lines (26 loc) 1.05 kB
/// <reference types="node" /> export declare class CommitmentSecret { /** * Generic version of commitment secret generator as defined in * BOLT3. * * This function works by decrementing from bits to 0. If the index * number has the corresponding bit set, it flips the bit in the * secret and hashes it. * * The natural conclusion is the first secret flips every bit and * the last secret flips zero (and is thus the seed). * * This function can be used for generate the local per-commitment * secret based on the per-commitment seed and a commitment index * (in this case it) generates all 48 bits. * * This function can also be used to generate prior commitment * secrets from a newer secret, which acts as a prefix. * * @param base base secret that will be used to derive from * @param i secret at index I to generate * @param bits bits to evaluate, default is 48 */ static derive(base: Buffer, i: bigint, bits?: number): Buffer; }