Files
hapi/web/scripts/passkey-e2e-entry.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

12 lines
788 B
TypeScript

// Bundled only by the isolated browser regression harness, not the auth site.
import { ApiClient } from '../src/api/client'
import { registerPasskey, signInWithPasskey } from '../src/lib/passkey'
const api = new ApiClient(document.body.dataset.token!, { baseUrl: location.origin })
const output = document.querySelector('#result')!
document.querySelector('#register')!.addEventListener('click', () => {
void registerPasskey(api, 'Browser integration').then(() => { output.textContent = 'registered' }).catch((e) => { output.textContent = String(e) })
})
document.querySelector('#login')!.addEventListener('click', () => {
void signInWithPasskey(location.origin).then((session) => { output.textContent = `session:${session}` }).catch((e) => { output.textContent = String(e) })
})