Skip to content

Commit

Permalink
QR code automatic import #185
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Feb 13, 2022
1 parent f6b2ddd commit 7bd38a0
Show file tree
Hide file tree
Showing 5 changed files with 214 additions and 152 deletions.
23 changes: 17 additions & 6 deletions app/application/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const loadFile = () => {
text = Buffer.from(loaded.codes, "base64").toString()
save_text = text

processdata(text)
processData(text)
} else {
dialog.showMessageBox({
title: "Authme",
Expand All @@ -117,21 +117,32 @@ const loadFile = () => {
})
}

/**
* Automatically import when creating import file
* @param {string} res
*/
const importedCodes = (res) => {
const text = Buffer.from(res, "base64").toString()
save_text = text

processData(text)
}

/**
* Process data from saved source
* @param {String} text
* @param {string} text
*/
const processdata = (text) => {
const processData = (text) => {
const data = convert.fromText(text, sort_number)

go(data)
generateCodeElements(data)
}

/**
* Start creating 2FA elements
* @param {LibImportFile} data
*/
const go = (data) => {
const generateCodeElements = (data) => {
document.querySelector("#search").style.display = "grid"
document.querySelector(".h1").style.marginBottom = "0px"
document.querySelector(".content").style.top = "80px"
Expand Down Expand Up @@ -643,7 +654,7 @@ const loadCodes = async () => {

prev = true

processdata(decrypted.toString())
processData(decrypted.toString())

decrypted.fill(0)
password.fill(0)
Expand Down
Loading

0 comments on commit 7bd38a0

Please sign in to comment.