mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-24 04:47:03 +00:00
Hub discovery required two authenticator prompts plus a confirm step:
a local locator-only ceremony to read the Hub from the user handle, then a
Hub-issued login challenge. Native apps now sign their own fresh challenge
{v:2, operation:"login", channel:"native", iat, nonce}, read the Hub from
the selected credential's v2 user handle, and post the assertion straight to
POST /api/passkey/login/verify.
- hub: accept native self-issued challenges only within
[now-5min, now+1min] and only once (replay guard keyed on the challenge,
claimed synchronously after verification); remove
/api/passkey/login/options. Browser ceremonies keep Hub-issued challenges.
- shared: createPasskeyNativeLoginChallenge / parsePasskeyNativeLoginChallenge;
drop discovery helpers.
- ios/android: one system sheet from the pairing screen; manual Hub entry
for long-address handles or an explicit Hub, which must match the
credential before anything is sent. Assertions are only posted to the Hub
named by the credential.
- web: revert address-free discovery; the web app signs in to its own Hub.
- docs: native single-ceremony contract and its security trade-off.
12 lines
810 B
TypeScript
12 lines
810 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: document.body.dataset.hub! })
|
|
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(document.body.dataset.hub!).then((session) => { output.textContent = `session:${session}` }).catch((e) => { output.textContent = String(e) })
|
|
})
|