I’ve been hard at work on a keychain script ALL DAY, and now it has stopped working completely. When I run this…
let alert = new Alert()
alert.addTextField("Vault Pass","TEST")
alert.addAction("Access Vault >")
alert.addAction("Create New Vault")
let choice = await alert.presentAlert()
let vaultPass = alert.textFieldValue(0)
if (!Keychain.contains(vaultPass)) {//Does the vault exist?
if (choice==1) {//If not, are they making a new vault?
let alert = new Alert()
alert.addTextField("Add text to vault", "EXAMPLE")
alert.addAction("Add to vault")
await alert.presentAlert()
Keychain.set(vaultPass, alert.textFieldValue(0))
console.log("[102]")
}else{//log error code
console.log("[201]")
}
}else{//If yes, log code and present vault contents
if (choice==1) {//Stop user from resetting existing vault
console.log("[202]")
let alert = new Alert()
alert.message = "[202] A vault already exists with that name"
alert.presentSheet()
return
}
let vaultContent = Keychain.get(vaultPass)//Get raw vault
let parsedVaultContent = JSON.parse("["+vaultContent+"]")
let alert = new Alert()//declare alert
//THIS IS WHERE IT CRASHES
var arrayLength = parsedVaultContent.length;
for (var i = 0; i < arrayLength; i++) {
alert.addAction(parsedVaultContent[i])
}
alert.addCancelAction("Add Item")
alert.addCancelAction("Remove Item")
await alert.presentAlert()
}
log("Debug Codes:\n101:Login Successful\n102:New Vault Created\n201:Invalid Pass\n202:Vault already exists\n204:Unknown error")
… and press the “Access Vault”, the app crashes and sends me to the homepage. I’ve identified where the crash occurs, it’s in the script comments. PLEASE HELP. I’ve tried restarting my device, and I need this to work ASAP.