Files
hapi/web/scripts/build-passkey-site.ts
T
weishu ee3d7eed4c feat(auth): share passkeys across web and native apps
Use auth.hapi.run as the shared RP with an isolated static browser bridge, Hub-bound challenges and accounts, and one-time PKCE code exchange.

Update iOS and Android validation, app associations, deployment documentation, and bidirectional browser regression coverage.
2026-11-17 11:39:01 +08:00

15 lines
761 B
TypeScript

import { cp, mkdir, rm } from 'node:fs/promises'
import { resolve } from 'node:path'
// Independent output: never deploy the marketing app/scripts to this origin.
const outdir = resolve(import.meta.dir, '../../website/dist/auth')
await rm(outdir, { recursive: true, force: true })
await mkdir(outdir, { recursive: true })
await cp(resolve(import.meta.dir, '../passkey-site'), outdir, { recursive: true })
const result = await Bun.build({
entrypoints: [resolve(import.meta.dir, '../src/passkey-site/main.ts')],
outdir, target: 'browser', minify: true, naming: 'main.js'
})
if (!result.success) throw new AggregateError(result.logs, 'Passkey site build failed')
console.log(`Static passkey site: ${outdir} (deploy only this directory to auth.hapi.run)`)