|
1 | 1 | import { describe, bench } from 'vitest'; |
2 | 2 |
|
3 | 3 | import fixtures from './fixtures'; |
4 | | -import { secp256k1, SLIP10Node } from '../src'; |
| 4 | +import { secp256k1, ed25519, ed25519Bip32, SLIP10Node } from '../src'; |
5 | 5 | import { deriveChildKey } from '../src/derivers/bip39'; |
6 | 6 |
|
7 | | -describe('SLIP10Node', async () => { |
8 | | - const privateNode = await deriveChildKey({ |
9 | | - path: fixtures.local.seed, |
10 | | - curve: secp256k1, |
11 | | - }); |
| 7 | +describe('SLIP10Node', () => { |
| 8 | + describe('fromExtendedKey', () => { |
| 9 | + describe('secp256k1', async () => { |
| 10 | + const privateNode = await deriveChildKey({ |
| 11 | + path: fixtures.local.seed, |
| 12 | + curve: secp256k1, |
| 13 | + }); |
12 | 14 |
|
13 | | - const publicNode = privateNode.neuter(); |
| 15 | + const publicNode = privateNode.neuter(); |
14 | 16 |
|
15 | | - describe('fromExtendedKey', () => { |
16 | | - describe('from a JSON object', () => { |
17 | | - bench('with a private key', async () => { |
18 | | - await SLIP10Node.fromExtendedKey(privateNode.toJSON()); |
| 17 | + describe('from a JSON object', () => { |
| 18 | + bench('with a private key', async () => { |
| 19 | + await SLIP10Node.fromExtendedKey(privateNode.toJSON()); |
| 20 | + }); |
| 21 | + |
| 22 | + bench('with a public key', async () => { |
| 23 | + await SLIP10Node.fromExtendedKey(publicNode.toJSON()); |
| 24 | + }); |
19 | 25 | }); |
20 | 26 |
|
21 | | - bench('with a public key', async () => { |
22 | | - await SLIP10Node.fromExtendedKey(publicNode.toJSON()); |
| 27 | + describe('from an extended key', () => { |
| 28 | + bench('with a private key', async () => { |
| 29 | + await SLIP10Node.fromExtendedKey(privateNode.extendedKey); |
| 30 | + }); |
| 31 | + |
| 32 | + bench('with a public key', async () => { |
| 33 | + await SLIP10Node.fromExtendedKey(publicNode.extendedKey); |
| 34 | + }); |
23 | 35 | }); |
24 | 36 | }); |
25 | 37 |
|
26 | | - describe('from an extended key', () => { |
27 | | - bench('with a private key', async () => { |
28 | | - await SLIP10Node.fromExtendedKey(privateNode.extendedKey); |
| 38 | + describe('ed25519', async () => { |
| 39 | + const privateNode = await deriveChildKey({ |
| 40 | + path: fixtures.local.seed, |
| 41 | + curve: ed25519, |
29 | 42 | }); |
30 | 43 |
|
31 | | - bench('with a public key', async () => { |
32 | | - await SLIP10Node.fromExtendedKey(publicNode.extendedKey); |
| 44 | + const publicNode = privateNode.neuter(); |
| 45 | + |
| 46 | + describe('from a JSON object', () => { |
| 47 | + bench('with a private key', async () => { |
| 48 | + await SLIP10Node.fromExtendedKey(privateNode.toJSON()); |
| 49 | + }); |
| 50 | + |
| 51 | + bench('with a public key', async () => { |
| 52 | + await SLIP10Node.fromExtendedKey(publicNode.toJSON()); |
| 53 | + }); |
| 54 | + }); |
| 55 | + }); |
| 56 | + |
| 57 | + describe('ed25519Bip32', async () => { |
| 58 | + const privateNode = await deriveChildKey({ |
| 59 | + path: fixtures.local.seed, |
| 60 | + curve: ed25519Bip32, |
| 61 | + }); |
| 62 | + |
| 63 | + const publicNode = privateNode.neuter(); |
| 64 | + |
| 65 | + describe('from a JSON object', () => { |
| 66 | + bench('with a private key', async () => { |
| 67 | + await SLIP10Node.fromExtendedKey(privateNode.toJSON()); |
| 68 | + }); |
| 69 | + |
| 70 | + bench('with a public key', async () => { |
| 71 | + await SLIP10Node.fromExtendedKey(publicNode.toJSON()); |
| 72 | + }); |
33 | 73 | }); |
34 | 74 | }); |
35 | 75 | }); |
|
0 commit comments