ecies-geth
Advanced tools
Comparing version 1.5.0 to 1.5.1
{ | ||
"name": "ecies-geth", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "JavaScript Elliptic Curve Integrated Encryption Scheme (ECIES) Library - Based off Geth's implementation", | ||
@@ -5,0 +5,0 @@ "main": "dist/lib/src/typescript/index.js", |
@@ -15,3 +15,3 @@ # ecies-geth | ||
We needed to have a JavaScript library fully compliant with the way the Go Ethereum ECIES module ([`ecies`](https://godoc.org/github.com/ethereum/go-ethereum/crypto/ecies)) was implemented. | ||
We needed to have a JavaScript library fully compliant with the way the Go Ethereum ECIES module ([`ecies`](https://godoc.org/github.com/ethereum/go-ethereum/crypto/ecies)) was implemented. \ | ||
[Parity](https://www.parity.io/) has implemented ECIES encryption and decryption for arbitrary messages through its extended [JSON RPC API](https://wiki.parity.io/JSONRPC-parity-module.html) and has started translating it into a JavaScript library ([`ecies-parity`](https://www.npmjs.com/package/ecies-parity)). But issues remain in the latter and needed a pass to correct them. | ||
@@ -29,3 +29,3 @@ | ||
#### Cryptography Warning | ||
#### _Cryptography Warning_ | ||
@@ -41,3 +41,3 @@ The ECIES implementation given here is solely based off Geth's and Parity's implementations. This module offers no guarantee as to the security or validity of the implementation. Furthermore, this project is being actively developed and as such should not be used for highly sensitive informations without further investigation on its robustness. | ||
Although this module is primarily developed for ECIES encryption/decryption, extra elliptic curve functionality is provided. | ||
Although this module was primarily developed for ECIES encryption/decryption, extra elliptic curve functionalities are provided. | ||
@@ -47,4 +47,4 @@ #### ECIES Encryption / Decryption | ||
```js | ||
const crypto = require("crypto"); | ||
const ecies = require("ecies-geth"); | ||
const crypto = require('crypto'); | ||
const ecies = require('ecies-geth'); | ||
@@ -57,6 +57,6 @@ const privateKeyA = crypto.randomBytes(32); | ||
// Encrypting the message for B. | ||
ecies.encrypt(publicKeyB, Buffer.from("msg to b")).then(function(encrypted) { | ||
ecies.encrypt(publicKeyB, Buffer.from('msg to b')).then(function(encrypted) { | ||
// B decrypting the message. | ||
ecies.decrypt(privateKeyB, encrypted).then(function(plaintext) { | ||
console.log("Message to part B", plaintext.toString()); | ||
console.log('Message to part B', plaintext.toString()); | ||
}); | ||
@@ -66,6 +66,6 @@ }); | ||
// Encrypting the message for A. | ||
ecies.encrypt(publicKeyA, Buffer.from("msg to a")).then(function(encrypted) { | ||
ecies.encrypt(publicKeyA, Buffer.from('msg to a')).then(function(encrypted) { | ||
// A decrypting the message. | ||
ecies.decrypt(privateKeyA, encrypted).then(function(plaintext) { | ||
console.log("Message to part A", plaintext.toString()); | ||
console.log('Message to part A', plaintext.toString()); | ||
}); | ||
@@ -75,7 +75,7 @@ }); | ||
#### Signing | ||
#### ECDSA Signing | ||
```js | ||
const crypto = require("crypto"); | ||
const ecies = require("ecies-geth"); | ||
const crypto = require('crypto'); | ||
const ecies = require('ecies-geth'); | ||
@@ -87,12 +87,12 @@ // A new random 32-byte private key. | ||
const str = "message to sign"; | ||
const str = 'message to sign'; | ||
// Always hash your message to sign! | ||
const msg = crypto.createHash("sha256").update(str).digest(); | ||
const msg = crypto.createHash('sha256').update(str).digest(); | ||
ecies.sign(privateKey, msg).then(function(sig) { | ||
console.log("Signature in DER format:", sig); | ||
console.log('Signature in DER format:', sig); | ||
ecies.verify(publicKey, msg, sig).then(function() { | ||
console.log("Signature is OK"); | ||
console.log('Signature is OK'); | ||
}).catch(function() { | ||
console.log("Signature is BAD"); | ||
console.log('Signature is BAD'); | ||
}); | ||
@@ -102,7 +102,7 @@ }) | ||
#### ECDH | ||
#### ECDH Derivation | ||
```js | ||
const crypto = require("crypto"); | ||
const ecies = require("ecies-geth"); | ||
const crypto = require('crypto'); | ||
const ecies = require('ecies-geth'); | ||
@@ -116,3 +116,3 @@ const privateKeyA = crypto.randomBytes(32); | ||
ecies.derive(privateKeyB, publicKeyA).then(function(sharedKey2) { | ||
console.log("Both shared keys are equal", sharedKey1, sharedKey2); | ||
console.log('Both shared keys are equal', sharedKey1, sharedKey2); | ||
}) | ||
@@ -122,2 +122,9 @@ }) | ||
### Dependencies | ||
This library relies on the following dependencies: | ||
- [`elliptic`](https://www.npmjs.com/package/elliptic); | ||
- [`secp256k1`](https://www.npmjs.com/package/secp256k1). | ||
### Credits | ||
@@ -124,0 +131,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58044
131