import { buildAuthenticationOptions } from '../../../utils/webauthnHelper'
import { issueChallenge } from '../../../utils/webauthnChallengeStore'

export default defineEventHandler(async (event) => {
  const options = await buildAuthenticationOptions()
  issueChallenge(event, options.challenge, { kind: 'login' })
  return options
})
