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

Commit 9a6aceb

Browse files
committed
A password is mandatory in both .fromV1() and .fromV3()
1 parent 9e9fd6c commit 9a6aceb

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ Wallet.fromPrivateKey = function (priv) {
143143

144144
// https://github.com/ethereum/go-ethereum/wiki/Passphrase-protected-key-store-spec
145145
Wallet.fromV1 = function (input, password) {
146+
assert(typeof password === 'string')
146147
var json = (typeof input === 'object') ? input : JSON.parse(input)
147148

148149
if (json.Version !== '1') {
@@ -173,6 +174,7 @@ Wallet.fromV1 = function (input, password) {
173174
}
174175

175176
Wallet.fromV3 = function (input, password, nonStrict) {
177+
assert(typeof password === 'string')
176178
var json = (typeof input === 'object') ? input : JSON.parse(nonStrict ? input.toLowerCase() : input)
177179

178180
if (json.version !== 3) {

0 commit comments

Comments
 (0)