Project import generated by Copybara.

GitOrigin-RevId: 63746295f1a5ab5a619056791995793d65529e62
diff --git a/src/dodeletesecuritykey.php b/src/dodeletesecuritykey.php
new file mode 100644
index 0000000..1252d7c
--- /dev/null
+++ b/src/dodeletesecuritykey.php
@@ -0,0 +1,22 @@
+<?php
+require_once("core.php");
+security::checkType(security::WORKER);
+security::checkWorkerUIEnabled();
+secondFactor::checkAvailability();
+
+if (!security::checkParams("POST", [
+  ["id", security::PARAM_NEMPTY]
+])) {
+  security::go("securitykeys.php?msg=unexpected");
+}
+
+$id = (int)$_POST["id"];
+
+$s = secondFactor::getSecurityKeyById($id);
+if ($s === false || people::userData("id") != $s["person"]) security::go("securitykeys.php?msg=unexpected");
+
+if (secondFactor::removeSecurityKey($id)) {
+  security::go("securitykeys.php?msg=securitykeydeleted");
+} else {
+  security::go("securitykeys.php?msg=unexpected");
+}