classic-ui/modules/account/store/actions/saveRecoveryKeyOnFile.js

14 lines
425 B
JavaScript
Raw Normal View History

2022-04-22 06:05:56 +03:00
import { saveAsFile } from '@/utils'
export function saveRecoveryKeyOnFile(_, { recoveryKey }) {
try {
const { address } = this.$provider.web3.eth.accounts.privateKeyToAccount(recoveryKey)
const data = new Blob([`${recoveryKey}`], { type: 'text/plain;charset=utf-8' })
saveAsFile(data, `backup-note-account-key-${address.slice(0, 10)}.txt`)
} catch (err) {
console.error('saveFile', err.message)
}
}