Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose wallet removal by wid in the API #711

Closed
waterdrop01 opened this issue Feb 22, 2019 · 4 comments
Closed

expose wallet removal by wid in the API #711

waterdrop01 opened this issue Feb 22, 2019 · 4 comments
Labels
enhancement Improving a current feature wallet Wallet related

Comments

@waterdrop01
Copy link

Hello,

I feel being able to remove a wallet (by using its ID) through the API would very useful. Something like:

const { WalletClient } = require('bclient');
const walletClient = new WalletClient({
        host: TESTNET_BWALLET_URI,
        port: 443,
        network: chain,
        apiKey: BTC_API_KEY,
        ssl: true,
      })
walletClient.remove(id).then(console.log) // { successfull }

Makes sense?

@pinheadmz
Copy link
Member

This method is already available in WalletDB:

/**
* Remove a wallet.
* @param {Number|String} id
* @returns {Promise}
*/
async remove(id) {
const wid = await this.ensureWID(id);
if (wid === -1)
return false;
// Grab all locks.
const unlock1 = await this.readLock.lock(wid);
const unlock2 = await this.writeLock.lock();
const unlock3 = await this.txLock.lock();
try {
return await this._remove(wid);
} finally {
unlock3();
unlock2();
unlock1();
}
}

...but I think it is too dangerous to leave exposed in the bclient API.

@braydonf
Copy link
Contributor

braydonf commented Feb 22, 2019

I think it's recommended to never delete a wallet, especially the private keys, and to set it aside instead. So it's likely not not be exposed on the API.

@waterdrop01
Copy link
Author

@pinheadmz : I don't get how I could use the method if it is not exposed over the API...? That's an internal method of the wallet service I believe...

@braydonf : copay wallet, metamask wallet ... virtually every blockchain wallet out there let the user the hability to delete a wallet.

In my case I'm using bcoin wallet for tracking only purposes (I import public keys) so I'm very comfortable with deleting them. But I can only access the bcoin wallet through the API...i'm curious which options are left :)

Many Thanks !

@pinheadmz pinheadmz added enhancement Improving a current feature wallet Wallet related labels Mar 6, 2019
@pinheadmz pinheadmz added the wontfix This will not be worked on label May 31, 2019
@pinheadmz
Copy link
Member

I think we're going to close this for now. @waterdrop01 fee free to reach out on slack if you need any more help! Be careful with your private keys :-) Don't regret deleting anything full of money!

@braydonf braydonf removed the wontfix This will not be worked on label May 31, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving a current feature wallet Wallet related
Projects
None yet
Development

No branches or pull requests

3 participants