Files
BYW-VoiceHub/VoiceHub-main/server/api/auth/webauthn/login/options.post.ts
T
Henry_Du 4ce4649aaf
Build VoiceHub FPK / build-fpk (push) Failing after 56m5s
Build and Push Docker Image / build-and-push (push) Canceled after 1h9m35s
初次提交
2026-09-06 08:19:02 +08:00

18 lines
530 B
TypeScript

import { generateAuthenticationOptions } from '@simplewebauthn/server'
import { setWebAuthnChallenge } from '~~/server/utils/webauthn-token'
import { getWebAuthnConfig } from '~~/server/utils/webauthn-config'
export default defineEventHandler(async (event) => {
const { rpID } = getWebAuthnConfig(event)
const options = await generateAuthenticationOptions({
rpID,
userVerification: 'preferred',
allowCredentials: [],
})
setWebAuthnChallenge(event, options.challenge, 'authentication')
return options
})