UNPKG

1.21 kBMarkdownView Raw
1# KeyLib v0.0.12
2
3## Principles
4
5keyLib 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
26var privateKey = new keyLib.PrivateKey();
27
28var exported = privateKey.toWIF();
29// e.g. L3T1s1TYP9oyhHpXgkyLoJFGniEgkv2Jhi138d7R2yJ9F4QdDU2m
30var imported = keyLib.PrivateKey.fromWIF(exported);
31var hexa = privateKey.toString();
32// e.g. 'b9de6e778fe92aa7edb69395556f843f1dce0448350112e14906efc2a80fa61a'
33```
34
35## Create and Save a Private Key - other cryptocurrencies
36
37The 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
40var privateKey = new keyLib.PrivateKey();
41var privateKey = new keyLib.PrivateKey('BTC');
42var privateKey = new keyLib.PrivateKey('BCH');
43var privateKey = new keyLib.PrivateKey('LTC');
44```