eth-crypto
Advanced tools
Comparing version 2.2.0 to 2.3.0
import { encrypt } from 'eccrypto'; | ||
import { decompress } from './public-key'; | ||
export default function encryptWithPublicKey(publicKey, message) { | ||
export default function encryptWithPublicKey(publicKey, message, opts) { | ||
// ensure its an uncompressed publicKey | ||
@@ -8,3 +8,3 @@ publicKey = decompress(publicKey); // re-add the compression-flag | ||
var pubString = '04' + publicKey; | ||
return encrypt(Buffer.from(pubString, 'hex'), Buffer.from(message)).then(function (encryptedBuffers) { | ||
return encrypt(Buffer.from(pubString, 'hex'), Buffer.from(message), opts ? opts : {}).then(function (encryptedBuffers) { | ||
var encrypted = { | ||
@@ -11,0 +11,0 @@ iv: encryptedBuffers.iv.toString('hex'), |
@@ -12,3 +12,3 @@ "use strict"; | ||
function encryptWithPublicKey(publicKey, message) { | ||
function encryptWithPublicKey(publicKey, message, opts) { | ||
// ensure its an uncompressed publicKey | ||
@@ -18,3 +18,3 @@ publicKey = (0, _publicKey.decompress)(publicKey); // re-add the compression-flag | ||
var pubString = '04' + publicKey; | ||
return (0, _eccrypto.encrypt)(Buffer.from(pubString, 'hex'), Buffer.from(message)).then(function (encryptedBuffers) { | ||
return (0, _eccrypto.encrypt)(Buffer.from(pubString, 'hex'), Buffer.from(message), opts ? opts : {}).then(function (encryptedBuffers) { | ||
var encrypted = { | ||
@@ -21,0 +21,0 @@ iv: encryptedBuffers.iv.toString('hex'), |
{ | ||
"name": "eth-crypto", | ||
"version": "2.2.0", | ||
"version": "2.3.0", | ||
"description": "Cryptographic functions for ethereum and how to use them with web3 and solidity", | ||
@@ -52,12 +52,12 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "7.16.8", | ||
"@babel/core": "7.16.12", | ||
"@babel/plugin-transform-runtime": "7.16.10", | ||
"@babel/cli": "7.17.6", | ||
"@babel/core": "7.17.9", | ||
"@babel/plugin-transform-runtime": "7.17.0", | ||
"@babel/preset-env": "7.16.11", | ||
"assert": "2.0.0", | ||
"async-test-util": "2.0.0", | ||
"babel-loader": "8.2.3", | ||
"babel-loader": "8.2.5", | ||
"bn.js": "5.2.0", | ||
"browserify": "17.0.0", | ||
"concurrently": "7.0.0", | ||
"concurrently": "7.1.0", | ||
"convert-hrtime": "5.0.0", | ||
@@ -72,7 +72,7 @@ "cross-env": "7.0.3", | ||
"js-sha3": "0.8.0", | ||
"karma": "6.3.13", | ||
"karma-babel-preprocessor": "8.0.1", | ||
"karma": "6.3.19", | ||
"karma-babel-preprocessor": "8.0.2", | ||
"karma-browserify": "8.1.0", | ||
"karma-chrome-launcher": "3.1.0", | ||
"karma-coverage": "2.1.0", | ||
"karma-chrome-launcher": "3.1.1", | ||
"karma-coverage": "2.2.0", | ||
"karma-detect-browsers": "2.3.3", | ||
@@ -85,11 +85,11 @@ "karma-edge-launcher": "0.4.2", | ||
"karma-safari-launcher": "1.0.0", | ||
"mocha": "9.2.0", | ||
"mocha": "9.2.2", | ||
"rimraf": "3.0.2", | ||
"solhint": "3.3.6", | ||
"solhint": "3.3.7", | ||
"solidity-cli": "1.0.3", | ||
"terser-webpack-plugin": "4.2.3", | ||
"ts-node": "10.4.0", | ||
"typescript": "4.5.5", | ||
"ts-node": "10.7.0", | ||
"typescript": "4.6.3", | ||
"uglify-es": "3.3.9", | ||
"web3": "1.7.0", | ||
"web3": "1.7.3", | ||
"webpack": "4.41.5", | ||
@@ -100,10 +100,10 @@ "webpack-bundle-analyzer": "4.5.0", | ||
"dependencies": { | ||
"@babel/runtime": "7.16.7", | ||
"@ethereumjs/tx": "3.4.0", | ||
"@babel/runtime": "7.17.9", | ||
"@ethereumjs/tx": "3.5.1", | ||
"@types/bn.js": "5.1.0", | ||
"eccrypto": "1.1.6", | ||
"ethereumjs-util": "7.1.3", | ||
"ethers": "5.5.4", | ||
"ethereumjs-util": "7.1.4", | ||
"ethers": "5.6.4", | ||
"secp256k1": "4.0.3" | ||
} | ||
} |
@@ -8,3 +8,3 @@ import { | ||
export default function encryptWithPublicKey(publicKey, message) { | ||
export default function encryptWithPublicKey(publicKey, message, opts) { | ||
@@ -20,3 +20,4 @@ // ensure its an uncompressed publicKey | ||
Buffer.from(pubString, 'hex'), | ||
Buffer.from(message) | ||
Buffer.from(message), | ||
opts ? opts : {} | ||
).then(encryptedBuffers => { | ||
@@ -23,0 +24,0 @@ const encrypted = { |
@@ -59,3 +59,7 @@ import BigNumber from 'bn.js'; | ||
type encryptWithPublicKeyType = (publicKey: string, message: string) => Promise<Encrypted>; | ||
export type EncryptOptions = { | ||
iv?: Buffer, | ||
ephemPrivateKey?: Buffer | ||
}; | ||
type encryptWithPublicKeyType = (publicKey: string, message: string, options?: EncryptOptions) => Promise<Encrypted>; | ||
export const encryptWithPublicKey: encryptWithPublicKeyType; | ||
@@ -62,0 +66,0 @@ |
Sorry, the diff of this file is not supported yet
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
71027
1385
+ Added@babel/runtime@7.17.9(transitive)
+ Added@ethereumjs/tx@3.5.1(transitive)
+ Added@ethersproject/abi@5.6.1(transitive)
+ Added@ethersproject/abstract-provider@5.6.0(transitive)
+ Added@ethersproject/abstract-signer@5.6.0(transitive)
+ Added@ethersproject/address@5.6.0(transitive)
+ Added@ethersproject/base64@5.6.0(transitive)
+ Added@ethersproject/basex@5.6.0(transitive)
+ Added@ethersproject/bignumber@5.6.0(transitive)
+ Added@ethersproject/bytes@5.6.1(transitive)
+ Added@ethersproject/constants@5.6.0(transitive)
+ Added@ethersproject/contracts@5.6.0(transitive)
+ Added@ethersproject/hash@5.6.0(transitive)
+ Added@ethersproject/hdnode@5.6.0(transitive)
+ Added@ethersproject/json-wallets@5.6.0(transitive)
+ Added@ethersproject/keccak256@5.6.0(transitive)
+ Added@ethersproject/logger@5.6.0(transitive)
+ Added@ethersproject/networks@5.6.2(transitive)
+ Added@ethersproject/pbkdf2@5.6.0(transitive)
+ Added@ethersproject/properties@5.6.0(transitive)
+ Added@ethersproject/providers@5.6.4(transitive)
+ Added@ethersproject/random@5.6.0(transitive)
+ Added@ethersproject/rlp@5.6.0(transitive)
+ Added@ethersproject/sha2@5.6.0(transitive)
+ Added@ethersproject/signing-key@5.6.0(transitive)
+ Added@ethersproject/solidity@5.6.0(transitive)
+ Added@ethersproject/strings@5.6.0(transitive)
+ Added@ethersproject/transactions@5.6.0(transitive)
+ Added@ethersproject/units@5.6.0(transitive)
+ Added@ethersproject/wallet@5.6.0(transitive)
+ Added@ethersproject/web@5.6.0(transitive)
+ Added@ethersproject/wordlists@5.6.0(transitive)
+ Addedethereumjs-util@7.1.4(transitive)
+ Addedethers@5.6.4(transitive)
- Removed@babel/runtime@7.16.7(transitive)
- Removed@ethereumjs/tx@3.4.0(transitive)
- Removed@ethersproject/abi@5.5.0(transitive)
- Removed@ethersproject/abstract-provider@5.5.1(transitive)
- Removed@ethersproject/abstract-signer@5.5.0(transitive)
- Removed@ethersproject/address@5.5.0(transitive)
- Removed@ethersproject/base64@5.5.0(transitive)
- Removed@ethersproject/basex@5.5.0(transitive)
- Removed@ethersproject/bignumber@5.5.0(transitive)
- Removed@ethersproject/bytes@5.5.0(transitive)
- Removed@ethersproject/constants@5.5.0(transitive)
- Removed@ethersproject/contracts@5.5.0(transitive)
- Removed@ethersproject/hash@5.5.0(transitive)
- Removed@ethersproject/hdnode@5.5.0(transitive)
- Removed@ethersproject/json-wallets@5.5.0(transitive)
- Removed@ethersproject/keccak256@5.5.0(transitive)
- Removed@ethersproject/logger@5.5.0(transitive)
- Removed@ethersproject/networks@5.5.2(transitive)
- Removed@ethersproject/pbkdf2@5.5.0(transitive)
- Removed@ethersproject/properties@5.5.0(transitive)
- Removed@ethersproject/providers@5.5.3(transitive)
- Removed@ethersproject/random@5.5.1(transitive)
- Removed@ethersproject/rlp@5.5.0(transitive)
- Removed@ethersproject/sha2@5.5.0(transitive)
- Removed@ethersproject/signing-key@5.5.0(transitive)
- Removed@ethersproject/solidity@5.5.0(transitive)
- Removed@ethersproject/strings@5.5.0(transitive)
- Removed@ethersproject/transactions@5.5.0(transitive)
- Removed@ethersproject/units@5.5.0(transitive)
- Removed@ethersproject/wallet@5.5.0(transitive)
- Removed@ethersproject/web@5.5.1(transitive)
- Removed@ethersproject/wordlists@5.5.0(transitive)
- Removedethereumjs-util@7.1.3(transitive)
- Removedethers@5.5.4(transitive)
Updated@babel/runtime@7.17.9
Updated@ethereumjs/tx@3.5.1
Updatedethereumjs-util@7.1.4
Updatedethers@5.6.4