MetaMask / metamask-extension

:globe_with_meridians: :electric_plug: The MetaMask browser extension enables browsing Ethereum blockchain enabled websites
https://metamask.io
Other
11.94k stars 4.88k forks source link

Request: Export UTC JSON format keys #1232

Open aakilfernandes opened 7 years ago

aakilfernandes commented 7 years ago

Allow exporting private keys as a UTC file. ethereumjs-wallet has the javascript logic for this

danfinlay commented 6 years ago

This should actually be a fairly easy feature to add, the hard part being that this will touch a lot of files, from the backend to the front-end, but it could be easy because you could copy how we currently export private keys. We made that system very modular,

I'm adding bounty worthy for that reason, although this would also be a good feature to make a tutorial out of, because it would teach how to use our entire stack...

scsaba commented 6 years ago

@danfinlay @vs77bb is it still on your radar? If so, is it still bounty worthy? I have a working prototype and I can invest some more time into this :)

dportabella commented 4 years ago

As a workaround, install the "MEW CX" Google Chrome extension, import the wallet using the MNENOMIC, and export "Keystore File (UTC/JSON)".

SvenMeyer commented 3 years ago

It's convenient to have all accounts in Metamask, but sometimes I need to use just one account elsewhere. Exporting an account as private key is supported, but handling an unencrypted private key is not the safest way. Ideally I could export one account and store it in an encrypted json-file and then use it in some other (backend) process or app.

I am surprised that it is still not supported, although it would be much more secure than exporting the private key.

GopherJ commented 1 year ago

I used many wallets and it really surprises me that such important feature is not supported by metamask. Metamask is not only used by users but also developers, I can easily export all my accounts from polkadot.js and import on another laptop, while it's not possible at all using metamask

SvenMeyer commented 1 year ago

Why is this super important (I think) security feature still not implemented ? Why is it difficult just to implement a few lines of code which (instead of showing the private key in plain text :-O !!!) just ask for a password and a filename, then store it in an encrypted json file ?

const fs = require("fs")
const wallet = require("ethereumjs-wallet")

const pk = new Buffer.from('c87509a1c067bbde78beb79..........82a4c0241e5e4a9ec0a0f44dc0d3', 'hex') // replace by correct private key
const account = wallet.fromPrivateKey(pk)
const password = 'something' // will be required to unlock/sign after importing to a wallet like MyEtherWallet
const content = JSON.stringify(account.toV3(password))

// writes to a file
const address = account.getAddress().toString('hex')
const file = `UTC--${new Date().toISOString().replace(/[:]/g, '-')}--${address}`
fs.writeFileSync(file, content)

Of course I could use this tiny code snippet to convert a PK to an ecrypted json file, but of course this is ..

GopherJ commented 1 year ago

@SvenMeyer the reason is simple:

I dont want to expose my private key at any time and any place, clipboard is dangerous, terminal is dangerous, moving encrypted keystore is much safer than moving private keys

and I dont even want to mention that when you have 100 accounts on metamask and you need to change laptop...

pls metamask, do this job it'll not kill you... You guys are just wasting time arguing.

4 years now, want to spend another 5 years and finally decide to do it? :)

you self taught to be focusing on security and at the same time ask your users to expose their private keys in air and using scripts to migrate accounts?

@danfinlay @kumavis ^ hope you guys can think about this