UNPKG

2.03 kBMarkdownView Raw
1<img src="http://bitcore.io/css/images/module-ecies.png" alt="bitcore ecies" height="35">
2# ECIES for bitcore
3
4[![NPM Package](https://img.shields.io/npm/v/bitcore-ecies.svg?style=flat-square)](https://www.npmjs.org/package/bitcore-ecies)
5[![Build Status](https://img.shields.io/travis/bitpay/bitcore-ecies.svg?branch=master&style=flat-square)](https://travis-ci.org/bitpay/bitcore-ecies)
6[![Coverage Status](https://img.shields.io/coveralls/bitpay/bitcore-ecies.svg?style=flat-square)](https://coveralls.io/r/bitpay/bitcore-ecies)
7
8A module for [bitcore][bitcore] that implements the [Elliptic Curve Integrated Encryption Scheme (ECIES)][ECIES]. Uses ECIES symmetric key negotiation from public keys to encrypt arbitrarily long data streams.
9
10See [the main bitcore repo](https://github.com/bitpay/bitcore) or the [bitcore guide on ECIES](http://bitcore.io/guide/module/ecies/index.html) for more information.
11
12Credit to [@ryanxcharles][ryan] for the original implementation.
13
14## Getting started
15
16ECIES will allow to securely encrypt and decrypt messages using ECDSA key pairs (bitcoin cryptography).
17
18```javascript
19var alice = ECIES()
20 .privateKey(aliceKey)
21 .publicKey(bobKey.publicKey);
22
23var message = 'some secret message';
24var encrypted = alice.encrypt(message);
25
26// encrypted will contain an encrypted buffer only Bob can decrypt
27
28var bob = ECIES()
29 .privateKey(bobKey)
30 .publicKey(aliceKey.publicKey);
31var decrypted = bob
32 .decrypt(encrypted)
33 .toString();
34// decrypted will be 'some secret message'
35```
36
37## Contributing
38
39See [CONTRIBUTING.md](https://github.com/bitpay/bitcore/blob/master/CONTRIBUTING.md) on the main bitcore repo for information about how to contribute.
40
41## License
42
43Code released under [the MIT license](https://github.com/bitpay/bitcore/blob/master/LICENSE).
44
45Copyright 2013-2015 BitPay, Inc. Bitcore is a trademark maintained by BitPay, Inc.
46
47[bitcore]: http://github.com/bitpay/bitcore
48[ECIES]: http://en.wikipedia.org/wiki/Integrated_Encryption_Scheme
49[ryan]: http://github.com/ryanxcharles