1 | <?php |
||
7 | class HierarchicalKeySequence |
||
8 | { |
||
9 | private static $filterBip32Index = [ |
||
10 | 'min_range' => 0, |
||
11 | 'max_range' => (1 << 31) - 1, |
||
12 | ]; |
||
13 | |||
14 | /** |
||
15 | * decodeAbsolute accepts an absolute BIP32 path, one beginning |
||
16 | * with m or M. It returns an array, containing two elements. |
||
17 | * The first is whether the prefix was public or private. |
||
18 | * The second is the array of indices contained in the path. |
||
19 | * |
||
20 | * @param string $path |
||
21 | * @return array - <isPrivate bool, path <int[]>> |
||
22 | */ |
||
23 | public function decodeAbsolute(string $path) |
||
39 | |||
40 | /** |
||
41 | * decodeRelative accepts a relative BIP32 path, that is, |
||
42 | * one without the prefix of m or M. These are usually provided |
||
43 | * when requesting some child derivation of a key. |
||
44 | * |
||
45 | * @param string $path |
||
46 | * @return int[] |
||
47 | */ |
||
48 | 44 | public function decodeRelative(string $path): array |
|
61 | |||
62 | /** |
||
63 | * Inner routine for decoding the numeric section of a path |
||
64 | * @param string ...$parts |
||
65 | * @return int[] |
||
66 | */ |
||
67 | 44 | private function decodeDerivation(string... $parts): array |
|
104 | } |
||
105 |