diff --git a/golang/wasm/pure.js b/golang/wasm/pure.js index f682243..097f473 100644 --- a/golang/wasm/pure.js +++ b/golang/wasm/pure.js @@ -762,3 +762,22 @@ async function handleFileSelection(event) { } } + const downloadKeys = () => { + const zip = new JSZip(); + + Object.keys(localStorage).forEach(keyName => { + const item = JSON.parse(localStorage.getItem(keyName)); + + if (item?.key && item?.private) { + zip.file(`${keyName}.key`, item.key); + zip.file(`${keyName}.private`, item.private); + } + }); + + zip.generateAsync({ type: "blob" }).then(content => { + const a = document.createElement("a"); + a.href = URL.createObjectURL(content); + a.download = "keys.zip"; + a.click(); + }); +} \ No newline at end of file diff --git a/golang/wasm/wasm_exec.html b/golang/wasm/wasm_exec.html index edaf521..3993a43 100644 --- a/golang/wasm/wasm_exec.html +++ b/golang/wasm/wasm_exec.html @@ -6,6 +6,7 @@
- +