MCPcopy
hub / github.com/logto-io/logto / publicWellKnownRoutes

Function publicWellKnownRoutes

packages/core/src/routes/public-wellknown.ts:17–39  ·  view source on GitHub ↗
(
  router: T,
  { queries }: TenantContext
)

Source from the content-addressed store, hash-verified

15 * So this route is not conflict with the routes in `./well-known/index.ts`.
16 */
17export default function publicWellKnownRoutes<T extends AnonymousRouter>(
18 router: T,
19 { queries }: TenantContext
20) {
21 const {
22 accountCenters: { findDefaultAccountCenter },
23 } = queries;
24
25 router.get(
26 '/webauthn',
27 koaGuard({
28 response: z.object({ origins: z.string().array() }),
29 status: 200,
30 }),
31 async (ctx, next) => {
32 const { webauthnRelatedOrigins } = await findDefaultAccountCenter();
33 ctx.body = { origins: webauthnRelatedOrigins };
34 ctx.status = 200;
35
36 return next();
37 }
38 );
39}

Callers 1

initPublicWellKnownApisFunction · 0.85

Calls 4

koaGuardFunction · 0.85
nextFunction · 0.85
arrayMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected