diff --git a/packages/caver-klay/caver-klay-accounts/src/index.js b/packages/caver-klay/caver-klay-accounts/src/index.js index 00b4bc2b..493b400e 100644 --- a/packages/caver-klay/caver-klay-accounts/src/index.js +++ b/packages/caver-klay/caver-klay-accounts/src/index.js @@ -1394,9 +1394,7 @@ Accounts.prototype.decrypt = function(v3Keystore, password, nonStrict) { } // To deep copy an object, using JSON.parse and JSON.stringify (object -> string -> object) - const json = _.isObject(v3Keystore) - ? JSON.parse(JSON.stringify(v3Keystore)) - : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore) + const json = _.isObject(v3Keystore) ? _.cloneDeep(v3Keystore) : JSON.parse(nonStrict ? v3Keystore.toLowerCase() : v3Keystore) if (json.version !== 3 && json.version !== 4) { console.warn('This is not a V3 or V4 wallet.') diff --git a/packages/caver-wallet/src/keyring/keyringFactory.js b/packages/caver-wallet/src/keyring/keyringFactory.js index 84e5cf1d..c80a14cc 100644 --- a/packages/caver-wallet/src/keyring/keyringFactory.js +++ b/packages/caver-wallet/src/keyring/keyringFactory.js @@ -210,7 +210,7 @@ class KeyringFactory { */ static decrypt(keystore, password) { // To deep copy an object, using JSON.parse and JSON.stringify (object -> string -> object) - const json = _.isObject(keystore) ? JSON.parse(JSON.stringify(keystore)) : JSON.parse(keystore) + const json = _.isObject(keystore) ? _.cloneDeep(keystore) : JSON.parse(keystore) if (json.version !== 3 && json.version !== 4) console.warn('This is not a V3 or V4 wallet.')