Socket
Socket
Sign inDemoInstall

eth-crypto

Package Overview
Dependencies
Maintainers
1
Versions
38
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eth-crypto - npm Package Compare versions

Comparing version 2.2.0 to 2.3.0

4

dist/es/encrypt-with-public-key.js
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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc