/**
 * Generic Auth Page
 *
 * Renders a simple authentication page for protected routes.
 * After successful auth, creates a session via /session/create and redirects.
 * The session cookie is set by the server and used for subsequent requests.
 *
 * Progressive enhancement: the form has `action="/session/create"`
 * `method="POST"` and submits as `application/x-www-form-urlencoded` if the
 * JS handler doesn't run (content blocker, JS error, transient extension
 * issue). The /session/create handler accepts both shapes — JSON+header for
 * the JS-enhanced path, form body for the native-form fallback. Without this
 * fallback, ANY fetch failure (e.g. iOS content blocker dropping POSTs)
 * leaves the user with "Load failed" and no recourse.
 *
 * Themes: the visitor's theme, as everywhere else on hadoku.me. The page
 * links /theme-bootstrap.js (spec/theme-bootstrap.js, which sets data-theme
 * from the `hadoku-theme` storage the apps write) and /themes.css
 * (@wolffm/themes' own stylesheet); the Astro build emits both
 * (src/pages/themes.css.ts, src/pages/theme-bootstrap.js.ts). Every colour
 * below is a theme token with the old fixed palette as its fallback, so the
 * page still renders where those files are not served.
 *
 * Password managers: the key is a password and the form says so in the
 * vocabulary every manager reads — `autocomplete="current-password"`, a
 * label, and a hidden `username` field, because managers file a credential
 * under a username and a key has none (Chrome's and Bitwarden's documented
 * shape for a password-only form). The WebView in the Android app hands the
 * same hints to whichever autofill service is installed. The server reads
 * only `key`, `return`, `fp` and `ft`.
 *
 * Device fingerprint (`fp`): a DETECTION signal, never an auth factor. The
 * page hashes a handful of device traits (screen, timezone, languages,
 * hardware, canvas and WebGL renders) in the browser and sends only the
 * digests — the raw values never leave it. edge-router compares them against
 * the devices that key has signed in from before and flags a stranger (see
 * workers/edge-router/src/device-ledger.ts). Collection is time-boxed and
 * every failure degrades to "no fingerprint", so it can never cost a login.
 */
interface AuthPageOptions {
    /** Title shown on the auth page */
    title?: string;
    /** Description shown above the form */
    description?: string;
    /** The target path to redirect to after auth (defaults to current path) */
    targetPath?: string;
    /** Error message shown above the form (from ?error= on the form-fallback path) */
    errorMessage?: string;
    /**
     * Open Graph title/description for link-preview crawlers (Discord, Slack,
     * iMessage…). Crawlers hitting a gated path receive this sign-in page, so
     * without these the embed reads "Sign in to Hadoku / Enter your access
     * key." — pass the APP's identity here so the preview describes the
     * destination while humans still see the sign-in form. Falls back to
     * title/description when not given.
     */
    ogTitle?: string;
    ogDescription?: string;
    /**
     * Absolute og:image URL for the preview card. Crawlers fetch this with NO
     * cookies, from their own IPs — so it must resolve for an unauthenticated
     * caller or the card renders imageless. Supplying it also upgrades the
     * Twitter card from `summary` to `summary_large_image`.
     */
    ogImage?: string;
    /** Pixel dimensions of ogImage. Let crawlers reserve layout before the fetch. */
    ogImageWidth?: number;
    ogImageHeight?: number;
    /** Canonical og:url for the resource, when it differs from the gated path. */
    ogUrl?: string;
    /**
     * The edge's signed proof that a sign-in came through THIS page (edge-router
     * auth-funnel.ts). Posted back as `ft` on both the fetch and the native-form
     * path; `/session/create` refuses a sign-in without one.
     */
    funnelToken?: string;
    /**
     * Offer sign-up beside sign-in: a name and a new passkey make a member
     * (edge-router accounts.ts). Only where the destination admits members,
     * so a stranger is never invited to make an account that gets them nowhere.
     */
    signup?: boolean;
}
/**
 * `/auth/sign-in.js`: the sign-in client as an ES module, for an app that
 * takes a key in its own UI.
 *
 *     const { signIn } = await import('/auth/sign-in.js');
 *     await signIn(key); // throws Error(message) on a refused key
 *
 *     if (passkeysSupported()) await signInWithPasskey(); // same, no key
 *     await addPasskey(); // signed in: save one on this device
 *     await signUp(name); // a new member account, signed in
 *     const assertion = await stepUpPasskey(); // re-prove a signed-in person
 *     await stepUpPasskey({ challengePath: '/session/tv/challenge' }); // for another purpose
 *
 * Both passkey calls take `{ signal }` to cancel an open prompt, and give up
 * on their own after 90s, so a prompt that never answers cannot hang the UI.
 *
 * Each throws an Error whose message is fit to show. The funnel token is
 * fetched per call from `/auth/funnel-token` rather than baked into the module, so a tab left open past the token's life still signs
 * in through the funnel. Signing in changes who the page is acting for, so the
 * caller reloads afterwards.
 */
declare function renderSignInModule(): string;
/**
 * Render a standalone auth page HTML
 */
declare function renderAuthPage(options?: AuthPageOptions): string;
/**
 * Create an auth page Response
 */
declare function authPageResponse(options?: AuthPageOptions): Response;

export { type AuthPageOptions, authPageResponse, renderAuthPage, renderSignInModule };
