diff --git a/lib/http/client.js b/lib/http/client.js index b9e1ac2a..5ce91e9c 100644 --- a/lib/http/client.js +++ b/lib/http/client.js @@ -673,7 +673,7 @@ HTTPClient.prototype.retoken = async function retoken(id, passphrase) { */ HTTPClient.prototype.setPassphrase = function setPassphrase(id, old, new_) { - const body = { old: old, passphrase: new_ }; + const body = { old: old, new: new_ }; return this._post(`/wallet/${id}/passphrase`, body); }; diff --git a/lib/wallet/wallet.js b/lib/wallet/wallet.js index 4257e132..36fa5cae 100644 --- a/lib/wallet/wallet.js +++ b/lib/wallet/wallet.js @@ -366,15 +366,10 @@ Wallet.prototype._removeSharedKey = async function _removeSharedKey(acct, key) { */ Wallet.prototype.setPassphrase = async function setPassphrase(old, new_) { - if (new_ == null) { - new_ = old; - old = null; - } - - if (old != null) + if (old) await this.decrypt(old); - if (new_ != null) + if (new_) await this.encrypt(new_); };