UNPKG

1.35 kBMarkdownView Raw
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)
4Private Key, Public Key, Signature, AES, Encryption / Decryption
5
6## Usage (Node)
7
8```js
9let {PrivateKey, PublicKey, Signature, Aes} = require('eosjs-ecc')
10
11// Create a new random private key
12privateWif = PrivateKey.randomKey().toWif()
13
14
15// Convert to a public key
16pubkey = 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
27var {PrivateKey} = eosjs_ecc
28var privateWif = PrivateKey.randomKey().toWif()
29var pubkey = PrivateKey.fromWif(privateWif).toPublic().toString()
30console.log(pubkey)
31```
32
33## Configure
34
35```js
36const {config} = require('eosjs-ecc')
37
38// Change the public key address prefix
39// config.address_prefix = 'XXX'
40
41```
42See [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
54Dependencies (for building only): Unix like OS, sha256sum
55
56```bash
57git clone https://github.com/EOSIO/eosjs-ecc.git ecc
58cd ecc
59yarn
60yarn build
61# builds: ./dist/eosjs-ecc.js
62# Verify release hash
63```
64
65## Releases
66
67* v1.0.0 - sha256 3f8ae6c183f18cd4a6e6b5a7fac2958a3a4071f2abe6dc0286dc30e10068851b