Add ability to remove non-stock key via WebUSB.

This commit is contained in:
flawedworld
2021-03-01 19:55:57 +00:00
committed by Daniel Micay
parent 780f47e61e
commit 3e44e17ea8
2 changed files with 33 additions and 1 deletions

View File

@@ -207,6 +207,19 @@ async function flashRelease(setProgress) {
return `Flashed ${latestZip} to device.`;
}
async function eraseNonStockKey(setProgress) {
await ensureConnected(setProgress);
setProgress("Erasing key...");
try {
await device.runCommand("erase:avb_custom_key");
} catch (error) {
console.log(error);
throw error;
}
return "Key erased.";
}
async function lockBootloader(setProgress) {
await ensureConnected(setProgress);
@@ -281,6 +294,7 @@ if ("usb" in navigator) {
addButtonHook("download-release", downloadRelease);
addButtonHook("flash-release", flashRelease);
addButtonHook("lock-bootloader", lockBootloader);
addButtonHook("remove-custom-key", eraseNonStockKey);
} else {
console.log("WebUSB unavailable");
}