From a5a54413fdb9ff63100ac0f342af365ab53f6fbc Mon Sep 17 00:00:00 2001 From: BokkyPooBah Date: Fri, 19 Apr 2024 14:23:22 +1000 Subject: [PATCH] wip --- docs/offline.html | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/docs/offline.html b/docs/offline.html index 2577404..aac79db 100644 --- a/docs/offline.html +++ b/docs/offline.html @@ -95,6 +95,12 @@ + + + + + Load + @@ -270,7 +276,10 @@ data: { wallet: { tab: 2, // 0: 'mnemonic', 1: 'keystorefile', 2: 'privatekey', 3: 'new' - type: 'mnemonic', // 'mnemonic', 'keystorefile', 'privatekey' + + type: 'mnemonic', // 'mnemonic', 'privatekey' + wallet: null, // HDNode for type 'mnemonic', Wallet for type 'privatekey' + mnemonic: { phrase: null, passphrase: null, @@ -394,6 +403,25 @@ this.$bvModal.hide('modal-loadprivatekeyfromkeystore'); }, + savePrivateKeyToKeystore() { + console.log(moment().format("HH:mm:ss") + " savePrivateKeyToKeystore - this.wallet.newWallet: " + JSON.stringify(this.wallet.newWallet)); + // const encrypted = await this.wallet.newWallet.encrypt(this.wallet.keystoreFilePassword); + // // console.log(moment().format("HH:mm:ss") + " downloadKeystore - encrypted: " + encrypted); + // const encryptedObject = JSON.parse(encrypted); + // const filename = encryptedObject && encryptedObject['x-ethers'] && encryptedObject['x-ethers'].gethFilename || "UTC--error-getting-filename"; + // console.log("filename: " + filename); + // // console.log(moment().format("HH:mm:ss") + " downloadKeystore - JSON.stringify(JSON.parse(encrypted), null, 2): " + JSON.stringify(JSON.parse(encrypted), null, 2)); + // let jsonContent = "data:text/json;charset=utf-8," + encrypted; + // // console.log(moment().format("HH:mm:ss") + " downloadKeystore - jsonContent: " + jsonContent); + // var encodedUri = encodeURI(jsonContent); + // var link = document.createElement("a"); + // link.setAttribute("href", encodedUri); + // link.setAttribute("download", filename); + // document.body.appendChild(link); // Required for FF + // link.click(); // This will download the data with the specified file name + + }, + generateMnemonic() { console.log(moment().format("HH:mm:ss") + " generateMnemonic - this.wallet.randomBytesLength: " + this.wallet.randomBytesLength); try {