1 | /// <reference types="node" />
|
2 | /**
|
3 | * Static builder for handling the parsing of Bip44 Paths.
|
4 | *
|
5 | * BIP44 is a particular application of BIP43.
|
6 | * It defines a hierarchy for deterministic wallets based on BIP32,
|
7 | * and the purpose scheme described in BIP43.
|
8 | *
|
9 | * A Bip44 path defines the following levels:
|
10 | * - m / purpose' / coin_type' / account' / change / address_index
|
11 | *
|
12 | * https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
|
13 | * https://github.com/bitcoin/bips/blob/master/bip-0043.mediawiki
|
14 | * https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
|
15 | *
|
16 | * @example const bip44Bytes = Bip44Path.fromString("44'/111'/0'/0/0").toBytes()
|
17 | * @example const bip44Bytes = Bip44Path.fromString("44'/111'/0'").toBytes()
|
18 | * @example const bip44Bytes = Bip44Path.fromString("m/44'/111'/0'/0/0").toBytes()
|
19 | */
|
20 | export declare class Bip44Path {
|
21 | private static readonly HARDENING;
|
22 | private static readonly REGEXP_VALID_BIP44;
|
23 | private _elements;
|
24 | /**
|
25 | * Private constructor.
|
26 | * Ensures precondition that 'fromString' is called before 'toBytes'.
|
27 | *
|
28 | * @param {number[]} elements a bip44 path as an array of elements
|
29 | */
|
30 | private constructor();
|
31 | /**
|
32 | * Parses a Bip44 path-string, storing the path as elements,
|
33 | * and returns a Bip44Path instance.
|
34 | *
|
35 | * Elements are stored as a 4-byte/uint32 Big-Endian-packed number array.
|
36 | *
|
37 | * @param {string} path a bip44 path as a string
|
38 | * Error} if the path-string is null
{ |
39 | * Error} if the path formatting is invalid
{ |
40 | * new instance containing parsed path elements
{Bip44Path} a |
41 | */
|
42 | static fromString(path: string): Bip44Path;
|
43 | /**
|
44 | * Parses and stores a Bip44 Path-string as an array of elements to the 'Bip44Path' instance.
|
45 | *
|
46 | * @param {string} path a bip44 path as a string
|
47 | * @throws {Error} if the path-string is null
|
48 | * @throws {Error} if the path-string has a length of '0'
|
49 | * @returns {Bip44Path} a new instance containing parsed path elements
|
50 | */
|
51 | protected static pathToElements(path: string): Bip44Path;
|
52 | /**
|
53 | * Get the bytes of a Parsed Bip44 Element Array.
|
54 | *
|
55 | * @returns {Buffer} a buffer of bytes representing the path
|
56 | * @throws {Error} if the internal bip44 element array has a length of '0'
|
57 | * @returns {Buffer} a byte buffer of parsed bip44 path elements
|
58 | */
|
59 | toBytes(): Buffer;
|
60 | }
|
61 | export { Bip44Path as Path };
|