Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 98a1409

Browse files
authored
Merge pull request #108 from dmihal/use-scrypt-shim
Change scrypt.js to scrypt-shim
2 parents ac90675 + 3942d99 commit 98a1409

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@
4343
},
4444
"homepage": "https://github.com/ethereumjs/ethereumjs-wallet",
4545
"dependencies": {
46+
"@web3-js/scrypt-shim": "^0.1.0",
4647
"aes-js": "^3.1.1",
4748
"bs58check": "^2.1.2",
4849
"ethereumjs-util": "^6.0.0",
4950
"hdkey": "^1.1.1",
5051
"randombytes": "^2.0.6",
51-
"scrypt.js": "^0.3.0",
5252
"utf8": "^3.0.0",
5353
"uuid": "^3.3.2"
5454
},
@@ -58,9 +58,9 @@
5858
"@ethereumjs/config-tsc": "^1.1.1",
5959
"@ethereumjs/config-tslint": "^1.1.1",
6060
"@types/bn.js": "^4.11.5",
61+
"@types/lodash.zip": "^4.2.6",
6162
"@types/mocha": "^5.2.7",
6263
"@types/node": "^12.0.10",
63-
"@types/lodash.zip": "^4.2.6",
6464
"coveralls": "^3.0.0",
6565
"ethers": "^4.0.33",
6666
"husky": "^2.1.0",

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ethUtil from 'ethereumjs-util'
33

44
const bs58check = require('bs58check')
55
const randomBytes = require('randombytes')
6-
const scryptsy = require('scrypt.js')
6+
const scryptsy = require('@web3-js/scrypt-shim')
77
const uuidv4 = require('uuid/v4')
88

99
// parameters for the toV3() method

src/thirdparty.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import * as ethUtil from 'ethereumjs-util'
33

44
import Wallet from './index'
55

6-
const scryptsy = require('scrypt.js')
6+
const scryptsy = require('@web3-js/scrypt-shim')
77
const utf8 = require('utf8')
88
const aesjs = require('aes-js')
99

test/index.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,14 @@ describe('.toV3()', function() {
297297
p: p,
298298
})
299299

300-
const encFixtureEthersWallet = (await fixtureEthersWallet.encrypt(pw, {
301-
scrypt: { N: n, r: r, p: p },
302-
salt: ethersOpts.salt,
303-
iv: ethersOpts.iv,
304-
uuid: ethersOpts.uuid,
305-
})).toLowerCase()
300+
const encFixtureEthersWallet = (
301+
await fixtureEthersWallet.encrypt(pw, {
302+
scrypt: { N: n, r: r, p: p },
303+
salt: ethersOpts.salt,
304+
iv: ethersOpts.iv,
305+
uuid: ethersOpts.uuid,
306+
})
307+
).toLowerCase()
306308

307309
const encRandomWallet = wRandom.toV3String(pw, {
308310
kdf: 'scrypt',
@@ -314,12 +316,14 @@ describe('.toV3()', function() {
314316
p: p,
315317
})
316318

317-
const encEthersWallet = (await wEthers.encrypt(pw, {
318-
scrypt: { N: n, r: r, p: p },
319-
salt: ethersOpts.salt,
320-
iv: ethersOpts.iv,
321-
uuid: ethersOpts.uuid,
322-
})).toLowerCase()
319+
const encEthersWallet = (
320+
await wEthers.encrypt(pw, {
321+
scrypt: { N: n, r: r, p: p },
322+
salt: ethersOpts.salt,
323+
iv: ethersOpts.iv,
324+
uuid: ethersOpts.uuid,
325+
})
326+
).toLowerCase()
323327

324328
assert.deepStrictEqual(JSON.parse(wStatic), JSON.parse(encFixtureWallet))
325329
assert.deepStrictEqual(JSON.parse(wStatic), JSON.parse(encFixtureEthersWallet))

0 commit comments

Comments
 (0)