1 |
|
2 |
|
3 | import { keyHdkdEcdsa } from "./hdkdEcdsa.js";
|
4 | import { keyHdkdEd25519 } from "./hdkdEd25519.js";
|
5 | import { keyHdkdSr25519 } from "./hdkdSr25519.js";
|
6 | const generators = {
|
7 | ecdsa: keyHdkdEcdsa,
|
8 | ed25519: keyHdkdEd25519,
|
9 |
|
10 | ethereum: keyHdkdEcdsa,
|
11 | sr25519: keyHdkdSr25519
|
12 | };
|
13 | export function keyFromPath(pair, path, type) {
|
14 | const keyHdkd = generators[type];
|
15 | let result = pair;
|
16 |
|
17 | for (const junction of path) {
|
18 | result = keyHdkd(result, junction);
|
19 | }
|
20 |
|
21 | return result;
|
22 | } |
\ | No newline at end of file |