1 | import { keyHdkdEcdsa } from './hdkdEcdsa.js';
|
2 | import { keyHdkdEd25519 } from './hdkdEd25519.js';
|
3 | import { keyHdkdSr25519 } from './hdkdSr25519.js';
|
4 | const generators = {
|
5 | ecdsa: keyHdkdEcdsa,
|
6 | ed25519: keyHdkdEd25519,
|
7 | // FIXME This is Substrate-compatible, not Ethereum-compatible
|
8 | ethereum: keyHdkdEcdsa,
|
9 | sr25519: keyHdkdSr25519
|
10 | };
|
11 | export function keyFromPath(pair, path, type) {
|
12 | const keyHdkd = generators[type];
|
13 | let result = pair;
|
14 | for (const junction of path) {
|
15 | result = keyHdkd(result, junction);
|
16 | }
|
17 | return result;
|
18 | }
|