Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@endpass/utils

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@endpass/utils - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

constants.js

21

keystore.js

@@ -5,2 +5,3 @@ 'use strict';

var constants = require('./constants.js');
var keythereum = _interopDefault(require('keythereum'));

@@ -24,9 +25,13 @@ var bs58check = _interopDefault(require('bs58check'));

encrypt: function encrypt(password, privateKey) {
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : constants.KDF_ENCRYPT_OPTIONS;
// Generate random salt and iv for each encryption
var dk = keythereum.create();
var options = {
kdf: ENV.kdfParams.kdf,
kdfparams: ENV.kdfParams
var dumpOptions = {
kdf: options.kdf,
kdfparams: {
kdf: options.kdf,
n: options.n
}
};
var encrypted = keythereum.dump(password, privateKey, dk.salt, dk.iv, options);
var encrypted = keythereum.dump(password, privateKey, dk.salt, dk.iv, dumpOptions);
delete encrypted.address;

@@ -48,4 +53,4 @@ return encrypted;

// Encrypts an ethereumjs Wallet
encryptWallet: function encryptWallet(password, wallet) {
var json = this.encrypt(password, wallet.getPrivateKey());
encryptWallet: function encryptWallet(password, wallet, encryptOptions) {
var json = this.encrypt(password, wallet.getPrivateKey(), encryptOptions);
json.address = wallet.getChecksumAddressString();

@@ -60,5 +65,5 @@ return json;

// Encrypts an ethereumjs Wallet
encryptHDWallet: function encryptHDWallet(password, wallet) {
encryptHDWallet: function encryptHDWallet(password, wallet, encryptOptions) {
var xPrv = this.decodeBase58(wallet.privateExtendedKey());
var json = this.encrypt(password, xPrv);
var json = this.encrypt(password, xPrv, encryptOptions);
json.address = wallet.publicExtendedKey();

@@ -65,0 +70,0 @@ return json;

{
"name": "@endpass/utils",
"version": "1.1.1",
"version": "1.1.2",
"description": "Utils and helper functions",

@@ -47,4 +47,3 @@ "author": "Endpass, Inc",

"access": "public"
},
"gitHead": "8e5e46a50c6e2954980dc8f0f90974b797c0e08b"
}
}

@@ -5,2 +5,3 @@ import keythereum from 'keythereum';

import HDKey from 'ethereumjs-wallet/hdkey';
import { KDF_ENCRYPT_OPTIONS } from './constants';

@@ -19,9 +20,14 @@ // Monkey patch keythereum to skip generating address for private keys

// The exported keystore does NOT include an address
encrypt(password, privateKey) {
encrypt(password, privateKey, options = KDF_ENCRYPT_OPTIONS) {
// Generate random salt and iv for each encryption
const dk = keythereum.create();
const options = {
kdf: ENV.kdfParams.kdf,
kdfparams: ENV.kdfParams,
const dumpOptions = {
kdf: options.kdf,
kdfparams: {
kdf: options.kdf,
n: options.n,
},
};
const encrypted = keythereum.dump(

@@ -32,3 +38,3 @@ password,

dk.iv,
options,
dumpOptions,
);

@@ -55,4 +61,4 @@

// Encrypts an ethereumjs Wallet
encryptWallet(password, wallet) {
const json = this.encrypt(password, wallet.getPrivateKey());
encryptWallet(password, wallet, encryptOptions) {
const json = this.encrypt(password, wallet.getPrivateKey(), encryptOptions);

@@ -72,5 +78,5 @@ json.address = wallet.getChecksumAddressString();

// Encrypts an ethereumjs Wallet
encryptHDWallet(password, wallet) {
encryptHDWallet(password, wallet, encryptOptions) {
const xPrv = this.decodeBase58(wallet.privateExtendedKey());
const json = this.encrypt(password, xPrv);
const json = this.encrypt(password, xPrv, encryptOptions);

@@ -77,0 +83,0 @@ json.address = wallet.publicExtendedKey();

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc