1 | # KeyLib v0.0.12
|
2 |
|
3 | ## Principles
|
4 |
|
5 | keyLib provides a reliable API for JavaScript apps that need to create, import, and derive ECDSA keys.
|
6 |
|
7 | # Documentation Index
|
8 |
|
9 | ## Key Management
|
10 |
|
11 | * [Private Keys](privatekey.md) and [Public Keys](publickey.md)
|
12 | * [Hierarchically-derived Private and Public Keys](hierarchical.md)
|
13 |
|
14 | ## Extra
|
15 | * [Crypto](crypto.md)
|
16 | * [Encoding](encoding.md)
|
17 |
|
18 | ## Module Development
|
19 | * [Browser Builds](browser.md)
|
20 |
|
21 | # Examples
|
22 |
|
23 | ## Create and Save a Private Key - Bitcoin
|
24 |
|
25 | ```javascript
|
26 | var privateKey = new keyLib.PrivateKey();
|
27 |
|
28 | var exported = privateKey.toWIF();
|
29 | // e.g. L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m
|
30 | var imported = keyLib.PrivateKey.fromWIF(exported);
|
31 | var hexa = privateKey.toString();
|
32 | // e.g. 'b9de6e778fe92aa7edb69395556f843f1dce0448350112e14906efc2a80fa61a'
|
33 | ```
|
34 |
|
35 | ## Create and Save a Private Key - other cryptocurrencies
|
36 |
|
37 | The default behavior creates a key for the Bitcoin network. You can specify another network by providing a string argument identifying the currency.
|
38 |
|
39 | ```javascript
|
40 | var privateKey = new keyLib.PrivateKey();
|
41 | var privateKey = new keyLib.PrivateKey('BTC');
|
42 | var privateKey = new keyLib.PrivateKey('BCH');
|
43 | var privateKey = new keyLib.PrivateKey('LTC');
|
44 | ```
|