{"id":16759567,"url":"https://github.com/cyrildever/ecies-geth","last_synced_at":"2025-07-25T04:37:02.843Z","repository":{"id":42686142,"uuid":"229442334","full_name":"cyrildever/ecies-geth","owner":"cyrildever","description":"JavaScript Elliptic Curve Integrated Encryption Scheme (ECIES) Library - Based off Geth's implementation","archived":false,"fork":false,"pushed_at":"2024-03-27T09:31:54.000Z","size":809,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-24T06:09:40.255Z","etag":null,"topics":["cryptography","ecdh","ecies-encryption","ecies-geth","javascript-library"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cyrildever.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-21T14:55:09.000Z","updated_at":"2024-06-18T21:25:46.814Z","dependencies_parsed_at":"2023-02-05T20:46:30.041Z","dependency_job_id":"4832c26c-5320-4f51-9812-5c3106db58db","html_url":"https://github.com/cyrildever/ecies-geth","commit_stats":{"total_commits":54,"total_committers":4,"mean_commits":13.5,"dds":0.2407407407407407,"last_synced_commit":"6a7e5f8879413587168f16acbb73197e63747594"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fecies-geth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fecies-geth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fecies-geth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cyrildever%2Fecies-geth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cyrildever","download_url":"https://codeload.github.com/cyrildever/ecies-geth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239325238,"owners_count":19620253,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cryptography","ecdh","ecies-encryption","ecies-geth","javascript-library"],"created_at":"2024-10-13T04:08:29.162Z","updated_at":"2025-02-17T16:31:25.704Z","avatar_url":"https://github.com/cyrildever.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ecies-geth\n\n![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/cyrildever/ecies-geth)\n![npm](https://img.shields.io/npm/dw/ecies-geth)\n![GitHub last commit](https://img.shields.io/github/last-commit/cyrildever/ecies-geth)\n![GitHub issues](https://img.shields.io/github/issues/cyrildever/ecies-geth)\n![NPM](https://img.shields.io/npm/l/ecies-geth)\n\nThis is a JavaScript Elliptic Curve Integrated Encryption Scheme (ECIES) library for use in both Browser and NodeJS apps.\nThis module is a modified version of the [`eccrypto`](https://github.com/bitchan/eccrypto) JavaScript library.\nIt's also based off Geth's implementation (Ethereum's `ecies` Go module).\n\n### Motivation\n\nWe 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. \\\n[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.\n\n\n### Implementation details\n\nAs with `eccrypto`, this library provides two implementations for Browser and NodeJS with the same API.\n\nThe ECIES implementation details mimic those introduced by both Geth and Parity, which are:\n* Implements a __SHA-256__ Key Derivation Function (KDF);\n* ECDH based only on the `secp256k1` curve (to match common blockchain transaction signing);\n* Uses __AES-128-CTR__ based symmetric encryption (with a 128-bit shared key derived from ECDH).\n\n#### _Cryptography Warning_\n\nThe 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. Any feedback or concerns regarding its security would be greatly appreciated.\n\n\n### Usage\n\n```\nnpm i ecies-geth\n```\n\nAlthough this module was primarily developed for ECIES encryption/decryption, extra elliptic curve functionalities are provided.\n\n#### ECIES Encryption / Decryption\n\n```js\nconst crypto = require('crypto');\nconst ecies = require('ecies-geth');\n\nconst privateKeyA = crypto.randomBytes(32);\nconst publicKeyA = await ecies.getPublic(privateKeyA);\nconst privateKeyB = crypto.randomBytes(32);\nconst publicKeyB = await ecies.getPublic(privateKeyB);\n\n// Encrypting the message for B.\necies.encrypt(publicKeyB, Buffer.from('msg to b')).then(function(encrypted) {\n  // B decrypting the message.\n  ecies.decrypt(privateKeyB, encrypted).then(function(plaintext) {\n    console.log('Message to part B', plaintext.toString());\n  });\n});\n\n// Encrypting the message for A.\necies.encrypt(publicKeyA, Buffer.from('msg to a')).then(function(encrypted) {\n  // A decrypting the message.\n  ecies.decrypt(privateKeyA, encrypted).then(function(plaintext) {\n    console.log('Message to part A', plaintext.toString());\n  });\n});\n```\n\n#### ECDSA Signing \n\n```js\nconst crypto = require('crypto');\nconst ecies = require('ecies-geth');\n\n// A new random 32-byte private key.\nconst privateKey = crypto.randomBytes(32)\n// Corresponding uncompressed (65-byte) public key.\nconst publicKey = await ecies.getPublic(privateKey);\n\nconst str = 'message to sign';\n// Always hash your message to sign!\nconst msg = crypto.createHash('sha256').update(str).digest();\n\necies.sign(privateKey, msg).then(function(sig) {\n  console.log('Signature in DER format:', sig);\n  ecies.verify(publicKey, msg, sig).then(function() {\n    console.log('Signature is OK');\n  }).catch(function() {\n    console.log('Signature is BAD');\n  });\n})\n```\n\n#### ECDH Derivation\n\n```js\nconst crypto = require('crypto');\nconst ecies = require('ecies-geth');\n\nconst privateKeyA = crypto.randomBytes(32);\nconst publicKeyA = await ecies.getPublic(privateKeyA);\nconst privateKeyB = crypto.randomBytes(32);\nconst publicKeyB = await ecies.getPublic(privateKeyB);\n\necies.derive(privateKeyA, publicKeyB).then(function(sharedKey1) {\n  ecies.derive(privateKeyB, publicKeyA).then(function(sharedKey2) {\n    console.log('Both shared keys are equal', sharedKey1, sharedKey2);\n  })\n})\n```\n\n### Dependencies\n\nThis library relies on the following dependencies:\n- [`elliptic`](https://www.npmjs.com/package/elliptic);\n- [`secp256k1`](https://www.npmjs.com/package/secp256k1).\n\nTo run the tests, you would need to install [`live-server`](https://www.npmjs.com/package/live-server):\n```console\nnpm i -g live-server\n```\n\n\n### Credits\n\nThanks to [@Methrat0n](https://github.com/Methrat0n/) for the initial work on this adaptation.\n\n\n### License\n\nThis module is distributed under a MIT license. \\\nSee the [LICENSE](LICENSE) file.\n\n\n\u003chr /\u003e\n\u0026copy; 2019-2025 Cyril Dever. All rights reserved.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyrildever%2Fecies-geth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyrildever%2Fecies-geth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyrildever%2Fecies-geth/lists"}