Skip to content

Commit

Permalink
Check for codes.authme version
Browse files Browse the repository at this point in the history
  • Loading branch information
Levminer committed Nov 26, 2021
1 parent 0aab107 commit 792f72a
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions app/application/src/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ const saveCodes = () => {
encrypted: true,
codes: encrypted.toString("base64"),
date: time.timestamp(),
version: "3",
version: 3,
}

fs.writeFileSync(path.join(folder_path, "codes", "codes.authme"), JSON.stringify(codes, null, "\t"))
Expand Down Expand Up @@ -743,15 +743,33 @@ const loadCodes = () => {
} else {
const codes_file = JSON.parse(content)

const decrypted = aes.decrypt(Buffer.from(codes_file.codes, "base64"), key)
if (codes_file.version === 3) {
const decrypted = aes.decrypt(Buffer.from(codes_file.codes, "base64"), key)

prev = true
prev = true

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

decrypted.fill(0)
password.fill(0)
key.fill(0)
decrypted.fill(0)
password.fill(0)
key.fill(0)
} else {
dialog
.showMessageBox({
title: "Authme",
buttons: ["Close", "Migration guide"],
defaultId: 0,
cancelId: 0,
type: "error",
noLink: true,
message: "The saved codes are only compatible with Authme 2. \n\nPlease read the migration guide!",
})
.then((result) => {
if (result.response === 1) {
shell.openExternal("https://docs.authme.levminer.com/migration")
}
})
}
}
})
}
Expand Down

0 comments on commit 792f72a

Please sign in to comment.