eth-crypto
Advanced tools
Comparing version 2.5.0 to 2.6.0
import { generateAddress, toChecksumAddress, toBuffer } from 'ethereumjs-util'; | ||
import { addLeading0x } from './util'; | ||
export default function calculateContractAddress(creatorAddress, nonce) { | ||
export function calculateContractAddress(creatorAddress, nonce) { | ||
var addressBuffer = generateAddress(toBuffer(addLeading0x(creatorAddress)), toBuffer(nonce)); | ||
@@ -5,0 +5,0 @@ var address = addressBuffer.toString('hex'); |
@@ -30,3 +30,3 @@ import { utils as ethersUtils, Wallet } from 'ethers'; | ||
*/ | ||
export default function createIdentity(entropy) { | ||
export function createIdentity(entropy) { | ||
var privateKey = createPrivateKey(entropy); | ||
@@ -33,0 +33,0 @@ var wallet = new Wallet(privateKey); |
import { decrypt } from 'eccrypto'; | ||
import { parse } from './cipher'; | ||
import { removeLeading0x } from './util'; | ||
export default function decryptWithPrivateKey(privateKey, encrypted) { | ||
export function decryptWithPrivateKey(privateKey, encrypted) { | ||
encrypted = parse(encrypted); | ||
@@ -6,0 +6,0 @@ |
import { encrypt } from 'eccrypto'; | ||
import { decompress } from './public-key'; | ||
export default function encryptWithPublicKey(publicKey, message, opts) { | ||
export function encryptWithPublicKey(publicKey, message, opts) { | ||
// ensure its an uncompressed publicKey | ||
@@ -5,0 +5,0 @@ publicKey = decompress(publicKey); |
@@ -1,13 +0,13 @@ | ||
import createIdentity from './create-identity'; | ||
import { createIdentity } from './create-identity'; | ||
import * as publicKey from './public-key'; | ||
import decryptWithPrivateKey from './decrypt-with-private-key'; | ||
import encryptWithPublicKey from './encrypt-with-public-key'; | ||
import { decryptWithPrivateKey } from './decrypt-with-private-key'; | ||
import { encryptWithPublicKey } from './encrypt-with-public-key'; | ||
import * as cipher from './cipher'; | ||
import publicKeyByPrivateKey from './public-key-by-private-key'; | ||
import recover from './recover'; | ||
import recoverPublicKey from './recover-public-key'; | ||
import sign from './sign'; | ||
import signTransaction from './sign-transaction'; | ||
import txDataByCompiled from './tx-data-by-compiled'; | ||
import calculateContractAddress from './calculate-contract-address'; | ||
import { publicKeyByPrivateKey } from './public-key-by-private-key'; | ||
import { recover } from './recover'; | ||
import { recoverPublicKey } from './recover-public-key'; | ||
import { sign } from './sign'; | ||
import { signTransaction } from './sign-transaction'; | ||
import { txDataByCompiled } from './tx-data-by-compiled'; | ||
import { calculateContractAddress } from './calculate-contract-address'; | ||
import * as hash from './hash'; | ||
@@ -14,0 +14,0 @@ import * as hex from './hex'; |
@@ -10,3 +10,3 @@ import { privateToPublic, toBuffer } from 'ethereumjs-util'; | ||
*/ | ||
export default function publicKeyOfPrivateKey(privateKey) { | ||
export function publicKeyByPrivateKey(privateKey) { | ||
privateKey = addLeading0x(privateKey); | ||
@@ -13,0 +13,0 @@ var publicKeyBuffer = privateToPublic(toBuffer(privateKey)); |
@@ -10,3 +10,3 @@ import { ecdsaRecover } from 'secp256k1'; | ||
*/ | ||
export default function recoverPublicKey(signature, hash) { | ||
export function recoverPublicKey(signature, hash) { | ||
signature = removeLeading0x(signature); | ||
@@ -13,0 +13,0 @@ |
@@ -1,2 +0,2 @@ | ||
import recoverPublicKey from './recover-public-key'; | ||
import { recoverPublicKey } from './recover-public-key'; | ||
import { toAddress as addressByPublicKey } from './public-key'; | ||
@@ -10,3 +10,3 @@ | ||
*/ | ||
export default function recover(sigString, hash) { | ||
export function recover(sigString, hash) { | ||
var pubkey = recoverPublicKey(sigString, hash); | ||
@@ -13,0 +13,0 @@ var address = addressByPublicKey(pubkey); |
import { Transaction } from '@ethereumjs/tx'; | ||
import publicKeyByPrivateKey from './public-key-by-private-key'; | ||
import { publicKeyByPrivateKey } from './public-key-by-private-key'; | ||
import { toAddress as addressByPublicKey } from './public-key'; | ||
export default function signTransaction(rawTx, privateKey) { | ||
export function signTransaction(rawTx, privateKey) { | ||
var txOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; | ||
@@ -6,0 +6,0 @@ // check if privateKey->address matches rawTx.from |
@@ -11,3 +11,3 @@ import { ecdsaSign as secp256k1_sign } from 'secp256k1'; | ||
*/ | ||
export default function sign(privateKey, hash) { | ||
export function sign(privateKey, hash) { | ||
hash = addLeading0x(hash); | ||
@@ -14,0 +14,0 @@ if (hash.length !== 66) throw new Error('EthCrypto.sign(): Can only sign hashes, given: ' + hash); |
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray"; | ||
import { ContractFactory } from 'ethers'; | ||
export default function txDataByCompiled(abi, bytecode, args) { | ||
export function txDataByCompiled(abi, bytecode, args) { | ||
// solc returns a string which is often passed instead of the json | ||
@@ -5,0 +5,0 @@ if (typeof abi === 'string') abi = JSON.parse(abi); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = calculateContractAddress; | ||
exports.calculateContractAddress = calculateContractAddress; | ||
var _ethereumjsUtil = require("ethereumjs-util"); | ||
@@ -9,0 +9,0 @@ var _util = require("./util"); |
@@ -6,4 +6,4 @@ "use strict"; | ||
}); | ||
exports.createIdentity = createIdentity; | ||
exports.createPrivateKey = createPrivateKey; | ||
exports["default"] = createIdentity; | ||
var _ethers = require("ethers"); | ||
@@ -10,0 +10,0 @@ var _ethereumjsUtil = require("ethereumjs-util"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = decryptWithPrivateKey; | ||
exports.decryptWithPrivateKey = decryptWithPrivateKey; | ||
var _eccrypto = require("eccrypto"); | ||
@@ -9,0 +9,0 @@ var _cipher = require("./cipher"); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = encryptWithPublicKey; | ||
exports.encryptWithPublicKey = encryptWithPublicKey; | ||
var _eccrypto = require("eccrypto"); | ||
@@ -9,0 +9,0 @@ var _publicKey = require("./public-key"); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
var _typeof = require("@babel/runtime/helpers/typeof"); | ||
@@ -11,3 +10,3 @@ Object.defineProperty(exports, "__esModule", { | ||
get: function get() { | ||
return _calculateContractAddress["default"]; | ||
return _calculateContractAddress.calculateContractAddress; | ||
} | ||
@@ -19,3 +18,3 @@ }); | ||
get: function get() { | ||
return _createIdentity["default"]; | ||
return _createIdentity.createIdentity; | ||
} | ||
@@ -26,3 +25,3 @@ }); | ||
get: function get() { | ||
return _decryptWithPrivateKey["default"]; | ||
return _decryptWithPrivateKey.decryptWithPrivateKey; | ||
} | ||
@@ -34,3 +33,3 @@ }); | ||
get: function get() { | ||
return _encryptWithPublicKey["default"]; | ||
return _encryptWithPublicKey.encryptWithPublicKey; | ||
} | ||
@@ -42,3 +41,3 @@ }); | ||
get: function get() { | ||
return _publicKeyByPrivateKey["default"]; | ||
return _publicKeyByPrivateKey.publicKeyByPrivateKey; | ||
} | ||
@@ -49,3 +48,3 @@ }); | ||
get: function get() { | ||
return _recover["default"]; | ||
return _recover.recover; | ||
} | ||
@@ -56,3 +55,3 @@ }); | ||
get: function get() { | ||
return _recoverPublicKey["default"]; | ||
return _recoverPublicKey.recoverPublicKey; | ||
} | ||
@@ -63,3 +62,3 @@ }); | ||
get: function get() { | ||
return _sign["default"]; | ||
return _sign.sign; | ||
} | ||
@@ -70,3 +69,3 @@ }); | ||
get: function get() { | ||
return _signTransaction["default"]; | ||
return _signTransaction.signTransaction; | ||
} | ||
@@ -77,20 +76,20 @@ }); | ||
get: function get() { | ||
return _txDataByCompiled["default"]; | ||
return _txDataByCompiled.txDataByCompiled; | ||
} | ||
}); | ||
exports.vrs = exports.util = void 0; | ||
var _createIdentity = _interopRequireDefault(require("./create-identity")); | ||
var _createIdentity = require("./create-identity"); | ||
var publicKey = _interopRequireWildcard(require("./public-key")); | ||
exports.publicKey = publicKey; | ||
var _decryptWithPrivateKey = _interopRequireDefault(require("./decrypt-with-private-key")); | ||
var _encryptWithPublicKey = _interopRequireDefault(require("./encrypt-with-public-key")); | ||
var _decryptWithPrivateKey = require("./decrypt-with-private-key"); | ||
var _encryptWithPublicKey = require("./encrypt-with-public-key"); | ||
var cipher = _interopRequireWildcard(require("./cipher")); | ||
exports.cipher = cipher; | ||
var _publicKeyByPrivateKey = _interopRequireDefault(require("./public-key-by-private-key")); | ||
var _recover = _interopRequireDefault(require("./recover")); | ||
var _recoverPublicKey = _interopRequireDefault(require("./recover-public-key")); | ||
var _sign = _interopRequireDefault(require("./sign")); | ||
var _signTransaction = _interopRequireDefault(require("./sign-transaction")); | ||
var _txDataByCompiled = _interopRequireDefault(require("./tx-data-by-compiled")); | ||
var _calculateContractAddress = _interopRequireDefault(require("./calculate-contract-address")); | ||
var _publicKeyByPrivateKey = require("./public-key-by-private-key"); | ||
var _recover = require("./recover"); | ||
var _recoverPublicKey = require("./recover-public-key"); | ||
var _sign = require("./sign"); | ||
var _signTransaction = require("./sign-transaction"); | ||
var _txDataByCompiled = require("./tx-data-by-compiled"); | ||
var _calculateContractAddress = require("./calculate-contract-address"); | ||
var hash = _interopRequireWildcard(require("./hash")); | ||
@@ -107,14 +106,14 @@ exports.hash = hash; | ||
var _default = { | ||
createIdentity: _createIdentity["default"], | ||
createIdentity: _createIdentity.createIdentity, | ||
publicKey: publicKey, | ||
decryptWithPrivateKey: _decryptWithPrivateKey["default"], | ||
encryptWithPublicKey: _encryptWithPublicKey["default"], | ||
decryptWithPrivateKey: _decryptWithPrivateKey.decryptWithPrivateKey, | ||
encryptWithPublicKey: _encryptWithPublicKey.encryptWithPublicKey, | ||
cipher: cipher, | ||
publicKeyByPrivateKey: _publicKeyByPrivateKey["default"], | ||
recover: _recover["default"], | ||
recoverPublicKey: _recoverPublicKey["default"], | ||
sign: _sign["default"], | ||
signTransaction: _signTransaction["default"], | ||
txDataByCompiled: _txDataByCompiled["default"], | ||
calculateContractAddress: _calculateContractAddress["default"], | ||
publicKeyByPrivateKey: _publicKeyByPrivateKey.publicKeyByPrivateKey, | ||
recover: _recover.recover, | ||
recoverPublicKey: _recoverPublicKey.recoverPublicKey, | ||
sign: _sign.sign, | ||
signTransaction: _signTransaction.signTransaction, | ||
txDataByCompiled: _txDataByCompiled.txDataByCompiled, | ||
calculateContractAddress: _calculateContractAddress.calculateContractAddress, | ||
hash: hash, | ||
@@ -121,0 +120,0 @@ hex: hex, |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = publicKeyOfPrivateKey; | ||
exports.publicKeyByPrivateKey = publicKeyByPrivateKey; | ||
var _ethereumjsUtil = require("ethereumjs-util"); | ||
@@ -16,3 +16,3 @@ var _util = require("./util"); | ||
*/ | ||
function publicKeyOfPrivateKey(privateKey) { | ||
function publicKeyByPrivateKey(privateKey) { | ||
privateKey = (0, _util.addLeading0x)(privateKey); | ||
@@ -19,0 +19,0 @@ var publicKeyBuffer = (0, _ethereumjsUtil.privateToPublic)((0, _ethereumjsUtil.toBuffer)(privateKey)); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = recoverPublicKey; | ||
exports.recoverPublicKey = recoverPublicKey; | ||
var _secp256k = require("secp256k1"); | ||
@@ -9,0 +9,0 @@ var _util = require("./util"); |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = recover; | ||
var _recoverPublicKey = _interopRequireDefault(require("./recover-public-key")); | ||
exports.recover = recover; | ||
var _recoverPublicKey = require("./recover-public-key"); | ||
var _publicKey = require("./public-key"); | ||
@@ -17,5 +16,5 @@ /** | ||
function recover(sigString, hash) { | ||
var pubkey = (0, _recoverPublicKey["default"])(sigString, hash); | ||
var pubkey = (0, _recoverPublicKey.recoverPublicKey)(sigString, hash); | ||
var address = (0, _publicKey.toAddress)(pubkey); | ||
return address; | ||
} |
"use strict"; | ||
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); | ||
Object.defineProperty(exports, "__esModule", { | ||
value: true | ||
}); | ||
exports["default"] = signTransaction; | ||
exports.signTransaction = signTransaction; | ||
var _tx = require("@ethereumjs/tx"); | ||
var _publicKeyByPrivateKey = _interopRequireDefault(require("./public-key-by-private-key")); | ||
var _publicKeyByPrivateKey = require("./public-key-by-private-key"); | ||
var _publicKey = require("./public-key"); | ||
@@ -14,3 +13,3 @@ function signTransaction(rawTx, privateKey) { | ||
// check if privateKey->address matches rawTx.from | ||
var publicKey = (0, _publicKeyByPrivateKey["default"])(privateKey); | ||
var publicKey = (0, _publicKeyByPrivateKey.publicKeyByPrivateKey)(privateKey); | ||
var address = (0, _publicKey.toAddress)(publicKey); | ||
@@ -17,0 +16,0 @@ if (address != rawTx.from) throw new Error('EthCrypto.signTransaction(): rawTx.from does not match the address of the privateKey'); |
@@ -6,3 +6,3 @@ "use strict"; | ||
}); | ||
exports["default"] = sign; | ||
exports.sign = sign; | ||
var _secp256k = require("secp256k1"); | ||
@@ -9,0 +9,0 @@ var _util = require("./util"); |
@@ -7,3 +7,3 @@ "use strict"; | ||
}); | ||
exports["default"] = txDataByCompiled; | ||
exports.txDataByCompiled = txDataByCompiled; | ||
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); | ||
@@ -10,0 +10,0 @@ var _ethers = require("ethers"); |
{ | ||
"name": "eth-crypto", | ||
"version": "2.5.0", | ||
"version": "2.6.0", | ||
"description": "Cryptographic functions for ethereum and how to use them with web3 and solidity", | ||
@@ -53,4 +53,4 @@ "keywords": [ | ||
"devDependencies": { | ||
"@babel/cli": "7.19.3", | ||
"@babel/core": "7.20.5", | ||
"@babel/cli": "7.20.7", | ||
"@babel/core": "7.20.12", | ||
"@babel/plugin-transform-runtime": "7.19.6", | ||
@@ -60,3 +60,3 @@ "@babel/preset-env": "7.20.2", | ||
"async-test-util": "2.0.0", | ||
"babel-loader": "9.1.0", | ||
"babel-loader": "9.1.2", | ||
"bn.js": "5.2.1", | ||
@@ -88,15 +88,17 @@ "browserify": "17.0.0", | ||
"rimraf": "3.0.2", | ||
"solhint": "3.3.7", | ||
"solhint": "3.4.0", | ||
"solidity-cli": "1.0.3", | ||
"terser-webpack-plugin": "4.2.3", | ||
"terser-webpack-plugin": "5.3.6", | ||
"ts-node": "10.9.1", | ||
"typescript": "4.9.3", | ||
"typescript": "4.9.5", | ||
"uglify-es": "3.3.9", | ||
"web3": "1.8.1", | ||
"webpack": "4.41.5", | ||
"webpack-bundle-analyzer": "4.7.0", | ||
"webpack-cli": "4.10.0" | ||
"web3": "1.8.2", | ||
"webpack": "5.75.0", | ||
"webpack-bundle-analyzer": "4.8.0", | ||
"webpack-cli": "5.0.1", | ||
"stream-browserify": "3.0.0", | ||
"crypto-browserify": "3.12.0" | ||
}, | ||
"dependencies": { | ||
"@babel/runtime": "7.20.6", | ||
"@babel/runtime": "7.20.13", | ||
"@ethereumjs/tx": "3.5.2", | ||
@@ -107,4 +109,4 @@ "@types/bn.js": "5.1.1", | ||
"ethers": "5.7.2", | ||
"secp256k1": "4.0.3" | ||
"secp256k1": "5.0.0" | ||
} | ||
} |
@@ -31,4 +31,4 @@ <p align="center"> | ||
<img | ||
src="https://github.com/pubkey/rxdb/raw/master/docs-src/files/logo/logo_text.svg" | ||
alt="Sponsored by RxDB" | ||
src="https://rxdb.info/files/logo/logo_text.svg" | ||
alt="JavaScript Database" | ||
width="300" | ||
@@ -35,0 +35,0 @@ /> |
@@ -11,3 +11,3 @@ import { | ||
export default function calculateContractAddress( | ||
export function calculateContractAddress( | ||
creatorAddress, | ||
@@ -14,0 +14,0 @@ nonce |
@@ -34,3 +34,3 @@ import { utils as ethersUtils, Wallet } from 'ethers'; | ||
*/ | ||
export default function createIdentity(entropy) { | ||
export function createIdentity(entropy) { | ||
const privateKey = createPrivateKey(entropy); | ||
@@ -37,0 +37,0 @@ const wallet = new Wallet(privateKey); |
@@ -11,3 +11,3 @@ import { | ||
export default function decryptWithPrivateKey(privateKey, encrypted) { | ||
export function decryptWithPrivateKey(privateKey, encrypted) { | ||
@@ -14,0 +14,0 @@ encrypted = parse(encrypted); |
@@ -8,3 +8,3 @@ import { | ||
export default function encryptWithPublicKey(publicKey, message, opts) { | ||
export function encryptWithPublicKey(publicKey, message, opts) { | ||
@@ -11,0 +11,0 @@ // ensure its an uncompressed publicKey |
import createIdentity from './create-identity'; | ||
import { createIdentity } from './create-identity'; | ||
import * as publicKey from './public-key'; | ||
import decryptWithPrivateKey from './decrypt-with-private-key'; | ||
import encryptWithPublicKey from './encrypt-with-public-key'; | ||
import { decryptWithPrivateKey } from './decrypt-with-private-key'; | ||
import { encryptWithPublicKey } from './encrypt-with-public-key'; | ||
import * as cipher from './cipher'; | ||
import publicKeyByPrivateKey from './public-key-by-private-key'; | ||
import recover from './recover'; | ||
import recoverPublicKey from './recover-public-key'; | ||
import sign from './sign'; | ||
import signTransaction from './sign-transaction'; | ||
import txDataByCompiled from './tx-data-by-compiled'; | ||
import calculateContractAddress from './calculate-contract-address'; | ||
import { publicKeyByPrivateKey } from './public-key-by-private-key'; | ||
import { recover } from './recover'; | ||
import { recoverPublicKey } from './recover-public-key'; | ||
import { sign } from './sign'; | ||
import { signTransaction } from './sign-transaction'; | ||
import { txDataByCompiled } from './tx-data-by-compiled'; | ||
import { calculateContractAddress } from './calculate-contract-address'; | ||
import * as hash from './hash'; | ||
@@ -15,0 +15,0 @@ import * as hex from './hex'; |
@@ -15,3 +15,3 @@ import { | ||
*/ | ||
export default function publicKeyOfPrivateKey(privateKey) { | ||
export function publicKeyByPrivateKey(privateKey) { | ||
privateKey = addLeading0x(privateKey); | ||
@@ -18,0 +18,0 @@ const publicKeyBuffer = privateToPublic(toBuffer(privateKey)); |
@@ -17,3 +17,3 @@ import { | ||
*/ | ||
export default function recoverPublicKey(signature, hash) { | ||
export function recoverPublicKey(signature, hash) { | ||
signature = removeLeading0x(signature); | ||
@@ -20,0 +20,0 @@ |
@@ -1,2 +0,2 @@ | ||
import recoverPublicKey from './recover-public-key'; | ||
import { recoverPublicKey } from './recover-public-key'; | ||
import { | ||
@@ -12,3 +12,3 @@ toAddress as addressByPublicKey | ||
*/ | ||
export default function recover(sigString, hash) { | ||
export function recover(sigString, hash) { | ||
const pubkey = recoverPublicKey(sigString, hash); | ||
@@ -15,0 +15,0 @@ const address = addressByPublicKey(pubkey); |
import { Transaction } from '@ethereumjs/tx'; | ||
import publicKeyByPrivateKey from './public-key-by-private-key'; | ||
import { publicKeyByPrivateKey } from './public-key-by-private-key'; | ||
import { | ||
@@ -8,3 +8,3 @@ toAddress as addressByPublicKey | ||
export default function signTransaction( | ||
export function signTransaction( | ||
rawTx, | ||
@@ -11,0 +11,0 @@ privateKey, |
@@ -16,3 +16,3 @@ import { | ||
*/ | ||
export default function sign(privateKey, hash) { | ||
export function sign(privateKey, hash) { | ||
hash = addLeading0x(hash); | ||
@@ -19,0 +19,0 @@ if (hash.length !== 66) |
import { ContractFactory } from 'ethers'; | ||
export default function txDataByCompiled( | ||
export function txDataByCompiled( | ||
abi, | ||
@@ -5,0 +5,0 @@ bytecode, |
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
62
71074
45
1406
+ Added@babel/runtime@7.20.13(transitive)
+ Addednode-addon-api@5.1.0(transitive)
+ Addedsecp256k1@5.0.0(transitive)
- Removed@babel/runtime@7.20.6(transitive)
Updated@babel/runtime@7.20.13
Updatedsecp256k1@5.0.0