Skip to content

Commit 792f72a

Browse files
committed
Check for codes.authme version
1 parent 0aab107 commit 792f72a

File tree

1 file changed

+25
-7
lines changed

1 file changed

+25
-7
lines changed

app/application/src/js/index.js

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ const saveCodes = () => {
687687
encrypted: true,
688688
codes: encrypted.toString("base64"),
689689
date: time.timestamp(),
690-
version: "3",
690+
version: 3,
691691
}
692692

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

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

748-
prev = true
749+
prev = true
749750

750-
processdata(decrypted.toString())
751+
processdata(decrypted.toString())
751752

752-
decrypted.fill(0)
753-
password.fill(0)
754-
key.fill(0)
753+
decrypted.fill(0)
754+
password.fill(0)
755+
key.fill(0)
756+
} else {
757+
dialog
758+
.showMessageBox({
759+
title: "Authme",
760+
buttons: ["Close", "Migration guide"],
761+
defaultId: 0,
762+
cancelId: 0,
763+
type: "error",
764+
noLink: true,
765+
message: "The saved codes are only compatible with Authme 2. \n\nPlease read the migration guide!",
766+
})
767+
.then((result) => {
768+
if (result.response === 1) {
769+
shell.openExternal("https://docs.authme.levminer.com/migration")
770+
}
771+
})
772+
}
755773
}
756774
})
757775
}

0 commit comments

Comments
 (0)