@@ -44,7 +44,7 @@
Ideal for scanning the QR codes or for security backup.
diff --git a/interface/windows/export/index.ts b/interface/windows/export/index.ts
index 4137256..3148422 100644
--- a/interface/windows/export/index.ts
+++ b/interface/windows/export/index.ts
@@ -3,6 +3,7 @@ import { generateMasterKey, decrypt } from "../../libraries/auth"
import { generateTimestamp } from "../../libraries/time"
import { textConverter } from "../../libraries/convert"
import { getSettings } from "../../stores/settings"
+import qrcode from "qrcode-generator"
let codesArray: LibImportFile
let codesText: string
@@ -15,6 +16,7 @@ export const exportCodes = async () => {
const saveFile: LibAuthmeFile = JSON.parse(await fs.readTextFile(filePath))
document.querySelector(".saveExportedCodes").style.display = "block"
+ document.querySelector(".exportCodes").style.display = "none"
const password = Buffer.from(settings.security.password, "base64")
const key = Buffer.from(settings.security.key, "base64")
@@ -44,3 +46,34 @@ export const exportAuthmeFile = async () => {
fs.writeFile(filePath, JSON.stringify(saveFile, null, "\t"))
}
}
+
+export const exportHtmlFile = async () => {
+ const names = codesArray.names
+ const secrets = codesArray.secrets
+ const issuers = codesArray.issuers
+
+ let htmlString = ""
+
+ for (let i = 0; i < names.length; i++) {
+ const qr = qrcode(10, "M")
+
+ qr.addData(`otpauth://totp/${names[i]}?secret=${secrets[i]}&issuer=${issuers[i]}`)
+ qr.make()
+
+ const qrSrc = qr.createDataURL(3, 3)
+
+ const element = `
+
+
+
${issuers[i]}
+
`
+
+ htmlString += element
+ }
+
+ const filePath = await dialog.save({ filters: [{ name: "HTML file", extensions: ["html"] }] })
+
+ if (filePath !== null) {
+ fs.writeFile(filePath, htmlString)
+ }
+}
diff --git a/package-lock.json b/package-lock.json
index dd22398..895f086 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -14,6 +14,7 @@
"otpauth": "^8.0.1",
"protocol-buffers": "^5.0.0",
"qrcode-decoder": "^0.2.2",
+ "qrcode-generator": "^1.4.4",
"svelte": "^3.49.0",
"ua-parser-js": "^1.0.2"
},
@@ -5200,6 +5201,11 @@
"jsqr": "^1.4.0"
}
},
+ "node_modules/qrcode-generator": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-1.4.4.tgz",
+ "integrity": "sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw=="
+ },
"node_modules/queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -9708,6 +9714,11 @@
"jsqr": "^1.4.0"
}
},
+ "qrcode-generator": {
+ "version": "1.4.4",
+ "resolved": "https://registry.npmjs.org/qrcode-generator/-/qrcode-generator-1.4.4.tgz",
+ "integrity": "sha512-HM7yY8O2ilqhmULxGMpcHSF1EhJJ9yBj8gvDEuZ6M+KGJ0YY2hKpnXvRD+hZPLrDVck3ExIGhmPtSdcjC+guuw=="
+ },
"queue-microtask": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
diff --git a/package.json b/package.json
index bcba766..208ac59 100644
--- a/package.json
+++ b/package.json
@@ -46,6 +46,7 @@
"otpauth": "^8.0.1",
"protocol-buffers": "^5.0.0",
"qrcode-decoder": "^0.2.2",
+ "qrcode-generator": "^1.4.4",
"svelte": "^3.49.0",
"ua-parser-js": "^1.0.2"
}