feat: вход по лицу целиком — заведение ключа, вход, отзыв на служебной странице

This commit is contained in:
anor
2026-08-16 05:10:31 +10:00
parent 0e38cb4b7e
commit 62224f93ab
5 changed files with 139 additions and 8 deletions
+20
View File
@@ -39,6 +39,26 @@ export function createAdminRouter({ history, getStatus, auth = null }) {
});
});
/** Ключи входа по лицу: какие заведены и на чьих устройствах. */
router.get('/passkeys', (request, response) => {
if (!auth) {
response.json({ available: false, keys: [] });
return;
}
response.json({ available: true, keys: auth.allPasskeys() });
});
/** Отзыв ключа: потеряли планшет или человек уволился. */
router.post('/passkeys/revoke', (request, response) => {
const credentialId = String(request.body?.credentialId ?? '').trim();
if (!auth || !credentialId) {
response.status(400).json({ error: 'нужен ключ, который отзываем' });
return;
}
auth.revokePasskey(credentialId);
response.json({ ok: true });
});
/** Журнал попыток входа: по нему разбирают, кого пустили и кого остановили. */
router.get('/logins', (request, response) => {
if (!auth) {