1 | [![NPM](https://img.shields.io/npm/v/eosjs-ecc.svg)](https://www.npmjs.org/package/eosjs-ecc)
|
2 |
|
3 | # Elliptic curve cryptography functions (ECC)
|
4 | Private Key, Public Key, Signature, AES, Encryption / Decryption
|
5 |
|
6 | ## Usage (Node)
|
7 |
|
8 | ```js
|
9 | let {PrivateKey, PublicKey, Signature, Aes} = require('eosjs-ecc')
|
10 |
|
11 | // Create a new random private key
|
12 | privateWif = PrivateKey.randomKey().toWif()
|
13 |
|
14 |
|
15 | // Convert to a public key
|
16 | pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()
|
17 |
|
18 | ```
|
19 |
|
20 | ## Browser (build eosjs-ecc.js below)
|
21 |
|
22 | ```html
|
23 | <script src=eosjs-ecc.js></script>
|
24 | ```
|
25 |
|
26 | ```js
|
27 | var {PrivateKey} = eosjs_ecc
|
28 | var privateWif = PrivateKey.randomKey().toWif()
|
29 | var pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()
|
30 | console.log(pubkey)
|
31 | ```
|
32 |
|
33 | ## Configure
|
34 |
|
35 | ```js
|
36 | const {config} = require('eosjs-ecc')
|
37 |
|
38 | // Change the public key address prefix
|
39 | // config.address_prefix = 'XXX'
|
40 |
|
41 | ```
|
42 | See [Config](./src/config.js)
|
43 |
|
44 |
|
45 | ## See Also
|
46 |
|
47 | * [PrivateKey](./src/key_private.js)
|
48 | * [PublicKey](./src/key_public.js)
|
49 | * [Signature](./src/signature.js)
|
50 | * [Aes](./src/aes.js)
|
51 |
|
52 | ## Build
|
53 |
|
54 | Dependencies (for building only): Unix like OS, sha256sum
|
55 |
|
56 | ```bash
|
57 | git clone https://github.com/EOSIO/eosjs-ecc.git ecc
|
58 | cd ecc
|
59 | yarn
|
60 | yarn build
|
61 | # builds: ./dist/eosjs-ecc.js
|
62 | # Verify release hash
|
63 | ```
|
64 |
|
65 | ## Releases
|
66 |
|
67 | * v1.0.0 - sha256 3f8ae6c183f18cd4a6e6b5a7fac2958a3a4071f2abe6dc0286dc30e10068851b
|