classic-ui/modules/account/store/actions/saveRecoveryKeyOnFile.js
Danil Kovtonyuk 44f31f8b9f
init
2022-04-22 13:14:19 +10:00

14 lines
425 B
JavaScript

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)
}
}