SPB Git

Repository Public

route.ts 2.5 KB 57 lines typescript

1/**2 * =============================================================================3 *                  SP BOUCHER | SOFTWARE & RESEARCH4 *             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING5 * =============================================================================6 *7 * Project          : Chat SPBoucher AI8 * File             : src/app/api/auth/passkeys/route.ts9 * Module           : app10 * Repository       : https://git.spboucher.ai/chat-spboucher-ai11 * Project Website  : https://chat.spboucher.ai12 * Created          : 2026-11-1713 * Last Modified    : 2026-11-1714 *15 * Author           : Simon-Pierre Boucher16 * Position         : Professor of Finance17 * Institution      : Université du Québec en Outaouais (UQO)18 * Organization     : SP Boucher19 * Website          : https://spboucher.ai20 * Git              : https://git.spboucher.ai21 *22 * Preferred Contact: contact@spboucher.ai23 * Development      : dev@spboucher.ai24 * Support          : support@spboucher.ai25 * Security/Admin   : admin@spboucher.ai26 *27 * Copyright (c) 202628 * Simon-Pierre Boucher29 * All rights reserved where applicable. This file is governed by the30 * applicable project license, copyright notices and relevant law.31 * Existing third-party rights and notices remain unaffected.32 *33 * License          : None specified (no license file in this repository)34 *35 * Do not embed credentials, private keys, access tokens,36 * certificates or confidential personal information.37 *38 * =============================================================================39 * END OF SP BOUCHER SOURCE HEADER40 * =============================================================================41 */4243import { guarded, json } from "@/lib/api";44import { listCredentials } from "@/lib/auth/webauthn";45import { recoveryStatus } from "@/lib/auth/grants";46import { recentlyAuthenticated } from "@/lib/auth/session";47import { authConfig } from "@/lib/auth/config";4849export const GET = guarded(async (_req, { session }) => {50  const creds = await listCredentials();51  return json({52    passkeys: creds.map(c => ({ id: c.id, label: c.label, createdAt: c.created_at, lastUsedAt: c.last_used_at, synced: c.backed_up, deviceType: c.device_type, createdVia: c.created_via, current: c.id === session.credential_id })),53    recovery: await recoveryStatus(), recentAuth: recentlyAuthenticated(session), rpId: authConfig.rpID,54    transitionLeftovers: !!(process.env.ACCESS_KEY || process.env.ACCESS_PASSWORD_HASH || process.env.AUTH_TRANSITION_UNTIL),55  });56});57
Files main
Menu

Theme