fix(native): the handoff's passkey sign-in lives in native/browserSignIn, so the page hook reaches no API on its own

This commit is contained in:
Maurice
2026-11-08 18:33:00 +01:00
parent cd1f39377d
commit afb6eae4c8
4 changed files with 32 additions and 25 deletions
+9
View File
@@ -1,5 +1,7 @@
import { sha256 } from '@noble/hashes/sha2';
import { bytesToHex } from '@noble/hashes/utils';
import { startAuthentication } from '@simplewebauthn/browser';
import { authApi } from '../api/client';
import { nativeAuthApi } from '../api/nativeAuth';
import { APP_URL_SCHEME, TrekShell } from './trekShell';
@@ -76,6 +78,13 @@ export async function requestHandoffCode(challenge: string): Promise<string> {
return code;
}
/** The browser side of a passkey sign-in the app started: the prompt, then the session cookie. */
export async function signInWithPasskey(): Promise<void> {
const options = await authApi.passkey.loginOptions();
const assertion = await startAuthentication({ optionsJSON: options });
await authApi.passkey.loginVerify(assertion);
}
export class BrowserSignInCancelled extends Error {
constructor() {
super('Sign-in cancelled');