{"version":3,"file":"fido2-web-sdk.cjs","sources":["../src/core/encoder.ts","../src/utils/buffer.ts","../src/utils/platform.ts","../src/core/deeplink.ts","../src/utils/session.ts","../src/core/webauthn.ts","../src/core/readiness.ts","../src/core/verified-summary.ts","../node_modules/cbor-x/decode.js","../node_modules/cbor-x/encode.js","../src/core/verifier.ts","../src/core/api.ts","../src/config/defaults.ts","../src/core/loopback.ts","../src/sdk.ts"],"sourcesContent":["/**\n * Custom Options Encoder\n *\n * This module provides encoding and decoding functionality for custom FIDO2\n * authentication options into a 32-byte salt format.\n *\n * @module encoder\n */\n\n/**\n * Custom authentication options for FIDO2 operations.\n *\n * These options are encoded into a 32-byte salt buffer that is passed\n * to the authenticator via the PRF (Pseudo-Random Function) extension.\n */\nexport interface CustomOptions {\n  /**\n   * Enable liveness detection check during authentication.\n   * When true, the authenticator will verify that a live person is present.\n   */\n  checkLiveness?: boolean;\n\n  /**\n   * Enable age verification during authentication.\n   * When true, the authenticator will verify the user's age.\n   */\n  checkAge?: boolean;\n\n  /**\n   * Enable age threshold verification during authentication.\n   * When true, the authenticator will verify if the user's age is above\n   * the specified threshold.\n   *\n   * Note: This should typically be used together with checkAge and a valid ageThreshold.\n   */\n  checkAgeAboveThreshold?: boolean;\n\n  /**\n   * Enable geolocation verification during authentication.\n   * When true, the authenticator will verify the user's geographic location.\n   */\n  checkGeoLocation?: boolean;\n\n  /**\n   * The age threshold value (0-255) for age verification.\n   *\n   * This value is only used when checkAge and/or checkAgeAboveThreshold are enabled.\n   *\n   * @minimum 0\n   * @maximum 255\n   */\n  ageThreshold?: number;\n}\n\n/**\n * Decoded custom options result with metadata.\n */\nexport interface DecodedCustomOptions extends CustomOptions {\n  /**\n   * The magic byte value (should always be 0xFF for valid encoded options)\n   */\n  magicByte: number;\n\n  /**\n   * The raw options flags byte\n   */\n  optionsFlags: number;\n\n  /**\n   * Whether the salt format is valid (magic byte is 0xFF)\n   */\n  isValid: boolean;\n}\n\n/**\n * Encodes custom authentication options into a 32-byte salt buffer.\n *\n * This function creates a standardized binary format for passing custom\n * authentication options to the FIDO2 authenticator through the PRF extension.\n *\n * **Salt Format Specification (32 bytes):**\n *\n * - **Byte 0**: Magic byte (0xFF) - Identifies this as a custom options salt\n * - **Byte 1**: Option flags (bitfield)\n *   - Bit 0 (0x01): CheckLiveness - Enable liveness detection\n *   - Bit 1 (0x02): CheckAge - Enable age verification\n *   - Bit 2 (0x04): CheckAgeAboveThreshold - Enable age threshold check\n *   - Bit 3 (0x08): CheckGeoLocation - Enable geolocation verification\n *   - Bits 4-7: Reserved for future use\n * - **Byte 2**: Age threshold (0-255) - The age value for verification\n * - **Bytes 3-31**: Reserved (all zeros) - Reserved for future extensions\n *\n * @param options - The custom authentication options to encode\n * @returns A 32-byte Uint8Array containing the encoded options\n *\n * @example\n * ```typescript\n * // Encode options with liveness and age checks\n * const salt = encodeCustomOptionsToSalt({\n *   checkLiveness: true,\n *   checkAge: true,\n *   checkAgeAboveThreshold: true,\n *   ageThreshold: 18\n * });\n *\n * // Use with WebAuthn PRF extension\n * const publicKeyOptions: PublicKeyCredentialRequestOptions = {\n *   challenge: new Uint8Array(32),\n *   extensions: {\n *     prf: {\n *       eval: { first: salt }\n *     }\n *   }\n * };\n * ```\n *\n * @throws {Error} If ageThreshold is provided and outside valid range (0-255)\n */\nexport function encodeCustomOptionsToSalt(options: CustomOptions = {}): Uint8Array {\n  // Validate age threshold if provided\n  if (options.ageThreshold !== undefined) {\n    if (\n      !Number.isInteger(options.ageThreshold) ||\n      options.ageThreshold < 0 ||\n      options.ageThreshold > 255\n    ) {\n      throw new Error('ageThreshold must be an integer between 0 and 255');\n    }\n  }\n\n  // Create a 32-byte salt buffer (initialized to zeros)\n  const salt = new Uint8Array(32);\n\n  // Byte 0: Set magic byte to identify custom options format\n  salt[0] = 0xff;\n\n  // Byte 1: Build options flags bitfield\n  let optionsFlags = 0;\n\n  if (options.checkLiveness) {\n    optionsFlags |= 1 << 0; // OptionFlag::CheckLiveness = 1 << 0\n  }\n  if (options.checkAge) {\n    optionsFlags |= 1 << 1; // OptionFlag::CheckAge = 1 << 1\n  }\n  if (options.checkAgeAboveThreshold) {\n    optionsFlags |= 1 << 2; // OptionFlag::CheckAgeAboveThreshold = 1 << 2\n  }\n  if (options.checkGeoLocation) {\n    optionsFlags |= 1 << 3; // OptionFlag::CheckGeoLocation = 1 << 3\n  }\n\n  salt[1] = optionsFlags;\n\n  // Byte 2: Set age threshold (default to 0 if not specified)\n  salt[2] = (options.ageThreshold ?? 0) & 0xff;\n\n  // Bytes 3-31 are already zero (default for Uint8Array)\n\n  return salt;\n}\n\n/**\n * Decodes a 32-byte salt buffer back into custom authentication options.\n *\n * This function reverses the encoding process, extracting the custom options\n * from the binary salt format. It validates the magic byte and decodes all flags.\n *\n * @param salt - The 32-byte salt buffer to decode\n * @returns The decoded custom options with metadata\n *\n * @throws {Error} If salt is not exactly 32 bytes\n *\n * @example\n * ```typescript\n * const encoded = encodeCustomOptionsToSalt({ checkLiveness: true, ageThreshold: 18 });\n * const decoded = decodeCustomOptionsFromSalt(encoded);\n *\n * console.log(decoded.isValid); // true\n * console.log(decoded.checkLiveness); // true\n * console.log(decoded.ageThreshold); // 18\n * ```\n */\nexport function decodeCustomOptionsFromSalt(salt: Uint8Array): DecodedCustomOptions {\n  // Validate salt length\n  if (salt.length !== 32) {\n    throw new Error('Salt must be exactly 32 bytes');\n  }\n\n  // Extract magic byte\n  const magicByte = salt[0];\n  const isValid = magicByte === 0xff;\n\n  // Extract options flags\n  const optionsFlags = salt[1];\n\n  // Decode individual flags\n  const checkLiveness = (optionsFlags & (1 << 0)) !== 0;\n  const checkAge = (optionsFlags & (1 << 1)) !== 0;\n  const checkAgeAboveThreshold = (optionsFlags & (1 << 2)) !== 0;\n  const checkGeoLocation = (optionsFlags & (1 << 3)) !== 0;\n\n  // Extract age threshold\n  const ageThreshold = salt[2];\n\n  return {\n    magicByte,\n    optionsFlags,\n    isValid,\n    checkLiveness,\n    checkAge,\n    checkAgeAboveThreshold,\n    checkGeoLocation,\n    ageThreshold,\n  };\n}\n\n/**\n * Validates that a salt buffer has the correct custom options format.\n *\n * @param salt - The salt buffer to validate\n * @returns true if the salt is valid (correct length and magic byte)\n *\n * @example\n * ```typescript\n * const salt = new Uint8Array(32);\n * salt[0] = 0xFF;\n *\n * if (isValidCustomOptionsSalt(salt)) {\n *   // Safe to decode\n *   const options = decodeCustomOptionsFromSalt(salt);\n * }\n * ```\n */\nexport function isValidCustomOptionsSalt(salt: Uint8Array): boolean {\n  return salt.length === 32 && salt[0] === 0xff;\n}\n","/**\n * Buffer Utility Functions\n *\n * This module provides utilities for converting between ArrayBuffer and Base64 string formats.\n * These are essential for WebAuthn operations where binary data needs to be serialized for\n * transmission or storage.\n *\n * @module utils/buffer\n */\n\n/**\n * Converts an ArrayBuffer to a Base64-encoded string.\n *\n * This function is commonly used to serialize binary data from WebAuthn credentials\n * (such as credential IDs, attestation objects, and signatures) into a string format\n * suitable for JSON serialization and HTTP transmission.\n *\n * @param buffer - The ArrayBuffer to convert\n * @returns A Base64-encoded string representation of the buffer\n *\n * @example\n * ```typescript\n * const buffer = new Uint8Array([72, 101, 108, 108, 111]).buffer;\n * const base64 = bufferToBase64(buffer);\n * console.log(base64); // \"SGVsbG8=\"\n * ```\n *\n * @remarks\n * This implementation uses a manual conversion approach rather than directly using btoa()\n * on the buffer to ensure compatibility with all buffer sizes and avoid potential issues\n * with binary data containing null bytes.\n */\nexport function bufferToBase64(buffer: ArrayBuffer): string {\n  const bytes = new Uint8Array(buffer);\n  let binary = '';\n  for (let i = 0; i < bytes.byteLength; i++) {\n    binary += String.fromCharCode(bytes[i]);\n  }\n  return window.btoa(binary);\n}\n\n/**\n * Converts a Base64 or Base64URL string back to an ArrayBuffer.\n *\n * This function is commonly used to deserialize Base64-encoded credential data\n * received from a server or retrieved from storage back into the binary format\n * required by the WebAuthn API.\n *\n * **Both alphabets are accepted, deliberately.** WebAuthn hands out the same credential in two\n * encodings at once: `bufferToBase64(rawId)` gives standard Base64 (`+`, `/`, padded) while\n * `PublicKeyCredential.id` is Base64URL (`-`, `_`, unpadded). A single result object therefore\n * carries both spellings of one credential:\n *\n * ```\n * credentialId: \"bsA9+najCxZLvNhXIg/RawfFH77...\"   // standard\n * rawCredential.id: \"bsA9-najCxZLvNhXIg_RawfFH77...\" // Base64URL\n * ```\n *\n * `atob` rejects `-` and `_` outright, so feeding it the second form threw\n * `InvalidCharacterError: The string to be decoded is not correctly encoded` — an error naming\n * neither the value nor the caller, typically surfacing from an `allowCredentials` entry that had\n * travelled through a store or a JSON round trip that normalised it. Since both spellings denote\n * the same bytes, normalising here is strictly better than making every caller guess which\n * alphabet it holds.\n *\n * Padding is restored too: Base64URL conventionally drops `=`, and `atob` requires it.\n *\n * @param base64 - The Base64 or Base64URL string to convert\n * @returns An ArrayBuffer containing the decoded binary data\n * @throws {Error} If the input is not valid in either alphabet — with the offending value in the\n *   message, unlike the bare DOMException `atob` raises\n *\n * @example\n * ```typescript\n * base64ToBuffer('SGVsbG8=');   // standard, padded\n * base64ToBuffer('SGVsbG8');    // unpadded\n * base64ToBuffer('a-b_c');      // Base64URL\n * ```\n *\n * @remarks\n * The returned ArrayBuffer can be directly used with WebAuthn APIs that expect\n * BufferSource types, such as the `id` field in credential descriptors or the\n * `challenge` field in credential request options.\n */\nexport function base64ToBuffer(base64: string): ArrayBuffer {\n  if (typeof base64 !== 'string') {\n    throw new Error(\n      `base64ToBuffer: expected a string, received ${base64 === null ? 'null' : typeof base64}.`\n    );\n  }\n\n  // Base64URL -> Base64, then restore the padding atob insists on.\n  const normalized = base64.replace(/-/g, '+').replace(/_/g, '/');\n  const padded = normalized.padEnd(Math.ceil(normalized.length / 4) * 4, '=');\n\n  let binary: string;\n  try {\n    binary = window.atob(padded);\n  } catch {\n    // atob's own message says only \"not correctly encoded\" — no value, no context. Anything\n    // reaching here is genuinely malformed rather than merely the other alphabet, and the caller\n    // needs to know WHICH string so it can be traced back to whatever stored it.\n    const preview = base64.length > 64 ? `${base64.slice(0, 64)}...` : base64;\n    throw new Error(\n      `base64ToBuffer: \"${preview}\" is not valid Base64 or Base64URL (${base64.length} chars). ` +\n        'A credential ID that has been through a URL query string is the usual cause — \"+\" ' +\n        'decodes to a space there unless it was encoded.'\n    );\n  }\n\n  const bytes = new Uint8Array(binary.length);\n  for (let i = 0; i < binary.length; i++) {\n    bytes[i] = binary.charCodeAt(i);\n  }\n  return bytes.buffer;\n}\n","/**\n * Platform Detection Utilities\n *\n * Provides functions to detect user's platform (iOS, Android, Desktop),\n * browser information, and WebAuthn API support.\n *\n * @module utils/platform\n */\n\n/**\n * Supported platform types\n */\nexport type Platform = 'iOS' | 'Android' | 'Desktop' | 'Unknown';\n\n/**\n * Browser information including name, version, and detected platform\n */\nexport interface BrowserInfo {\n  /**\n   * Browser name (e.g., 'Chrome', 'Safari', 'Firefox')\n   */\n  name: string;\n\n  /**\n   * Browser version string\n   */\n  version: string;\n\n  /**\n   * Detected platform\n   */\n  platform: Platform;\n}\n\n/**\n * Detects the user's platform based on the user agent string\n *\n * This function checks the navigator.userAgent and navigator.vendor\n * to determine if the user is on iOS, Android, Desktop, or Unknown platform.\n *\n * @returns The detected platform type\n *\n * @example\n * ```typescript\n * const platform = detectPlatform();\n * if (platform === 'iOS') {\n *   // iOS-specific logic\n * }\n * ```\n */\nexport function detectPlatform(): Platform {\n  // Check if we're in a browser environment\n  if (typeof navigator === 'undefined') {\n    return 'Unknown';\n  }\n\n  const ua = navigator.userAgent || (navigator as any).vendor || '';\n\n  // Check for Android\n  if (/android/i.test(ua)) {\n    return 'Android';\n  }\n\n  // Check for iOS\n  // Note: MSStream check is for IE11 compatibility\n  if (/iPad|iPhone|iPod/.test(ua) && !(window as any).MSStream) {\n    return 'iOS';\n  }\n\n  // Default to Desktop if we have a navigator\n  if (typeof navigator !== 'undefined') {\n    return 'Desktop';\n  }\n\n  return 'Unknown';\n}\n\n/**\n * Extracts detailed browser information including name, version, and platform\n *\n * This function parses the user agent string to determine the browser\n * name and version. It supports detection of major browsers including\n * Chrome, Safari, Firefox, Edge, and Opera.\n *\n * @returns Browser information object\n *\n * @example\n * ```typescript\n * const info = getBrowserInfo();\n * console.log(`${info.name} ${info.version} on ${info.platform}`);\n * // Output: \"Chrome 120.0 on Desktop\"\n * ```\n */\nexport function getBrowserInfo(): BrowserInfo {\n  const platform = detectPlatform();\n\n  // Default values\n  let name = 'Unknown';\n  let version = 'Unknown';\n\n  if (typeof navigator === 'undefined') {\n    return { name, version, platform };\n  }\n\n  const ua = navigator.userAgent;\n\n  // Detect browser name and version\n  // Order matters: check for more specific browsers first\n\n  // Opera (must check before Chrome)\n  if (/OPR\\//.test(ua) || /Opera\\//.test(ua)) {\n    name = 'Opera';\n    const oprMatch = ua.match(/OPR\\/([\\d.]+)/);\n    const operaMatch = ua.match(/Opera\\/([\\d.]+)/);\n    version = oprMatch ? oprMatch[1] : (operaMatch ? operaMatch[1] : version);\n  }\n  // Edge (Chromium-based)\n  else if (/Edg\\//.test(ua)) {\n    name = 'Edge';\n    const match = ua.match(/Edg\\/([\\d.]+)/);\n    version = match ? match[1] : version;\n  }\n  // Chrome\n  else if (/Chrome\\//.test(ua) && !/Edg\\//.test(ua)) {\n    name = 'Chrome';\n    const match = ua.match(/Chrome\\/([\\d.]+)/);\n    version = match ? match[1] : version;\n  }\n  // Safari\n  else if (/Safari\\//.test(ua) && !/Chrome\\//.test(ua)) {\n    name = 'Safari';\n    const match = ua.match(/Version\\/([\\d.]+)/);\n    version = match ? match[1] : version;\n  }\n  // Firefox\n  else if (/Firefox\\//.test(ua)) {\n    name = 'Firefox';\n    const match = ua.match(/Firefox\\/([\\d.]+)/);\n    version = match ? match[1] : version;\n  }\n\n  return { name, version, platform };\n}\n\n/**\n * Checks if the WebAuthn API is supported in the current browser environment\n *\n * This function verifies that the required WebAuthn API is available:\n * - window.PublicKeyCredential (existence)\n * - navigator.credentials.create and .get methods\n *\n * Note: We use a lenient check that works across all platforms including\n * Android browsers where PublicKeyCredential might not be a constructor function.\n *\n * @returns true if WebAuthn is supported, false otherwise\n *\n * @example\n * ```typescript\n * if (!checkWebAuthnSupport()) {\n *   console.error('WebAuthn is not supported in this browser');\n *   return;\n * }\n * // Proceed with WebAuthn operations\n * ```\n */\nexport function checkWebAuthnSupport(): boolean {\n  // More lenient check that works on Android browsers\n  // Some Android browsers have PublicKeyCredential as an object/interface\n  // rather than a constructor function\n  if (typeof window === 'undefined' || !window.PublicKeyCredential) {\n    return false;\n  }\n\n  // Additionally verify that navigator.credentials API is available\n  // This is the actual API we use for create/get operations\n  if (typeof navigator === 'undefined' || !navigator.credentials) {\n    return false;\n  }\n\n  // Check if the essential methods exist\n  if (typeof navigator.credentials.create !== 'function' ||\n      typeof navigator.credentials.get !== 'function') {\n    return false;\n  }\n\n  return true;\n}\n\n/**\n * Checks if the browser supports specific WebAuthn extensions\n *\n * This function verifies support for optional WebAuthn extensions like\n * PRF (Pseudo-Random Function) and largeBlob.\n *\n * @param _extension - The extension name to check (e.g., 'prf', 'largeBlob')\n * @returns Promise that resolves to true if the extension is supported\n *\n * @example\n * ```typescript\n * const prfSupported = await checkWebAuthnExtensionSupport('prf');\n * if (prfSupported) {\n *   console.log('PRF extension is supported');\n * }\n * ```\n */\nexport async function checkWebAuthnExtensionSupport(\n  _extension: string\n): Promise<boolean> {\n  if (!checkWebAuthnSupport()) {\n    return false;\n  }\n\n  try {\n    // Check if PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable exists\n    if (typeof window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable === 'function') {\n      // Note: There's no standard way to check extension support yet\n      // This is a placeholder for future extension checks\n      // For now, we assume extensions might be available if WebAuthn is supported\n      // The _extension parameter is reserved for future implementation\n      return true;\n    }\n  } catch (error) {\n    // Extension check failed\n    return false;\n  }\n\n  return false;\n}\n\n/**\n * Gets a human-readable description of the current platform\n *\n * @returns A descriptive string about the platform\n *\n * @example\n * ```typescript\n * const description = getPlatformDescription();\n * // Returns: \"Chrome 120.0 on iOS\"\n * ```\n */\nexport function getPlatformDescription(): string {\n  const info = getBrowserInfo();\n  return `${info.name} ${info.version} on ${info.platform}`;\n}\n","/**\n * Deeplink Generation for Mobile Integration\n *\n * Generates platform-specific deeplinks for iOS and Android mobile flows.\n * Supports the two-phase authentication pattern where biometric capture\n * happens in the native app (Phase 1) followed by WebAuthn ceremony (Phase 2).\n *\n * @module core/deeplink\n */\n\nimport type { Platform } from '../utils/platform';\nimport type { CustomOptions } from './encoder';\n\n/**\n * Parameters for enrollment deeplink generation\n */\nexport interface EnrollmentDeeplinkParams {\n  /**\n   * Username for enrollment\n   */\n  username: string;\n\n  /**\n   * Relying Party domain (e.g., 'example.com')\n   */\n  rp: string;\n\n  /**\n   * Return URL for callback after biometric capture\n   */\n  returnURL: string;\n\n  /**\n   * Policy ID for authenticator configuration\n   */\n  policyId: string;\n\n  /**\n   * API key for backend authentication\n   */\n  apiKey: string;\n\n  /**\n   * Optional user ID (base64-encoded).\n   *\n   * When omitted this is derived as base64(UTF-8(username)), matching the native launcher\n   * (the native iOS launcher falls back to the UTF-8 username when no userId is given). The app derives\n   * the same value itself when the param is absent, so this only removes ambiguity.\n   */\n  userId?: string;\n\n  /**\n   * Human-readable display name for the credential.\n   *\n   * Sent for parity with the native launcher, which includes it when provided. Note the app's\n   * deeplink router does not currently read `displayName` on any host — it is accepted and\n   * ignored — so this is forward-compatibility, not behaviour you can depend on yet.\n   */\n  displayName?: string;\n\n  /**\n   * Public key that unlocks `encryptedEmbedding` on the result, enabling local silent\n   * re-verification. The app stores it for the ceremony\n   * (`SharedStorage.saveVerifyPublicKey`).\n   *\n   * This SDK has no key manager, so the caller supplies the key; without it enrollment still\n   * succeeds but no encrypted embedding is ever returned.\n   */\n  verifyPublicKey?: string;\n\n  /**\n   * Caller-supplied age, used by the app to adapt enrollment — for instance skipping the\n   * document scan for under-16 users.\n   */\n  userAge?: number;\n\n  /**\n   * iOS UltraPass URL scheme without `://` (e.g. 'ultrapass' or 'ultrapass-staging').\n   *\n   * Must match the UltraPass build installed on the device. Defaults to 'ultrapass'.\n   */\n  scheme?: string;\n}\n\n/**\n * Parameters for the unified `start` deeplink.\n *\n * `ultrapass://start` is the current entry point on iOS — UltraPass decides enroll-vs-verify\n * itself by looking for a matching local credential, then reports back which one it ran by\n * appending `mode=verify` or `mode=enroll` to the return URL\n * (the app's `start` deeplink branch).\n *\n * Prefer this over the legacy `ultrapass://verify` host for authentication: the `start` branch\n * reads `options` (in the app's start branch) and routes into the same `.authenticate` flow as the\n * legacy path, so custom biometric options are fully honoured. The newer\n * `ultrapass://verify?mode=verify` branch does **not** read `options` — it only understands\n * `verifyMethod` — so migrating authentication there would silently drop them.\n */\nexport interface StartDeeplinkParams {\n  /**\n   * Relying Party ID (domain)\n   */\n  rpId: string;\n\n  /**\n   * Return URL for callback. UltraPass appends `mode=verify` or `mode=enroll` to this.\n   */\n  returnURL: string;\n\n  /**\n   * Policy ID for authenticator configuration\n   */\n  policyId: string;\n\n  /**\n   * API key for backend authentication\n   */\n  apiKey: string;\n\n  /**\n   * Username to match a local credential against\n   */\n  username?: string;\n\n  /**\n   * Optional user ID (base64-encoded)\n   */\n  userId?: string;\n\n  /**\n   * Candidate credential IDs. Sent as the `credentialIds` comma-separated list the current\n   * app expects, not the legacy singular `credentialId`.\n   */\n  credentialIds?: string[];\n\n  /**\n   * Custom biometric options. Encoded to the same 32-byte base64 payload the app validates\n   * (32 bytes, leading `0xFF`) — see the app's start-branch options decoding.\n   */\n  options?: CustomOptions;\n\n  /**\n   * When true, sends `verifyOnly=true` so UltraPass returns\n   * `status=error&reason=credential_invalid` instead of silently falling back to enrollment\n   * when no local credential matches.\n   *\n   * Authentication sets this — an explicit sign-in should fail rather than enrol.\n   */\n  verifyOnly?: boolean;\n\n  /**\n   * Pre-select the verification modality, skipping UltraPass's auth-method picker.\n   * Only 'face' and 'voice' are recognised by the app.\n   */\n  verifyMethod?: 'face' | 'voice';\n\n  /**\n   * Public key that unlocks `encryptedEmbedding` on the result, for local re-verification.\n   */\n  verifyPublicKey?: string;\n\n  /**\n   * Caller-supplied age, used by the app to adapt enrollment (e.g. skipping document scan\n   * for under-16 users).\n   */\n  userAge?: number;\n\n  /**\n   * iOS UltraPass URL scheme without `://` (e.g. 'ultrapass' or 'ultrapass-staging').\n   *\n   * Must match the UltraPass build installed on the device. Defaults to 'ultrapass'.\n   */\n  scheme?: string;\n}\n\n/**\n * Parameters for verification deeplink generation\n */\nexport interface VerificationDeeplinkParams {\n  /**\n   * Relying Party ID (domain)\n   */\n  rpId: string;\n\n  /**\n   * Return URL for callback after biometric capture\n   */\n  returnURL: string;\n\n  /**\n   * Policy ID for authenticator configuration\n   */\n  policyId: string;\n\n  /**\n   * API key for backend authentication\n   */\n  apiKey: string;\n\n  /**\n   * Optional credential ID to verify against\n   */\n  credentialId?: string;\n\n  /**\n   * Optional user ID\n   */\n  userId?: string;\n\n  /**\n   * Optional custom verification options\n   */\n  options?: CustomOptions;\n\n  /**\n   * Verification mode for backend token verification\n   * - 'default': Verify with backend (default behavior)\n   * - 'none': Skip backend verification (JWE token only)\n   */\n  verification?: 'default' | 'none';\n\n  /**\n   * iOS UltraPass URL scheme without `://` (e.g. 'ultrapass' or 'ultrapass-staging').\n   *\n   * Must match the UltraPass build installed on the device. Defaults to 'ultrapass'.\n   */\n  scheme?: string;\n}\n\n/**\n * Generates iOS enrollment deeplink\n *\n * Format: {scheme}://fido2-enroll?username={}&rp={}&returnURL={}&userId={}&displayName={}\n *         &policyId={}&apiKey={}&verifyPublicKey={}&userAge={}\n *\n * Parameter set matches the native launcher's enroll deeplink\n * (the native iOS launcher uses the `fido2-enroll` host).\n *\n * @param params - Enrollment parameters\n * @returns iOS deeplink URL\n *\n * @example\n * ```typescript\n * const deeplink = generateIOSEnrollmentDeeplink({\n *   username: 'john.doe',\n *   rp: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   policyId: 'mobile',\n *   apiKey: 'your-api-key',\n *   displayName: 'John Doe'\n * });\n * ```\n */\nexport function generateIOSEnrollmentDeeplink(params: EnrollmentDeeplinkParams): string {\n  const queryParams = new URLSearchParams();\n  queryParams.set('username', params.username);\n  queryParams.set('rp', params.rp);\n  queryParams.set('returnURL', params.returnURL);\n  queryParams.set('policyId', params.policyId);\n  queryParams.set('apiKey', params.apiKey);\n\n  // Native always sends userId, deriving it from the username when the caller does not supply\n  // one. The app performs the same derivation for an absent param, so matching here keeps the\n  // two implementations byte-comparable rather than relying on that fallback.\n  const userId = params.userId || deriveUserIdFromUsername(params.username);\n  if (userId) {\n    queryParams.set('userId', userId);\n  }\n\n  if (params.displayName) {\n    queryParams.set('displayName', params.displayName);\n  }\n\n  if (params.verifyPublicKey) {\n    queryParams.set('verifyPublicKey', params.verifyPublicKey);\n  }\n\n  if (params.userAge !== undefined) {\n    queryParams.set('userAge', String(params.userAge));\n  }\n\n  return `${params.scheme || 'ultrapass'}://fido2-enroll?${queryParams.toString()}`;\n}\n\n/**\n * Derives a userId the same way the native launcher and app do: base64 of the UTF-8 username.\n *\n * Returns undefined for an empty username, and for any value that cannot be encoded, so the\n * caller simply omits the param and lets the app fall back to its own derivation.\n *\n * @param username - Username to derive from\n * @returns Base64-encoded userId, or undefined\n */\nfunction deriveUserIdFromUsername(username: string): string | undefined {\n  if (!username) {\n    return undefined;\n  }\n\n  try {\n    const bytes = new TextEncoder().encode(username);\n    let binary = '';\n    for (const byte of bytes) {\n      binary += String.fromCharCode(byte);\n    }\n    return btoa(binary);\n  } catch {\n    return undefined;\n  }\n}\n\n/**\n * Generates the unified iOS `start` deeplink.\n *\n * Format: {scheme}://start?rpId={}&returnURL={}&policyId={}&apiKey={}&username={}\n *         &credentialIds={csv}&options={base64}&verifyOnly={}&verifyMethod={}\n *\n * UltraPass resolves enroll-vs-verify itself and reports the outcome back as `mode` on the\n * return URL, which removes the need for the browser to commit to an operation up front.\n *\n * @param params - Start parameters\n * @returns iOS deeplink URL\n *\n * @example\n * ```typescript\n * const deeplink = generateIOSStartDeeplink({\n *   rpId: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   policyId: 'mobile',\n *   apiKey: 'your-api-key',\n *   username: 'john.doe',\n *   credentialIds: ['AAA...', 'BBB...'],\n *   verifyOnly: true,\n *   options: { checkLiveness: true, checkAge: true, ageThreshold: 21 }\n * });\n * ```\n */\nexport function generateIOSStartDeeplink(params: StartDeeplinkParams): string {\n  const queryParams = new URLSearchParams();\n  queryParams.set('rpId', params.rpId);\n  queryParams.set('returnURL', params.returnURL);\n  queryParams.set('policyId', params.policyId);\n  queryParams.set('apiKey', params.apiKey);\n\n  if (params.username) {\n    queryParams.set('username', params.username);\n  }\n\n  if (params.userId) {\n    queryParams.set('userId', params.userId);\n  }\n\n  // The app expects a comma-separated list under `credentialIds`. Empty entries are dropped\n  // on its side, so filter them here rather than emitting a trailing comma.\n  const credentialIds = params.credentialIds?.filter(id => !!id);\n  if (credentialIds && credentialIds.length > 0) {\n    queryParams.set('credentialIds', credentialIds.join(','));\n  }\n\n  if (params.options) {\n    queryParams.set('options', encodeOptionsForIOS(params.options));\n  }\n\n  if (params.verifyOnly) {\n    queryParams.set('verifyOnly', 'true');\n  }\n\n  if (params.verifyMethod) {\n    queryParams.set('verifyMethod', params.verifyMethod);\n  }\n\n  if (params.verifyPublicKey) {\n    queryParams.set('verifyPublicKey', params.verifyPublicKey);\n  }\n\n  if (params.userAge !== undefined) {\n    queryParams.set('userAge', String(params.userAge));\n  }\n\n  return `${params.scheme || 'ultrapass'}://start?${queryParams.toString()}`;\n}\n\n/**\n * Generates iOS verification deeplink\n *\n * Format: {scheme}://verify?rpId={}&returnURL={}&policyId={}&apiKey={}&credentialId={}&userId={}&options={}\n *\n * @param params - Verification parameters\n * @returns iOS deeplink URL\n *\n * @example\n * ```typescript\n * const deeplink = generateIOSVerificationDeeplink({\n *   rpId: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   policyId: 'mobile',\n *   apiKey: 'your-api-key',\n *   options: {\n *     checkLiveness: true,\n *     checkAge: true,\n *     ageThreshold: 21\n *   }\n * });\n * ```\n */\nexport function generateIOSVerificationDeeplink(params: VerificationDeeplinkParams): string {\n  const queryParams = new URLSearchParams();\n  queryParams.set('rpId', params.rpId);\n  queryParams.set('returnURL', params.returnURL);\n  queryParams.set('policyId', params.policyId);\n  queryParams.set('apiKey', params.apiKey);\n\n  if (params.credentialId) {\n    queryParams.set('credentialId', params.credentialId);\n  }\n\n  if (params.userId) {\n    queryParams.set('userId', params.userId);\n  }\n\n  if (params.options) {\n    // Encode options as Base64 JSON for iOS\n    const optionsBase64 = encodeOptionsForIOS(params.options);\n    queryParams.set('options', optionsBase64);\n  }\n\n  return `${params.scheme || 'ultrapass'}://verify?${queryParams.toString()}`;\n}\n\n/**\n * Generates Android initialization deeplink\n *\n * Format: privateid://init?sessionToken={}&policyId={}\n *\n * @param apiKey - API key (used as sessionToken)\n * @param policyId - Policy ID\n * @returns Android deeplink URL\n *\n * @example\n * ```typescript\n * const deeplink = generateAndroidInitDeeplink('your-api-key', 'mobile');\n * ```\n */\nexport function generateAndroidInitDeeplink(apiKey: string, policyId: string): string {\n  const queryParams = new URLSearchParams();\n  queryParams.set('sessionToken', apiKey);\n  queryParams.set('policyId', policyId);\n\n  return `privateid://init?${queryParams.toString()}`;\n}\n\n/**\n * Action values understood by Android's `SessionInitActivity`.\n *\n * Only the preflight is exposed here; the others are listed for reference.\n * Source: `SessionInitActivity.kt` companion constants.\n */\nexport const ANDROID_ACTIONS = {\n  RESOLVE_PROFILE_AND_CREDENTIALS: 'resolve_profile_and_credentials',\n  VERIFY_CREDENTIALS: 'verify_credentials',\n  VERIFY_IDENTITY: 'verify_identity',\n  ANONYMOUS_VERIFY: 'anonymous_verify',\n  NONE: 'none'\n} as const;\n\n/**\n * Parameters for the Android resolve preflight.\n */\nexport interface AndroidResolveParams {\n  /**\n   * API key, sent as `sessionToken`\n   */\n  apiKey: string;\n\n  /**\n   * Policy ID\n   */\n  policyId: string;\n\n  /**\n   * Relying Party ID (domain). Required — the app ignores the action without it.\n   */\n  rpId: string;\n\n  /**\n   * Return URL the app redirects to with the outcome. Required for the same reason.\n   */\n  returnURL: string;\n\n  /**\n   * Candidate credential IDs to look for on the device. Sent as `credentialIdList` (CSV).\n   */\n  credentialIds?: string[];\n}\n\n/**\n * Generates the Android `resolve_profile_and_credentials` preflight deeplink.\n *\n * Format: privateid://init?sessionToken={}&policyId={}&rpId={}&returnURL={}\n *         &credentialIdList={csv}&action=resolve_profile_and_credentials\n *\n * This is Android's analogue of iOS's `ultrapass://start`: a **scan-free** check that reports\n * whether a credential for this RP already exists on the device, so the browser learns whether\n * to register or authenticate instead of guessing. The app documents it as the call to use\n * \"instead of `VERIFY_CREDENTIALS` before register/authenticate\".\n *\n * No biometric is captured — the face scan happens later, during the WebAuthn ceremony itself.\n * Both `rpId` and `returnURL` are mandatory: `SessionInitActivity` logs\n * \"RESOLVE_PROFILE_AND_CREDENTIALS requires returnURL + rpId\" and finishes silently otherwise.\n *\n * Parse the outcome with {@link parseReturnURLStatus}, which maps\n * `status=authenticate` → `mode: 'verify'` and `status=register` → `mode: 'enroll'`.\n *\n * @param params - Resolve parameters\n * @returns Android deeplink URL\n * @throws {Error} If rpId or returnURL is missing, which the app would silently ignore\n *\n * @example\n * ```typescript\n * const deeplink = generateAndroidResolveDeeplink({\n *   apiKey: 'your-api-key',\n *   policyId: 'mobile',\n *   rpId: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   credentialIds: ['AAA...', 'BBB...']\n * });\n * ```\n */\nexport function generateAndroidResolveDeeplink(params: AndroidResolveParams): string {\n  // Fail loudly rather than emitting a deeplink the app drops on the floor without a callback,\n  // which would strand the caller waiting for a redirect that never comes.\n  if (!params.rpId) {\n    throw new Error(\n      'rpId is required for the Android resolve preflight — SessionInitActivity ignores the action without it.'\n    );\n  }\n\n  if (!params.returnURL) {\n    throw new Error(\n      'returnURL is required for the Android resolve preflight — SessionInitActivity ignores the action without it.'\n    );\n  }\n\n  const queryParams = new URLSearchParams();\n  queryParams.set('sessionToken', params.apiKey);\n  queryParams.set('policyId', params.policyId);\n  queryParams.set('rpId', params.rpId);\n  queryParams.set('returnURL', params.returnURL);\n\n  // The app reads `credentialIdList` as CSV, falling back to singular `credentialId`.\n  const credentialIds = params.credentialIds?.filter(id => !!id);\n  if (credentialIds && credentialIds.length > 0) {\n    queryParams.set('credentialIdList', credentialIds.join(','));\n  }\n\n  queryParams.set('action', ANDROID_ACTIONS.RESOLVE_PROFILE_AND_CREDENTIALS);\n\n  return `privateid://init?${queryParams.toString()}`;\n}\n\n/**\n * Builds return URL with state parameters as query params\n *\n * This provides a fallback mechanism if sessionStorage doesn't persist\n * across the deeplink redirect (iOS Safari edge case). The operation type,\n * username, and apiKey are embedded in the return URL itself.\n *\n * Based on iOS dev reference implementation which uses URL params as backup.\n *\n * @param baseURL - Base return URL\n * @param operation - Operation type ('enroll' or 'verify')\n * @param params - Additional parameters to include\n * @returns Enhanced return URL with query parameters\n *\n * @example\n * ```typescript\n * const returnURL = buildReturnURLWithParams(\n *   'https://example.com/callback',\n *   'enroll',\n *   { username: 'alice', apiKey: 'test-key' }\n * );\n * // Returns: https://example.com/callback?op=enroll&username=alice&apiKey=test-key\n * ```\n */\nexport function buildReturnURLWithParams(\n  baseURL: string,\n  operation: 'enroll' | 'verify',\n  params: { username?: string; apiKey?: string; verification?: string }\n): string {\n  try {\n    const url = new URL(baseURL);\n\n    // Add operation type\n    url.searchParams.set('op', operation);\n\n    // Add username if provided\n    if (params.username) {\n      url.searchParams.set('username', params.username);\n    }\n\n    // Add apiKey if provided (used for JWE verification on callback)\n    if (params.apiKey) {\n      url.searchParams.set('apiKey', params.apiKey);\n    }\n\n    // Add verification mode if provided (critical for backend verification)\n    if (params.verification) {\n      url.searchParams.set('verification', params.verification);\n    }\n\n    return url.toString();\n  } catch (error) {\n    // If URL parsing fails, return the base URL unchanged\n    // This prevents breaking the flow if an invalid URL is provided\n    console.error('[FIDO2-JS] Failed to parse return URL:', baseURL, error);\n    return baseURL;\n  }\n}\n\n/**\n * Encodes custom options as Base64 binary for iOS\n *\n * iOS expects options in the 32-byte binary format (same as PRF salt):\n * - Byte 0: 0xFF (magic byte)\n * - Byte 1: flags bitfield (checkLiveness, checkAge, etc.)\n * - Byte 2: age threshold value\n * - Bytes 3-31: reserved (zeros)\n *\n * This MUST match the format used by the POC reference implementation.\n *\n * @param options - Custom options object\n * @returns Base64-encoded binary string (32 bytes)\n *\n * @example\n * ```typescript\n * const encoded = encodeOptionsForIOS({\n *   checkLiveness: true,\n *   checkAge: true,\n *   ageThreshold: 21\n * });\n * // Returns base64 of: [0xFF, 0x07, 21, 0, 0, ..., 0]\n * ```\n */\nexport function encodeOptionsForIOS(options: CustomOptions): string {\n  // Create 32-byte binary buffer (same format as PRF salt)\n  const salt = new Uint8Array(32);\n\n  // Byte 0: Magic byte\n  salt[0] = 0xFF;\n\n  // Byte 1: Build options flags bitfield\n  let optionsFlags = 0;\n\n  if (options.checkLiveness) {\n    optionsFlags |= 1 << 0; // OptionFlag::CheckLiveness = 1 << 0\n  }\n  if (options.checkAge) {\n    optionsFlags |= 1 << 1; // OptionFlag::CheckAge = 1 << 1\n  }\n  if (options.checkAgeAboveThreshold) {\n    optionsFlags |= 1 << 2; // OptionFlag::CheckAgeAboveThreshold = 1 << 2\n  }\n  if (options.checkGeoLocation) {\n    optionsFlags |= 1 << 3; // OptionFlag::CheckGeoLocation = 1 << 3\n  }\n\n  salt[1] = optionsFlags;\n\n  // Byte 2: Set age threshold (default to 0 if not specified)\n  salt[2] = (options.ageThreshold ?? 0) & 0xff;\n\n  // Bytes 3-31 are already zero (default for Uint8Array)\n\n  // Convert binary to base64 (matching POC implementation)\n  let binaryString = '';\n  for (let i = 0; i < salt.length; i++) {\n    binaryString += String.fromCharCode(salt[i]);\n  }\n\n  return btoa(binaryString);\n}\n\n/**\n * Generates enrollment deeplink for the specified platform\n *\n * @param platform - Target platform ('iOS' or 'Android')\n * @param params - Enrollment parameters\n * @returns Platform-specific deeplink URL\n *\n * @throws {Error} If platform is not supported\n *\n * @example\n * ```typescript\n * const platform = detectPlatform();\n * const deeplink = generateEnrollmentDeeplink(platform, {\n *   username: 'john.doe',\n *   rp: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   policyId: 'mobile',\n *   apiKey: 'your-api-key'\n * });\n * ```\n */\nexport function generateEnrollmentDeeplink(\n  platform: Platform,\n  params: EnrollmentDeeplinkParams\n): string {\n  switch (platform) {\n    case 'iOS':\n      // Enhance return URL with state params (fallback for sessionStorage)\n      const enhancedReturnURL = buildReturnURLWithParams(\n        params.returnURL,\n        'enroll',\n        {\n          username: params.username,\n          apiKey: params.apiKey\n        }\n      );\n\n      return generateIOSEnrollmentDeeplink({\n        ...params,\n        returnURL: enhancedReturnURL\n      });\n    case 'Android':\n      // Android uses init deeplink for both enrollment and verification\n      return generateAndroidInitDeeplink(params.apiKey, params.policyId);\n    default:\n      throw new Error(\n        `Deeplink generation not supported for platform: ${platform}. ` +\n          'Mobile deeplink flow is only available on iOS and Android.'\n      );\n  }\n}\n\n/**\n * Generates verification deeplink for the specified platform\n *\n * @param platform - Target platform ('iOS' or 'Android')\n * @param params - Verification parameters\n * @returns Platform-specific deeplink URL\n *\n * @throws {Error} If platform is not supported\n *\n * @example\n * ```typescript\n * const platform = detectPlatform();\n * const deeplink = generateVerificationDeeplink(platform, {\n *   rpId: 'example.com',\n *   returnURL: 'https://example.com/callback',\n *   policyId: 'mobile',\n *   apiKey: 'your-api-key',\n *   options: { checkLiveness: true }\n * });\n * ```\n */\nexport function generateVerificationDeeplink(\n  platform: Platform,\n  params: VerificationDeeplinkParams\n): string {\n  switch (platform) {\n    case 'iOS':\n      // Enhance return URL with state params (fallback for sessionStorage)\n      const enhancedReturnURL = buildReturnURLWithParams(\n        params.returnURL,\n        'verify',\n        {\n          apiKey: params.apiKey,\n          verification: params.verification || 'default' // Default to backend verification\n        }\n      );\n\n      return generateIOSVerificationDeeplink({\n        ...params,\n        returnURL: enhancedReturnURL\n      });\n    case 'Android':\n      // Android uses init deeplink for both enrollment and verification\n      return generateAndroidInitDeeplink(params.apiKey, params.policyId);\n    default:\n      throw new Error(\n        `Deeplink generation not supported for platform: ${platform}. ` +\n          'Mobile deeplink flow is only available on iOS and Android.'\n      );\n  }\n}\n\n/**\n * Checks if deeplink flow is supported on the current platform\n *\n * @param platform - Platform to check\n * @returns true if deeplink flow is supported\n *\n * @example\n * ```typescript\n * const platform = detectPlatform();\n * if (isDeeplinkSupported(platform)) {\n *   // Use mobile deeplink flow\n * } else {\n *   // Use direct WebAuthn flow\n * }\n * ```\n */\nexport function isDeeplinkSupported(platform: Platform): boolean {\n  return platform === 'iOS' || platform === 'Android';\n}\n\n/**\n * Parses return URL status from query parameters\n *\n * After the mobile app completes the biometric capture, it redirects back\n * to the return URL with a status query parameter:\n * - No status param = success\n * - ?status=error = biometric verification failed\n * - ?status=cancelled = user cancelled the operation\n *\n * Android's `resolve_profile_and_credentials` preflight reuses the same `status` param for its\n * own outcomes (`authenticate`, `register`, `deactivated`, `resolved_not_found`). Those are\n * recognised here and folded into `mode`, so a resolve callback drives the same\n * operation-selection path as the iOS `start` flow.\n *\n * @param url - URL to parse (defaults to current window.location)\n * @returns Status object with success flag and optional error message\n *\n * @example\n * ```typescript\n * // After redirect from mobile app\n * const status = parseReturnURLStatus();\n * if (!status.success) {\n *   console.error('Biometric failed:', status.error);\n * }\n * ```\n */\nexport function parseReturnURLStatus(url?: string): {\n  success: boolean;\n  error?: string;\n  cancelled?: boolean;\n  /**\n   * Which operation UltraPass actually ran, as reported by the `start` flow appending\n   * `mode=verify` / `mode=enroll` to the return URL. Absent on the legacy hosts.\n   */\n  mode?: 'enroll' | 'verify';\n  /**\n   * Machine-readable failure reason, e.g. `credential_invalid` when `verifyOnly=true` was sent\n   * and no local credential matched.\n   */\n  reason?: string;\n  /**\n   * Outcome of Android's `resolve_profile_and_credentials` preflight, when the callback came\n   * from one. No biometric has been captured at this point — the scan happens later, during\n   * the WebAuthn ceremony.\n   */\n  resolve?: {\n    status: 'authenticate' | 'register' | 'deactivated' | 'resolved_not_found';\n    /** The matching credential the app found on the device, for `authenticate`. */\n    credentialId?: string;\n    /** Owning UltraPass profile, when the app resolved one. */\n    profileId?: string;\n  };\n} {\n  const urlToParse = url || (typeof window !== 'undefined' ? window.location.href : '');\n\n  try {\n    const urlObj = new URL(urlToParse);\n    const status = urlObj.searchParams.get('status');\n\n    // The unified `start` flow reports back which operation it performed. This is the app's\n    // own account of what happened, so it outranks anything the browser guessed beforehand.\n    const rawMode = urlObj.searchParams.get('mode');\n    const mode = rawMode === 'enroll' || rawMode === 'verify' ? rawMode : undefined;\n    const reason = urlObj.searchParams.get('reason') || undefined;\n\n    if (!status) {\n      // No status parameter means success\n      return { success: true, mode };\n    }\n\n    // ── Android resolve preflight outcomes ──────────────────────────────────────────────\n    // `authenticate` / `register` are successful resolutions, not ceremony results. Mapping\n    // them onto `mode` lets the callback reuse the same operation-selection logic as iOS\n    // `start`, which is the point: on both platforms the app decides, not the browser.\n    if (status === 'authenticate' || status === 'register') {\n      const credentialId = urlObj.searchParams.get('credentialId') || undefined;\n      const profileId = urlObj.searchParams.get('profileId') || undefined;\n\n      return {\n        success: true,\n        mode: status === 'authenticate' ? 'verify' : 'enroll',\n        resolve: { status, credentialId, profileId }\n      };\n    }\n\n    if (status === 'deactivated') {\n      // The owning profile was auto-deactivated for inactivity. Not a retryable failure —\n      // the user has to reactivate in UltraPass (tier-1 document + face).\n      const message = urlObj.searchParams.get('message');\n\n      return {\n        success: false,\n        reason: reason || 'profile_deactivated',\n        error:\n          message ||\n          'This UltraPass profile has been deactivated for inactivity and must be reactivated in the UltraPass app before signing in.',\n        resolve: {\n          status,\n          credentialId: urlObj.searchParams.get('credentialId') || undefined,\n          profileId: urlObj.searchParams.get('profileId') || undefined\n        }\n      };\n    }\n\n    if (status === 'resolved_not_found') {\n      return {\n        success: false,\n        reason,\n        error:\n          reason === 'initialization_failed'\n            ? 'UltraPass could not initialize on this device, so credentials could not be resolved.'\n            : 'UltraPass could not resolve any credential for this relying party on this device.',\n        resolve: { status }\n      };\n    }\n\n    if (status === 'error') {\n      // Try to get more detailed error info from URL params\n      const errorCode = urlObj.searchParams.get('errorCode');\n      const errorMsg = urlObj.searchParams.get('errorMessage');\n\n      // `credential_invalid` is a distinct, actionable outcome rather than a biometric failure,\n      // and it has two quite different causes:\n      //\n      // 1. UltraPass found no passkey for this RP at all (verifyOnly=true suppressed the\n      //    silent enroll fallback that would otherwise have kicked in).\n      // 2. The passkey exists in UltraPass's authenticator, but no *face enrollment* is bound\n      //    to it — `resolveCredentialByIds` needs a keychain enrollment carrying an embedding\n      //    for that credential ID, and gives up when there is none\n      //    (the app's credential resolver → \"Please register again\").\n      //\n      // Case 2 is the one that looks like a bug: routing correctly chose verify (the return URL\n      // carries mode=verify), then resolution failed inside the app. Both are fixed by\n      // registering again on the device, so the message says so rather than guessing which.\n      if (reason === 'credential_invalid') {\n        return {\n          success: false,\n          reason,\n          mode,\n          error:\n            'UltraPass could not use a credential for this site on this device. Either no ' +\n            'passkey is registered here, or the registered passkey has no face enrollment ' +\n            'bound to it. Register again on this device to fix it.'\n        };\n      }\n\n      let detailedError = 'Biometric verification failed in the UltraPass app.';\n\n      if (errorMsg) {\n        detailedError += ` Details: ${errorMsg}`;\n      } else if (errorCode) {\n        detailedError += ` Error code: ${errorCode}`;\n      }\n\n      return {\n        success: false,\n        error: detailedError,\n        reason,\n        mode\n      };\n    }\n\n    if (status === 'cancelled') {\n      return {\n        success: false,\n        cancelled: true,\n        error: 'Operation was cancelled by the user.',\n        reason,\n        mode\n      };\n    }\n\n    // Unknown status\n    return {\n      success: false,\n      error: `Unknown status: ${status}`,\n      reason,\n      mode\n    };\n  } catch (error) {\n    // URL parsing failed\n    return {\n      success: false,\n      error: `Failed to parse return URL: ${error instanceof Error ? error.message : 'Unknown error'}`\n    };\n  }\n}\n","/**\n * Session State Management for Mobile Deeplink Flow\n *\n * Manages session state across deeplink redirects using sessionStorage.\n * This is critical for the two-phase mobile authentication flow where\n * the page context is lost during the deeplink redirect.\n *\n * @module utils/session\n */\n\n/**\n * Types of pending operations\n */\nexport type OperationType = 'enroll' | 'verify';\n\n/**\n * Session state data structure\n */\nexport interface SessionState {\n  /**\n   * Type of operation (enrollment or verification)\n   */\n  operation: OperationType;\n\n  /**\n   * Username (for enrollment)\n   */\n  username?: string;\n\n  /**\n   * User ID (base64-encoded)\n   */\n  userId?: string;\n\n  /**\n   * Domain/rpId\n   */\n  domain: string;\n\n  /**\n   * Display name (for enrollment)\n   */\n  displayName?: string;\n\n  /**\n   * Challenge (base64-encoded)\n   */\n  challenge?: string;\n\n  /**\n   * Credential ID (base64-encoded, for verification)\n   */\n  credentialId?: string;\n\n  /**\n   * Custom authentication options\n   */\n  customOptions?: {\n    checkLiveness?: boolean;\n    checkAge?: boolean;\n    checkAgeAboveThreshold?: boolean;\n    checkGeoLocation?: boolean;\n    ageThreshold?: number;\n  };\n\n  /**\n   * Verification mode\n   */\n  verification?: 'none' | 'default' | { custom: { endpoint: string; apiKey: string } };\n\n  /**\n   * Allowed credentials for authentication\n   */\n  allowCredentials?: string[];\n\n  /**\n   * Timeout value\n   */\n  timeout?: number;\n\n  /**\n   * Timestamp when the state was saved\n   */\n  timestamp: number;\n}\n\n/**\n * Storage key for session state\n */\nconst STORAGE_KEY = 'fido2_pending_operation';\n\n/**\n * Maximum age for session state (5 minutes)\n * After this time, the state is considered stale and will be ignored\n */\nconst MAX_STATE_AGE = 5 * 60 * 1000;\n\n/**\n * Checks if sessionStorage is available\n *\n * @returns true if sessionStorage is available\n */\nfunction isSessionStorageAvailable(): boolean {\n  try {\n    if (typeof sessionStorage === 'undefined') {\n      return false;\n    }\n    // Test if we can actually use it\n    const testKey = '__fido2_test__';\n    sessionStorage.setItem(testKey, 'test');\n    sessionStorage.removeItem(testKey);\n    return true;\n  } catch (error) {\n    return false;\n  }\n}\n\n/**\n * Saves pending operation state to sessionStorage\n *\n * This is called before redirecting to the mobile app via deeplink.\n * The state will be retrieved after the app redirects back.\n *\n * @param state - Session state to save\n *\n * @throws {Error} If sessionStorage is not available\n *\n * @example\n * ```typescript\n * savePendingOperation({\n *   operation: 'enroll',\n *   username: 'john.doe',\n *   domain: 'example.com',\n *   timestamp: Date.now()\n * });\n * ```\n */\nexport function savePendingOperation(state: SessionState): void {\n  if (!isSessionStorageAvailable()) {\n    throw new Error(\n      'sessionStorage is not available. ' +\n        'Mobile deeplink flow requires sessionStorage to preserve state across redirects.'\n    );\n  }\n\n  try {\n    const stateWithTimestamp: SessionState = {\n      ...state,\n      timestamp: Date.now()\n    };\n\n    const serialized = JSON.stringify(stateWithTimestamp);\n    sessionStorage.setItem(STORAGE_KEY, serialized);\n\n    // Mirror into localStorage as well. sessionStorage is scoped per browsing context, and iOS\n    // routinely opens the deeplink callback in a NEW TAB — where sessionStorage is empty. The\n    // callback then had to rebuild the operation from URL params, which carry only op/username/\n    // apiKey/verification, silently dropping customOptions (so no PRF salt reached Phase 2),\n    // along with the challenge and allowCredentials.\n    //\n    // localStorage is shared across tabs of the same origin, so the real state survives. It is\n    // still age-limited by MAX_STATE_AGE and cleared alongside the sessionStorage copy.\n    try {\n      if (typeof localStorage !== 'undefined') {\n        localStorage.setItem(STORAGE_KEY, serialized);\n      }\n    } catch {\n      // Non-fatal: the sessionStorage copy is the primary, this is only the cross-tab fallback.\n    }\n  } catch (error) {\n    throw new Error(\n      `Failed to save pending operation to sessionStorage: ${error instanceof Error ? error.message : 'Unknown error'}`\n    );\n  }\n}\n\n/**\n * Retrieves pending operation state from sessionStorage\n *\n * This is called after the mobile app redirects back to the website.\n * Returns null if no state exists or if the state is stale.\n *\n * @returns The session state, or null if not found or stale\n *\n * @example\n * ```typescript\n * const state = getPendingOperation();\n * if (state) {\n *   console.log('Operation type:', state.operation);\n *   console.log('Domain:', state.domain);\n * }\n * ```\n */\nexport function getPendingOperation(): SessionState | null {\n  try {\n    // Prefer sessionStorage (tab-local, so unambiguous), then fall back to the localStorage\n    // mirror — which is what survives when iOS opens the callback in a new tab.\n    let stateJson: string | null = null;\n\n    if (isSessionStorageAvailable()) {\n      stateJson = sessionStorage.getItem(STORAGE_KEY);\n    }\n\n    if (!stateJson && typeof localStorage !== 'undefined') {\n      stateJson = localStorage.getItem(STORAGE_KEY);\n    }\n\n    if (!stateJson) {\n      return null;\n    }\n\n    const state: SessionState = JSON.parse(stateJson);\n\n    // Check if state is stale\n    const age = Date.now() - state.timestamp;\n    if (age > MAX_STATE_AGE) {\n      // State is too old, clear it\n      clearPendingOperation();\n      return null;\n    }\n\n    return state;\n  } catch (error) {\n    // If parsing fails, clear the corrupted state\n    clearPendingOperation();\n    return null;\n  }\n}\n\n/**\n * Clears pending operation state from sessionStorage\n *\n * This should be called after successfully completing the operation\n * or when cancelling/aborting.\n *\n * @example\n * ```typescript\n * // After successfully completing WebAuthn ceremony\n * clearPendingOperation();\n * ```\n */\nexport function clearPendingOperation(): void {\n  try {\n    if (isSessionStorageAvailable()) {\n      sessionStorage.removeItem(STORAGE_KEY);\n    }\n    // Clear the cross-tab mirror too, or a stale operation would outlive the tab that made it.\n    if (typeof localStorage !== 'undefined') {\n      localStorage.removeItem(STORAGE_KEY);\n    }\n  } catch (error) {\n    // Silently fail if removal fails\n    console.warn('Failed to clear pending operation:', error);\n  }\n}\n\n/**\n * Checks if there is a pending operation\n *\n * @returns true if there is a valid pending operation\n *\n * @example\n * ```typescript\n * if (hasPendingOperation()) {\n *   // Handle callback from mobile app\n *   await sdk.handleDeeplinkCallback();\n * }\n * ```\n */\nexport function hasPendingOperation(): boolean {\n  return getPendingOperation() !== null;\n}\n\n/**\n * Gets the age of the current pending operation in milliseconds\n *\n * @returns Age in milliseconds, or null if no pending operation\n *\n * @example\n * ```typescript\n * const age = getPendingOperationAge();\n * if (age && age > 60000) {\n *   console.log('Operation is over 1 minute old');\n * }\n * ```\n */\nexport function getPendingOperationAge(): number | null {\n  const state = getPendingOperation();\n  if (!state) {\n    return null;\n  }\n  return Date.now() - state.timestamp;\n}\n","/**\n * WebAuthn Wrapper Module\n *\n * This module provides low-level wrappers around the native WebAuthn API\n * (navigator.credentials.create and navigator.credentials.get) with support\n * for custom extensions like PRF and LargeBlob.\n *\n * These functions preserve the exact WebAuthn logic from the working implementation\n * while adding TypeScript types, error handling, and proper abstraction.\n *\n * @module core/webauthn\n */\n\nimport { encodeCustomOptionsToSalt, type CustomOptions } from './encoder';\nimport { bufferToBase64, base64ToBuffer } from '../utils/buffer';\n\n/**\n * Options for creating a new WebAuthn credential (registration).\n */\nexport interface CreateCredentialOptions {\n  /**\n   * The username for the credential.\n   * This will be displayed during authentication.\n   */\n  username: string;\n\n  /**\n   * The relying party domain (e.g., 'example.com').\n   * Must match the current origin's domain.\n   */\n  domain: string;\n\n  /**\n   * Optional cryptographic challenge for registration.\n   * If not provided, a random 32-byte challenge will be generated.\n   */\n  challenge?: Uint8Array;\n\n  /**\n   * Optional user ID for the credential.\n   * If not provided, a random 16-byte user ID will be generated.\n   */\n  userId?: Uint8Array;\n\n  /**\n   * Optional display name for the user.\n   * If not provided, defaults to the username.\n   */\n  displayName?: string;\n\n  /**\n   * Optional relying party name.\n   * Defaults to 'WebAuthn Demo' if not provided.\n   */\n  rpName?: string;\n\n  /**\n   * Optional timeout in milliseconds.\n   * Defaults to 60000ms (60 seconds) if not provided.\n   */\n  timeout?: number;\n\n  /**\n   * Optional authenticator attachment constraint.\n   * - 'cross-platform': Roaming/external authenticator (USB HID, NFC, BLE) — use for physical UltraPass device on desktop\n   * - 'platform': Built-in authenticator (Face ID, Touch ID, Windows Hello, Android biometrics)\n   * - undefined: No constraint — browser offers all available authenticators (default)\n   */\n  authenticatorAttachment?: AuthenticatorAttachment;\n\n  /**\n   * LargeBlob support level to request at registration.\n   *\n   * The credential must declare largeBlob support at creation for the biometric-proof JWE\n   * to be readable during authentication. Defaults to 'required', matching native.\n   *\n   * @default 'required'\n   */\n  largeBlobSupport?: 'required' | 'preferred';\n\n  /**\n   * Which extension name declares blob support at registration.\n   *\n   * 'largeBlobKey' matches the working reference implementation; 'largeBlob' matches the\n   * WebAuthn Level 3 spec and native. Defaults to 'largeBlobKey'.\n   */\n  largeBlobExtension?: 'largeBlob' | 'largeBlobKey';\n\n  /**\n   * Whether to request the PRF (hmac-secret) extension.\n   *\n   * The PF adapter's enrollment template requests no PRF at all. Resolved from\n   * `SDKConfig.prfExtension` by the SDK, which knows the platform.\n   *\n   * @default true\n   */\n  requestPrf?: boolean;\n\n  /**\n   * Whether to send the CTAP2.1 `credProtect` extension keys.\n   *\n   * Resolved from `SDKConfig.credProtectExtension` by the SDK.\n   *\n   * @default true\n   */\n  requestCredProtect?: boolean;\n\n  /**\n   * Whether to enforce {@link timeout} with an AbortController.\n   *\n   * Resolved from `SDKConfig.enforceTimeoutWithAbort` by the SDK.\n   *\n   * @default false\n   */\n  enforceTimeoutWithAbort?: boolean;\n}\n\n/**\n * Result data from successful credential creation.\n */\nexport interface Credential {\n  /**\n   * Base64-encoded credential ID (rawId).\n   * This uniquely identifies the credential.\n   */\n  credentialId: string;\n\n  /**\n   * Base64-encoded attestation object.\n   * Contains authenticator data and attestation statement.\n   */\n  attestationObject: string;\n\n  /**\n   * Base64-encoded client data JSON.\n   * Contains challenge, origin, and type information.\n   */\n  clientDataJSON: string;\n\n  /**\n   * Whether the authenticator confirmed `largeBlob` support for this credential.\n   *\n   * True only when the create response echoed `largeBlob: { supported: true }`. False means the\n   * credential can never carry the biometric-proof JWE, so any later verification will fail —\n   * check this before treating a registration as usable, rather than discovering it at the next\n   * assertion.\n   */\n  largeBlobSupported: boolean;\n\n  /**\n   * Raw WebAuthn credential object.\n   * Useful for accessing extension results.\n   */\n  rawCredential: PublicKeyCredential;\n}\n\n/**\n * Options for getting an existing WebAuthn credential (authentication).\n */\nexport interface GetCredentialOptions {\n  /**\n   * The relying party domain (e.g., 'example.com').\n   * Must match the current origin's domain.\n   */\n  domain: string;\n\n  /**\n   * Optional cryptographic challenge for authentication.\n   * If not provided, a random 32-byte challenge will be generated.\n   */\n  challenge?: Uint8Array;\n\n  /**\n   * Optional array of allowed credential IDs (base64-encoded).\n   * If provided, only these credentials can be used for authentication.\n   */\n  allowedCredentials?: string[];\n\n  /**\n   * Optional custom authentication options.\n   * These will be encoded into a salt and passed via the PRF extension.\n   */\n  customOptions?: CustomOptions;\n\n  /**\n   * Optional timeout in milliseconds.\n   * Defaults to 60000ms (60 seconds) if not provided.\n   */\n  timeout?: number;\n\n  /**\n   * Optional AbortSignal to cancel the authentication request.\n   * Can be used to implement a cancel button or timeout logic.\n   */\n  signal?: AbortSignal;\n\n  /**\n   * Whether to request the PRF extension when {@link customOptions} are present.\n   *\n   * The PF adapter's assertion template requests only `largeBlob: { read: true }`. Resolved from\n   * `SDKConfig.prfExtension` by the SDK, which knows the platform.\n   *\n   * @default true\n   */\n  requestPrf?: boolean;\n\n  /**\n   * Transports hint applied to each `allowCredentials` entry, or `null` to omit it.\n   *\n   * A hint that omits the authenticator's real transport can make a valid credential\n   * unmatchable, surfacing as `NotAllowedError`. Resolved from\n   * `SDKConfig.allowCredentialsTransports` by the SDK.\n   *\n   * @default ['internal', 'hybrid', 'usb']\n   */\n  transports?: AuthenticatorTransport[] | null;\n\n  /**\n   * Whether to enforce {@link timeout} with an AbortController.\n   *\n   * Ignored when an explicit {@link signal} is supplied. Resolved from\n   * `SDKConfig.enforceTimeoutWithAbort` by the SDK.\n   *\n   * @default false\n   */\n  enforceTimeoutWithAbort?: boolean;\n\n  /**\n   * Fallback used when the assertion returns no `largeBlob`.\n   *\n   * Receives the base64 `clientDataJSON` of the completed assertion and resolves with the payload\n   * text (same shape `largeBlob` would have delivered) or null. Injected rather than called\n   * directly so this module stays free of transport concerns and testable without a socket; the\n   * SDK supplies `core/loopback.fetchAssertionPayload` when configured.\n   *\n   * Only consulted when the blob is genuinely absent, so a transport that does deliver one is\n   * unaffected.\n   */\n  fetchAssertionPayload?: (clientDataJSON: string) => Promise<string | null>;\n}\n\n/**\n * Result data from successful credential authentication.\n */\nexport interface AuthenticationResult {\n  /**\n   * Base64-encoded credential ID that was used.\n   */\n  credentialId: string;\n\n  /**\n   * Base64-encoded authenticator data.\n   * Contains RP ID hash, flags, signature counter, and extensions.\n   */\n  authenticatorData: string;\n\n  /**\n   * Base64-encoded client data JSON.\n   */\n  clientDataJSON: string;\n\n  /**\n   * Base64-encoded signature over authenticator data and client data hash.\n   */\n  signature: string;\n\n  /**\n   * Base64-encoded user handle (user ID), or null if not available.\n   */\n  userHandle: string | null;\n\n  /**\n   * The JWE token itself, or null if no biometric proof was available.\n   *\n   * Use this for display, logging, or handing to your own backend. To verify against the\n   * PrivateID endpoint use {@link verifyPayload} instead — the endpoint expects the whole\n   * payload object, not just this token.\n   */\n  jweToken: string | null;\n\n  /**\n   * Exact request body to POST to the verify endpoint, or null if no proof was available.\n   *\n   * For the current JSON blob format this is the blob with `encrypted_embedding` removed —\n   * i.e. `{\"jwe_token\":\"...\",\"device_uuid\":\"...\",\"version\":\"...\"}` — sent as the raw body.\n   * For the legacy plain-token format it is the bare token, which the API client wraps as\n   * `{ jwe_token }`.\n   *\n   * Kept separate from {@link jweToken} because the two are not interchangeable: posting\n   * the token alone drops `device_uuid`/`version`, and posting this object inside a\n   * `jwe_token` field double-wraps it.\n   */\n  verifyPayload: string | null;\n\n  /**\n   * Base64 face embedding encrypted with ECIES, or null when not present.\n   *\n   * Only populated when the credential was registered with a `verifyPublicKey`. Used for\n   * local silent re-verification; stripped from {@link verifyPayload} before sending.\n   */\n  encryptedEmbedding: string | null;\n\n  /**\n   * PRF extension results, or null if not available.\n   * Contains the pseudo-random function output.\n   */\n  prfResults: {\n    first: string; // Base64-encoded\n    second?: string; // Base64-encoded (optional)\n  } | null;\n\n  /**\n   * Raw WebAuthn assertion object.\n   * Useful for accessing additional extension results.\n   */\n  rawAssertion: PublicKeyCredential;\n}\n\n/**\n * Splits a largeBlob payload into the pieces callers need.\n *\n * Two formats exist in the wild and both must keep working:\n *\n * 1. **Current (JSON)** — `{\"jwe_token\":\"...\",\"device_uuid\":\"...\",\"version\":\"...\",\n *    \"encrypted_embedding\":\"...\"}`. The embedding is extracted separately and stripped; the\n *    remaining object is the raw verify request body. Sending only `jwe_token` here would\n *    drop `device_uuid` and `version`, which the endpoint expects.\n * 2. **Legacy (plain string)** — a bare JWE token, which the API client wraps as\n *    `{ jwe_token }`.\n *\n * Mirrors the native handling in the native iOS launcher (and\n * `verifyJWEPayload`, which posts the stripped object as the raw HTTP body).\n *\n * @param decoded - UTF-8 decoded largeBlob contents\n * @returns The token, the exact verify request body, and the encrypted embedding if present\n */\nexport function parseLargeBlobPayload(decoded: string): {\n  jweToken: string | null;\n  verifyPayload: string | null;\n  encryptedEmbedding: string | null;\n} {\n  let parsed: Record<string, unknown> | null = null;\n\n  try {\n    const candidate = JSON.parse(decoded);\n    // A JWE is a dot-delimited string, so a bare token parses as a JSON *string*, not an\n    // object. Only treat real objects as the structured format.\n    if (candidate && typeof candidate === 'object' && !Array.isArray(candidate)) {\n      parsed = candidate as Record<string, unknown>;\n    }\n  } catch {\n    // Not JSON — legacy plain-token format.\n  }\n\n  if (!parsed) {\n    const token = decoded.trim();\n    if (token.length === 0) {\n      return { jweToken: null, verifyPayload: null, encryptedEmbedding: null };\n    }\n    console.log('largeBlob: legacy plain-token format');\n    return { jweToken: token, verifyPayload: token, encryptedEmbedding: null };\n  }\n\n  const embedding = parsed.encrypted_embedding;\n  const encryptedEmbedding = typeof embedding === 'string' ? embedding : null;\n\n  // Strip the embedding — it is for local use and must not go to the verify endpoint.\n  const payloadForVerify: Record<string, unknown> = { ...parsed };\n  delete payloadForVerify.encrypted_embedding;\n\n  const token = parsed.jwe_token;\n\n  console.log(\n    `largeBlob: JSON format (encrypted_embedding: ${encryptedEmbedding ? 'present' : 'absent'})`\n  );\n\n  return {\n    jweToken: typeof token === 'string' ? token : null,\n    verifyPayload: JSON.stringify(payloadForVerify),\n    encryptedEmbedding\n  };\n}\n\n/**\n * Custom error class for WebAuthn-related errors.\n */\nexport class WebAuthnError extends Error {\n  /**\n   * Error code identifying the type of error.\n   */\n  public code: WebAuthnErrorCode;\n\n  /**\n   * Additional error details.\n   */\n  public details?: unknown;\n\n  constructor(code: WebAuthnErrorCode, message: string, details?: unknown) {\n    super(message);\n    this.name = 'WebAuthnError';\n    this.code = code;\n    this.details = details;\n  }\n}\n\n/**\n * Error codes for WebAuthn operations.\n */\nexport enum WebAuthnErrorCode {\n  /** WebAuthn API is not supported in this browser */\n  NOT_SUPPORTED = 'NOT_SUPPORTED',\n  /** User cancelled the operation */\n  USER_CANCELLED = 'USER_CANCELLED',\n  /** Operation timed out */\n  TIMEOUT = 'TIMEOUT',\n  /** Invalid parameters provided */\n  INVALID_PARAMS = 'INVALID_PARAMS',\n  /** Credential creation failed */\n  CREATION_FAILED = 'CREATION_FAILED',\n  /** Credential retrieval failed */\n  RETRIEVAL_FAILED = 'RETRIEVAL_FAILED',\n  /** Unknown error occurred */\n  UNKNOWN = 'UNKNOWN',\n}\n\n/**\n * Converts a thrown value into a plain, JSON-serializable descriptor.\n *\n * `DOMException` (and `Error`) carry `name`/`message` on the prototype as non-enumerable\n * properties, so `JSON.stringify(domException)` yields `\"{}\"` — any log or telemetry pipeline\n * that stringifies the error silently discards the only fields that identify it. A Windows\n * registration failure then reads as `{\"code\":\"CREATION_FAILED\",\"details\":{\"originalError\":{}}}`,\n * which says nothing about whether the authenticator reported NotSupportedError, ConstraintError\n * or UnknownError — three different bugs with three different fixes.\n *\n * Copying the fields onto an own-property object makes them survive serialization.\n *\n * @param error - The caught value\n * @returns A plain object safe to stringify\n */\nexport function describeError(error: unknown): Record<string, unknown> {\n  if (error instanceof Error) {\n    return {\n      name: error.name,\n      message: error.message,\n      // DOMException.code is the legacy numeric code; harmless when absent.\n      ...(typeof (error as DOMException).code === 'number' && { domCode: (error as DOMException).code }),\n      ...(error.stack && { stack: error.stack }),\n    };\n  }\n\n  if (error && typeof error === 'object') {\n    return { name: 'UnknownObject', message: String(error), raw: error };\n  }\n\n  return { name: typeof error, message: String(error) };\n}\n\n/**\n * Largest RP ID the UltraPass authenticator can store per resident key, in bytes.\n *\n * The authenticator stores each resident key's RP ID in a fixed 48-byte field and the write\n * clamps to it. The clamp is memory-safe but silent: nothing records that the value was cut,\n * so an over-long RP ID fails much later and nowhere near the cause.\n */\nexport const RK_STORE_RP_ID_MAX_BYTES = 48;\n\n/**\n * Warns when an RP ID is too long for the authenticator's resident-key store.\n *\n * Worth a dedicated check because the consequences are severe and land nowhere near the cause.\n * The C library matches credentials by `rpIdHash` (SHA-256 of the *full* RP ID), so registration\n * and the assertion both appear to work. The iOS credential-provider extension, though, compares\n * and looks up by the RP ID *string* it reads back from the resident key — now 48 bytes — against\n * the full value from the WebAuthn request. Observed on 2026-08-04 with a 51-byte RP ID:\n *\n *   rpId mismatch: stored=<51 bytes>, expected=<48 bytes>\n *   Verification not valid for selected credential — trying Face ID fallback\n *   Got 0 credential(s) from authenticator for RP: <48 bytes>\n *   Credential no longer exists in FIDO2 authenticator — cleaning up\n *   → deletes the credential AND its face enrollment\n *\n * So a too-long RP ID does not merely fail: it makes the authenticator destroy the enrollment it\n * just created, which then reads as `credential_invalid` on the next attempt and leaves an\n * embedding-less resident key behind. Naming it up front is far cheaper than tracing that chain.\n *\n * @param domain - The RP ID about to be used\n */\nfunction warnIfRpIdTooLongForStore(domain: string): void {\n  // Byte length, not character count — the C buffer is bytes, and an IDN hostname can exceed 48\n  // bytes while looking shorter.\n  const byteLength = new TextEncoder().encode(domain).length;\n\n  if (byteLength > RK_STORE_RP_ID_MAX_BYTES) {\n    console.warn(\n      `[FIDO2-JS] RP ID is ${byteLength} bytes, over the ${RK_STORE_RP_ID_MAX_BYTES}-byte limit ` +\n        `of the authenticator's resident-key store (\"${domain}\"). It will be stored truncated, ` +\n        'and on iOS the credential provider then compares the truncated value against the full ' +\n        'one, concludes the credential no longer exists, and DELETES the credential together ' +\n        'with its face enrollment — surfacing later as reason=credential_invalid. Use a hostname ' +\n        `of at most ${RK_STORE_RP_ID_MAX_BYTES} bytes.`\n    );\n  }\n}\n\n/**\n * Runs a credentials call, optionally enforcing its timeout with an AbortController.\n *\n * `publicKey.timeout` is only a hint the platform may ignore. On Windows the native WebAuthn\n * dialog can stay open well past it while the authenticator keeps retrying the face match, so\n * the ceremony never settles and the caller's `timeout` means nothing. `abort()` sends the CTAP\n * cancel, dismisses the OS dialog, and rejects — which is at least a definite outcome.\n *\n * Mirrors the PingFederate adapter's approach in\n * `ultrapass-pf-adapter/templates/ultrapass.webauthn.template.html`.\n *\n * @param invoke - Receives the abort signal (undefined when enforcement is off)\n * @param timeoutMs - Timeout to enforce\n * @param enforce - Whether to arm the controller at all\n * @param label - Included in the log line on expiry\n */\nasync function callWithEnforcedTimeout<T>(\n  invoke: (signal?: AbortSignal) => Promise<T>,\n  timeoutMs: number,\n  enforce: boolean,\n  label: string\n): Promise<T> {\n  if (!enforce || typeof AbortController === 'undefined') {\n    return invoke(undefined);\n  }\n\n  const controller = new AbortController();\n  const timer = setTimeout(() => {\n    console.warn(\n      `[FIDO2-JS] ${label}: timeout of ${timeoutMs}ms reached — aborting. The platform dialog ` +\n        'ignored publicKey.timeout.'\n    );\n    try {\n      controller.abort(new DOMException(`${label} timed out`, 'AbortError'));\n    } catch {\n      // Older browsers reject abort(reason); the signal still fires.\n      controller.abort();\n    }\n  }, timeoutMs);\n\n  try {\n    return await invoke(controller.signal);\n  } finally {\n    clearTimeout(timer);\n  }\n}\n\n/**\n * Checks if WebAuthn is supported in the current browser.\n *\n * @returns true if WebAuthn is supported, false otherwise\n */\nexport function isWebAuthnSupported(): boolean {\n  // More lenient check that works on Android browsers\n  // Some Android browsers have PublicKeyCredential as an object/interface\n  // rather than a constructor function\n  if (typeof window === 'undefined' || !window.PublicKeyCredential) {\n    return false;\n  }\n\n  // Additionally verify that navigator.credentials API is available\n  // This is the actual API we use for create/get operations\n  if (typeof navigator === 'undefined' || !navigator.credentials) {\n    return false;\n  }\n\n  // Check if the essential methods exist\n  if (typeof navigator.credentials.create !== 'function' ||\n      typeof navigator.credentials.get !== 'function') {\n    return false;\n  }\n\n  return true;\n}\n\n/**\n * Creates a new WebAuthn credential (registration).\n *\n * This function wraps the native `navigator.credentials.create()` API with:\n * - Automatic challenge and user ID generation\n * - PRF and LargeBlob extension support\n * - Type-safe options and results\n * - Comprehensive error handling\n *\n * The created credential can be stored on the server and used for future\n * authentication operations.\n *\n * @param options - Options for credential creation\n * @returns A promise that resolves to the created credential data\n * @throws {WebAuthnError} If credential creation fails\n *\n * @example\n * ```typescript\n * try {\n *   const credential = await createCredential({\n *     username: 'john.doe',\n *     domain: 'example.com',\n *     displayName: 'John Doe'\n *   });\n *\n *   console.log('Credential ID:', credential.credentialId);\n *   // Send credential to server for storage\n * } catch (error) {\n *   if (error instanceof WebAuthnError) {\n *     console.error('WebAuthn error:', error.code, error.message);\n *   }\n * }\n * ```\n *\n * @remarks\n * - Challenge: A random 32-byte value is generated if not provided\n * - User ID: A random 16-byte value is generated if not provided\n * - Extensions: PRF and LargeBlob (write support required) are enabled\n * - Attestation: Set to 'none' for privacy (no authenticator attestation)\n * - Authenticator Selection: Prefers user verification and resident keys\n */\nexport async function createCredential(\n  options: CreateCredentialOptions\n): Promise<Credential> {\n  // Validate WebAuthn support\n  if (!isWebAuthnSupported()) {\n    throw new WebAuthnError(\n      WebAuthnErrorCode.NOT_SUPPORTED,\n      'WebAuthn is not supported in this browser'\n    );\n  }\n\n  // Validate required parameters\n  if (!options.username || typeof options.username !== 'string') {\n    throw new WebAuthnError(\n      WebAuthnErrorCode.INVALID_PARAMS,\n      'username is required and must be a string'\n    );\n  }\n\n  if (!options.domain || typeof options.domain !== 'string') {\n    throw new WebAuthnError(\n      WebAuthnErrorCode.INVALID_PARAMS,\n      'domain is required and must be a string'\n    );\n  }\n\n  warnIfRpIdTooLongForStore(options.domain);\n\n  try {\n    // Generate challenge if not provided\n    const challenge = options.challenge || crypto.getRandomValues(new Uint8Array(32));\n\n    // Generate user ID if not provided\n    // Convert to UTF-8 compatible format using base64 (same as original implementation)\n    let userId: Uint8Array;\n    if (options.userId) {\n      userId = options.userId;\n    } else {\n      const randomBytes = crypto.getRandomValues(new Uint8Array(16));\n      const userIdString = bufferToBase64(randomBytes.buffer);\n      userId = new TextEncoder().encode(userIdString);\n    }\n\n    // Build PublicKeyCredentialCreationOptions (same structure as original)\n    const publicKeyCredentialCreationOptions: PublicKeyCredentialCreationOptions = {\n      challenge: challenge as BufferSource,\n      rp: {\n        name: options.rpName || 'WebAuthn Demo',\n        id: options.domain,\n      },\n      user: {\n        id: userId as BufferSource,\n        name: options.username,\n        displayName: options.displayName || options.username,\n      },\n      pubKeyCredParams: [\n        { alg: -7, type: 'public-key' }, // ES256\n        { alg: -257, type: 'public-key' }, // RS256\n      ],\n      authenticatorSelection: {\n        ...(options.authenticatorAttachment && { authenticatorAttachment: options.authenticatorAttachment }),\n        // Native registers through ASAuthorizationPlatformPublicKeyCredentialProvider, whose\n        // passkeys are ALWAYS discoverable and always user-verified — ASAuthorization exposes no\n        // residentKey knob because being resident is not optional there. 'required' is therefore\n        // the faithful browser equivalent of what the launcher produces.\n        //\n        // This was 'preferred', which let the authenticator create a NON-discoverable credential.\n        // A Phase 2 assertion that relies on resident-key discovery then has nothing to find and\n        // the browser rejects with NotAllowedError — indistinguishable from the user cancelling.\n        userVerification: 'required',\n        requireResidentKey: true,\n        residentKey: 'required',\n      },\n      timeout: options.timeout || 60000,\n      attestation: 'direct',\n      excludeCredentials: [],\n      extensions: {\n        // Each of the three blocks below is a divergence from the PF adapter's enrollment\n        // template, which sends `extensions: { largeBlob: { support: 'preferred' } }` and\n        // nothing else. They are individually switchable so a Windows failure can be bisected\n        // instead of guessed at. Defaults stay on to preserve the deeplink flows.\n        // credProtect: use CTAP2.1 flat format (top-level keys) rather than the nested\n        // WebAuthn Level 3 format ({ credProtect: { credentialProtectionPolicy, ... } }).\n        // WebAuthn relaxed its requirement to not break enterprise CTAP2.1 deployments.\n        // See: https://github.com/w3c/webauthn/issues/1430\n        //\n        // The authenticator receives the policy as a CBOR integer (\"credProtect\": N):\n        //   1 = userVerificationOptional          — no UV required (discoverable or not)\n        //   2 = userVerificationOptionalWithCredentialIDList — UV optional if allowList provided; required for discoverable\n        //   3 = userVerificationRequired           — UV always required\n        //\n        // Level 1 allows discoverable (passkey-style) auth without requiring CTAP2 UV.\n        // UltraPass performs biometric verification at the application layer via the\n        // PrivateID backend — not as a CTAP2 UV assertion.\n        ...(options.requestCredProtect !== false && {\n          credentialProtectionPolicy: 'userVerificationOptional',\n          enforceCredentialProtectionPolicy: false,\n        }),\n        ...(options.requestPrf !== false && { prf: {} }),\n        // `largeBlob` is the WebAuthn Level 3 extension that carries the biometric-proof JWE,\n        // and it is what the current launcher requests:\n        //   the native iOS launcher registers largeBlob as required\n        // paired with `assertionRequest.largeBlob = .read` on the assertion.\n        //\n        // `largeBlobKey` is a different, CTAP2-level extension for fetching a per-credential\n        // blob *key*; browsers do not map one onto the other. Older web references\n        // (webauthn_client/webauthn_v2.js, poc-deeplink) are no longer in use — do not take\n        // either as the contract.\n        ...(options.largeBlobExtension === 'largeBlobKey'\n          ? { largeBlobKey: { support: options.largeBlobSupport || 'required' } }\n          : { largeBlob: { support: options.largeBlobSupport || 'required' } }),\n      } as AuthenticationExtensionsClientInputs,\n    };\n\n    console.log('Registration options:', publicKeyCredentialCreationOptions);\n\n    // Create the credential\n    const credential = (await callWithEnforcedTimeout(\n      (signal) =>\n        navigator.credentials.create({\n          publicKey: publicKeyCredentialCreationOptions,\n          ...(signal && { signal }),\n        }),\n      options.timeout || 60000,\n      options.enforceTimeoutWithAbort === true,\n      'registration'\n    )) as PublicKeyCredential | null;\n\n    if (!credential) {\n      throw new WebAuthnError(\n        WebAuthnErrorCode.CREATION_FAILED,\n        'Credential creation returned null'\n      );\n    }\n\n    // Extract response data\n    const response = credential.response as AuthenticatorAttestationResponse;\n\n    // Did the authenticator actually accept largeBlob?\n    //\n    // Per WebAuthn L3, `largeBlob: { support: 'required' }` on create must either be honoured —\n    // echoed back as `largeBlob: { supported: true }` — or make the ceremony fail. Some\n    // providers do neither: they return success with EMPTY client extension results, leaving a\n    // credential that can never carry a blob.\n    //\n    // Worth reporting, because the blob is the only channel for the biometric-proof JWE and a\n    // credential genuinely lacking one can never verify — a failure that surfaces far from its\n    // cause, as a later `credential_invalid` rather than anything at registration.\n    //\n    // But an empty result is NOT proof the blob is missing, and the warning must not claim it is.\n    // Both mobile providers under-report here:\n    //   - iOS, 2026-08-10: `clientExtensionResults: {}` at create, then the very same credential\n    //     read 1085 bytes of blob at authentication and produced a JWE.\n    //   - Android, 2026-08-11: same empty result; the ED (extension data) flag in authData is\n    //     also clear, so nothing was negotiated at the WebAuthn layer either.\n    // largeBlob is a *client* extension, so a clear ED flag is expected regardless and proves\n    // nothing on its own — the only decisive test is whether a read at authentication returns\n    // bytes. Hence \"unconfirmed\", not \"failed\".\n    // Guarded: getClientExtensionResults is required by the spec, but this whole check exists\n    // because providers do not always follow it — crashing a successful registration over a\n    // missing diagnostic method would be a worse bug than the one being detected.\n    const creationExtensions = (typeof credential.getClientExtensionResults === 'function'\n      ? credential.getClientExtensionResults()\n      : undefined) as { largeBlob?: { supported?: boolean } } | undefined;\n    const largeBlobSupported = creationExtensions?.largeBlob?.supported === true;\n\n    if (!largeBlobSupported) {\n      const requested = options.largeBlobSupport || 'required';\n      console.warn(\n        `[FIDO2-JS] largeBlob support was requested as '${requested}' but the authenticator did ` +\n          'not confirm it (client extension results: ' +\n          `${JSON.stringify(creationExtensions || {})}).` +\n          (requested === 'required'\n            ? ' Per spec a required largeBlob should have failed the ceremony outright, so the ' +\n              'provider is not reporting the extension correctly.'\n            : '') +\n          ' This does NOT by itself mean the credential has no blob: the iOS and Android ' +\n          'providers have both returned empty extension results for credentials whose blob ' +\n          'reads back fine at authentication. Treat it as unconfirmed, not failed — authenticate ' +\n          'once and check whether the blob read returns bytes. If it comes back empty, then ' +\n          'there is genuinely no biometric-proof JWE and verification cannot succeed.'\n      );\n    }\n\n    return {\n      credentialId: bufferToBase64(credential.rawId),\n      attestationObject: bufferToBase64(response.attestationObject),\n      clientDataJSON: bufferToBase64(response.clientDataJSON),\n      largeBlobSupported,\n      rawCredential: credential,\n    };\n  } catch (error: any) {\n    // Handle specific WebAuthn error types\n    if (error instanceof WebAuthnError) {\n      throw error;\n    }\n\n    // Map DOMException errors to WebAuthnError.\n    //\n    // Every branch carries the browser's own name and message through to the WebAuthnError\n    // message, not just into `details`. The requested option set here is unusually demanding\n    // (residentKey 'required' + userVerification 'required' + attestation 'direct' + largeBlob\n    // + credProtect), so a rejection is far more likely to be an authenticator refusing one of\n    // those options than an actual user cancellation — and the two are only distinguishable by\n    // the DOMException name.\n    if (error instanceof DOMException) {\n      if (error.name === 'NotAllowedError') {\n        const detail = error.message ? ` Browser said: \"${error.message}\".` : '';\n\n        throw new WebAuthnError(\n          WebAuthnErrorCode.USER_CANCELLED,\n          `Registration was not completed (NotAllowedError).${detail} Causes: the user ` +\n            'dismissed the prompt or picker; the user declined the attestation ' +\n            '(\"see the make and model of your security key\") consent that attestation ' +\n            \"'direct' triggers on Windows; or the authenticator refused without a specific \" +\n            'reason.',\n          { originalError: describeError(error) }\n        );\n      }\n      if (error.name === 'TimeoutError' || error.name === 'AbortError') {\n        throw new WebAuthnError(\n          WebAuthnErrorCode.TIMEOUT,\n          `Registration timed out (${error.name}).`,\n          { originalError: describeError(error) }\n        );\n      }\n\n      // These are the option-refusal names. They mean the ceremony reached the authenticator\n      // and it declined a specific requested option — so the remedy is to relax that option,\n      // never to retry the same request.\n      const optionRefusalHints: Record<string, string> = {\n        // Requested option unsupported: on Windows this is most often largeBlob with\n        // support 'required' against an authenticator that has no large-blob storage, or a\n        // pubKeyCredParams algorithm mismatch.\n        NotSupportedError:\n          \"The authenticator does not support a requested option. Most likely largeBlob \" +\n          \"support 'required' (try 'preferred'), or none of the requested algorithms \" +\n          '(ES256/RS256) are supported.',\n        // A constraint could not be met: residentKey/UV are the usual culprits.\n        ConstraintError:\n          \"The authenticator could not satisfy a constraint. Most likely residentKey \" +\n          \"'required' (discoverable-credential storage full or unsupported) or \" +\n          \"userVerification 'required' with no PIN/biometric enrolled.\",\n        // Do NOT read this as \"a credential already exists\" — for the UltraPass authenticator it\n        // usually is not. the authenticator returns CTAP2_ERR_CREDENTIAL_EXCLUDED (0x19) from three\n        // places, and the third deliberately overloads it:\n        //\n        //   1. a genuine excludeList match — we send excludeCredentials: [], so not this;\n        //   2. its duplicate (rpId, username) product extension, keyed on the authenticator's own\n        //      resident-key store rather than the browser's or Windows' cache;\n        //   3. **biometric registration failed** — `bio->register_fn` returned non-zero. 0x19 is\n        //      the only status that reliably halts Windows' ceremony retry loop, so the\n        //      authenticator reuses it (\"Overloads the 'excluded' meaning, but reliably halts the\n        //      Windows retry loop\").\n        //\n        // Timing separates them: 1 and 2 are checked before any side effects and fail in\n        // milliseconds, while 3 fails only after a face capture has run — tens of seconds.\n        InvalidStateError:\n          'The authenticator refused with CREDENTIAL_EXCLUDED. For UltraPass this does NOT ' +\n          'reliably mean a duplicate credential — it also returns this when FACE REGISTRATION ' +\n          'FAILED, because it is the only error that stops Windows retrying. If this took more ' +\n          'than a few seconds, a capture ran and the biometric step failed: check the ' +\n          'authenticator service log for \"Biometric register failed\" and confirm the service\\'s ' +\n          'own apiKey/policyId and backend are right (its /status route reports them). Only if ' +\n          'it failed instantly is it a real duplicate — then remove the existing passkey ' +\n          '(Windows: Settings → Accounts → Passkeys), or change the username, since the ' +\n          'authenticator also rejects a duplicate (rpId, username).',\n        // Chrome on Android raises this when the request reached Android's Credential Manager\n        // but no provider fulfilled it. Unlike its neighbours in this map it is NOT an option\n        // refusal — the same request commonly succeeds on the next attempt, so retrying is the\n        // right first move rather than relaxing an option.\n        //\n        // Observed on 2026-08-11: a registration failed here ~9s after the ceremony started, and\n        // an identical retry 20s later completed normally. The Android flow fires\n        // `privateid://init` and waits `androidInitDelay` before calling WebAuthn, so a cold\n        // start of the UltraPass app can still be in progress when the ceremony begins.\n        NotReadableError:\n          \"Android's Credential Manager could not complete the request, which usually means no \" +\n          'provider was ready rather than that anything was misconfigured. Retry first — this ' +\n          'is frequently transient. If it repeats, the UltraPass app is likely still cold ' +\n          'starting when the ceremony begins: raise `androidInitDelay` (default 1000ms). Also ' +\n          'confirm UltraPass is enabled under Settings → Passwords & accounts → Passkeys, and ' +\n          'that Google Play services is up to date.',\n        // Windows/CTAP returned an error the browser could not map — commonly an\n        // authenticator-side failure part-way through an otherwise successful enrollment.\n        UnknownError:\n          'The platform returned an unmapped error, typically a CTAP-level failure from the ' +\n          'authenticator itself. Check the authenticator/device log for the underlying cause.',\n        SecurityError:\n          'The RP ID is not valid for this origin. The domain field must match the page ' +\n          \"origin's registrable suffix.\",\n      };\n\n      const hint = optionRefusalHints[error.name];\n\n      throw new WebAuthnError(\n        WebAuthnErrorCode.CREATION_FAILED,\n        `Credential creation failed with ${error.name}: \"${error.message}\".` +\n          (hint ? ` ${hint}` : ''),\n        { originalError: describeError(error) }\n      );\n    }\n\n    // Generic error — not a DOMException, so this is a bug in our own post-processing\n    // (buffer conversion, CBOR decode) rather than a WebAuthn refusal.\n    throw new WebAuthnError(\n      WebAuthnErrorCode.CREATION_FAILED,\n      `Credential creation failed: ${error.message}`,\n      { originalError: describeError(error) }\n    );\n  }\n}\n\n/**\n * Gets an existing WebAuthn credential (authentication).\n *\n * This function wraps the native `navigator.credentials.get()` API with:\n * - Automatic challenge generation\n * - Custom options encoding via PRF extension\n * - LargeBlob reading for JWE tokens\n * - Type-safe options and results\n * - Comprehensive error handling\n *\n * The function can authenticate with any registered credential or be restricted\n * to specific credentials via the `allowedCredentials` option.\n *\n * @param options - Options for credential retrieval\n * @returns A promise that resolves to the authentication result\n * @throws {WebAuthnError} If credential retrieval fails\n *\n * @example\n * ```typescript\n * try {\n *   const result = await getCredential({\n *     domain: 'example.com',\n *     customOptions: {\n *       checkLiveness: true,\n *       checkAge: true,\n *       ageThreshold: 18\n *     }\n *   });\n *\n *   console.log('Authenticated with credential:', result.credentialId);\n *\n *   if (result.jweToken) {\n *     // Send JWE token to server for verification\n *     console.log('JWE token:', result.jweToken);\n *   }\n * } catch (error) {\n *   if (error instanceof WebAuthnError) {\n *     console.error('Authentication failed:', error.code, error.message);\n *   }\n * }\n * ```\n *\n * @remarks\n * - Challenge: A random 32-byte value is generated if not provided\n * - Custom Options: Encoded into a 32-byte salt and passed via PRF extension\n * - LargeBlob: Automatically reads the blob and extracts JWE token\n * - PRF Results: Extracted from extension results if available\n * - Transports: Supports internal, hybrid, and USB authenticators\n */\nexport async function getCredential(\n  options: GetCredentialOptions\n): Promise<AuthenticationResult> {\n  // Validate WebAuthn support\n  if (!isWebAuthnSupported()) {\n    throw new WebAuthnError(\n      WebAuthnErrorCode.NOT_SUPPORTED,\n      'WebAuthn is not supported in this browser'\n    );\n  }\n\n  // Validate required parameters\n  if (!options.domain || typeof options.domain !== 'string') {\n    throw new WebAuthnError(\n      WebAuthnErrorCode.INVALID_PARAMS,\n      'domain is required and must be a string'\n    );\n  }\n\n  warnIfRpIdTooLongForStore(options.domain);\n\n  try {\n    // Generate challenge if not provided\n    const challenge = options.challenge || crypto.getRandomValues(new Uint8Array(32));\n\n    // Build PublicKeyCredentialRequestOptions\n    const publicKeyCredentialRequestOptions: PublicKeyCredentialRequestOptions = {\n      challenge: challenge as BufferSource,\n      rpId: options.domain,\n      timeout: options.timeout || 60000,\n      userVerification: 'required', // Require biometric verification (matches reference POC)\n      // Extensions will be added conditionally below\n    };\n\n    // Add allowed credentials if provided.\n    //\n    // The transports hint is a filter, not a preference: if it omits the transport the\n    // authenticator actually uses, the credential cannot match and the browser rejects with\n    // NotAllowedError — which looks exactly like a user cancellation. The PF adapter sends bare\n    // `{ type, id }` entries for this reason; `transports: null` reproduces that.\n    if (options.allowedCredentials && options.allowedCredentials.length > 0) {\n      const transports =\n        options.transports === undefined\n          ? (['internal', 'hybrid', 'usb'] as AuthenticatorTransport[])\n          : options.transports;\n\n      publicKeyCredentialRequestOptions.allowCredentials = options.allowedCredentials.map(\n        (credentialId) => ({\n          id: base64ToBuffer(credentialId),\n          type: 'public-key' as const,\n          ...(transports && transports.length > 0 && { transports }),\n        })\n      );\n\n      if (!transports || transports.length === 0) {\n        console.log('allowCredentials sent without a transports hint (PF-adapter behaviour)');\n      }\n    }\n\n    // ALWAYS request the largeBlob read — it carries the biometric-proof JWE, which is the\n    // whole point of a face-verified assertion. Native requests it unconditionally\n    // (matching the native iOS launcher, which reads largeBlob on assertion).\n    //\n    // This used to be gated on `options.customOptions`, so a plain authenticate() asked for\n    // no blob at all and silently produced no JWE.\n    publicKeyCredentialRequestOptions.extensions = {\n      largeBlob: {\n        read: true,\n      },\n    };\n\n    // PRF is only meaningful when there are custom options to encode into the salt — and only\n    // when the platform is willing to entertain the extension at all. The PF adapter, which is\n    // the reference that works on Windows, requests PRF nowhere.\n    if (options.customOptions && options.requestPrf === false) {\n      console.log(\n        'largeBlob read requested; PRF suppressed by config, so custom biometric options are ' +\n          'NOT conveyed through this assertion'\n      );\n    } else if (options.customOptions) {\n      const salt = encodeCustomOptionsToSalt(options.customOptions);\n      (publicKeyCredentialRequestOptions.extensions as AuthenticationExtensionsClientInputs).prf = {\n        eval: {\n          first: salt as BufferSource,  // Pass Uint8Array directly (not salt.buffer)\n        },\n      };\n      console.log('PRF + largeBlob extensions enabled with encoded custom options');\n      console.log('Custom options:', options.customOptions);\n      console.log('Encoded salt:', salt);\n      console.log('Encoded salt (base64):', bufferToBase64(salt.buffer as ArrayBuffer));\n    } else {\n      console.log('largeBlob read requested (no custom options, so no PRF)');\n    }\n\n    console.log('Authentication options:', publicKeyCredentialRequestOptions);\n\n    console.log('🔵 Calling navigator.credentials.get() - waiting for user interaction...');\n\n    // Get the credential (with optional abort signal)\n    // An explicit caller signal wins — it may be wired to a cancel button, and replacing it with\n    // our own would silently disable that.\n    const assertion = (await callWithEnforcedTimeout(\n      (signal) =>\n        navigator.credentials.get({\n          publicKey: publicKeyCredentialRequestOptions,\n          signal: options.signal || signal,\n        }),\n      options.timeout || 60000,\n      options.enforceTimeoutWithAbort === true && !options.signal,\n      'authentication'\n    )) as PublicKeyCredential | null;\n\n    console.log('🟢 navigator.credentials.get() completed! Got assertion:', assertion ? 'YES' : 'NULL');\n\n    if (!assertion) {\n      throw new WebAuthnError(\n        WebAuthnErrorCode.RETRIEVAL_FAILED,\n        'Credential retrieval returned null'\n      );\n    }\n\n    // Extract response data\n    const response = assertion.response as AuthenticatorAssertionResponse;\n\n    // Extract extension results\n    console.log('🔵 Extracting extension results...');\n    const extensionResults = assertion.getClientExtensionResults();\n    console.log('Extension results:', extensionResults);\n\n    // Extract the biometric proof from the largeBlob extension\n    let jweToken: string | null = null;\n    let verifyPayload: string | null = null;\n    let encryptedEmbedding: string | null = null;\n\n    if (extensionResults.largeBlob && (extensionResults.largeBlob as any).blob) {\n      const blobData = (extensionResults.largeBlob as any).blob as ArrayBuffer;\n      const decoded = new TextDecoder().decode(blobData);\n      console.log(`✓ Blob read successful (${blobData.byteLength} bytes)`);\n\n      const parsed = parseLargeBlobPayload(decoded);\n      jweToken = parsed.jweToken;\n      verifyPayload = parsed.verifyPayload;\n      encryptedEmbedding = parsed.encryptedEmbedding;\n    } else if (options.fetchAssertionPayload) {\n      // The Windows plugin-authenticator transport carries a ceremony as one CTAP command and the\n      // platform does not forward largeBlob across it, so the blob is absent even though the JWE\n      // was minted. Collect it from the authenticator's loopback control plane instead — see\n      // core/loopback.ts. This is a delivery fallback, not a different proof.\n      const fetched = await options.fetchAssertionPayload(\n        bufferToBase64(response.clientDataJSON)\n      );\n\n      if (fetched) {\n        const parsed = parseLargeBlobPayload(fetched);\n        jweToken = parsed.jweToken;\n        verifyPayload = parsed.verifyPayload;\n        encryptedEmbedding = parsed.encryptedEmbedding;\n        console.log('✓ Biometric proof recovered over the loopback /payload route');\n      } else {\n        console.warn(\n          '[FIDO2-JS] No largeBlob in the assertion and the loopback /payload route returned ' +\n            'nothing — no biometric proof available.\\n' +\n            'Note the assertion itself succeeded, so on the Windows plugin transport the ' +\n            'authenticator service IS running (the provider forwards CTAP over that same port). ' +\n            'The likeliest cause is therefore the page origin, not the service: browsers block a ' +\n            'PUBLIC origin (an https trycloudflare/ngrok tunnel) from reaching loopback. Serve ' +\n            'the page from http://localhost on the same machine and the fallback can connect. ' +\n            'Other possibilities: PRIVID_CONFIG_WS_ALLOWED_ORIGINS excludes this origin, or the ' +\n            'payload was already taken or expired (one-shot, 120s).'\n        );\n      }\n    } else {\n      // Not benign: no blob means no biometric proof, so face verification cannot be\n      // checked. Callers that requested verification surface this as an error.\n      console.warn(\n        '[FIDO2-JS] No largeBlob data in assertion — no biometric proof available. ' +\n          'If verification is expected, the credential may predate largeBlob support and ' +\n          'need re-registration.'\n      );\n    }\n\n    // Extract PRF results\n    let prfResults: { first: string; second?: string } | null = null;\n    if (extensionResults.prf && (extensionResults.prf as any).results) {\n      const results = (extensionResults.prf as any).results;\n      prfResults = {\n        first: bufferToBase64(results.first),\n      };\n      if (results.second) {\n        prfResults.second = bufferToBase64(results.second);\n      }\n      console.log('✓ PRF results (base64):', prfResults);\n    } else {\n      console.log('ℹ️ No PRF results available (this is OK)');\n    }\n\n    console.log('🟢 Building authentication result object...');\n\n    return {\n      credentialId: bufferToBase64(assertion.rawId),\n      authenticatorData: bufferToBase64(response.authenticatorData),\n      clientDataJSON: bufferToBase64(response.clientDataJSON),\n      signature: bufferToBase64(response.signature),\n      userHandle: response.userHandle ? bufferToBase64(response.userHandle) : null,\n      jweToken,\n      verifyPayload,\n      encryptedEmbedding,\n      prfResults,\n      rawAssertion: assertion,\n    };\n  } catch (error: any) {\n    // Handle specific WebAuthn error types\n    if (error instanceof WebAuthnError) {\n      throw error;\n    }\n\n    // Map DOMException errors to WebAuthnError\n    if (error instanceof DOMException) {\n      if (error.name === 'NotAllowedError') {\n        // NotAllowedError is deliberately vague in the spec — browsers use it for a genuine\n        // user cancellation AND for \"no credential was usable\", without distinguishing them.\n        // Reporting it as a cancellation sends debugging down the wrong path, so name the\n        // other causes too. The allowCredentials case is the common one on the deeplink\n        // callback path: registration uses residentKey 'preferred', so a discovery-only\n        // assertion can legitimately find nothing.\n        // Include the browser's own message — Safari sometimes distinguishes a real\n        // cancellation from \"no credentials available\", and the credential provider's\n        // ASExtensionError description can surface here too (e.g. UltraPass returns\n        // \"Passkey needs to be re-registered\" as credentialIdentityNotFound).\n        const detail = error.message ? ` Browser said: \"${error.message}\".` : '';\n\n        throw new WebAuthnError(\n          WebAuthnErrorCode.USER_CANCELLED,\n          `Authentication was not completed (NotAllowedError).${detail} Causes: the user ` +\n            'dismissed the prompt; no usable credential was found; or the UltraPass credential ' +\n            'provider refused. For the deeplink flow the provider requires a successful face ' +\n            'verification result in shared storage from Phase 1 and the credential present in ' +\n            'its resident-key store — check the UltraPass device log for \"No verification ' +\n            'result in shared storage\" or \"Credential ID not found in FIDO2 RK store\".',\n          { originalError: describeError(error) }\n        );\n      }\n      if (error.name === 'TimeoutError' || error.name === 'AbortError') {\n        throw new WebAuthnError(\n          WebAuthnErrorCode.TIMEOUT,\n          `Authentication timed out (${error.name}).`,\n          { originalError: describeError(error) }\n        );\n      }\n\n      // Name the DOMException rather than folding it into an anonymous failure.\n      throw new WebAuthnError(\n        WebAuthnErrorCode.RETRIEVAL_FAILED,\n        `Credential retrieval failed with ${error.name}: \"${error.message}\".`,\n        { originalError: describeError(error) }\n      );\n    }\n\n    // Generic error\n    throw new WebAuthnError(\n      WebAuthnErrorCode.RETRIEVAL_FAILED,\n      `Credential retrieval failed: ${error.message}`,\n      { originalError: describeError(error) }\n    );\n  }\n}\n","/**\n * UltraPass readiness: is the app installed, and is the user set up to use it?\n *\n * Two separate questions, with very different answers.\n *\n * **Is UltraPass selected as the credential provider?** Undetectable. Not from the web, and not\n * even from a native app that isn't UltraPass itself. iOS exposes no API for it at all; Android's\n * `CredentialManager.isEnabledCredentialProviderService()` rejects any caller whose package isn't\n * the provider's own. There is no clever workaround here — the only ground truth is the ceremony\n * outcome, which is why {@link classifyReadinessFailure} exists.\n *\n * **Is UltraPass installed?** Answerable on Chromium/Android via\n * `navigator.getInstalledRelatedApps()`, and nowhere else. On iOS the honest answer is \"unknown\",\n * and the right move is to let Safari answer it: a Smart App Banner meta tag makes Safari itself\n * render OPEN vs GET. Safari knows; script does not. See {@link getSmartAppBannerContent}.\n *\n * Note the asymmetry that follows: on iOS the *user* can be shown an accurate install state that\n * the *page* is never told, so nothing here should gate behaviour on knowing it.\n *\n * Probing the `ultrapass://` scheme is deliberately not offered. On iOS Safari a scheme with no\n * handler produces a visible \"cannot open the page\" dialog, so the probe costs the user an error\n * modal to learn something it then cannot report reliably anyway.\n *\n * Because installation is only partly knowable and selection is not knowable at all, guidance is\n * unconditional on mobile rather than gated on a check. {@link getSetupGuidance} returns copy\n * ported from the native apps so the web instructions match what users are told in-app.\n *\n * @module core/readiness\n */\n\nimport { Platform } from '../utils/platform';\n\n/**\n * How confident we are that UltraPass is present on the device.\n *\n * There is no `not-configured`: whether the user selected UltraPass in their passkey settings is\n * not observable, so it is never a state this module reports.\n */\nexport type InstallStatus =\n  /** Positively confirmed present. Only ever produced by a Digital Asset Links match. */\n  | 'installed'\n  /** Positively confirmed absent. Only ever produced by a Digital Asset Links match. */\n  | 'not-installed'\n  /** No mechanism available on this platform/browser. The default, and not a failure. */\n  | 'unknown';\n\n/**\n * Result of an installation check, including why it reached that answer.\n */\nexport interface InstallCheckResult {\n  /** What we could determine. */\n  status: InstallStatus;\n\n  /**\n   * Which mechanism produced {@link status}.\n   *\n   * - `related-apps` — `navigator.getInstalledRelatedApps()` returned an answer.\n   * - `unsupported` — the API does not exist in this browser (everything but Chromium/Android).\n   * - `not-configured` — the API exists but no `androidPackageName` was supplied to check for.\n   * - `error` — the API threw; see {@link InstallCheckResult.detail}.\n   */\n  method: 'related-apps' | 'unsupported' | 'not-configured' | 'error';\n\n  /** Human-readable note for logs. Never shown to users. */\n  detail?: string;\n}\n\n/**\n * A single numbered step in the provider setup instructions.\n */\nexport interface SetupStep {\n  /** 1-based position. */\n  number: number;\n\n  /**\n   * Step text. May contain `**bold**` spans, matching the native strings this is ported from\n   * (`autofill.step.*`), which mark up the literal Settings labels the user is looking for.\n   */\n  text: string;\n}\n\n/**\n * Platform-specific copy telling a user how to make UltraPass usable.\n *\n * Ported from the native apps so a user who has seen the in-app screen reads the same words here.\n * Every field is overridable through {@link ReadinessCopyOverrides}.\n */\nexport interface SetupGuidance {\n  /** Platform this guidance targets. */\n  platform: Platform;\n\n  /** Short heading. iOS: `autofill.title`. */\n  title: string;\n\n  /** One-line statement of what is required. iOS: `autofill.requirement`. */\n  requirement: string;\n\n  /** Longer explanation of why. iOS: `autofill.alertBody`. */\n  body: string;\n\n  /** Ordered Settings steps. iOS: `autofill.step.*`. */\n  steps: SetupStep[];\n\n  /** Reassurance that the flow resumes on return. iOS: `autofill.returnHint`. */\n  returnHint: string;\n\n  /** Label for the \"get the app\" action. */\n  installLabel: string;\n\n  /** What the user is told when they picked the wrong provider mid-ceremony. */\n  wrongProviderMessage: string;\n\n  /** Store URL for this platform, if one is configured. */\n  storeUrl?: string;\n}\n\n/**\n * Per-platform copy overrides, merged field-by-field over the defaults.\n *\n * Every string an integrator might need to reword or localize is reachable from here — nothing in\n * this module hardcodes user-visible text that cannot be replaced.\n */\nexport type ReadinessCopyOverrides = {\n  [P in 'iOS' | 'Android' | 'Desktop' | 'Unknown']?: Partial<Omit<SetupGuidance, 'platform'>>;\n};\n\n/**\n * Inputs for the readiness helpers.\n *\n * Deliberately not the full `SDKConfig`: these helpers are useful on a landing page before an SDK\n * instance exists, which is exactly when the guidance matters most.\n */\nexport interface ReadinessOptions {\n  /**\n   * Android package name to look for, and the subject of the Digital Asset Links association.\n   *\n   * @default 'com.privateid.ultrapass'\n   */\n  androidPackageName?: string;\n\n  /**\n   * Numeric App Store ID for the iOS Smart App Banner — digits only, no `id` prefix.\n   *\n   * Defaults to {@link ULTRAPASS_APP_STORE_ID}. Pass `''` to suppress the banner entirely.\n   */\n  appleItunesAppId?: string;\n\n  /** Store URLs, keyed by platform. */\n  appStoreUrls?: {\n    iOS?: string;\n    Android?: string;\n  };\n\n  /** Copy overrides, merged over {@link DEFAULT_READINESS_COPY}. */\n  copy?: ReadinessCopyOverrides;\n}\n\n/**\n * Default Android package name for UltraPass.\n *\n * Matches `ProviderChecker.providerPackage` in the Android launcher.\n */\nexport const DEFAULT_ANDROID_PACKAGE = 'com.privateid.ultrapass';\n\n/**\n * Numeric App Store ID for Ultrapass, verified 2026-08-13 against the live listing\n * (`apps.apple.com/app/ultrapass/id6758148839`, seller \"PRIVATE IDENTITY LLC\").\n *\n * Note this is the **production** listing. Staging UltraPass is a separate app distributed\n * outside the App Store, so a staging-configured page should pass `appleItunesAppId: ''` rather\n * than send testers to install the production build alongside it.\n */\nexport const ULTRAPASS_APP_STORE_ID = '6758148839';\n\n/**\n * Public store URLs for production UltraPass.\n */\nexport const ULTRAPASS_STORE_URLS = {\n  iOS: `https://apps.apple.com/app/ultrapass/id${ULTRAPASS_APP_STORE_ID}`,\n  Android: `https://play.google.com/store/apps/details?id=${DEFAULT_ANDROID_PACKAGE}`\n} as const;\n\n/**\n * Default setup copy, ported from the native apps.\n *\n * iOS strings come from `Localizable.xcstrings` (`autofill.*`), rendered natively by\n * `EnableAutoFillView.swift`. Android has no equivalent step-by-step screen, so its steps are\n * written to match the Android Settings labels, while its wrong-provider line is taken verbatim\n * from `demo_msg_wrong_provider` in the Android client demo.\n *\n * Kept as a plain exported constant so integrators can diff their overrides against it.\n */\nexport const DEFAULT_READINESS_COPY: Record<\n  'iOS' | 'Android' | 'Desktop' | 'Unknown',\n  Omit<SetupGuidance, 'platform' | 'storeUrl'>\n> = {\n  iOS: {\n    title: 'Enable Ultrapass AutoFill',\n    requirement: 'Passkey authentication requires Ultrapass to be enabled in your device Settings.',\n    body:\n      'To complete this action, Ultrapass needs to be set up as an AutoFill provider on your ' +\n      'device.\\n\\nThis allows Ultrapass to securely provide passkeys when websites and apps ' +\n      'request authentication.',\n    steps: [\n      { number: 1, text: 'Open **Settings** on your device' },\n      { number: 2, text: 'Go to **General**' },\n      { number: 3, text: 'Tap **AutoFill and Passwords**' },\n      { number: 4, text: 'Enable **Ultrapass**' }\n    ],\n    returnHint: 'After enabling, return to this page. The process will continue automatically.',\n    installLabel: 'Get UltraPass',\n    wrongProviderMessage:\n      'Wrong passkey provider selected. Please select UltraPass from the passkey provider list.'\n  },\n  Android: {\n    title: 'Enable UltraPass as your passkey provider',\n    requirement:\n      'Passkey authentication requires UltraPass to be enabled in Settings > Passkeys & Passwords.',\n    body:\n      'To complete this action, UltraPass needs to be enabled as a passkey provider on your ' +\n      'device.\\n\\nThis allows UltraPass to securely provide passkeys when websites and apps ' +\n      'request authentication.',\n    steps: [\n      { number: 1, text: 'Open **Settings** on your device' },\n      { number: 2, text: 'Go to **Passwords & accounts**' },\n      { number: 3, text: 'Tap **Passkeys, passwords & data services**' },\n      { number: 4, text: 'Enable **UltraPass**' }\n    ],\n    returnHint: 'After enabling, return to this page. The process will continue automatically.',\n    installLabel: 'Get UltraPass on Google Play',\n    wrongProviderMessage:\n      'Wrong passkey provider selected. Please select UltraPass from the passkey provider list.'\n  },\n  Desktop: {\n    title: 'Use UltraPass on this computer',\n    requirement:\n      'Sign in with UltraPass on the desktop by scanning the QR code your browser shows, or by ' +\n      'using an UltraPass security key.',\n    body:\n      'Desktop browsers reach UltraPass through the operating system, either over the cross-device ' +\n      'QR flow or through a connected UltraPass device.',\n    steps: [],\n    returnHint: '',\n    installLabel: 'Get UltraPass',\n    wrongProviderMessage:\n      'Wrong passkey provider selected. Please select UltraPass from the passkey provider list.'\n  },\n  Unknown: {\n    title: 'UltraPass required',\n    requirement: 'This sign-in needs the UltraPass app and it enabled as your passkey provider.',\n    body: 'Install UltraPass and enable it as a passkey provider to continue.',\n    steps: [],\n    returnHint: '',\n    installLabel: 'Get UltraPass',\n    wrongProviderMessage:\n      'Wrong passkey provider selected. Please select UltraPass from the passkey provider list.'\n  }\n};\n\n/**\n * Shape of `navigator.getInstalledRelatedApps()`, which TypeScript's DOM lib does not declare.\n */\ninterface RelatedApplication {\n  platform: string;\n  id?: string;\n  url?: string;\n  version?: string;\n}\n\n/**\n * Checks whether UltraPass is installed.\n *\n * Only Chromium on Android can answer. Everywhere else this resolves to `unknown`, which callers\n * should treat as \"show the guidance anyway\" rather than as an error — the whole point of this\n * module is that unconditional guidance is the fallback.\n *\n * Even on Android, a positive result means only that the app is present. It says nothing about\n * whether the user enabled it as a credential provider, which is not observable.\n *\n * Three things must all be true for a real answer on Android:\n *\n * 1. The page serves a web app manifest whose `related_applications` lists the Play package, with\n *    `prefer_related_applications` present.\n * 2. The origin serves `/.well-known/assetlinks.json` naming that package and its SHA-256 signing\n *    fingerprint — obtainable only from whoever signs the UltraPass release.\n * 3. The page is on HTTPS.\n *\n * Miss any of them and the call returns an empty list, which is indistinguishable from \"not\n * installed\". This function therefore reports `not-installed` on an empty list only when a package\n * name was supplied; treat that verdict as advisory and never as a hard block.\n *\n * @param options - Package name to look for\n * @returns What could be determined, and by what means. Never rejects.\n *\n * @example\n * ```typescript\n * const { status } = await checkUltraPassInstalled();\n * if (status === 'not-installed') {\n *   showInstallPrompt();\n * }\n * ```\n */\nexport async function checkUltraPassInstalled(\n  options: ReadinessOptions = {}\n): Promise<InstallCheckResult> {\n  const packageName = options.androidPackageName || DEFAULT_ANDROID_PACKAGE;\n\n  if (typeof navigator === 'undefined') {\n    return { status: 'unknown', method: 'unsupported', detail: 'No navigator (non-browser)' };\n  }\n\n  const getInstalledRelatedApps = (\n    navigator as Navigator & {\n      getInstalledRelatedApps?: () => Promise<RelatedApplication[]>;\n    }\n  ).getInstalledRelatedApps;\n\n  if (typeof getInstalledRelatedApps !== 'function') {\n    return {\n      status: 'unknown',\n      method: 'unsupported',\n      detail: 'navigator.getInstalledRelatedApps is unavailable (Chromium/Android only)'\n    };\n  }\n\n  if (!packageName) {\n    return { status: 'unknown', method: 'not-configured', detail: 'No androidPackageName' };\n  }\n\n  try {\n    const apps = await getInstalledRelatedApps.call(navigator);\n    const match = apps.find((app) => app.platform === 'play' && app.id === packageName);\n\n    if (match) {\n      return {\n        status: 'installed',\n        method: 'related-apps',\n        detail: `Matched ${packageName}${match.version ? ` v${match.version}` : ''}`\n      };\n    }\n\n    return {\n      status: 'not-installed',\n      method: 'related-apps',\n      detail:\n        apps.length === 0\n          ? 'No related apps reported — may also mean the manifest or assetlinks.json is missing'\n          : `Related apps reported, none matching ${packageName}`\n    };\n  } catch (error) {\n    return {\n      status: 'unknown',\n      method: 'error',\n      detail: error instanceof Error ? error.message : String(error)\n    };\n  }\n}\n\n/**\n * Builds the `content` value for an iOS Smart App Banner meta tag.\n *\n * This is the only way a web page gets an install affordance whose state is actually correct on\n * iOS. Safari resolves the app ID against what is installed and labels the banner OPEN or GET\n * itself. Script never learns which — but the user sees the right button, which is the part that\n * matters.\n *\n * Safari on iOS only. Chrome and Firefox on iOS ignore the tag, and so does every desktop browser.\n *\n * @param options - Must include `appleItunesAppId`\n * @param extras - Optional `app-argument` deep link, and affiliate parameters\n * @returns The `content` string, or `null` if no app ID was configured\n *\n * @example\n * ```typescript\n * const content = getSmartAppBannerContent({ appleItunesAppId: '1234567890' });\n * if (content) {\n *   const meta = document.createElement('meta');\n *   meta.name = 'apple-itunes-app';\n *   meta.content = content;\n *   document.head.appendChild(meta);\n * }\n * ```\n */\nexport function getSmartAppBannerContent(\n  options: ReadinessOptions = {},\n  extras: { appArgument?: string; affiliateData?: string } = {}\n): string | null {\n  // `?? default` rather than `|| default`: an explicit '' is how a caller suppresses the banner\n  // (staging pages, where the production listing is the wrong app to advertise).\n  const appId = (options.appleItunesAppId ?? ULTRAPASS_APP_STORE_ID).trim();\n\n  if (!appId) {\n    return null;\n  }\n\n  const parts = [`app-id=${appId}`];\n\n  if (extras.affiliateData) {\n    parts.push(`affiliate-data=${extras.affiliateData}`);\n  }\n\n  if (extras.appArgument) {\n    parts.push(`app-argument=${extras.appArgument}`);\n  }\n\n  return parts.join(', ');\n}\n\n/**\n * Installs the iOS Smart App Banner meta tag into the document head.\n *\n * Idempotent: an existing `apple-itunes-app` tag is updated rather than duplicated. Safari only\n * honours the tag on page load, so call this before first paint — adding it later has no effect\n * until the next navigation.\n *\n * @param options - Must include `appleItunesAppId`\n * @param extras - Passed through to {@link getSmartAppBannerContent}\n * @returns `true` if a tag was written\n */\nexport function installSmartAppBanner(\n  options: ReadinessOptions = {},\n  extras: { appArgument?: string; affiliateData?: string } = {}\n): boolean {\n  if (typeof document === 'undefined') {\n    return false;\n  }\n\n  const content = getSmartAppBannerContent(options, extras);\n  if (!content) {\n    return false;\n  }\n\n  let meta = document.querySelector<HTMLMetaElement>('meta[name=\"apple-itunes-app\"]');\n\n  if (!meta) {\n    meta = document.createElement('meta');\n    meta.name = 'apple-itunes-app';\n    document.head.appendChild(meta);\n  }\n\n  meta.content = content;\n  return true;\n}\n\n/**\n * Returns the setup guidance to show for a platform.\n *\n * Not conditional on any check, by design — whether the user selected UltraPass as their provider\n * cannot be observed, so guidance that waits for a negative signal would never appear.\n *\n * @param platform - Target platform, usually from `detectPlatform()`\n * @param options - Store URLs and copy overrides\n * @returns Fully resolved copy, defaults merged with any overrides\n *\n * @example\n * ```typescript\n * const guidance = getSetupGuidance(detectPlatform(), {\n *   appStoreUrls: { iOS: 'https://apps.apple.com/app/ultrapass/id1234567890' }\n * });\n * heading.textContent = guidance.title;\n * ```\n */\nexport function getSetupGuidance(\n  platform: Platform,\n  options: ReadinessOptions = {}\n): SetupGuidance {\n  const base = DEFAULT_READINESS_COPY[platform] || DEFAULT_READINESS_COPY.Unknown;\n  const override = options.copy?.[platform] || {};\n\n  const storeUrl =\n    platform === 'iOS'\n      ? (options.appStoreUrls?.iOS ?? ULTRAPASS_STORE_URLS.iOS)\n      : platform === 'Android'\n        ? (options.appStoreUrls?.Android ?? ULTRAPASS_STORE_URLS.Android)\n        : undefined;\n\n  return {\n    platform,\n    title: override.title ?? base.title,\n    requirement: override.requirement ?? base.requirement,\n    body: override.body ?? base.body,\n    steps: override.steps ?? base.steps,\n    returnHint: override.returnHint ?? base.returnHint,\n    installLabel: override.installLabel ?? base.installLabel,\n    wrongProviderMessage: override.wrongProviderMessage ?? base.wrongProviderMessage,\n    storeUrl: override.storeUrl ?? storeUrl\n  };\n}\n\n/**\n * Why a ceremony looks like it failed for readiness reasons rather than for real ones.\n */\nexport type ReadinessFailureKind =\n  /** No provider offered a credential. Usually UltraPass is absent or not enabled in Settings. */\n  | 'provider-unavailable'\n  /** A credential came back, but from some other authenticator. The user picked the wrong one. */\n  | 'wrong-provider'\n  /** The failure does not look readiness-related; report it as itself. */\n  | 'unrelated';\n\n/**\n * A ceremony failure classified against the readiness cases, with copy to show.\n */\nexport interface ReadinessFailure {\n  kind: ReadinessFailureKind;\n\n  /** Message to show the user. Empty for `unrelated` — the caller's own error text applies. */\n  message: string;\n\n  /** Whether showing the full setup steps is warranted. */\n  shouldShowGuidance: boolean;\n}\n\n/**\n * Classifies a ceremony error as a readiness problem or a genuine one.\n *\n * This is where the \"user never selected UltraPass\" case is finally caught. It cannot be detected\n * up front, so it surfaces here — as a `NotAllowedError`, or as an AAGUID mismatch when some other\n * provider answered instead.\n *\n * `NotAllowedError` is inherently ambiguous: the WebAuthn spec has the browser report a plain user\n * cancellation and an unsatisfiable request identically, precisely so that pages cannot probe for\n * what a user has installed. This maps it to `provider-unavailable` because a user who cancelled\n * loses nothing by seeing the setup steps, while a user with no working provider is stuck without\n * them.\n *\n * @param error - The thrown error\n * @param platform - Platform whose copy to use\n * @param options - Copy overrides\n * @returns Classification plus the message to show\n *\n * @example\n * ```typescript\n * try {\n *   await sdk.register({ username });\n * } catch (error) {\n *   const failure = classifyReadinessFailure(error, detectPlatform());\n *   if (failure.shouldShowGuidance) showSetupPanel(failure.message);\n *   else showError(error);\n * }\n * ```\n */\nexport function classifyReadinessFailure(\n  error: unknown,\n  platform: Platform,\n  options: ReadinessOptions = {}\n): ReadinessFailure {\n  const guidance = getSetupGuidance(platform, options);\n  const name = (error as { name?: string } | null)?.name || '';\n  const code = (error as { code?: string } | null)?.code || '';\n  const rawMessage = (error as { message?: string } | null)?.message || '';\n  const message = rawMessage.toLowerCase();\n\n  // An AAGUID mismatch means some authenticator did respond — it just was not UltraPass. That is\n  // the wrong-provider case exactly, and the only one we can identify positively.\n  const isAaguidMismatch =\n    code === 'AAGUID_MISMATCH' ||\n    name === 'VerificationError' ||\n    message.includes('aaguid');\n\n  if (isAaguidMismatch) {\n    return {\n      kind: 'wrong-provider',\n      message: guidance.wrongProviderMessage,\n      shouldShowGuidance: true\n    };\n  }\n\n  // Android Credential Manager surfaces a missing/disabled provider through these; the strings\n  // match ProviderChecker.isProviderNotEnabledError() in the Android launcher.\n  const isNoProvider =\n    name === 'NotAllowedError' ||\n    message.includes('no create options available') ||\n    message.includes('no credential options available') ||\n    message.includes('nocreateoption') ||\n    message.includes('nocredential');\n\n  if (isNoProvider) {\n    return {\n      kind: 'provider-unavailable',\n      message: guidance.requirement,\n      shouldShowGuidance: true\n    };\n  }\n\n  return { kind: 'unrelated', message: '', shouldShowGuidance: false };\n}\n","/**\n * Typed projection over the /v4/fido2/verify response.\n *\n * Ports `VerifiedSummary` from the native launchers so browser callers gate access\n * on the same rules as iOS and Android instead of hand-parsing the raw response.\n *\n * @module core/verified-summary\n */\n\n/**\n * Typed view of a verification response.\n *\n * Field semantics match the native `VerifiedSummary` exactly. In particular, a predicate\n * that is `null` was **not requested** — it is not a failure. Only an explicit `false`\n * counts against the result.\n */\nexport interface VerifiedSummary {\n  /**\n   * Whether the verify endpoint returned a usable, error-free payload.\n   */\n  verified: boolean;\n\n  /**\n   * Face-match result from `predicates.face_match_pass`.\n   * `null` when the check was not present in the response.\n   */\n  faceMatch: boolean | null;\n\n  /**\n   * Liveness / presentation-attack-detection result from `predicates.pad_pass`.\n   * `null` when the check was not present in the response.\n   */\n  livenessPass: boolean | null;\n\n  /**\n   * Age-check result from `predicates.age_pass`.\n   * `null` when no age predicate was requested.\n   */\n  agePass: boolean | null;\n\n  /**\n   * Non-null when the verify endpoint (or the decoder) returned an error instead of a\n   * predicate payload. When set, treat the result as unverified.\n   */\n  errorDescription: string | null;\n\n  /**\n   * `true` only when `verified` is true, no error is present, and no predicate that IS\n   * present failed. An absent predicate does not block the result.\n   *\n   * This is the value to gate access on.\n   */\n  allChecksPassed: boolean;\n\n  /**\n   * The raw decoded verify response, for fields not surfaced above.\n   */\n  verifiedData: Record<string, unknown> | null;\n}\n\n/**\n * Decoded biometric-proof predicates carried by the JWE payload.\n *\n * @see BACKEND_API.md \"JWE Token Payload\"\n */\ninterface PredicatePayload {\n  predicates?: {\n    face_match_pass?: unknown;\n    pad_pass?: unknown;\n    age_pass?: unknown;\n    age_threshold?: unknown;\n    assurance_level?: unknown;\n  };\n}\n\n/**\n * Reads a value only if it is a real boolean.\n *\n * Anything else (missing, null, string, number) becomes `null` — \"not present\" rather\n * than a coerced pass/fail. Matches the native `as? Bool` behaviour.\n */\nfunction optionalBoolean(value: unknown): boolean | null {\n  return typeof value === 'boolean' ? value : null;\n}\n\n/**\n * Computes `allChecksPassed` from the individual fields.\n *\n * Mirrors the native rule: require `verified` and no error, then reject only on an\n * explicit `false`. A `null` predicate is not a failure.\n */\nfunction computeAllChecksPassed(fields: {\n  verified: boolean;\n  faceMatch: boolean | null;\n  livenessPass: boolean | null;\n  agePass: boolean | null;\n  errorDescription: string | null;\n}): boolean {\n  if (fields.errorDescription !== null) return false;\n  if (!fields.verified) return false;\n  if (fields.faceMatch === false) return false;\n  if (fields.livenessPass === false) return false;\n  if (fields.agePass === false) return false;\n  return true;\n}\n\n/**\n * Builds a typed {@link VerifiedSummary} from a raw verify response.\n *\n * The response nests the predicate payload as a JSON *string* under `payload.payload`,\n * which is parsed here. When that structure is missing the summary still reports\n * `verified`, with all predicates `null` — the same degradation as native.\n *\n * @param raw - Decoded JSON body from the verify endpoint, or null/undefined\n * @returns A typed summary, or `null` when there was no response at all\n *\n * @example\n * ```typescript\n * const summary = parseVerifiedSummary(response);\n * if (summary?.allChecksPassed) {\n *   grantAccess();\n * } else {\n *   denyAccess(summary?.errorDescription ?? 'checks did not pass');\n * }\n * ```\n */\nexport function parseVerifiedSummary(raw: unknown): VerifiedSummary | null {\n  if (raw === null || raw === undefined || typeof raw !== 'object') {\n    return null;\n  }\n\n  const response = raw as Record<string, unknown>;\n\n  // Error responses short-circuit: the endpoint returned a failure instead of predicates.\n  // Client-side failures are folded into this same shape ({ error: message }) so callers\n  // have one path to check, matching native.\n  if (typeof response.error === 'string') {\n    return {\n      verified: false,\n      faceMatch: null,\n      livenessPass: null,\n      agePass: null,\n      errorDescription: response.error,\n      allChecksPassed: false,\n      verifiedData: response\n    };\n  }\n\n  const verified = response.verified === true;\n\n  // Predicates live in a JSON string nested two levels deep: payload.payload\n  let predicates: PredicatePayload['predicates'];\n  const payloadContainer = response.payload as Record<string, unknown> | undefined;\n  const payloadString = payloadContainer?.payload;\n\n  if (typeof payloadString === 'string') {\n    try {\n      const parsed = JSON.parse(payloadString) as PredicatePayload;\n      if (parsed && typeof parsed === 'object' && typeof parsed.predicates === 'object') {\n        predicates = parsed.predicates ?? undefined;\n      }\n    } catch {\n      // Undecodable payload — fall through with null predicates rather than failing the\n      // whole summary. `verified` still reflects what the endpoint said.\n    }\n  }\n\n  const faceMatch = optionalBoolean(predicates?.face_match_pass);\n  const livenessPass = optionalBoolean(predicates?.pad_pass);\n  const agePass = optionalBoolean(predicates?.age_pass);\n\n  return {\n    verified,\n    faceMatch,\n    livenessPass,\n    agePass,\n    errorDescription: null,\n    allChecksPassed: computeAllChecksPassed({\n      verified,\n      faceMatch,\n      livenessPass,\n      agePass,\n      errorDescription: null\n    }),\n    verifiedData: response\n  };\n}\n","let decoder\ntry {\n\tdecoder = new TextDecoder()\n} catch(error) {}\nlet src\nlet srcEnd\nlet position = 0\nlet alreadySet\nconst EMPTY_ARRAY = []\nconst LEGACY_RECORD_INLINE_ID = 105\nconst RECORD_DEFINITIONS_ID = 0xdffe\nconst RECORD_INLINE_ID = 0xdfff // temporary first-come first-serve tag // proposed tag: 0x7265 // 're'\nconst BUNDLED_STRINGS_ID = 0xdff9\nconst PACKED_TABLE_TAG_ID = 51\nconst PACKED_REFERENCE_TAG_ID = 6\nconst STOP_CODE = {}\nlet maxArraySize = 112810000 // This is the maximum array size in V8. We would potentially detect and set it higher\n// for JSC, but this is pretty large and should be sufficient for most use cases\nlet maxMapSize = 16810000 // JavaScript has a fixed maximum map size of about 16710000, but JS itself enforces this,\n// so we don't need to\n\nlet maxObjectSize = 16710000; // This is the maximum number of keys in a Map. It takes over a minute to create this\n// many keys in an object, so also probably a reasonable choice there.\nlet strings = EMPTY_ARRAY\nlet stringPosition = 0\nlet currentDecoder = {}\nlet currentStructures\nlet srcString\nlet srcStringStart = 0\nlet srcStringEnd = 0\nlet bundledStrings\nlet referenceMap\nlet currentExtensions = []\nlet currentExtensionRanges = []\nlet packedValues\nlet dataView\nlet restoreMapsAsObject\nlet defaultOptions = {\n\tuseRecords: false,\n\tmapsAsObjects: true\n}\nlet sequentialMode = false\nlet inlineObjectReadThreshold = 2;\nvar BlockedFunction // we use search and replace to change the next call to BlockedFunction to avoid CSP issues for\n// no-eval build\ntry {\n\tnew Function('')\n} catch(error) {\n\t// if eval variants are not supported, do not create inline object readers ever\n\tinlineObjectReadThreshold = Infinity\n}\n\n\n\nexport class Decoder {\n\tconstructor(options) {\n\t\tif (options) {\n\t\t\tif ((options.keyMap || options._keyMap) && !options.useRecords) {\n\t\t\t\toptions.useRecords = false\n\t\t\t\toptions.mapsAsObjects = true\n\t\t\t}\n\t\t\tif (options.useRecords === false && options.mapsAsObjects === undefined)\n\t\t\t\toptions.mapsAsObjects = true\n\t\t\tif (options.getStructures)\n\t\t\t\toptions.getShared = options.getStructures\n\t\t\tif (options.getShared && !options.structures)\n\t\t\t\t(options.structures = []).uninitialized = true // this is what we use to denote an uninitialized structures\n\t\t\tif (options.keyMap) {\n\t\t\t\tthis.mapKey = new Map()\n\t\t\t\tfor (let [k,v] of Object.entries(options.keyMap)) this.mapKey.set(v,k)\n\t\t\t}\n\t\t}\n\t\tObject.assign(this, options)\n\t}\n\t/*\n\tdecodeKey(key) {\n\t\treturn this.keyMap\n\t\t\t? Object.keys(this.keyMap)[Object.values(this.keyMap).indexOf(key)] || key\n\t\t\t: key\n\t}\n\t*/\n\tdecodeKey(key) {\n\t\treturn this.keyMap ? this.mapKey.get(key) || key : key\n\t}\n\t\n\tencodeKey(key) {\n\t\treturn this.keyMap && this.keyMap.hasOwnProperty(key) ? this.keyMap[key] : key\n\t}\n\n\tencodeKeys(rec) {\n\t\tif (!this._keyMap) return rec\n\t\tlet map = new Map()\n\t\tfor (let [k,v] of Object.entries(rec)) map.set((this._keyMap.hasOwnProperty(k) ? this._keyMap[k] : k), v)\n\t\treturn map\n\t}\n\n\tdecodeKeys(map) {\n\t\tif (!this._keyMap || map.constructor.name != 'Map') return map\n\t\tif (!this._mapKey) {\n\t\t\tthis._mapKey = new Map()\n\t\t\tfor (let [k,v] of Object.entries(this._keyMap)) this._mapKey.set(v,k)\n\t\t}\n\t\tlet res = {}\n\t\t//map.forEach((v,k) => res[Object.keys(this._keyMap)[Object.values(this._keyMap).indexOf(k)] || k] = v)\n\t\tmap.forEach((v,k) => res[safeKey(this._mapKey.has(k) ? this._mapKey.get(k) : k)] =  v)\n\t\treturn res\n\t}\n\t\n\tmapDecode(source, end) {\n\t\n\t\tlet res = this.decode(source)\n\t\tif (this._keyMap) { \n\t\t\t//Experiemntal support for Optimised KeyMap  decoding \n\t\t\tswitch (res.constructor.name) {\n\t\t\t\tcase 'Array': return res.map(r => this.decodeKeys(r))\n\t\t\t\t//case 'Map': return this.decodeKeys(res)\n\t\t\t}\n\t\t}\n\t\treturn res\n\t}\n\n\tdecode(source, end) {\n\t\tif (src) {\n\t\t\t// re-entrant execution, save the state and restore it after we do this decode\n\t\t\treturn saveState(() => {\n\t\t\t\tclearSource()\n\t\t\t\treturn this ? this.decode(source, end) : Decoder.prototype.decode.call(defaultOptions, source, end)\n\t\t\t})\n\t\t}\n\t\tsrcEnd = end > -1 ? end : source.length\n\t\tposition = 0\n\t\tstringPosition = 0\n\t\tsrcStringEnd = 0\n\t\tsrcString = null\n\t\tstrings = EMPTY_ARRAY\n\t\tbundledStrings = null\n\t\tsrc = source\n\t\t// this provides cached access to the data view for a buffer if it is getting reused, which is a recommend\n\t\t// technique for getting data from a database where it can be copied into an existing buffer instead of creating\n\t\t// new ones\n\t\ttry {\n\t\t\tdataView = source.dataView || (source.dataView = new DataView(source.buffer, source.byteOffset, source.byteLength))\n\t\t} catch(error) {\n\t\t\t// if it doesn't have a buffer, maybe it is the wrong type of object\n\t\t\tsrc = null\n\t\t\tif (source instanceof Uint8Array)\n\t\t\t\tthrow error\n\t\t\tthrow new Error('Source must be a Uint8Array or Buffer but was a ' + ((source && typeof source == 'object') ? source.constructor.name : typeof source))\n\t\t}\n\t\tif (this instanceof Decoder) {\n\t\t\tcurrentDecoder = this\n\t\t\tpackedValues = this.sharedValues &&\n\t\t\t\t(this.pack ? new Array(this.maxPrivatePackedValues || 16).concat(this.sharedValues) :\n\t\t\t\tthis.sharedValues)\n\t\t\tif (this.structures) {\n\t\t\t\tcurrentStructures = this.structures\n\t\t\t\treturn checkedRead()\n\t\t\t} else if (!currentStructures || currentStructures.length > 0) {\n\t\t\t\tcurrentStructures = []\n\t\t\t}\n\t\t} else {\n\t\t\tcurrentDecoder = defaultOptions\n\t\t\tif (!currentStructures || currentStructures.length > 0)\n\t\t\t\tcurrentStructures = []\n\t\t\tpackedValues = null\n\t\t}\n\t\treturn checkedRead()\n\t}\n\tdecodeMultiple(source, forEach) {\n\t\tlet values, lastPosition = 0\n\t\ttry {\n\t\t\tlet size = source.length\n\t\t\tsequentialMode = true\n\t\t\tlet value = this ? this.decode(source, size) : defaultDecoder.decode(source, size)\n\t\t\tif (forEach) {\n\t\t\t\tif (forEach(value) === false) {\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\twhile(position < size) {\n\t\t\t\t\tlastPosition = position\n\t\t\t\t\tif (forEach(checkedRead()) === false) {\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse {\n\t\t\t\tvalues = [ value ]\n\t\t\t\twhile(position < size) {\n\t\t\t\t\tlastPosition = position\n\t\t\t\t\tvalues.push(checkedRead())\n\t\t\t\t}\n\t\t\t\treturn values\n\t\t\t}\n\t\t} catch(error) {\n\t\t\terror.lastPosition = lastPosition\n\t\t\terror.values = values\n\t\t\tthrow error\n\t\t} finally {\n\t\t\tsequentialMode = false\n\t\t\tclearSource()\n\t\t}\n\t}\n}\nexport function getPosition() {\n\treturn position\n}\nexport function checkedRead() {\n\ttry {\n\t\tlet result = read()\n\t\tif (bundledStrings) {\n\t\t\tif (position >= bundledStrings.postBundlePosition) {\n\t\t\t\tlet error = new Error('Unexpected bundle position');\n\t\t\t\terror.incomplete = true;\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\t// bundled strings to skip past\n\t\t\tposition = bundledStrings.postBundlePosition;\n\t\t\tbundledStrings = null;\n\t\t}\n\n\t\tif (position == srcEnd) {\n\t\t\t// finished reading this source, cleanup references\n\t\t\tcurrentStructures = null\n\t\t\tsrc = null\n\t\t\tif (referenceMap)\n\t\t\t\treferenceMap = null\n\t\t} else if (position > srcEnd) {\n\t\t\t// over read\n\t\t\tlet error = new Error('Unexpected end of CBOR data')\n\t\t\terror.incomplete = true\n\t\t\tthrow error\n\t\t} else if (!sequentialMode) {\n\t\t\tthrow new Error('Data read, but end of buffer not reached')\n\t\t}\n\t\t// else more to read, but we are reading sequentially, so don't clear source yet\n\t\treturn result\n\t} catch(error) {\n\t\tclearSource()\n\t\tif (error instanceof RangeError || error.message.startsWith('Unexpected end of buffer')) {\n\t\t\terror.incomplete = true\n\t\t}\n\t\tthrow error\n\t}\n}\n\nexport function read() {\n\tlet token = src[position++]\n\tlet majorType = token >> 5\n\ttoken = token & 0x1f\n\tif (token > 0x17) {\n\t\tswitch (token) {\n\t\t\tcase 0x18:\n\t\t\t\ttoken = src[position++]\n\t\t\t\tbreak\n\t\t\tcase 0x19:\n\t\t\t\tif (majorType == 7) {\n\t\t\t\t\treturn getFloat16()\n\t\t\t\t}\n\t\t\t\ttoken = dataView.getUint16(position)\n\t\t\t\tposition += 2\n\t\t\t\tbreak\n\t\t\tcase 0x1a:\n\t\t\t\tif (majorType == 7) {\n\t\t\t\t\tlet value = dataView.getFloat32(position)\n\t\t\t\t\tif (currentDecoder.useFloat32 > 2) {\n\t\t\t\t\t\t// this does rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved\n\t\t\t\t\t\tlet multiplier = mult10[((src[position] & 0x7f) << 1) | (src[position + 1] >> 7)]\n\t\t\t\t\t\tposition += 4\n\t\t\t\t\t\treturn ((multiplier * value + (value > 0 ? 0.5 : -0.5)) >> 0) / multiplier\n\t\t\t\t\t}\n\t\t\t\t\tposition += 4\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\ttoken = dataView.getUint32(position)\n\t\t\t\tposition += 4\n\t\t\t\tif (majorType === 1) return -1 - token; // can't safely use negation operator here\n\t\t\t\tbreak\n\t\t\tcase 0x1b:\n\t\t\t\tif (majorType == 7) {\n\t\t\t\t\tlet value = dataView.getFloat64(position)\n\t\t\t\t\tposition += 8\n\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\tif (majorType > 1) {\n\t\t\t\t\tif (dataView.getUint32(position) > 0)\n\t\t\t\t\t\tthrow new Error('JavaScript does not support arrays, maps, or strings with length over 4294967295')\n\t\t\t\t\ttoken = dataView.getUint32(position + 4)\n\t\t\t\t} else if (currentDecoder.int64AsNumber) {\n\t\t\t\t\ttoken = dataView.getUint32(position) * 0x100000000\n\t\t\t\t\ttoken += dataView.getUint32(position + 4)\n\t\t\t\t} else token = dataView.getBigUint64(position)\n\t\t\t\tposition += 8\n\t\t\t\tbreak\n\t\t\tcase 0x1f: \n\t\t\t\t// indefinite length\n\t\t\t\tswitch(majorType) {\n\t\t\t\t\tcase 2: // byte string\n\t\t\t\t\tcase 3: // text string\n\t\t\t\t\t\tthrow new Error('Indefinite length not supported for byte or text strings')\n\t\t\t\t\tcase 4: // array\n\t\t\t\t\t\tlet array = []\n\t\t\t\t\t\tlet value, i = 0\n\t\t\t\t\t\twhile ((value = read()) != STOP_CODE) {\n\t\t\t\t\t\t\tif (i >= maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`)\n\t\t\t\t\t\t\tarray[i++] = value\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn majorType == 4 ? array : majorType == 3 ? array.join('') : Buffer.concat(array)\n\t\t\t\t\tcase 5: // map\n\t\t\t\t\t\tlet key\n\t\t\t\t\t\tif (currentDecoder.mapsAsObjects) {\n\t\t\t\t\t\t\tlet object = {}\n\t\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\t\tif (currentDecoder.keyMap) {\n\t\t\t\t\t\t\t\twhile((key = read()) != STOP_CODE) {\n\t\t\t\t\t\t\t\t\tif (i++ >= maxMapSize) throw new Error(`Property count exceeds ${maxMapSize}`)\n\t\t\t\t\t\t\t\t\tobject[safeKey(currentDecoder.decodeKey(key))] = read()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\twhile ((key = read()) != STOP_CODE) {\n\t\t\t\t\t\t\t\t\tif (i++ >= maxMapSize) throw new Error(`Property count exceeds ${maxMapSize}`)\n\t\t\t\t\t\t\t\t\tobject[safeKey(key)] = read()\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn object\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tif (restoreMapsAsObject) {\n\t\t\t\t\t\t\t\tcurrentDecoder.mapsAsObjects = true\n\t\t\t\t\t\t\t\trestoreMapsAsObject = false\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tlet map = new Map()\n\t\t\t\t\t\t\tif (currentDecoder.keyMap) {\n\t\t\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\t\t\twhile((key = read()) != STOP_CODE) {\n\t\t\t\t\t\t\t\t\tif (i++ >= maxMapSize) {\n\t\t\t\t\t\t\t\t\t\tthrow new Error(`Map size exceeds ${maxMapSize}`);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmap.set(currentDecoder.decodeKey(key), read())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\tlet i = 0;\n\t\t\t\t\t\t\t\twhile ((key = read()) != STOP_CODE) {\n\t\t\t\t\t\t\t\t\tif (i++ >= maxMapSize) {\n\t\t\t\t\t\t\t\t\t\tthrow new Error(`Map size exceeds ${maxMapSize}`);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tmap.set(key, read())\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn map\n\t\t\t\t\t\t}\n\t\t\t\t\tcase 7:\n\t\t\t\t\t\treturn STOP_CODE\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tthrow new Error('Invalid major type for indefinite length ' + majorType)\n\t\t\t\t}\n\t\t\tdefault:\n\t\t\t\tthrow new Error('Unknown token ' + token)\n\t\t}\n\t}\n\tswitch (majorType) {\n\t\tcase 0: // positive int\n\t\t\treturn token\n\t\tcase 1: // negative int\n\t\t\treturn ~token\n\t\tcase 2: // buffer\n\t\t\treturn readBin(token)\n\t\tcase 3: // string\n\t\t\tif (srcStringEnd >= position) {\n\t\t\t\treturn srcString.slice(position - srcStringStart, (position += token) - srcStringStart)\n\t\t\t}\n\t\t\tif (srcStringEnd == 0 && srcEnd < 140 && token < 32) {\n\t\t\t\t// for small blocks, avoiding the overhead of the extract call is helpful\n\t\t\t\tlet string = token < 16 ? shortStringInJS(token) : longStringInJS(token)\n\t\t\t\tif (string != null)\n\t\t\t\t\treturn string\n\t\t\t}\n\t\t\treturn readFixedString(token)\n\t\tcase 4: // array\n\t\t\tif (token >= maxArraySize) throw new Error(`Array length exceeds ${maxArraySize}`)\n\t\t\tlet array = new Array(token)\n\t\t  //if (currentDecoder.keyMap) for (let i = 0; i < token; i++) array[i] = currentDecoder.decodeKey(read())\t\n\t\t\t//else \n\t\t\tfor (let i = 0; i < token; i++) array[i] = read()\n\t\t\treturn array\n\t\tcase 5: // map\n\t\t\tif (token >= maxMapSize) throw new Error(`Map size exceeds ${maxArraySize}`)\n\t\t\tif (currentDecoder.mapsAsObjects) {\n\t\t\t\tlet object = {}\n\t\t\t\tif (currentDecoder.keyMap) for (let i = 0; i < token; i++) object[safeKey(currentDecoder.decodeKey(read()))] = read()\n\t\t\t\telse for (let i = 0; i < token; i++) object[safeKey(read())] = read()\n\t\t\t\treturn object\n\t\t\t} else {\n\t\t\t\tif (restoreMapsAsObject) {\n\t\t\t\t\tcurrentDecoder.mapsAsObjects = true\n\t\t\t\t\trestoreMapsAsObject = false\n\t\t\t\t}\n\t\t\t\tlet map = new Map()\n\t\t\t\tif (currentDecoder.keyMap) for (let i = 0; i < token; i++) map.set(currentDecoder.decodeKey(read()),read())\n\t\t\t\telse for (let i = 0; i < token; i++) map.set(read(), read())\n\t\t\t\treturn map\n\t\t\t}\n\t\tcase 6: // extension\n\t\t\tif (token >= BUNDLED_STRINGS_ID) {\n\t\t\t\tlet structure = currentStructures[token & 0x1fff] // check record structures first\n\t\t\t\t// At some point we may provide an option for dynamic tag assignment with a range like token >= 8 && (token < 16 || (token > 0x80 && token < 0xc0) || (token > 0x130 && token < 0x4000))\n\t\t\t\tif (structure) {\n\t\t\t\t\tif (!structure.read) structure.read = createStructureReader(structure)\n\t\t\t\t\treturn structure.read()\n\t\t\t\t}\n\t\t\t\tif (token < 0x10000) {\n\t\t\t\t\tif (token == RECORD_INLINE_ID) { // we do a special check for this so that we can keep the\n\t\t\t\t\t\t// currentExtensions as densely stored array (v8 stores arrays densely under about 3000 elements)\n\t\t\t\t\t\tlet length = readJustLength()\n\t\t\t\t\t\tlet id = read()\n\t\t\t\t\t\tlet structure = read()\n\t\t\t\t\t\trecordDefinition(id, structure)\n\t\t\t\t\t\tlet object = {}\n\t\t\t\t\t\tif (currentDecoder.keyMap) for (let i = 2; i < length; i++) {\n\t\t\t\t\t\t\tlet key = currentDecoder.decodeKey(structure[i - 2])\n\t\t\t\t\t\t\tobject[safeKey(key)] = read()\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse for (let i = 2; i < length; i++) {\n\t\t\t\t\t\t\tlet key = structure[i - 2]\n\t\t\t\t\t\t\tobject[safeKey(key)] = read()\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn object\n\t\t\t\t\t}\n\t\t\t\t\telse if (token == RECORD_DEFINITIONS_ID) {\n\t\t\t\t\t\tlet length = readJustLength()\n\t\t\t\t\t\tlet id = read()\n\t\t\t\t\t\tfor (let i = 2; i < length; i++) {\n\t\t\t\t\t\t\trecordDefinition(id++, read())\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn read()\n\t\t\t\t\t} else if (token == BUNDLED_STRINGS_ID) {\n\t\t\t\t\t\treturn readBundleExt()\n\t\t\t\t\t}\n\t\t\t\t\tif (currentDecoder.getShared) {\n\t\t\t\t\t\tloadShared()\n\t\t\t\t\t\tstructure = currentStructures[token & 0x1fff]\n\t\t\t\t\t\tif (structure) {\n\t\t\t\t\t\t\tif (!structure.read)\n\t\t\t\t\t\t\t\tstructure.read = createStructureReader(structure)\n\t\t\t\t\t\t\treturn structure.read()\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet extension = currentExtensions[token]\n\t\t\tif (extension) {\n\t\t\t\tif (extension.handlesRead)\n\t\t\t\t\treturn extension(read)\n\t\t\t\telse\n\t\t\t\t\treturn extension(read())\n\t\t\t} else {\n\t\t\t\tlet input = read()\n\t\t\t\tfor (let i = 0; i < currentExtensionRanges.length; i++) {\n\t\t\t\t\tlet value = currentExtensionRanges[i](token, input)\n\t\t\t\t\tif (value !== undefined)\n\t\t\t\t\t\treturn value\n\t\t\t\t}\n\t\t\t\treturn new Tag(input, token)\n\t\t\t}\n\t\tcase 7: // fixed value\n\t\t\tswitch (token) {\n\t\t\t\tcase 0x14: return false\n\t\t\t\tcase 0x15: return true\n\t\t\t\tcase 0x16: return null\n\t\t\t\tcase 0x17: return; // undefined\n\t\t\t\tcase 0x1f:\n\t\t\t\tdefault:\n\t\t\t\t\tlet packedValue = (packedValues || getPackedValues())[token]\n\t\t\t\t\tif (packedValue !== undefined)\n\t\t\t\t\t\treturn packedValue\n\t\t\t\t\tthrow new Error('Unknown token ' + token)\n\t\t\t}\n\t\tdefault: // negative int\n\t\t\tif (isNaN(token)) {\n\t\t\t\tlet error = new Error('Unexpected end of CBOR data')\n\t\t\t\terror.incomplete = true\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\tthrow new Error('Unknown CBOR token ' + token)\n\t}\n}\nconst validName = /^[a-zA-Z_$][a-zA-Z\\d_$]*$/\nfunction createStructureReader(structure) {\n\tif (!structure) throw new Error('Structure is required in record definition');\n\tfunction readObject() {\n\t\t// get the array size from the header\n\t\tlet length = src[position++]\n\t\t//let majorType = token >> 5\n\t\tlength = length & 0x1f\n\t\tif (length > 0x17) {\n\t\t\tswitch (length) {\n\t\t\t\tcase 0x18:\n\t\t\t\t\tlength = src[position++]\n\t\t\t\t\tbreak\n\t\t\t\tcase 0x19:\n\t\t\t\t\tlength = dataView.getUint16(position)\n\t\t\t\t\tposition += 2\n\t\t\t\t\tbreak\n\t\t\t\tcase 0x1a:\n\t\t\t\t\tlength = dataView.getUint32(position)\n\t\t\t\t\tposition += 4\n\t\t\t\t\tbreak\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new Error('Expected array header, but got ' + src[position - 1])\n\t\t\t}\n\t\t}\n\t\t// This initial function is quick to instantiate, but runs slower. After several iterations pay the cost to build the faster function\n\t\tlet compiledReader = this.compiledReader // first look to see if we have the fast compiled function\n\t\twhile(compiledReader) {\n\t\t\t// we have a fast compiled object literal reader\n\t\t\tif (compiledReader.propertyCount === length)\n\t\t\t\treturn compiledReader(read) // with the right length, so we use it\n\t\t\tcompiledReader = compiledReader.next // see if there is another reader with the right length\n\t\t}\n\t\tif (this.slowReads++ >= inlineObjectReadThreshold) { // create a fast compiled reader\n\t\t\tlet array = this.length == length ? this : this.slice(0, length)\n\t\t\tcompiledReader = currentDecoder.keyMap \n\t\t\t? new Function('r', 'return {' + array.map(k => currentDecoder.decodeKey(k)).map(k => validName.test(k) ? safeKey(k) + ':r()' : ('[' + JSON.stringify(k) + ']:r()')).join(',') + '}')\n\t\t\t: new Function('r', 'return {' + array.map(key => validName.test(key) ? safeKey(key) + ':r()' : ('[' + JSON.stringify(key) + ']:r()')).join(',') + '}')\n\t\t\tif (this.compiledReader)\n\t\t\t\tcompiledReader.next = this.compiledReader // if there is an existing one, we store multiple readers as a linked list because it is usually pretty rare to have multiple readers (of different length) for the same structure\n\t\t\tcompiledReader.propertyCount = length\n\t\t\tthis.compiledReader = compiledReader\n\t\t\treturn compiledReader(read)\n\t\t}\n\t\tlet object = {}\n\t\tif (currentDecoder.keyMap) for (let i = 0; i < length; i++) object[safeKey(currentDecoder.decodeKey(this[i]))] = read()\n\t\telse for (let i = 0; i < length; i++) {\n\t\t\tobject[safeKey(this[i])] = read();\n\t\t}\n\t\treturn object\n\t}\n\tstructure.slowReads = 0\n\treturn readObject\n}\n\nfunction safeKey(key) {\n\t// protect against prototype pollution\n\tif (typeof key === 'string') return key === '__proto__' ? '__proto_' : key\n\tif (typeof key === 'number' || typeof key === 'boolean' || typeof key === 'bigint') return key.toString();\n\tif (key == null) return key + '';\n\t// protect against expensive (DoS) string conversions\n\tthrow new Error('Invalid property name type ' + typeof key);\n}\n\nlet readFixedString = readStringJS\nlet readString8 = readStringJS\nlet readString16 = readStringJS\nlet readString32 = readStringJS\n\nexport let isNativeAccelerationEnabled = false\nexport function setExtractor(extractStrings) {\n\tisNativeAccelerationEnabled = true\n\treadFixedString = readString(1)\n\treadString8 = readString(2)\n\treadString16 = readString(3)\n\treadString32 = readString(5)\n\tfunction readString(headerLength) {\n\t\treturn function readString(length) {\n\t\t\tlet string = strings[stringPosition++]\n\t\t\tif (string == null) {\n\t\t\t\tif (bundledStrings)\n\t\t\t\t\treturn readStringJS(length)\n\t\t\t\tlet extraction = extractStrings(position, srcEnd, length, src)\n\t\t\t\tif (typeof extraction == 'string') {\n\t\t\t\t\tstring = extraction\n\t\t\t\t\tstrings = EMPTY_ARRAY\n\t\t\t\t} else {\n\t\t\t\t\tstrings = extraction\n\t\t\t\t\tstringPosition = 1\n\t\t\t\t\tsrcStringEnd = 1 // even if a utf-8 string was decoded, must indicate we are in the midst of extracted strings and can't skip strings\n\t\t\t\t\tstring = strings[0]\n\t\t\t\t\tif (string === undefined)\n\t\t\t\t\t\tthrow new Error('Unexpected end of buffer')\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet srcStringLength = string.length\n\t\t\tif (srcStringLength <= length) {\n\t\t\t\tposition += length\n\t\t\t\treturn string\n\t\t\t}\n\t\t\tsrcString = string\n\t\t\tsrcStringStart = position\n\t\t\tsrcStringEnd = position + srcStringLength\n\t\t\tposition += length\n\t\t\treturn string.slice(0, length) // we know we just want the beginning\n\t\t}\n\t}\n}\nfunction readStringJS(length) {\n\tlet result\n\tif (length < 16) {\n\t\tif (result = shortStringInJS(length))\n\t\t\treturn result\n\t}\n\tif (length > 64 && decoder)\n\t\treturn decoder.decode(src.subarray(position, position += length))\n\tconst end = position + length\n\tconst units = []\n\tresult = ''\n\twhile (position < end) {\n\t\tconst byte1 = src[position++]\n\t\tif ((byte1 & 0x80) === 0) {\n\t\t\t// 1 byte\n\t\t\tunits.push(byte1)\n\t\t} else if ((byte1 & 0xe0) === 0xc0) {\n\t\t\t// 2 bytes\n\t\t\tconst byte2 = src[position++] & 0x3f\n\t\t\tconst codePoint = ((byte1 & 0x1f) << 6) | byte2\n\t\t\t// Reject overlong encoding: 2-byte sequences must encode values >= 0x80\n\t\t\tif (codePoint < 0x80) {\n\t\t\t\tunits.push(0xFFFD) // replacement character\n\t\t\t} else {\n\t\t\t\tunits.push(codePoint)\n\t\t\t}\n\t\t} else if ((byte1 & 0xf0) === 0xe0) {\n\t\t\t// 3 bytes\n\t\t\tconst byte2 = src[position++] & 0x3f\n\t\t\tconst byte3 = src[position++] & 0x3f\n\t\t\tconst codePoint = ((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3\n\t\t\t// Reject overlong encoding: 3-byte sequences must encode values >= 0x800\n\t\t\t// Also reject surrogates (0xD800-0xDFFF)\n\t\t\tif (codePoint < 0x800 || (codePoint >= 0xD800 && codePoint <= 0xDFFF)) {\n\t\t\t\tunits.push(0xFFFD) // replacement character\n\t\t\t} else {\n\t\t\t\tunits.push(codePoint)\n\t\t\t}\n\t\t} else if ((byte1 & 0xf8) === 0xf0) {\n\t\t\t// 4 bytes\n\t\t\tconst byte2 = src[position++] & 0x3f\n\t\t\tconst byte3 = src[position++] & 0x3f\n\t\t\tconst byte4 = src[position++] & 0x3f\n\t\t\tlet unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4\n\t\t\t// Reject overlong encoding: 4-byte sequences must encode values >= 0x10000\n\t\t\t// Also reject values > 0x10FFFF (maximum valid Unicode)\n\t\t\tif (unit < 0x10000 || unit > 0x10FFFF) {\n\t\t\t\tunits.push(0xFFFD) // replacement character\n\t\t\t} else if (unit > 0xffff) {\n\t\t\t\tunit -= 0x10000\n\t\t\t\tunits.push(((unit >>> 10) & 0x3ff) | 0xd800)\n\t\t\t\tunit = 0xdc00 | (unit & 0x3ff)\n\t\t\t\tunits.push(unit)\n\t\t\t} else {\n\t\t\t\tunits.push(unit)\n\t\t\t}\n\t\t} else {\n\t\t\tunits.push(0xFFFD) // replacement character for invalid lead byte\n\t\t}\n\n\t\tif (units.length >= 0x1000) {\n\t\t\tresult += fromCharCode.apply(String, units)\n\t\t\tunits.length = 0\n\t\t}\n\t}\n\n\tif (units.length > 0) {\n\t\tresult += fromCharCode.apply(String, units)\n\t}\n\n\treturn result\n}\nlet fromCharCode = String.fromCharCode\nfunction longStringInJS(length) {\n\tlet start = position\n\tlet bytes = new Array(length)\n\tfor (let i = 0; i < length; i++) {\n\t\tconst byte = src[position++];\n\t\tif ((byte & 0x80) > 0) {\n\t\t\tposition = start\n    \t\t\treturn\n    \t\t}\n    \t\tbytes[i] = byte\n    \t}\n    \treturn fromCharCode.apply(String, bytes)\n}\nfunction shortStringInJS(length) {\n\tif (length < 4) {\n\t\tif (length < 2) {\n\t\t\tif (length === 0)\n\t\t\t\treturn ''\n\t\t\telse {\n\t\t\t\tlet a = src[position++]\n\t\t\t\tif ((a & 0x80) > 1) {\n\t\t\t\t\tposition -= 1\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn fromCharCode(a)\n\t\t\t}\n\t\t} else {\n\t\t\tlet a = src[position++]\n\t\t\tlet b = src[position++]\n\t\t\tif ((a & 0x80) > 0 || (b & 0x80) > 0) {\n\t\t\t\tposition -= 2\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (length < 3)\n\t\t\t\treturn fromCharCode(a, b)\n\t\t\tlet c = src[position++]\n\t\t\tif ((c & 0x80) > 0) {\n\t\t\t\tposition -= 3\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn fromCharCode(a, b, c)\n\t\t}\n\t} else {\n\t\tlet a = src[position++]\n\t\tlet b = src[position++]\n\t\tlet c = src[position++]\n\t\tlet d = src[position++]\n\t\tif ((a & 0x80) > 0 || (b & 0x80) > 0 || (c & 0x80) > 0 || (d & 0x80) > 0) {\n\t\t\tposition -= 4\n\t\t\treturn\n\t\t}\n\t\tif (length < 6) {\n\t\t\tif (length === 4)\n\t\t\t\treturn fromCharCode(a, b, c, d)\n\t\t\telse {\n\t\t\t\tlet e = src[position++]\n\t\t\t\tif ((e & 0x80) > 0) {\n\t\t\t\t\tposition -= 5\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn fromCharCode(a, b, c, d, e)\n\t\t\t}\n\t\t} else if (length < 8) {\n\t\t\tlet e = src[position++]\n\t\t\tlet f = src[position++]\n\t\t\tif ((e & 0x80) > 0 || (f & 0x80) > 0) {\n\t\t\t\tposition -= 6\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (length < 7)\n\t\t\t\treturn fromCharCode(a, b, c, d, e, f)\n\t\t\tlet g = src[position++]\n\t\t\tif ((g & 0x80) > 0) {\n\t\t\t\tposition -= 7\n\t\t\t\treturn\n\t\t\t}\n\t\t\treturn fromCharCode(a, b, c, d, e, f, g)\n\t\t} else {\n\t\t\tlet e = src[position++]\n\t\t\tlet f = src[position++]\n\t\t\tlet g = src[position++]\n\t\t\tlet h = src[position++]\n\t\t\tif ((e & 0x80) > 0 || (f & 0x80) > 0 || (g & 0x80) > 0 || (h & 0x80) > 0) {\n\t\t\t\tposition -= 8\n\t\t\t\treturn\n\t\t\t}\n\t\t\tif (length < 10) {\n\t\t\t\tif (length === 8)\n\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h)\n\t\t\t\telse {\n\t\t\t\t\tlet i = src[position++]\n\t\t\t\t\tif ((i & 0x80) > 0) {\n\t\t\t\t\t\tposition -= 9\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i)\n\t\t\t\t}\n\t\t\t} else if (length < 12) {\n\t\t\t\tlet i = src[position++]\n\t\t\t\tlet j = src[position++]\n\t\t\t\tif ((i & 0x80) > 0 || (j & 0x80) > 0) {\n\t\t\t\t\tposition -= 10\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (length < 11)\n\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j)\n\t\t\t\tlet k = src[position++]\n\t\t\t\tif ((k & 0x80) > 0) {\n\t\t\t\t\tposition -= 11\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j, k)\n\t\t\t} else {\n\t\t\t\tlet i = src[position++]\n\t\t\t\tlet j = src[position++]\n\t\t\t\tlet k = src[position++]\n\t\t\t\tlet l = src[position++]\n\t\t\t\tif ((i & 0x80) > 0 || (j & 0x80) > 0 || (k & 0x80) > 0 || (l & 0x80) > 0) {\n\t\t\t\t\tposition -= 12\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tif (length < 14) {\n\t\t\t\t\tif (length === 12)\n\t\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l)\n\t\t\t\t\telse {\n\t\t\t\t\t\tlet m = src[position++]\n\t\t\t\t\t\tif ((m & 0x80) > 0) {\n\t\t\t\t\t\t\tposition -= 13\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tlet m = src[position++]\n\t\t\t\t\tlet n = src[position++]\n\t\t\t\t\tif ((m & 0x80) > 0 || (n & 0x80) > 0) {\n\t\t\t\t\t\tposition -= 14\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tif (length < 15)\n\t\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n)\n\t\t\t\t\tlet o = src[position++]\n\t\t\t\t\tif ((o & 0x80) > 0) {\n\t\t\t\t\t\tposition -= 15\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\treturn fromCharCode(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction readBin(length) {\n\treturn currentDecoder.copyBuffers ?\n\t\t// specifically use the copying slice (not the node one)\n\t\tUint8Array.prototype.slice.call(src, position, position += length) :\n\t\tsrc.subarray(position, position += length)\n}\nfunction readExt(length) {\n\tlet type = src[position++]\n\tif (currentExtensions[type]) {\n\t\treturn currentExtensions[type](src.subarray(position, position += length))\n\t}\n\telse\n\t\tthrow new Error('Unknown extension type ' + type)\n}\nlet f32Array = new Float32Array(1)\nlet u8Array = new Uint8Array(f32Array.buffer, 0, 4)\nfunction getFloat16() {\n\tlet byte0 = src[position++]\n\tlet byte1 = src[position++]\n\tlet exponent = (byte0 & 0x7f) >> 2;\n\tif (exponent === 0x1f) { // specials\n\t\tif (byte1 || (byte0 & 3))\n\t\t\treturn NaN;\n\t\treturn (byte0 & 0x80) ? -Infinity : Infinity;\n\t}\n\tif (exponent === 0) { // sub-normals\n\t\t// significand with 10 fractional bits and divided by 2^14\n\t\tlet abs = (((byte0 & 3) << 8) | byte1) / (1 << 24)\n\t\treturn (byte0 & 0x80) ? -abs : abs\n\t}\n\n\tu8Array[3] = (byte0 & 0x80) | // sign bit\n\t\t((exponent >> 1) + 56) // 4 of 5 of the exponent bits, re-offset-ed\n\tu8Array[2] = ((byte0 & 7) << 5) | // last exponent bit and first two mantissa bits\n\t\t(byte1 >> 3) // next 5 bits of mantissa\n\tu8Array[1] = byte1 << 5; // last three bits of mantissa\n\tu8Array[0] = 0;\n\treturn f32Array[0];\n}\n\nlet keyCache = new Array(4096)\nfunction readKey() {\n\tlet length = src[position++]\n\tif (length >= 0x60 && length < 0x78) {\n\t\t// fixstr, potentially use key cache\n\t\tlength = length - 0x60\n\t\tif (srcStringEnd >= position) // if it has been extracted, must use it (and faster anyway)\n\t\t\treturn srcString.slice(position - srcStringStart, (position += length) - srcStringStart)\n\t\telse if (!(srcStringEnd == 0 && srcEnd < 180))\n\t\t\treturn readFixedString(length)\n\t} else { // not cacheable, go back and do a standard read\n\t\tposition--\n\t\treturn read()\n\t}\n\tlet key = ((length << 5) ^ (length > 1 ? dataView.getUint16(position) : length > 0 ? src[position] : 0)) & 0xfff\n\tlet entry = keyCache[key]\n\tlet checkPosition = position\n\tlet end = position + length - 3\n\tlet chunk\n\tlet i = 0\n\tif (entry && entry.bytes == length) {\n\t\twhile (checkPosition < end) {\n\t\t\tchunk = dataView.getUint32(checkPosition)\n\t\t\tif (chunk != entry[i++]) {\n\t\t\t\tcheckPosition = 0x70000000\n\t\t\t\tbreak\n\t\t\t}\n\t\t\tcheckPosition += 4\n\t\t}\n\t\tend += 3\n\t\twhile (checkPosition < end) {\n\t\t\tchunk = src[checkPosition++]\n\t\t\tif (chunk != entry[i++]) {\n\t\t\t\tcheckPosition = 0x70000000\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif (checkPosition === end) {\n\t\t\tposition = checkPosition\n\t\t\treturn entry.string\n\t\t}\n\t\tend -= 3\n\t\tcheckPosition = position\n\t}\n\tentry = []\n\tkeyCache[key] = entry\n\tentry.bytes = length\n\twhile (checkPosition < end) {\n\t\tchunk = dataView.getUint32(checkPosition)\n\t\tentry.push(chunk)\n\t\tcheckPosition += 4\n\t}\n\tend += 3\n\twhile (checkPosition < end) {\n\t\tchunk = src[checkPosition++]\n\t\tentry.push(chunk)\n\t}\n\t// for small blocks, avoiding the overhead of the extract call is helpful\n\tlet string = length < 16 ? shortStringInJS(length) : longStringInJS(length)\n\tif (string != null)\n\t\treturn entry.string = string\n\treturn entry.string = readFixedString(length)\n}\n\nexport class Tag {\n\tconstructor(value, tag) {\n\t\tthis.value = value\n\t\tthis.tag = tag\n\t}\n}\n\ncurrentExtensions[0] = (dateString) => {\n\t// string date extension\n\treturn new Date(dateString)\n}\n\ncurrentExtensions[1] = (epochSec) => {\n\t// numeric date extension\n\treturn new Date(Math.round(epochSec * 1000))\n}\n\ncurrentExtensions[2] = (buffer) => {\n\t// bigint extension\n\tlet value = BigInt(0)\n\tfor (let i = 0, l = buffer.byteLength; i < l; i++) {\n\t\tvalue = BigInt(buffer[i]) + (value << BigInt(8))\n\t}\n\treturn value\n}\n\ncurrentExtensions[3] = (buffer) => {\n\t// negative bigint extension\n\treturn BigInt(-1) - currentExtensions[2](buffer)\n}\ncurrentExtensions[4] = (fraction) => {\n\t// best to reparse to maintain accuracy\n\treturn +(fraction[1] + 'e' + fraction[0])\n}\n\ncurrentExtensions[5] = (fraction) => {\n\t// probably not sufficiently accurate\n\treturn fraction[1] * Math.exp(fraction[0] * Math.log(2))\n}\n\n// the registration of the record definition extension\nconst recordDefinition = (id, structure) => {\n\tid = id - 0xe000\n\tlet existingStructure = currentStructures[id]\n\tif (existingStructure && existingStructure.isShared) {\n\t\t(currentStructures.restoreStructures || (currentStructures.restoreStructures = []))[id] = existingStructure\n\t}\n\tcurrentStructures[id] = structure\n\n\tstructure.read = createStructureReader(structure)\n}\ncurrentExtensions[LEGACY_RECORD_INLINE_ID] = (data) => {\n\tlet length = data.length\n\tlet structure = data[1]\n\trecordDefinition(data[0], structure)\n\tlet object = {}\n\tfor (let i = 2; i < length; i++) {\n\t\tlet key = structure[i - 2]\n\t\tobject[safeKey(key)] = data[i]\n\t}\n\treturn object\n}\ncurrentExtensions[14] = (value) => {\n\tif (bundledStrings)\n\t\treturn bundledStrings[0].slice(bundledStrings.position0, bundledStrings.position0 += value)\n\treturn new Tag(value, 14)\n}\ncurrentExtensions[15] = (value) => {\n\tif (bundledStrings)\n\t\treturn bundledStrings[1].slice(bundledStrings.position1, bundledStrings.position1 += value)\n\treturn new Tag(value, 15)\n}\nlet glbl = { Error, RegExp }\ncurrentExtensions[27] = (data) => { // http://cbor.schmorp.de/generic-object\n\treturn (glbl[data[0]] || Error)(data[1], data[2])\n}\nconst packedTable = (read) => {\n\tif (src[position++] != 0x84) {\n\t\tlet error = new Error('Packed values structure must be followed by a 4 element array')\n\t\tif (src.length < position)\n\t\t\terror.incomplete = true\n\t\tthrow error\n\t}\n\tlet newPackedValues = read() // packed values\n\tif (!newPackedValues || !newPackedValues.length) {\n\t\tlet error = new Error('Packed values structure must be followed by a 4 element array')\n\t\terror.incomplete = true\n\t\tthrow error\n\t}\n\tpackedValues = packedValues ? newPackedValues.concat(packedValues.slice(newPackedValues.length)) : newPackedValues\n\tpackedValues.prefixes = read()\n\tpackedValues.suffixes = read()\n\treturn read() // read the rump\n}\npackedTable.handlesRead = true\ncurrentExtensions[51] = packedTable\n\ncurrentExtensions[PACKED_REFERENCE_TAG_ID] = (data) => { // packed reference\n\tif (!packedValues) {\n\t\tif (currentDecoder.getShared)\n\t\t\tloadShared()\n\t\telse\n\t\t\treturn new Tag(data, PACKED_REFERENCE_TAG_ID)\n\t}\n\tif (typeof data == 'number')\n\t\treturn packedValues[16 + (data >= 0 ? 2 * data : (-2 * data - 1))]\n\tlet error = new Error('No support for non-integer packed references yet')\n\tif (data === undefined)\n\t\terror.incomplete = true\n\tthrow error\n}\n\n// The following code is an incomplete implementation of http://cbor.schmorp.de/stringref\n// the real thing would need to implemennt more logic to populate the stringRefs table and\n// maintain a stack of stringRef \"namespaces\".\n//\n// currentExtensions[25] = (id) => {\n// \treturn stringRefs[id]\n// }\n// currentExtensions[256] = (read) => {\n// \tstringRefs = []\n// \ttry {\n// \t\treturn read()\n// \t} finally {\n// \t\tstringRefs = null\n// \t}\n// }\n// currentExtensions[256].handlesRead = true\n\ncurrentExtensions[28] = (read) => { \n\t// shareable http://cbor.schmorp.de/value-sharing (for structured clones)\n\tif (!referenceMap) {\n\t\treferenceMap = new Map()\n\t\treferenceMap.id = 0\n\t}\n\tlet id = referenceMap.id++\n\tlet startingPosition = position\n\tlet token = src[position]\n\tlet target\n\t// TODO: handle Maps, Sets, and other types that can cycle; this is complicated, because you potentially need to read\n\t// ahead past references to record structure definitions\n\tif ((token >> 5) == 4)\n\t\ttarget = []\n\telse\n\t\ttarget = {}\n\n\tlet refEntry = { target } // a placeholder object\n\treferenceMap.set(id, refEntry)\n\tlet targetProperties = read() // read the next value as the target object to id\n\tif (refEntry.used) {// there is a cycle, so we have to assign properties to original target\n\t\tif (Object.getPrototypeOf(target) !== Object.getPrototypeOf(targetProperties)) {\n\t\t\t// this means that the returned target does not match the targetProperties, so we need rerun the read to\n\t\t\t// have the correctly create instance be assigned as a reference, then we do the copy the properties back to the\n\t\t\t// target\n\t\t\t// reset the position so that the read can be repeated\n\t\t\tposition = startingPosition\n\t\t\t// the returned instance is our new target for references\n\t\t\ttarget = targetProperties\n\t\t\treferenceMap.set(id, { target })\n\t\t\ttargetProperties = read()\n\t\t}\n\t\treturn Object.assign(target, targetProperties)\n\t}\n\trefEntry.target = targetProperties // the placeholder wasn't used, replace with the deserialized one\n\treturn targetProperties // no cycle, can just use the returned read object\n}\ncurrentExtensions[28].handlesRead = true\n\ncurrentExtensions[29] = (id) => {\n\t// sharedref http://cbor.schmorp.de/value-sharing (for structured clones)\n\tlet refEntry = referenceMap.get(id)\n\trefEntry.used = true\n\treturn refEntry.target\n}\n\ncurrentExtensions[258] = (array) => new Set(array); // https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md\n(currentExtensions[259] = (read) => {\n\t// https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec\n\t// for decoding as a standard Map\n\tif (currentDecoder.mapsAsObjects) {\n\t\tcurrentDecoder.mapsAsObjects = false\n\t\trestoreMapsAsObject = true\n\t}\n\treturn read()\n}).handlesRead = true\nfunction combine(a, b) {\n\tif (typeof a === 'string')\n\t\treturn a + b\n\tif (a instanceof Array)\n\t\treturn a.concat(b)\n\treturn Object.assign({}, a, b)\n}\nfunction getPackedValues() {\n\tif (!packedValues) {\n\t\tif (currentDecoder.getShared)\n\t\t\tloadShared()\n\t\telse\n\t\t\tthrow new Error('No packed values available')\n\t}\n\treturn packedValues\n}\nconst SHARED_DATA_TAG_ID = 0x53687264 // ascii 'Shrd'\ncurrentExtensionRanges.push((tag, input) => {\n\tif (tag >= 225 && tag <= 255)\n\t\treturn combine(getPackedValues().prefixes[tag - 224], input)\n\tif (tag >= 28704 && tag <= 32767)\n\t\treturn combine(getPackedValues().prefixes[tag - 28672], input)\n\tif (tag >= 1879052288 && tag <= 2147483647)\n\t\treturn combine(getPackedValues().prefixes[tag - 1879048192], input)\n\tif (tag >= 216 && tag <= 223)\n\t\treturn combine(input, getPackedValues().suffixes[tag - 216])\n\tif (tag >= 27647 && tag <= 28671)\n\t\treturn combine(input, getPackedValues().suffixes[tag - 27639])\n\tif (tag >= 1811940352 && tag <= 1879048191)\n\t\treturn combine(input, getPackedValues().suffixes[tag - 1811939328])\n\tif (tag == SHARED_DATA_TAG_ID) {// we do a special check for this so that we can keep the currentExtensions as densely stored array (v8 stores arrays densely under about 3000 elements)\n\t\treturn {\n\t\t\tpackedValues: packedValues,\n\t\t\tstructures: currentStructures.slice(0),\n\t\t\tversion: input,\n\t\t}\n\t}\n\tif (tag == 55799) // self-descriptive CBOR tag, just return input value\n\t\treturn input\n})\n\nconst isLittleEndianMachine = new Uint8Array(new Uint16Array([1]).buffer)[0] == 1\nexport const typedArrays = [Uint8Array, Uint8ClampedArray, Uint16Array, Uint32Array,\n\ttypeof BigUint64Array == 'undefined' ? { name:'BigUint64Array' } : BigUint64Array, Int8Array, Int16Array, Int32Array,\n\ttypeof BigInt64Array == 'undefined' ? { name:'BigInt64Array' } : BigInt64Array, Float32Array, Float64Array]\nconst typedArrayTags = [64, 68, 69, 70, 71, 72, 77, 78, 79, 85, 86]\nfor (let i = 0; i < typedArrays.length; i++) {\n\tregisterTypedArray(typedArrays[i], typedArrayTags[i])\n}\nfunction registerTypedArray(TypedArray, tag) {\n\tlet dvMethod = 'get' + TypedArray.name.slice(0, -5)\n\tlet bytesPerElement;\n\tif (typeof TypedArray === 'function')\n\t\tbytesPerElement = TypedArray.BYTES_PER_ELEMENT;\n\telse\n\t\tTypedArray = null;\n\tfor (let littleEndian = 0; littleEndian < 2; littleEndian++) {\n\t\tif (!littleEndian && bytesPerElement == 1)\n\t\t\tcontinue\n\t\tlet sizeShift = bytesPerElement == 2 ? 1 : bytesPerElement == 4 ? 2 : bytesPerElement == 8 ? 3 : 0\n\t\tcurrentExtensions[littleEndian ? tag : (tag - 4)] = (bytesPerElement == 1 || littleEndian == isLittleEndianMachine) ? (buffer) => {\n\t\t\tif (!TypedArray)\n\t\t\t\tthrow new Error('Could not find typed array for code ' + tag)\n\t\t\tif (!currentDecoder.copyBuffers) {\n\t\t\t\t// try provide a direct view, but will only work if we are byte-aligned\n\t\t\t\tif (bytesPerElement === 1 ||\n\t\t\t\t\tbytesPerElement === 2 && !(buffer.byteOffset & 1) ||\n\t\t\t\t\tbytesPerElement === 4 && !(buffer.byteOffset & 3) ||\n\t\t\t\t\tbytesPerElement === 8 && !(buffer.byteOffset & 7))\n\t\t\t\t\treturn new TypedArray(buffer.buffer, buffer.byteOffset, buffer.byteLength >> sizeShift);\n\t\t\t}\n\t\t\t// we have to slice/copy here to get a new ArrayBuffer, if we are not word/byte aligned\n\t\t\treturn new TypedArray(Uint8Array.prototype.slice.call(buffer, 0).buffer)\n\t\t} : buffer => {\n\t\t\tif (!TypedArray)\n\t\t\t\tthrow new Error('Could not find typed array for code ' + tag)\n\t\t\tlet dv = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength)\n\t\t\tlet elements = buffer.length >> sizeShift\n\t\t\tlet ta = new TypedArray(elements)\n\t\t\tlet method = dv[dvMethod]\n\t\t\tfor (let i = 0; i < elements; i++) {\n\t\t\t\tta[i] = method.call(dv, i << sizeShift, littleEndian)\n\t\t\t}\n\t\t\treturn ta\n\t\t}\n\t}\n}\n\nfunction readBundleExt() {\n\tlet length = readJustLength()\n\tlet bundlePosition = position + read()\n\tfor (let i = 2; i < length; i++) {\n\t\t// skip past bundles that were already read\n\t\tlet bundleLength = readJustLength() // this will increment position, so must add to position afterwards\n\t\tposition += bundleLength\n\t}\n\tlet dataPosition = position\n\tposition = bundlePosition\n\tbundledStrings = [readStringJS(readJustLength()), readStringJS(readJustLength())]\n\tbundledStrings.position0 = 0\n\tbundledStrings.position1 = 0\n\tbundledStrings.postBundlePosition = position\n\tposition = dataPosition\n\treturn read()\n}\n\nfunction readJustLength() {\n\tlet token = src[position++] & 0x1f\n\tif (token > 0x17) {\n\t\tswitch (token) {\n\t\t\tcase 0x18:\n\t\t\t\ttoken = src[position++]\n\t\t\t\tbreak\n\t\t\tcase 0x19:\n\t\t\t\ttoken = dataView.getUint16(position)\n\t\t\t\tposition += 2\n\t\t\t\tbreak\n\t\t\tcase 0x1a:\n\t\t\t\ttoken = dataView.getUint32(position)\n\t\t\t\tposition += 4\n\t\t\t\tbreak\n\t\t}\n\t}\n\treturn token\n}\n\nfunction loadShared() {\n\tif (currentDecoder.getShared) {\n\t\tlet sharedData = saveState(() => {\n\t\t\t// save the state in case getShared modifies our buffer\n\t\t\tsrc = null\n\t\t\treturn currentDecoder.getShared()\n\t\t}) || {}\n\t\tlet updatedStructures = sharedData.structures || []\n\t\tcurrentDecoder.sharedVersion = sharedData.version\n\t\tpackedValues = currentDecoder.sharedValues = sharedData.packedValues\n\t\tif (currentStructures === true)\n\t\t\tcurrentDecoder.structures = currentStructures = updatedStructures\n\t\telse\n\t\t\tcurrentStructures.splice.apply(currentStructures, [0, updatedStructures.length].concat(updatedStructures))\n\t}\n}\n\nfunction saveState(callback) {\n\tlet savedSrcEnd = srcEnd\n\tlet savedPosition = position\n\tlet savedStringPosition = stringPosition\n\tlet savedSrcStringStart = srcStringStart\n\tlet savedSrcStringEnd = srcStringEnd\n\tlet savedSrcString = srcString\n\tlet savedStrings = strings\n\tlet savedReferenceMap = referenceMap\n\tlet savedBundledStrings = bundledStrings\n\n\t// TODO: We may need to revisit this if we do more external calls to user code (since it could be slow)\n\tlet savedSrc = new Uint8Array(src.slice(0, srcEnd)) // we copy the data in case it changes while external data is processed\n\tlet savedStructures = currentStructures\n\tlet savedDecoder = currentDecoder\n\tlet savedSequentialMode = sequentialMode\n\tlet value = callback()\n\tsrcEnd = savedSrcEnd\n\tposition = savedPosition\n\tstringPosition = savedStringPosition\n\tsrcStringStart = savedSrcStringStart\n\tsrcStringEnd = savedSrcStringEnd\n\tsrcString = savedSrcString\n\tstrings = savedStrings\n\treferenceMap = savedReferenceMap\n\tbundledStrings = savedBundledStrings\n\tsrc = savedSrc\n\tsequentialMode = savedSequentialMode\n\tcurrentStructures = savedStructures\n\tcurrentDecoder = savedDecoder\n\tdataView = new DataView(src.buffer, src.byteOffset, src.byteLength)\n\treturn value\n}\nexport function clearSource() {\n\tsrc = null\n\treferenceMap = null\n\tcurrentStructures = null\n}\n\nexport function addExtension(extension) {\n\tcurrentExtensions[extension.tag] = extension.decode\n}\n\nexport function setSizeLimits(limits) {\n\tif (limits.maxMapSize) maxMapSize = limits.maxMapSize;\n\tif (limits.maxArraySize) maxArraySize = limits.maxArraySize;\n\tif (limits.maxObjectSize) maxObjectSize = limits.maxObjectSize;\n}\n\nexport const mult10 = new Array(147) // this is a table matching binary exponents to the multiplier to determine significant digit rounding\nfor (let i = 0; i < 256; i++) {\n\tmult10[i] = +('1e' + Math.floor(45.15 - i * 0.30103))\n}\nlet defaultDecoder = new Decoder({ useRecords: false })\nexport const decode = defaultDecoder.decode\nexport const decodeMultiple = defaultDecoder.decodeMultiple\nexport const FLOAT32_OPTIONS = {\n\tNEVER: 0,\n\tALWAYS: 1,\n\tDECIMAL_ROUND: 3,\n\tDECIMAL_FIT: 4\n}\nexport function roundFloat32(float32Number) {\n\tf32Array[0] = float32Number\n\tlet multiplier = mult10[((u8Array[3] & 0x7f) << 1) | (u8Array[2] >> 7)]\n\treturn ((multiplier * float32Number + (float32Number > 0 ? 0.5 : -0.5)) >> 0) / multiplier\n}\n","import { Decoder, mult10, Tag, typedArrays, addExtension as decodeAddExtension } from './decode.js'\nlet textEncoder\ntry {\n\ttextEncoder = new TextEncoder()\n} catch (error) {}\nlet extensions, extensionClasses\nconst Buffer = typeof globalThis === 'object' && globalThis.Buffer;\nconst hasNodeBuffer = typeof Buffer !== 'undefined'\nconst ByteArrayAllocate = hasNodeBuffer ? Buffer.allocUnsafeSlow : Uint8Array\nconst ByteArray = hasNodeBuffer ? Buffer : Uint8Array\nconst MAX_STRUCTURES = 0x100\nconst MAX_BUFFER_SIZE = hasNodeBuffer ? 0x100000000 : 0x7fd00000\nlet serializationId = 1\nlet throwOnIterable\nlet target\nlet targetView\nlet position = 0\nlet safeEnd\nlet bundledStrings = null\nconst MAX_BUNDLE_SIZE = 0xf000\nconst hasNonLatin = /[\\u0080-\\uFFFF]/\nconst RECORD_SYMBOL = Symbol('record-id')\nexport class Encoder extends Decoder {\n\tconstructor(options) {\n\t\tsuper(options)\n\t\tthis.offset = 0\n\t\tlet typeBuffer\n\t\tlet start\n\t\tlet sharedStructures\n\t\tlet hasSharedUpdate\n\t\tlet structures\n\t\tlet referenceMap\n\t\toptions = options || {}\n\t\tlet encodeUtf8 = ByteArray.prototype.utf8Write ? function(string, position) {\n\t\t\treturn target.utf8Write(string, position, target.byteLength - position)\n\t\t} : (textEncoder && textEncoder.encodeInto) ?\n\t\t\tfunction(string, position) {\n\t\t\t\treturn textEncoder.encodeInto(string, target.subarray(position)).written\n\t\t\t} : false\n\n\t\tlet encoder = this\n\t\tlet hasSharedStructures = options.structures || options.saveStructures\n\t\tlet maxSharedStructures = options.maxSharedStructures\n\t\tif (maxSharedStructures == null)\n\t\t\tmaxSharedStructures = hasSharedStructures ? 128 : 0\n\t\tif (maxSharedStructures > 8190)\n\t\t\tthrow new Error('Maximum maxSharedStructure is 8190')\n\t\tlet isSequential = options.sequential\n\t\tif (isSequential) {\n\t\t\tmaxSharedStructures = 0\n\t\t}\n\t\tif (!this.structures)\n\t\t\tthis.structures = []\n\t\tif (this.saveStructures)\n\t\t\tthis.saveShared = this.saveStructures\n\t\tlet samplingPackedValues, packedObjectMap, sharedValues = options.sharedValues\n\t\tlet sharedPackedObjectMap\n\t\tif (sharedValues) {\n\t\t\tsharedPackedObjectMap = Object.create(null)\n\t\t\tfor (let i = 0, l = sharedValues.length; i < l; i++) {\n\t\t\t\tsharedPackedObjectMap[sharedValues[i]] = i\n\t\t\t}\n\t\t}\n\t\tlet recordIdsToRemove = []\n\t\tlet transitionsCount = 0\n\t\tlet serializationsSinceTransitionRebuild = 0\n\t\t\n\t\tthis.mapEncode = function(value, encodeOptions) {\n\t\t\t// Experimental support for premapping keys using _keyMap instad of keyMap - not optiimised yet)\n\t\t\tif (this._keyMap && !this._mapped) {\n\t\t\t\t//console.log('encoding ', value)\n\t\t\t\tswitch (value.constructor.name) {\n\t\t\t\t\tcase 'Array': \n\t\t\t\t\t\tvalue = value.map(r => this.encodeKeys(r))\n\t\t\t\t\t\tbreak\n\t\t\t\t\t//case 'Map': \n\t\t\t\t\t//\tvalue = this.encodeKeys(value)\n\t\t\t\t\t//\tbreak\n\t\t\t\t}\n\t\t\t\t//this._mapped = true\n\t\t\t}\n\t\t\treturn this.encode(value, encodeOptions)\n\t\t}\n\t\t\n\t\tthis.encode = function(value, encodeOptions)\t{\n\t\t\tif (!target) {\n\t\t\t\ttarget = new ByteArrayAllocate(8192)\n\t\t\t\ttargetView = new DataView(target.buffer, 0, 8192)\n\t\t\t\tposition = 0\n\t\t\t}\n\t\t\tsafeEnd = target.length - 10\n\t\t\tif (safeEnd - position < 0x800) {\n\t\t\t\t// don't start too close to the end, \n\t\t\t\ttarget = new ByteArrayAllocate(target.length)\n\t\t\t\ttargetView = new DataView(target.buffer, 0, target.length)\n\t\t\t\tsafeEnd = target.length - 10\n\t\t\t\tposition = 0\n\t\t\t} else if (encodeOptions === REUSE_BUFFER_MODE)\n\t\t\t\tposition = (position + 7) & 0x7ffffff8 // Word align to make any future copying of this buffer faster\n\t\t\tstart = position\n\t\t\tif (encoder.useSelfDescribedHeader) {\n\t\t\t\ttargetView.setUint32(position, 0xd9d9f700) // tag two byte, then self-descriptive tag\n\t\t\t\tposition += 3\n\t\t\t}\n\t\t\treferenceMap = encoder.structuredClone ? new Map() : null\n\t\t\tif (encoder.bundleStrings && typeof value !== 'string') {\n\t\t\t\tbundledStrings = []\n\t\t\t\tbundledStrings.size = Infinity // force a new bundle start on first string\n\t\t\t} else\n\t\t\t\tbundledStrings = null\n\n\t\t\tsharedStructures = encoder.structures\n\t\t\tif (sharedStructures) {\n\t\t\t\tif (sharedStructures.uninitialized) {\n\t\t\t\t\tlet sharedData = encoder.getShared() || {}\n\t\t\t\t\tencoder.structures = sharedStructures = sharedData.structures || []\n\t\t\t\t\tencoder.sharedVersion = sharedData.version\n\t\t\t\t\tlet sharedValues = encoder.sharedValues = sharedData.packedValues\n\t\t\t\t\tif (sharedValues) {\n\t\t\t\t\t\tsharedPackedObjectMap = {}\n\t\t\t\t\t\tfor (let i = 0, l = sharedValues.length; i < l; i++)\n\t\t\t\t\t\t\tsharedPackedObjectMap[sharedValues[i]] = i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlet sharedStructuresLength = sharedStructures.length\n\t\t\t\tif (sharedStructuresLength > maxSharedStructures && !isSequential)\n\t\t\t\t\tsharedStructuresLength = maxSharedStructures\n\t\t\t\tif (!sharedStructures.transitions) {\n\t\t\t\t\t// rebuild our structure transitions\n\t\t\t\t\tsharedStructures.transitions = Object.create(null)\n\t\t\t\t\tfor (let i = 0; i < sharedStructuresLength; i++) {\n\t\t\t\t\t\tlet keys = sharedStructures[i]\n\t\t\t\t\t\t//console.log('shared struct keys:', keys)\n\t\t\t\t\t\tif (!keys)\n\t\t\t\t\t\t\tcontinue\n\t\t\t\t\t\tlet nextTransition, transition = sharedStructures.transitions\n\t\t\t\t\t\tfor (let j = 0, l = keys.length; j < l; j++) {\n\t\t\t\t\t\t\tif (transition[RECORD_SYMBOL] === undefined)\n\t\t\t\t\t\t\t\ttransition[RECORD_SYMBOL] = i\n\t\t\t\t\t\t\tlet key = keys[j]\n\t\t\t\t\t\t\tnextTransition = transition[key]\n\t\t\t\t\t\t\tif (!nextTransition) {\n\t\t\t\t\t\t\t\tnextTransition = transition[key] = Object.create(null)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttransition = nextTransition\n\t\t\t\t\t\t}\n\t\t\t\t\t\ttransition[RECORD_SYMBOL] = i | 0x100000\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (!isSequential)\n\t\t\t\t\tsharedStructures.nextId = sharedStructuresLength\n\t\t\t}\n\t\t\tif (hasSharedUpdate)\n\t\t\t\thasSharedUpdate = false\n\t\t\tstructures = sharedStructures || []\n\t\t\tpackedObjectMap = sharedPackedObjectMap\n\t\t\tif (options.pack) {\n\t\t\t\tlet packedValues = new Map()\n\t\t\t\tpackedValues.values = []\n\t\t\t\tpackedValues.encoder = encoder\n\t\t\t\tpackedValues.maxValues = options.maxPrivatePackedValues || (sharedPackedObjectMap ? 16 : Infinity)\n\t\t\t\tpackedValues.objectMap = sharedPackedObjectMap || false\n\t\t\t\tpackedValues.samplingPackedValues = samplingPackedValues\n\t\t\t\tfindRepetitiveStrings(value, packedValues)\n\t\t\t\tif (packedValues.values.length > 0) {\n\t\t\t\t\ttarget[position++] = 0xd8 // one-byte tag\n\t\t\t\t\ttarget[position++] = 51 // tag 51 for packed shared structures https://www.potaroo.net/ietf/ids/draft-ietf-cbor-packed-03.txt\n\t\t\t\t\twriteArrayHeader(4)\n\t\t\t\t\tlet valuesArray = packedValues.values\n\t\t\t\t\tencode(valuesArray)\n\t\t\t\t\twriteArrayHeader(0) // prefixes\n\t\t\t\t\twriteArrayHeader(0) // suffixes\n\t\t\t\t\tpackedObjectMap = Object.create(sharedPackedObjectMap || null)\n\t\t\t\t\tfor (let i = 0, l = valuesArray.length; i < l; i++) {\n\t\t\t\t\t\tpackedObjectMap[valuesArray[i]] = i\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrowOnIterable = encodeOptions & THROW_ON_ITERABLE;\n\t\t\ttry {\n\t\t\t\tif (throwOnIterable)\n\t\t\t\t\treturn;\n\t\t\t\tencode(value)\n\t\t\t\tif (bundledStrings) {\n\t\t\t\t\twriteBundles(start, encode)\n\t\t\t\t}\n\t\t\t\tencoder.offset = position // update the offset so next serialization doesn't write over our buffer, but can continue writing to same buffer sequentially\n\t\t\t\tif (referenceMap && referenceMap.idsToInsert) {\n\t\t\t\t\tposition += referenceMap.idsToInsert.length * 2\n\t\t\t\t\tif (position > safeEnd)\n\t\t\t\t\t\tmakeRoom(position)\n\t\t\t\t\tencoder.offset = position\n\t\t\t\t\tlet serialized = insertIds(target.subarray(start, position), referenceMap.idsToInsert)\n\t\t\t\t\treferenceMap = null\n\t\t\t\t\treturn serialized\n\t\t\t\t}\n\t\t\t\tif (encodeOptions & REUSE_BUFFER_MODE) {\n\t\t\t\t\ttarget.start = start\n\t\t\t\t\ttarget.end = position\n\t\t\t\t\treturn target\n\t\t\t\t}\n\t\t\t\treturn target.subarray(start, position) // position can change if we call encode again in saveShared, so we get the buffer now\n\t\t\t} finally {\n\t\t\t\tif (sharedStructures) {\n\t\t\t\t\tif (serializationsSinceTransitionRebuild < 10)\n\t\t\t\t\t\tserializationsSinceTransitionRebuild++\n\t\t\t\t\tif (sharedStructures.length > maxSharedStructures)\n\t\t\t\t\t\tsharedStructures.length = maxSharedStructures\n\t\t\t\t\tif (transitionsCount > 10000) {\n\t\t\t\t\t\t// force a rebuild occasionally after a lot of transitions so it can get cleaned up\n\t\t\t\t\t\tsharedStructures.transitions = null\n\t\t\t\t\t\tserializationsSinceTransitionRebuild = 0\n\t\t\t\t\t\ttransitionsCount = 0\n\t\t\t\t\t\tif (recordIdsToRemove.length > 0)\n\t\t\t\t\t\t\trecordIdsToRemove = []\n\t\t\t\t\t} else if (recordIdsToRemove.length > 0 && !isSequential) {\n\t\t\t\t\t\tfor (let i = 0, l = recordIdsToRemove.length; i < l; i++) {\n\t\t\t\t\t\t\trecordIdsToRemove[i][RECORD_SYMBOL] = undefined\n\t\t\t\t\t\t}\n\t\t\t\t\t\trecordIdsToRemove = []\n\t\t\t\t\t\t//sharedStructures.nextId = maxSharedStructures\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (hasSharedUpdate && encoder.saveShared) {\n\t\t\t\t\tif (encoder.structures.length > maxSharedStructures) {\n\t\t\t\t\t\tencoder.structures = encoder.structures.slice(0, maxSharedStructures)\n\t\t\t\t\t}\n\t\t\t\t\t// we can't rely on start/end with REUSE_BUFFER_MODE since they will (probably) change when we save\n\t\t\t\t\tlet returnBuffer = target.subarray(start, position)\n\t\t\t\t\tif (encoder.updateSharedData() === false)\n\t\t\t\t\t\treturn encoder.encode(value) // re-encode if it fails\n\t\t\t\t\treturn returnBuffer\n\t\t\t\t}\n\t\t\t\tif (encodeOptions & RESET_BUFFER_MODE)\n\t\t\t\t\tposition = start\n\t\t\t}\n\t\t}\n\t\tthis.findCommonStringsToPack = () => {\n\t\t\tsamplingPackedValues = new Map()\n\t\t\tif (!sharedPackedObjectMap)\n\t\t\t\tsharedPackedObjectMap = Object.create(null)\n\t\t\treturn (options) => {\n\t\t\t\tlet threshold = options && options.threshold || 4\n\t\t\t\tlet position = this.pack ? options.maxPrivatePackedValues || 16 : 0\n\t\t\t\tif (!sharedValues)\n\t\t\t\t\tsharedValues = this.sharedValues = []\n\t\t\t\tfor (let [ key, status ] of samplingPackedValues) {\n\t\t\t\t\tif (status.count > threshold) {\n\t\t\t\t\t\tsharedPackedObjectMap[key] = position++\n\t\t\t\t\t\tsharedValues.push(key)\n\t\t\t\t\t\thasSharedUpdate = true\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\twhile (this.saveShared && this.updateSharedData() === false) {}\n\t\t\t\tsamplingPackedValues = null\n\t\t\t}\n\t\t}\n\t\tconst encode = (value) => {\n\t\t\tif (position > safeEnd)\n\t\t\t\ttarget = makeRoom(position)\n\n\t\t\tvar type = typeof value\n\t\t\tvar length\n\t\t\tif (type === 'string') {\n\t\t\t\tif (packedObjectMap) {\n\t\t\t\t\tlet packedPosition = packedObjectMap[value]\n\t\t\t\t\tif (packedPosition >= 0) {\n\t\t\t\t\t\tif (packedPosition < 16)\n\t\t\t\t\t\t\ttarget[position++] = packedPosition + 0xe0 // simple values, defined in https://www.potaroo.net/ietf/ids/draft-ietf-cbor-packed-03.txt\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttarget[position++] = 0xc6 // tag 6 defined in https://www.potaroo.net/ietf/ids/draft-ietf-cbor-packed-03.txt\n\t\t\t\t\t\t\tif (packedPosition & 1)\n\t\t\t\t\t\t\t\tencode((15 - packedPosition) >> 1)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tencode((packedPosition - 16) >> 1)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn\n/*\t\t\t\t\t\t} else if (packedStatus.serializationId != serializationId) {\n\t\t\t\t\t\t\tpackedStatus.serializationId = serializationId\n\t\t\t\t\t\t\tpackedStatus.count = 1\n\t\t\t\t\t\t\tif (options.sharedPack) {\n\t\t\t\t\t\t\t\tlet sharedCount = packedStatus.sharedCount = (packedStatus.sharedCount || 0) + 1\n\t\t\t\t\t\t\t\tif (shareCount > (options.sharedPack.threshold || 5)) {\n\t\t\t\t\t\t\t\t\tlet sharedPosition = packedStatus.position = packedStatus.nextSharedPosition\n\t\t\t\t\t\t\t\t\thasSharedUpdate = true\n\t\t\t\t\t\t\t\t\tif (sharedPosition < 16)\n\t\t\t\t\t\t\t\t\t\ttarget[position++] = sharedPosition + 0xc0\n\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} // else any in-doc incrementation?*/\n\t\t\t\t\t} else if (samplingPackedValues && !options.pack) {\n\t\t\t\t\t\tlet status = samplingPackedValues.get(value)\n\t\t\t\t\t\tif (status)\n\t\t\t\t\t\t\tstatus.count++\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tsamplingPackedValues.set(value, {\n\t\t\t\t\t\t\t\tcount: 1,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tlet strLength = value.length\n\t\t\t\tif (bundledStrings && strLength >= 4 && strLength < 0x400) {\n\t\t\t\t\tif ((bundledStrings.size += strLength) > MAX_BUNDLE_SIZE) {\n\t\t\t\t\t\tlet extStart\n\t\t\t\t\t\tlet maxBytes = (bundledStrings[0] ? bundledStrings[0].length * 3 + bundledStrings[1].length : 0) + 10\n\t\t\t\t\t\tif (position + maxBytes > safeEnd)\n\t\t\t\t\t\t\ttarget = makeRoom(position + maxBytes)\n\t\t\t\t\t\ttarget[position++] = 0xd9 // tag 16-bit\n\t\t\t\t\t\ttarget[position++] = 0xdf // tag 0xdff9\n\t\t\t\t\t\ttarget[position++] = 0xf9\n\t\t\t\t\t\t// TODO: If we only have one bundle with any string data, only write one string bundle\n\t\t\t\t\t\ttarget[position++] = bundledStrings.position ? 0x84 : 0x82 // array of 4 or 2 elements depending on if we write bundles\n\t\t\t\t\t\ttarget[position++] = 0x1a // 32-bit unsigned int\n\t\t\t\t\t\textStart = position - start\n\t\t\t\t\t\tposition += 4 // reserve for writing bundle reference\n\t\t\t\t\t\tif (bundledStrings.position) {\n\t\t\t\t\t\t\twriteBundles(start, encode) // write the last bundles\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbundledStrings = ['', ''] // create new ones\n\t\t\t\t\t\tbundledStrings.size = 0\n\t\t\t\t\t\tbundledStrings.position = extStart\n\t\t\t\t\t}\n\t\t\t\t\tlet twoByte = hasNonLatin.test(value)\n\t\t\t\t\tbundledStrings[twoByte ? 0 : 1] += value\n\t\t\t\t\ttarget[position++] = twoByte ? 0xce : 0xcf\n\t\t\t\t\tencode(strLength);\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t\tlet headerSize\n\t\t\t\t// first we estimate the header size, so we can write to the correct location\n\t\t\t\tif (strLength < 0x20) {\n\t\t\t\t\theaderSize = 1\n\t\t\t\t} else if (strLength < 0x100) {\n\t\t\t\t\theaderSize = 2\n\t\t\t\t} else if (strLength < 0x10000) {\n\t\t\t\t\theaderSize = 3\n\t\t\t\t} else {\n\t\t\t\t\theaderSize = 5\n\t\t\t\t}\n\t\t\t\tlet maxBytes = strLength * 3\n\t\t\t\tif (position + maxBytes > safeEnd)\n\t\t\t\t\ttarget = makeRoom(position + maxBytes)\n\n\t\t\t\tif (strLength < 0x40 || !encodeUtf8) {\n\t\t\t\t\tlet i, c1, c2, strPosition = position + headerSize\n\t\t\t\t\tfor (i = 0; i < strLength; i++) {\n\t\t\t\t\t\tc1 = value.charCodeAt(i)\n\t\t\t\t\t\tif (c1 < 0x80) {\n\t\t\t\t\t\t\ttarget[strPosition++] = c1\n\t\t\t\t\t\t} else if (c1 < 0x800) {\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 6 | 0xc0\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 & 0x3f | 0x80\n\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t(c1 & 0xfc00) === 0xd800 &&\n\t\t\t\t\t\t\t((c2 = value.charCodeAt(i + 1)) & 0xfc00) === 0xdc00\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tc1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff)\n\t\t\t\t\t\t\ti++\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 18 | 0xf0\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 12 & 0x3f | 0x80\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 6 & 0x3f | 0x80\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 & 0x3f | 0x80\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 12 | 0xe0\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 >> 6 & 0x3f | 0x80\n\t\t\t\t\t\t\ttarget[strPosition++] = c1 & 0x3f | 0x80\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tlength = strPosition - position - headerSize\n\t\t\t\t} else {\n\t\t\t\t\tlength = encodeUtf8(value, position + headerSize, maxBytes)\n\t\t\t\t}\n\n\t\t\t\tif (length < 0x18) {\n\t\t\t\t\ttarget[position++] = 0x60 | length\n\t\t\t\t} else if (length < 0x100) {\n\t\t\t\t\tif (headerSize < 2) {\n\t\t\t\t\t\ttarget.copyWithin(position + 2, position + 1, position + 1 + length)\n\t\t\t\t\t}\n\t\t\t\t\ttarget[position++] = 0x78\n\t\t\t\t\ttarget[position++] = length\n\t\t\t\t} else if (length < 0x10000) {\n\t\t\t\t\tif (headerSize < 3) {\n\t\t\t\t\t\ttarget.copyWithin(position + 3, position + 2, position + 2 + length)\n\t\t\t\t\t}\n\t\t\t\t\ttarget[position++] = 0x79\n\t\t\t\t\ttarget[position++] = length >> 8\n\t\t\t\t\ttarget[position++] = length & 0xff\n\t\t\t\t} else {\n\t\t\t\t\tif (headerSize < 5) {\n\t\t\t\t\t\ttarget.copyWithin(position + 5, position + 3, position + 3 + length)\n\t\t\t\t\t}\n\t\t\t\t\ttarget[position++] = 0x7a\n\t\t\t\t\ttargetView.setUint32(position, length)\n\t\t\t\t\tposition += 4\n\t\t\t\t}\n\t\t\t\tposition += length\n\t\t\t} else if (type === 'number') {\n\t\t\t\tif (!this.alwaysUseFloat && value >>> 0 === value) {// positive integer, 32-bit or less\n\t\t\t\t\t// positive uint\n\t\t\t\t\tif (value < 0x18) {\n\t\t\t\t\t\ttarget[position++] = value\n\t\t\t\t\t} else if (value < 0x100) {\n\t\t\t\t\t\ttarget[position++] = 0x18\n\t\t\t\t\t\ttarget[position++] = value\n\t\t\t\t\t} else if (value < 0x10000) {\n\t\t\t\t\t\ttarget[position++] = 0x19\n\t\t\t\t\t\ttarget[position++] = value >> 8\n\t\t\t\t\t\ttarget[position++] = value & 0xff\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget[position++] = 0x1a\n\t\t\t\t\t\ttargetView.setUint32(position, value)\n\t\t\t\t\t\tposition += 4\n\t\t\t\t\t}\n\t\t\t\t} else if (!this.alwaysUseFloat && value >> 0 === value) { // negative integer, 31-bit or less\n\t\t\t\t\tif (value >= -0x18) {\n\t\t\t\t\t\ttarget[position++] = 0x1f - value\n\t\t\t\t\t} else if (value >= -0x100) {\n\t\t\t\t\t\ttarget[position++] = 0x38\n\t\t\t\t\t\ttarget[position++] = ~value\n\t\t\t\t\t} else if (value >= -0x10000) {\n\t\t\t\t\t\ttarget[position++] = 0x39\n\t\t\t\t\t\ttargetView.setUint16(position, ~value)\n\t\t\t\t\t\tposition += 2\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttarget[position++] = 0x3a\n\t\t\t\t\t\ttargetView.setUint32(position, ~value)\n\t\t\t\t\t\tposition += 4\n\t\t\t\t\t}\n\t\t\t\t} else if (!this.alwaysUseFloat && value < 0 && value >= -0x100000000 && Math.floor(value) === value) {\n\t\t\t\t\t// negative integer, 32-bit or less\n\t\t\t\t\ttarget[position++] = 0x3a\n\t\t\t\t\ttargetView.setUint32(position, -1 - value)\n\t\t\t\t\tposition += 4\n\t\t\t\t} else {\n\t\t\t\t\tlet useFloat32\n\t\t\t\t\tif ((useFloat32 = this.useFloat32) > 0 && value < 0x100000000 && value >= -0x80000000) {\n\t\t\t\t\t\ttarget[position++] = 0xfa\n\t\t\t\t\t\ttargetView.setFloat32(position, value)\n\t\t\t\t\t\tlet xShifted\n\t\t\t\t\t\tif (useFloat32 < 4 ||\n\t\t\t\t\t\t\t\t// this checks for rounding of numbers that were encoded in 32-bit float to nearest significant decimal digit that could be preserved\n\t\t\t\t\t\t\t\t((xShifted = value * mult10[((target[position] & 0x7f) << 1) | (target[position + 1] >> 7)]) >> 0) === xShifted) {\n\t\t\t\t\t\t\tposition += 4\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t} else\n\t\t\t\t\t\t\tposition-- // move back into position for writing a double\n\t\t\t\t\t}\n\t\t\t\t\ttarget[position++] = 0xfb\n\t\t\t\t\ttargetView.setFloat64(position, value)\n\t\t\t\t\tposition += 8\n\t\t\t\t}\n\t\t\t} else if (type === 'object') {\n\t\t\t\tif (!value)\n\t\t\t\t\ttarget[position++] = 0xf6\n\t\t\t\telse {\n\t\t\t\t\tif (referenceMap) {\n\t\t\t\t\t\tlet referee = referenceMap.get(value)\n\t\t\t\t\t\tif (referee) {\n\t\t\t\t\t\t\ttarget[position++] = 0xd8\n\t\t\t\t\t\t\ttarget[position++] = 29 // http://cbor.schmorp.de/value-sharing\n\t\t\t\t\t\t\ttarget[position++] = 0x19 // 16-bit uint\n\t\t\t\t\t\t\tif (!referee.references) {\n\t\t\t\t\t\t\t\tlet idsToInsert = referenceMap.idsToInsert || (referenceMap.idsToInsert = [])\n\t\t\t\t\t\t\t\treferee.references = []\n\t\t\t\t\t\t\t\tidsToInsert.push(referee)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treferee.references.push(position - start)\n\t\t\t\t\t\t\tposition += 2 // TODO: also support 32-bit\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t} else \n\t\t\t\t\t\t\treferenceMap.set(value, { offset: position - start })\n\t\t\t\t\t}\n\t\t\t\t\tlet constructor = value.constructor\n\t\t\t\t\tif (constructor === Object) {\n\t\t\t\t\t\tif (this.skipFunction === true) {\n\t\t\t\t\t\t\tvalue = Object.fromEntries([...Object.keys(value).filter(x => typeof value[x] !== \"function\").map(x => [x, value[x]])]);\n\t\t\t\t\t\t}\n\t\t\t\t\t\twriteObject(value)\n\t\t\t\t\t} else if (constructor === Array) {\n\t\t\t\t\t\tlength = value.length\n\t\t\t\t\t\tif (length < 0x18) {\n\t\t\t\t\t\t\ttarget[position++] = 0x80 | length\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\twriteArrayHeader(length)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t\t\tencode(value[i])\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (constructor === Map) {\n\t\t\t\t\t\tif (this.mapsAsObjects ? this.useTag259ForMaps !== false : this.useTag259ForMaps) {\n\t\t\t\t\t\t\t// use Tag 259 (https://github.com/shanewholloway/js-cbor-codec/blob/master/docs/CBOR-259-spec--explicit-maps.md) for maps if the user wants it that way\n\t\t\t\t\t\t\ttarget[position++] = 0xd9\n\t\t\t\t\t\t\ttarget[position++] = 1\n\t\t\t\t\t\t\ttarget[position++] = 3\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlength = value.size\n\t\t\t\t\t\tif (length < 0x18) {\n\t\t\t\t\t\t\ttarget[position++] = 0xa0 | length\n\t\t\t\t\t\t} else if (length < 0x100) {\n\t\t\t\t\t\t\ttarget[position++] = 0xb8\n\t\t\t\t\t\t\ttarget[position++] = length\n\t\t\t\t\t\t} else if (length < 0x10000) {\n\t\t\t\t\t\t\ttarget[position++] = 0xb9\n\t\t\t\t\t\t\ttarget[position++] = length >> 8\n\t\t\t\t\t\t\ttarget[position++] = length & 0xff\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\ttarget[position++] = 0xba\n\t\t\t\t\t\t\ttargetView.setUint32(position, length)\n\t\t\t\t\t\t\tposition += 4\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (encoder.keyMap) { \n\t\t\t\t\t\t\tfor (let [ key, entryValue ] of value) {\n\t\t\t\t\t\t\t\tencode(encoder.encodeKey(key))\n\t\t\t\t\t\t\t\tencode(entryValue)\n\t\t\t\t\t\t\t} \n\t\t\t\t\t\t} else { \n\t\t\t\t\t\t\tfor (let [ key, entryValue ] of value) {\n\t\t\t\t\t\t\t\tencode(key) \n\t\t\t\t\t\t\t\tencode(entryValue)\n\t\t\t\t\t\t\t} \t\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tfor (let i = 0, l = extensions.length; i < l; i++) {\n\t\t\t\t\t\t\tlet extensionClass = extensionClasses[i]\n\t\t\t\t\t\t\tif (value instanceof extensionClass) {\n\t\t\t\t\t\t\t\tlet extension = extensions[i]\n\t\t\t\t\t\t\t\tlet tag = extension.tag\n\t\t\t\t\t\t\t\tif (tag == undefined)\n\t\t\t\t\t\t\t\t\ttag = extension.getTag && extension.getTag.call(this, value)\n\t\t\t\t\t\t\t\tif (tag < 0x18) {\n\t\t\t\t\t\t\t\t\ttarget[position++] = 0xc0 | tag\n\t\t\t\t\t\t\t\t} else if (tag < 0x100) {\n\t\t\t\t\t\t\t\t\ttarget[position++] = 0xd8\n\t\t\t\t\t\t\t\t\ttarget[position++] = tag\n\t\t\t\t\t\t\t\t} else if (tag < 0x10000) {\n\t\t\t\t\t\t\t\t\ttarget[position++] = 0xd9\n\t\t\t\t\t\t\t\t\ttarget[position++] = tag >> 8\n\t\t\t\t\t\t\t\t\ttarget[position++] = tag & 0xff\n\t\t\t\t\t\t\t\t} else if (tag > -1) {\n\t\t\t\t\t\t\t\t\ttarget[position++] = 0xda\n\t\t\t\t\t\t\t\t\ttargetView.setUint32(position, tag)\n\t\t\t\t\t\t\t\t\tposition += 4\n\t\t\t\t\t\t\t\t} // else undefined, don't write tag\n\t\t\t\t\t\t\t\textension.encode.call(this, value, encode, makeRoom)\n\t\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (value[Symbol.iterator]) {\n\t\t\t\t\t\t\tif (throwOnIterable) {\n\t\t\t\t\t\t\t\tlet error = new Error('Iterable should be serialized as iterator')\n\t\t\t\t\t\t\t\terror.iteratorNotHandled = true;\n\t\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttarget[position++] = 0x9f // indefinite length array\n\t\t\t\t\t\t\tfor (let entry of value) {\n\t\t\t\t\t\t\t\tencode(entry)\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\ttarget[position++] = 0xff // stop-code\n\t\t\t\t\t\t\treturn\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (value[Symbol.asyncIterator] || isBlob(value)) {\n\t\t\t\t\t\t\tlet error = new Error('Iterable/blob should be serialized as iterator')\n\t\t\t\t\t\t\terror.iteratorNotHandled = true;\n\t\t\t\t\t\t\tthrow error;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (this.useToJSON && value.toJSON) {\n\t\t\t\t\t\t\tconst json = value.toJSON()\n\t\t\t\t\t\t\t// if for some reason value.toJSON returns itself it'll loop forever\n\t\t\t\t\t\t\tif (json !== value)\n\t\t\t\t\t\t\t\treturn encode(json)\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// no extension found, write as a plain object\n\t\t\t\t\t\twriteObject(value)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (type === 'boolean') {\n\t\t\t\ttarget[position++] = value ? 0xf5 : 0xf4\n\t\t\t} else if (type === 'bigint') {\n\t\t\t\tif (value < (BigInt(1)<<BigInt(64)) && value >= 0) {\n\t\t\t\t\t// use an unsigned int as long as it fits\n\t\t\t\t\ttarget[position++] = 0x1b\n\t\t\t\t\ttargetView.setBigUint64(position, value)\n\t\t\t\t} else if (value > -(BigInt(1)<<BigInt(64)) && value < 0) {\n\t\t\t\t\t// if we can fit an unsigned int, use that\n\t\t\t\t\ttarget[position++] = 0x3b\n\t\t\t\t\ttargetView.setBigUint64(position, -value - BigInt(1))\n\t\t\t\t} else {\n\t\t\t\t\t// overflow\n\t\t\t\t\tif (this.largeBigIntToFloat) {\n\t\t\t\t\t\ttarget[position++] = 0xfb\n\t\t\t\t\t\ttargetView.setFloat64(position, Number(value))\n\t\t\t\t\t} else {\n\t\t\t\t\t\tif (value >= BigInt(0))\n\t\t\t\t\t\t\ttarget[position++] = 0xc2 // tag 2\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\ttarget[position++] = 0xc3 // tag 2\n\t\t\t\t\t\t\tvalue = BigInt(-1) - value;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlet bytes = [];\n\t\t\t\t\t\twhile (value) {\n\t\t\t\t\t\t\tbytes.push(Number(value & BigInt(0xff)));\n\t\t\t\t\t\t\tvalue >>= BigInt(8);\n\t\t\t\t\t\t}\n\t\t\t\t\t\twriteBuffer(new Uint8Array(bytes.reverse()), makeRoom);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tposition += 8\n\t\t\t} else if (type === 'undefined') {\n\t\t\t\ttarget[position++] = 0xf7\n\t\t\t} else {\n\t\t\t\tthrow new Error('Unknown type: ' + type)\n\t\t\t}\n\t\t}\n\n\t\tconst writeObject = this.useRecords === false ? this.variableMapSize ? (object) => {\n\t\t\t// this method is slightly slower, but generates \"preferred serialization\" (optimally small for smaller objects)\n\t\t\tlet keys = Object.keys(object)\n\t\t\tlet vals = Object.values(object)\n\t\t\tlet length = keys.length\n\t\t\tif (length < 0x18) {\n\t\t\t\ttarget[position++] = 0xa0 | length\n\t\t\t} else if (length < 0x100) {\n\t\t\t\ttarget[position++] = 0xb8\n\t\t\t\ttarget[position++] = length\n\t\t\t} else if (length < 0x10000) {\n\t\t\t\ttarget[position++] = 0xb9\n\t\t\t\ttarget[position++] = length >> 8\n\t\t\t\ttarget[position++] = length & 0xff\n\t\t\t} else {\n\t\t\t\ttarget[position++] = 0xba\n\t\t\t\ttargetView.setUint32(position, length)\n\t\t\t\tposition += 4\n\t\t\t}\n\t\t\tlet key\n\t\t\tif (encoder.keyMap) { \n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tencode(encoder.encodeKey(keys[i]))\n\t\t\t\t\tencode(vals[i])\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tencode(keys[i])\n\t\t\t\t\tencode(vals[i])\n\t\t\t\t}\n\t\t\t}\n\t\t} :\n\t\t(object) => {\n\t\t\ttarget[position++] = 0xb9 // always use map 16, so we can preallocate and set the length afterwards\n\t\t\tlet objectOffset = position - start\n\t\t\tposition += 2\n\t\t\tlet size = 0\n\t\t\tif (encoder.keyMap) {\n\t\t\t\tfor (let key in object) if (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key)) {\n\t\t\t\t\tencode(encoder.encodeKey(key))\n\t\t\t\t\tencode(object[key])\n\t\t\t\t\tsize++\n\t\t\t\t}\n\t\t\t} else { \n\t\t\t\tfor (let key in object) if (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key)) {\n\t\t\t\t\t\tencode(key)\n\t\t\t\t\t\tencode(object[key])\n\t\t\t\t\tsize++\n\t\t\t\t}\n\t\t\t}\n\t\t\ttarget[objectOffset++ + start] = size >> 8\n\t\t\ttarget[objectOffset + start] = size & 0xff\n\t\t} :\n\t\t(object, skipValues) => {\n\t\t\tlet nextTransition, transition = structures.transitions || (structures.transitions = Object.create(null))\n\t\t\tlet newTransitions = 0\n\t\t\tlet length = 0\n\t\t\tlet parentRecordId\n\t\t\tlet keys\n\t\t\tif (this.keyMap) {\n\t\t\t\tkeys = Object.keys(object).map(k => this.encodeKey(k))\n\t\t\t\tlength = keys.length\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tlet key = keys[i]\n\t\t\t\t\tnextTransition = transition[key]\n\t\t\t\t\tif (!nextTransition) {\n\t\t\t\t\t\tnextTransition = transition[key] = Object.create(null)\n\t\t\t\t\t\tnewTransitions++\n\t\t\t\t\t}\n\t\t\t\t\ttransition = nextTransition\n\t\t\t\t}\t\t\t\t\n\t\t\t} else {\n\t\t\t\tfor (let key in object) if (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key)) {\n\t\t\t\t\tnextTransition = transition[key]\n\t\t\t\t\tif (!nextTransition) {\n\t\t\t\t\t\tif (transition[RECORD_SYMBOL] & 0x100000) {// this indicates it is a brancheable/extendable terminal node, so we will use this record id and extend it\n\t\t\t\t\t\t\tparentRecordId = transition[RECORD_SYMBOL] & 0xffff\n\t\t\t\t\t\t}\n\t\t\t\t\t\tnextTransition = transition[key] = Object.create(null)\n\t\t\t\t\t\tnewTransitions++\n\t\t\t\t\t}\n\t\t\t\t\ttransition = nextTransition\n\t\t\t\t\tlength++\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet recordId = transition[RECORD_SYMBOL]\n\t\t\tif (recordId !== undefined) {\n\t\t\t\trecordId &= 0xffff\n\t\t\t\ttarget[position++] = 0xd9\n\t\t\t\ttarget[position++] = (recordId >> 8) | 0xe0\n\t\t\t\ttarget[position++] = recordId & 0xff\n\t\t\t} else {\n\t\t\t\tif (!keys)\n\t\t\t\t\tkeys = transition.__keys__ || (transition.__keys__ = Object.keys(object))\n\t\t\t\tif (parentRecordId === undefined) {\n\t\t\t\t\trecordId = structures.nextId++\n\t\t\t\t\tif (!recordId) {\n\t\t\t\t\t\trecordId = 0\n\t\t\t\t\t\tstructures.nextId = 1\n\t\t\t\t\t}\n\t\t\t\t\tif (recordId >= MAX_STRUCTURES) {// cycle back around\n\t\t\t\t\t\tstructures.nextId = (recordId = maxSharedStructures) + 1\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\trecordId = parentRecordId\n\t\t\t\t}\n\t\t\t\tstructures[recordId] = keys\n\t\t\t\tif (recordId < maxSharedStructures) {\n\t\t\t\t\ttarget[position++] = 0xd9\n\t\t\t\t\ttarget[position++] = (recordId >> 8) | 0xe0\n\t\t\t\t\ttarget[position++] = recordId & 0xff\n\t\t\t\t\ttransition = structures.transitions\n\t\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\t\tif (transition[RECORD_SYMBOL] === undefined || (transition[RECORD_SYMBOL] & 0x100000))\n\t\t\t\t\t\t\ttransition[RECORD_SYMBOL] = recordId\n\t\t\t\t\t\ttransition = transition[keys[i]]\n\t\t\t\t\t}\n\t\t\t\t\ttransition[RECORD_SYMBOL] = recordId | 0x100000 // indicates it is a extendable terminal\n\t\t\t\t\thasSharedUpdate = true\n\t\t\t\t} else {\n\t\t\t\t\ttransition[RECORD_SYMBOL] = recordId\n\t\t\t\t\ttargetView.setUint32(position, 0xd9dfff00) // tag two byte, then record definition id\n\t\t\t\t\tposition += 3\n\t\t\t\t\tif (newTransitions)\n\t\t\t\t\t\ttransitionsCount += serializationsSinceTransitionRebuild * newTransitions\n\t\t\t\t\t// record the removal of the id, we can maintain our shared structure\n\t\t\t\t\tif (recordIdsToRemove.length >= MAX_STRUCTURES - maxSharedStructures)\n\t\t\t\t\t\trecordIdsToRemove.shift()[RECORD_SYMBOL] = undefined // we are cycling back through, and have to remove old ones\n\t\t\t\t\trecordIdsToRemove.push(transition)\n\t\t\t\t\twriteArrayHeader(length + 2)\n\t\t\t\t\tencode(0xe000 + recordId)\n\t\t\t\t\tencode(keys)\n\t\t\t\t\tif (skipValues) return; // special exit for iterator\n\t\t\t\t\tfor (let key in object)\n\t\t\t\t\t\tif (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key))\n\t\t\t\t\t\t\tencode(object[key])\n\t\t\t\t\treturn\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (length < 0x18) { // write the array header\n\t\t\t\ttarget[position++] = 0x80 | length\n\t\t\t} else {\n\t\t\t\twriteArrayHeader(length)\n\t\t\t}\n\t\t\tif (skipValues) return; // special exit for iterator\n\t\t\tfor (let key in object)\n\t\t\t\tif (typeof object.hasOwnProperty !== 'function' || object.hasOwnProperty(key))\n\t\t\t\t\tencode(object[key])\n\t\t}\n\t\tconst makeRoom = (end) => {\n\t\t\tlet newSize\n\t\t\tif (end > 0x1000000) {\n\t\t\t\t// special handling for really large buffers\n\t\t\t\tif ((end - start) > MAX_BUFFER_SIZE)\n\t\t\t\t\tthrow new Error('Encoded buffer would be larger than maximum buffer size')\n\t\t\t\tnewSize = Math.min(MAX_BUFFER_SIZE,\n\t\t\t\t\tMath.round(Math.max((end - start) * (end > 0x4000000 ? 1.25 : 2), 0x400000) / 0x1000) * 0x1000)\n\t\t\t} else // faster handling for smaller buffers\n\t\t\t\tnewSize = ((Math.max((end - start) << 2, target.length - 1) >> 12) + 1) << 12\n\t\t\tlet newBuffer = new ByteArrayAllocate(newSize)\n\t\t\ttargetView = new DataView(newBuffer.buffer, 0, newSize)\n\t\t\tif (target.copy)\n\t\t\t\ttarget.copy(newBuffer, 0, start, end)\n\t\t\telse\n\t\t\t\tnewBuffer.set(target.slice(start, end))\n\t\t\tposition -= start\n\t\t\tstart = 0\n\t\t\tsafeEnd = newBuffer.length - 10\n\t\t\treturn target = newBuffer\n\t\t}\n\t\tlet chunkThreshold = 100;\n\t\tlet continuedChunkThreshold = 1000;\n\t\tthis.encodeAsIterable = function(value, options) {\n\t\t\treturn startEncoding(value, options, encodeObjectAsIterable);\n\t\t}\n\t\tthis.encodeAsAsyncIterable = function(value, options) {\n\t\t\treturn startEncoding(value, options, encodeObjectAsAsyncIterable);\n\t\t}\n\n\t\tfunction* encodeObjectAsIterable(object, iterateProperties, finalIterable) {\n\t\t\tlet constructor = object.constructor;\n\t\t\tif (constructor === Object) {\n\t\t\t\tlet useRecords = encoder.useRecords !== false;\n\t\t\t\tif (useRecords)\n\t\t\t\t\twriteObject(object, true); // write the record identifier\n\t\t\t\telse\n\t\t\t\t\twriteEntityLength(Object.keys(object).length, 0xa0);\n\t\t\t\tfor (let key in object) {\n\t\t\t\t\tlet value = object[key];\n\t\t\t\t\tif (!useRecords) encode(key);\n\t\t\t\t\tif (value && typeof value === 'object') {\n\t\t\t\t\t\tif (iterateProperties[key])\n\t\t\t\t\t\t\tyield* encodeObjectAsIterable(value, iterateProperties[key]);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tyield* tryEncode(value, iterateProperties, key);\n\t\t\t\t\t} else encode(value);\n\t\t\t\t}\n\t\t\t} else if (constructor === Array) {\n\t\t\t\tlet length = object.length;\n\t\t\t\twriteArrayHeader(length);\n\t\t\t\tfor (let i = 0; i < length; i++) {\n\t\t\t\t\tlet value = object[i];\n\t\t\t\t\tif (value && (typeof value === 'object' || position - start > chunkThreshold)) {\n\t\t\t\t\t\tif (iterateProperties.element)\n\t\t\t\t\t\t\tyield* encodeObjectAsIterable(value, iterateProperties.element);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tyield* tryEncode(value, iterateProperties, 'element');\n\t\t\t\t\t} else encode(value);\n\t\t\t\t}\n\t\t\t} else if (object[Symbol.iterator] && !object.buffer) { // iterator, but exclude typed arrays\n\t\t\t\ttarget[position++] = 0x9f; // start indefinite array\n\t\t\t\tfor (let value of object) {\n\t\t\t\t\tif (value && (typeof value === 'object' || position - start > chunkThreshold)) {\n\t\t\t\t\t\tif (iterateProperties.element)\n\t\t\t\t\t\t\tyield* encodeObjectAsIterable(value, iterateProperties.element);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tyield* tryEncode(value, iterateProperties, 'element');\n\t\t\t\t\t} else encode(value);\n\t\t\t\t}\n\t\t\t\ttarget[position++] = 0xff; // stop byte\n\t\t\t} else if (isBlob(object)){\n\t\t\t\twriteEntityLength(object.size, 0x40); // encode as binary data\n\t\t\t\tyield target.subarray(start, position);\n\t\t\t\tyield object; // directly return blobs, they have to be encoded asynchronously\n\t\t\t\trestartEncoding();\n\t\t\t} else if (object[Symbol.asyncIterator]) {\n\t\t\t\ttarget[position++] = 0x9f; // start indefinite array\n\t\t\t\tyield target.subarray(start, position);\n\t\t\t\tyield object; // directly return async iterators, they have to be encoded asynchronously\n\t\t\t\trestartEncoding();\n\t\t\t\ttarget[position++] = 0xff; // stop byte\n\t\t\t} else {\n\t\t\t\tencode(object);\n\t\t\t}\n\t\t\tif (finalIterable && position > start) yield target.subarray(start, position);\n\t\t\telse if (position - start > chunkThreshold) {\n\t\t\t\tyield target.subarray(start, position);\n\t\t\t\trestartEncoding();\n\t\t\t}\n\t\t}\n\t\tfunction* tryEncode(value, iterateProperties, key) {\n\t\t\tlet restart = position - start;\n\t\t\ttry {\n\t\t\t\tencode(value);\n\t\t\t\tif (position - start > chunkThreshold) {\n\t\t\t\t\tyield target.subarray(start, position);\n\t\t\t\t\trestartEncoding();\n\t\t\t\t}\n\t\t\t} catch (error) {\n\t\t\t\tif (error.iteratorNotHandled) {\n\t\t\t\t\titerateProperties[key] = {};\n\t\t\t\t\tposition = start + restart; // restart our position so we don't have partial data from last encode\n\t\t\t\t\tyield* encodeObjectAsIterable.call(this, value, iterateProperties[key]);\n\t\t\t\t} else throw error;\n\t\t\t}\n\t\t}\n\t\tfunction restartEncoding() {\n\t\t\tchunkThreshold = continuedChunkThreshold;\n\t\t\tencoder.encode(null, THROW_ON_ITERABLE); // restart encoding\n\t\t}\n\t\tfunction startEncoding(value, options, encodeIterable) {\n\t\t\tif (options && options.chunkThreshold) // explicitly specified chunk sizes\n\t\t\t\tchunkThreshold = continuedChunkThreshold = options.chunkThreshold;\n\t\t\telse // we start with a smaller threshold to get initial bytes sent quickly\n\t\t\t\tchunkThreshold = 100;\n\t\t\tif (value && typeof value === 'object') {\n\t\t\t\tencoder.encode(null, THROW_ON_ITERABLE); // start encoding\n\t\t\t\treturn encodeIterable(value, encoder.iterateProperties || (encoder.iterateProperties = {}), true);\n\t\t\t}\n\t\t\treturn [encoder.encode(value)];\n\t\t}\n\n\t\tasync function* encodeObjectAsAsyncIterable(value, iterateProperties) {\n\t\t\tfor (let encodedValue of encodeObjectAsIterable(value, iterateProperties, true)) {\n\t\t\t\tlet constructor = encodedValue.constructor;\n\t\t\t\tif (constructor === ByteArray || constructor === Uint8Array)\n\t\t\t\t\tyield encodedValue;\n\t\t\t\telse if (isBlob(encodedValue)) {\n\t\t\t\t\tlet reader = encodedValue.stream().getReader();\n\t\t\t\t\tlet next;\n\t\t\t\t\twhile (!(next = await reader.read()).done) {\n\t\t\t\t\t\tyield next.value;\n\t\t\t\t\t}\n\t\t\t\t} else if (encodedValue[Symbol.asyncIterator]) {\n\t\t\t\t\tfor await (let asyncValue of encodedValue) {\n\t\t\t\t\t\trestartEncoding();\n\t\t\t\t\t\tif (asyncValue)\n\t\t\t\t\t\t\tyield* encodeObjectAsAsyncIterable(asyncValue, iterateProperties.async || (iterateProperties.async = {}));\n\t\t\t\t\t\telse yield encoder.encode(asyncValue);\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tyield encodedValue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tuseBuffer(buffer) {\n\t\t// this means we are finished using our own buffer and we can write over it safely\n\t\ttarget = buffer\n\t\ttargetView = new DataView(target.buffer, target.byteOffset, target.byteLength)\n\t\tposition = 0\n\t}\n\tclearSharedData() {\n\t\tif (this.structures)\n\t\t\tthis.structures = []\n\t\tif (this.sharedValues)\n\t\t\tthis.sharedValues = undefined\n\t}\n\tupdateSharedData() {\n\t\tlet lastVersion = this.sharedVersion || 0\n\t\tthis.sharedVersion = lastVersion + 1\n\t\tlet structuresCopy = this.structures.slice(0)\n\t\tlet sharedData = new SharedData(structuresCopy, this.sharedValues, this.sharedVersion)\n\t\tlet saveResults = this.saveShared(sharedData,\n\t\t\t\texistingShared => (existingShared && existingShared.version || 0) == lastVersion)\n\t\tif (saveResults === false) {\n\t\t\t// get updated structures and try again if the update failed\n\t\t\tsharedData = this.getShared() || {}\n\t\t\tthis.structures = sharedData.structures || []\n\t\t\tthis.sharedValues = sharedData.packedValues\n\t\t\tthis.sharedVersion = sharedData.version\n\t\t\tthis.structures.nextId = this.structures.length\n\t\t} else {\n\t\t\t// restore structures\n\t\t\tstructuresCopy.forEach((structure, i) => this.structures[i] = structure)\n\t\t}\n\t\t// saveShared may fail to write and reload, or may have reloaded to check compatibility and overwrite saved data, either way load the correct shared data\n\t\treturn saveResults\n\t}\n}\nfunction writeEntityLength(length, majorValue) {\n\tif (length < 0x18)\n\t\ttarget[position++] = majorValue | length\n\telse if (length < 0x100) {\n\t\ttarget[position++] = majorValue | 0x18\n\t\ttarget[position++] = length\n\t} else if (length < 0x10000) {\n\t\ttarget[position++] = majorValue | 0x19\n\t\ttarget[position++] = length >> 8\n\t\ttarget[position++] = length & 0xff\n\t} else {\n\t\ttarget[position++] = majorValue | 0x1a\n\t\ttargetView.setUint32(position, length)\n\t\tposition += 4\n\t}\n\n}\nclass SharedData {\n\tconstructor(structures, values, version) {\n\t\tthis.structures = structures\n\t\tthis.packedValues = values\n\t\tthis.version = version\n\t}\n}\n\nfunction writeArrayHeader(length) {\n\tif (length < 0x18)\n\t\ttarget[position++] = 0x80 | length\n\telse if (length < 0x100) {\n\t\ttarget[position++] = 0x98\n\t\ttarget[position++] = length\n\t} else if (length < 0x10000) {\n\t\ttarget[position++] = 0x99\n\t\ttarget[position++] = length >> 8\n\t\ttarget[position++] = length & 0xff\n\t} else {\n\t\ttarget[position++] = 0x9a\n\t\ttargetView.setUint32(position, length)\n\t\tposition += 4\n\t}\n}\n\nconst BlobConstructor = typeof Blob === 'undefined' ? function(){} : Blob;\nfunction isBlob(object) {\n\tif (object instanceof BlobConstructor)\n\t\treturn true;\n\tlet tag = object[Symbol.toStringTag];\n\treturn tag === 'Blob' || tag === 'File';\n}\nfunction findRepetitiveStrings(value, packedValues) {\n\tswitch(typeof value) {\n\t\tcase 'string':\n\t\t\tif (value.length > 3) {\n\t\t\t\tif (packedValues.objectMap[value] > -1 || packedValues.values.length >= packedValues.maxValues)\n\t\t\t\t\treturn\n\t\t\t\tlet packedStatus = packedValues.get(value)\n\t\t\t\tif (packedStatus) {\n\t\t\t\t\tif (++packedStatus.count == 2) {\n\t\t\t\t\t\tpackedValues.values.push(value)\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tpackedValues.set(value, {\n\t\t\t\t\t\tcount: 1,\n\t\t\t\t\t})\n\t\t\t\t\tif (packedValues.samplingPackedValues) {\n\t\t\t\t\t\tlet status = packedValues.samplingPackedValues.get(value)\n\t\t\t\t\t\tif (status)\n\t\t\t\t\t\t\tstatus.count++\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tpackedValues.samplingPackedValues.set(value, {\n\t\t\t\t\t\t\t\tcount: 1,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\tcase 'object':\n\t\t\tif (value) {\n\t\t\t\tif (value instanceof Array) {\n\t\t\t\t\tfor (let i = 0, l = value.length; i < l; i++) {\n\t\t\t\t\t\tfindRepetitiveStrings(value[i], packedValues)\n\t\t\t\t\t}\n\n\t\t\t\t} else {\n\t\t\t\t\tlet includeKeys = !packedValues.encoder.useRecords\n\t\t\t\t\tfor (var key in value) {\n\t\t\t\t\t\tif (value.hasOwnProperty(key)) {\n\t\t\t\t\t\t\tif (includeKeys)\n\t\t\t\t\t\t\t\tfindRepetitiveStrings(key, packedValues)\n\t\t\t\t\t\t\tfindRepetitiveStrings(value[key], packedValues)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak\n\t\tcase 'function': console.log(value)\n\t}\n}\nconst isLittleEndianMachine = new Uint8Array(new Uint16Array([1]).buffer)[0] == 1\nextensionClasses = [ Date, Set, Error, RegExp, Tag, ArrayBuffer,\n\tUint8Array, Uint8ClampedArray, Uint16Array, Uint32Array,\n\ttypeof BigUint64Array == 'undefined' ? function() {} : BigUint64Array, Int8Array, Int16Array, Int32Array,\n\ttypeof BigInt64Array == 'undefined' ? function() {} : BigInt64Array,\n\tFloat32Array, Float64Array, SharedData ]\n\n//Object.getPrototypeOf(Uint8Array.prototype).constructor /*TypedArray*/\nextensions = [{ // Date\n\ttag: 1,\n\tencode(date, encode) {\n\t\tlet seconds = date.getTime() / 1000\n\t\tif ((this.useTimestamp32 || date.getMilliseconds() === 0) && seconds >= 0 && seconds < 0x100000000) {\n\t\t\t// Timestamp 32\n\t\t\ttarget[position++] = 0x1a\n\t\t\ttargetView.setUint32(position, seconds)\n\t\t\tposition += 4\n\t\t} else {\n\t\t\t// Timestamp float64\n\t\t\ttarget[position++] = 0xfb\n\t\t\ttargetView.setFloat64(position, seconds)\n\t\t\tposition += 8\n\t\t}\n\t}\n}, { // Set\n\ttag: 258, // https://github.com/input-output-hk/cbor-sets-spec/blob/master/CBOR_SETS.md\n\tencode(set, encode) {\n\t\tlet array = Array.from(set)\n\t\tencode(array)\n\t}\n}, { // Error\n\ttag: 27, // http://cbor.schmorp.de/generic-object\n\tencode(error, encode) {\n\t\tencode([ error.name, error.message ])\n\t}\n}, { // RegExp\n\ttag: 27, // http://cbor.schmorp.de/generic-object\n\tencode(regex, encode) {\n\t\tencode([ 'RegExp', regex.source, regex.flags ])\n\t}\n}, { // Tag\n\tgetTag(tag) {\n\t\treturn tag.tag\n\t},\n\tencode(tag, encode) {\n\t\tencode(tag.value)\n\t}\n}, { // ArrayBuffer\n\tencode(arrayBuffer, encode, makeRoom) {\n\t\twriteBuffer(arrayBuffer, makeRoom)\n\t}\n}, { // Uint8Array\n\tgetTag(typedArray) {\n\t\tif (typedArray.constructor === Uint8Array) {\n\t\t\tif (this.tagUint8Array || hasNodeBuffer && this.tagUint8Array !== false)\n\t\t\t\treturn 64;\n\t\t} // else no tag\n\t},\n\tencode(typedArray, encode, makeRoom) {\n\t\twriteBuffer(typedArray, makeRoom)\n\t}\n},\n\ttypedArrayEncoder(68, 1),\n\ttypedArrayEncoder(69, 2),\n\ttypedArrayEncoder(70, 4),\n\ttypedArrayEncoder(71, 8),\n\ttypedArrayEncoder(72, 1),\n\ttypedArrayEncoder(77, 2),\n\ttypedArrayEncoder(78, 4),\n\ttypedArrayEncoder(79, 8),\n\ttypedArrayEncoder(85, 4),\n\ttypedArrayEncoder(86, 8),\n{\n\tencode(sharedData, encode) { // write SharedData\n\t\tlet packedValues = sharedData.packedValues || []\n\t\tlet sharedStructures = sharedData.structures || []\n\t\tif (packedValues.values.length > 0) {\n\t\t\ttarget[position++] = 0xd8 // one-byte tag\n\t\t\ttarget[position++] = 51 // tag 51 for packed shared structures https://www.potaroo.net/ietf/ids/draft-ietf-cbor-packed-03.txt\n\t\t\twriteArrayHeader(4)\n\t\t\tlet valuesArray = packedValues.values\n\t\t\tencode(valuesArray)\n\t\t\twriteArrayHeader(0) // prefixes\n\t\t\twriteArrayHeader(0) // suffixes\n\t\t\tpackedObjectMap = Object.create(sharedPackedObjectMap || null)\n\t\t\tfor (let i = 0, l = valuesArray.length; i < l; i++) {\n\t\t\t\tpackedObjectMap[valuesArray[i]] = i\n\t\t\t}\n\t\t}\n\t\tif (sharedStructures) {\n\t\t\ttargetView.setUint32(position, 0xd9dffe00)\n\t\t\tposition += 3\n\t\t\tlet definitions = sharedStructures.slice(0)\n\t\t\tdefinitions.unshift(0xe000)\n\t\t\tdefinitions.push(new Tag(sharedData.version, 0x53687264))\n\t\t\tencode(definitions)\n\t\t} else\n\t\t\tencode(new Tag(sharedData.version, 0x53687264))\n\t\t}\n\t}]\nfunction typedArrayEncoder(tag, size) {\n\tif (!isLittleEndianMachine && size > 1)\n\t\ttag -= 4 // the big endian equivalents are 4 less\n\treturn {\n\t\ttag: tag,\n\t\tencode: function writeExtBuffer(typedArray, encode) {\n\t\t\tlet length = typedArray.byteLength\n\t\t\tlet offset = typedArray.byteOffset || 0\n\t\t\tlet buffer = typedArray.buffer || typedArray\n\t\t\tencode(hasNodeBuffer ? Buffer.from(buffer, offset, length) :\n\t\t\t\tnew Uint8Array(buffer, offset, length))\n\t\t}\n\t}\n}\nfunction writeBuffer(buffer, makeRoom) {\n\tlet length = buffer.byteLength\n\tif (length < 0x18) {\n\t\ttarget[position++] = 0x40 + length\n\t} else if (length < 0x100) {\n\t\ttarget[position++] = 0x58\n\t\ttarget[position++] = length\n\t} else if (length < 0x10000) {\n\t\ttarget[position++] = 0x59\n\t\ttarget[position++] = length >> 8\n\t\ttarget[position++] = length & 0xff\n\t} else {\n\t\ttarget[position++] = 0x5a\n\t\ttargetView.setUint32(position, length)\n\t\tposition += 4\n\t}\n\tif (position + length >= target.length) {\n\t\tmakeRoom(position + length)\n\t}\n\t// if it is already a typed array (has an ArrayBuffer), use that, but if it is an ArrayBuffer itself,\n\t// must wrap it to set it.\n\ttarget.set(buffer.buffer ? buffer : new Uint8Array(buffer), position)\n\tposition += length\n}\n\nfunction insertIds(serialized, idsToInsert) {\n\t// insert the ids that need to be referenced for structured clones\n\tlet nextId\n\tlet distanceToMove = idsToInsert.length * 2\n\tlet lastEnd = serialized.length - distanceToMove\n\tidsToInsert.sort((a, b) => a.offset > b.offset ? 1 : -1)\n\tfor (let id = 0; id < idsToInsert.length; id++) {\n\t\tlet referee = idsToInsert[id]\n\t\treferee.id = id\n\t\tfor (let position of referee.references) {\n\t\t\tserialized[position++] = id >> 8\n\t\t\tserialized[position] = id & 0xff\n\t\t}\n\t}\n\twhile (nextId = idsToInsert.pop()) {\n\t\tlet offset = nextId.offset\n\t\tserialized.copyWithin(offset + distanceToMove, offset, lastEnd)\n\t\tdistanceToMove -= 2\n\t\tlet position = offset + distanceToMove\n\t\tserialized[position++] = 0xd8\n\t\tserialized[position++] = 28 // http://cbor.schmorp.de/value-sharing\n\t\tlastEnd = offset\n\t}\n\treturn serialized\n}\nfunction writeBundles(start, encode) {\n\ttargetView.setUint32(bundledStrings.position + start, position - bundledStrings.position - start + 1) // the offset to bundle\n\tlet writeStrings = bundledStrings\n\tbundledStrings = null\n\tencode(writeStrings[0])\n\tencode(writeStrings[1])\n}\n\nexport function addExtension(extension) {\n\tif (extension.Class) {\n\t\tif (!extension.encode)\n\t\t\tthrow new Error('Extension has no encode function')\n\t\textensionClasses.unshift(extension.Class)\n\t\textensions.unshift(extension)\n\t}\n\tdecodeAddExtension(extension)\n}\nlet defaultEncoder = new Encoder({ useRecords: false })\nexport const encode = defaultEncoder.encode\nexport const encodeAsIterable = defaultEncoder.encodeAsIterable\nexport const encodeAsAsyncIterable = defaultEncoder.encodeAsAsyncIterable\nexport { FLOAT32_OPTIONS } from './decode.js'\nimport { FLOAT32_OPTIONS } from './decode.js'\nexport const { NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } = FLOAT32_OPTIONS\nexport const REUSE_BUFFER_MODE = 512\nexport const RESET_BUFFER_MODE = 1024\nexport const THROW_ON_ITERABLE = 2048\n\n\n","/**\n * AAGUID (Authenticator Attestation GUID) Verification Module\n *\n * Extracts and verifies authenticator AAGUID from attestation objects.\n * Adapted from webauthn.js (lines 54-81) with externalized configuration.\n *\n * @module core/verifier\n */\n\nimport { SDKConfig, AuthenticatorConfig } from '../types/config';\nimport { decode as cborDecode } from 'cbor-x';\nimport { detectPlatform, type Platform } from '../utils/platform';\n\n/**\n * Result of AAGUID verification\n *\n * @interface AAGUIDVerificationResult\n */\nexport interface AAGUIDVerificationResult {\n  /**\n   * Whether the found AAGUID matches the expected AAGUID\n   */\n  matches: boolean;\n\n  /**\n   * AAGUID found in the attestation object (hex string)\n   */\n  foundHex: string;\n\n  /**\n   * Expected AAGUID from configuration (hex string)\n   */\n  targetHex: string;\n\n  /**\n   * Name of the authenticator that was matched (if matches is true)\n   */\n  authenticatorName?: string;\n}\n\n/**\n * Error thrown when AAGUID verification fails\n *\n * @class VerificationError\n */\nexport class VerificationError extends Error {\n  constructor(\n    message: string,\n    public details?: {\n      cause?: unknown;\n      foundHex?: string;\n      targetHex?: string;\n    }\n  ) {\n    super(message);\n    this.name = 'VerificationError';\n  }\n}\n\n/**\n * Converts hex string with colon separators to Uint8Array\n *\n * @param hexString - Hex string in format \"XX:XX:XX:...\" or \"XXXX...\"\n * @returns Uint8Array representation\n *\n * @throws {VerificationError} If hex string is invalid\n *\n * @example\n * ```typescript\n * const bytes = hexStringToUint8Array(\"00:76:63:1b\");\n * // Returns: Uint8Array([0x00, 0x76, 0x63, 0x1b])\n * ```\n */\nexport function hexStringToUint8Array(hexString: string): Uint8Array {\n  try {\n    // Remove colons and spaces\n    const cleaned = hexString.replace(/[:\\s]/g, '');\n\n    // Validate hex string\n    if (!/^[0-9a-fA-F]+$/.test(cleaned)) {\n      throw new Error('Invalid hex characters');\n    }\n\n    if (cleaned.length % 2 !== 0) {\n      throw new Error('Hex string must have even length');\n    }\n\n    // Convert to Uint8Array\n    const bytes = new Uint8Array(cleaned.length / 2);\n    for (let i = 0; i < bytes.length; i++) {\n      bytes[i] = parseInt(cleaned.substring(i * 2, i * 2 + 2), 16);\n    }\n\n    return bytes;\n  } catch (error) {\n    throw new VerificationError('Failed to convert hex string to Uint8Array', {\n      cause: error\n    });\n  }\n}\n\n/**\n * Converts Uint8Array to hex string without separators\n *\n * @param bytes - Uint8Array to convert\n * @returns Hex string (lowercase, no separators)\n *\n * @example\n * ```typescript\n * const hex = uint8ArrayToHexString(new Uint8Array([0x00, 0x76, 0x63, 0x1b]));\n * // Returns: \"0076631b\"\n * ```\n */\nexport function uint8ArrayToHexString(bytes: Uint8Array): string {\n  return Array.from(bytes)\n    .map((b) => b.toString(16).padStart(2, '0'))\n    .join('');\n}\n\n/**\n * Resolves which AAGUIDs are acceptable for an authenticator on a given platform.\n *\n * A `platformAaguids` entry for the platform replaces the defaults outright — including when it\n * is an empty array, which means \"nothing is acceptable here\". That is deliberate: the fallback\n * is for platforms the config says nothing about, not a floor under an explicit statement.\n *\n * @param authenticatorConfig - The authenticator's configuration\n * @param platform - Platform the ceremony ran on\n * @returns Normalized hex AAGUIDs (lowercase, no separators), in priority order\n */\nexport function resolveAcceptedAAGUIDs(\n  authenticatorConfig: AuthenticatorConfig,\n  platform: Platform\n): string[] {\n  const normalize = (value: string) => uint8ArrayToHexString(hexStringToUint8Array(value));\n\n  const platformKey = platform.toLowerCase() as keyof NonNullable<\n    AuthenticatorConfig['platformAaguids']\n  >;\n  const perPlatform = authenticatorConfig.platformAaguids?.[platformKey];\n\n  if (perPlatform) {\n    return perPlatform.map(normalize);\n  }\n\n  return [\n    authenticatorConfig.aaguid,\n    ...(authenticatorConfig.additionalAaguids || [])\n  ].map(normalize);\n}\n\n/**\n * Checks if the AAGUID in the attestation object matches a configured authenticator\n *\n * Extracts AAGUID from the attestation object's authenticator data and compares\n * it against the configured authenticator AAGUIDs. The AAGUID is located at\n * bytes 37-52 in the authenticator data according to WebAuthn spec.\n *\n * This is a direct adaptation of checkAAGUID() from webauthn.js (lines 54-81)\n * with the following improvements:\n * - AAGUID is externalized via config (not hardcoded)\n * - Supports multiple authenticators\n * - TypeScript types and error handling\n * - Configurable authenticator name\n *\n * @param attestationObject - The attestation object from credential creation\n * @param authenticatorName - Name of authenticator to verify against (e.g., \"ultrapass\")\n * @param config - SDK configuration containing authenticator AAGUIDs\n * @param platform - Platform the ceremony ran on, selecting which `platformAaguids` entry\n *   applies. Detected from the user agent when omitted; pass it explicitly from callers that\n *   already know, so the value can't disagree with the one used to build the request.\n * @returns Verification result with match status and hex values\n *\n * @throws {VerificationError} If CBOR decoding fails or authenticator not found in config\n *\n * @example\n * ```typescript\n * const result = checkAAGUID(\n *   attestationObject,\n *   'ultrapass',\n *   config\n * );\n *\n * if (result.matches) {\n *   console.log('Authenticator verified:', result.authenticatorName);\n * } else {\n *   console.error('AAGUID mismatch!');\n *   console.error('Expected:', result.targetHex);\n *   console.error('Found:', result.foundHex);\n * }\n * ```\n *\n * @see https://www.w3.org/TR/webauthn-2/#sctn-attestation\n */\nexport function checkAAGUID(\n  attestationObject: ArrayBuffer,\n  authenticatorName: string,\n  config: SDKConfig,\n  platform?: Platform\n): AAGUIDVerificationResult {\n  try {\n    // Validate authenticator exists in config\n    const authenticatorConfig = config.authenticators[authenticatorName];\n    if (!authenticatorConfig) {\n      throw new VerificationError(\n        `Authenticator \"${authenticatorName}\" not found in configuration. ` +\n          `Available: ${Object.keys(config.authenticators).join(', ')}`\n      );\n    }\n\n    // Parse the attestation object to extract AAGUID\n    const decodedAttestation = cborDecode(new Uint8Array(attestationObject)) as { authData: ArrayBuffer };\n    const authData = decodedAttestation.authData;\n\n    // AAGUID is at bytes 37-52 in authenticator data\n    // Per WebAuthn spec: https://www.w3.org/TR/webauthn-2/#sctn-authenticator-data\n    // Offset 37: AAGUID (16 bytes)\n    const aaguid = new Uint8Array(authData.slice(37, 53));\n\n    const foundHex = uint8ArrayToHexString(aaguid);\n\n    // The AAGUID rotation reached the native builds at different times — the 1.0.13 Windows MSI\n    // reports the new value while iOS/Android still report the legacy one — so which values are\n    // correct depends on where the ceremony ran. Resolve per platform rather than accepting the\n    // union everywhere, which would let an unexpected authenticator model pass on a platform\n    // where only one value is right.\n    const activePlatform = platform || detectPlatform();\n    const acceptedHex = resolveAcceptedAAGUIDs(authenticatorConfig, activePlatform);\n\n    // Reported as the expected value; the first entry is the platform's primary.\n    const targetHex = acceptedHex[0] ?? '';\n\n    const matches = acceptedHex.includes(foundHex);\n\n    // Log for debugging (if enabled)\n    if (config.debug) {\n      console.log('[FIDO2-JS] AAGUID Verification:');\n      console.log('  Authenticator:', authenticatorName);\n      console.log('  Platform:', activePlatform);\n      console.log('  Target AAGUID:', targetHex || '(none accepted on this platform)');\n      if (acceptedHex.length > 1) {\n        console.log('  Also accepted:', acceptedHex.slice(1).join(', '));\n      }\n      console.log('  Found AAGUID:', foundHex);\n      console.log('  Match:', matches);\n      if (matches && foundHex !== targetHex) {\n        console.log('  (matched a secondary AAGUID for this platform)');\n      }\n    }\n\n    return {\n      matches,\n      foundHex,\n      targetHex,\n      authenticatorName: matches ? authenticatorName : undefined\n    };\n  } catch (error) {\n    // Re-throw VerificationError as-is\n    if (error instanceof VerificationError) {\n      throw error;\n    }\n\n    // Wrap other errors\n    throw new VerificationError('Failed to verify AAGUID', {\n      cause: error\n    });\n  }\n}\n\n/**\n * Checks if the AAGUID matches any configured authenticator\n *\n * Tries to match the AAGUID against all configured authenticators and\n * returns the first match found.\n *\n * @param attestationObject - The attestation object from credential creation\n * @param config - SDK configuration containing authenticator AAGUIDs\n * @returns Verification result with match status and matched authenticator name\n *\n * @throws {VerificationError} If CBOR decoding fails\n *\n * @example\n * ```typescript\n * const result = checkAAGUIDAny(attestationObject, config);\n *\n * if (result.matches) {\n *   console.log('Matched authenticator:', result.authenticatorName);\n * } else {\n *   console.error('No matching authenticator found');\n * }\n * ```\n */\nexport function checkAAGUIDAny(\n  attestationObject: ArrayBuffer,\n  config: SDKConfig,\n  platform?: Platform\n): AAGUIDVerificationResult {\n  const authenticatorNames = Object.keys(config.authenticators);\n\n  if (authenticatorNames.length === 0) {\n    throw new VerificationError('No authenticators configured');\n  }\n\n  // Try each configured authenticator\n  for (const authenticatorName of authenticatorNames) {\n    const result = checkAAGUID(attestationObject, authenticatorName, config, platform);\n    if (result.matches) {\n      return result;\n    }\n  }\n\n  // No match found - return result from first authenticator\n  // (to provide foundHex and targetHex for debugging)\n  const firstResult = checkAAGUID(attestationObject, authenticatorNames[0], config, platform);\n  return {\n    ...firstResult,\n    matches: false,\n    authenticatorName: undefined\n  };\n}\n","/**\n * API Client for FIDO2 Backend Services\n *\n * Provides methods to communicate with the FIDO2 backend for JWE token\n * verification. The SDK works in standalone mode - no initialization needed.\n *\n * @module core/api\n */\n\nimport { SDKConfig } from '../types/config';\n\n/**\n * Error response from API\n */\nexport interface APIErrorResponse {\n  /**\n   * Error message from the server\n   */\n  message?: string;\n\n  /**\n   * Error code from the server\n   */\n  code?: string;\n\n  /**\n   * Additional error details\n   */\n  details?: unknown;\n}\n\n/**\n * Response from the verify endpoint\n */\nexport interface VerifyResponse {\n  /**\n   * Indicates if verification was successful\n   */\n  success: boolean;\n\n  /**\n   * Verified user data (if successful)\n   */\n  userData?: unknown;\n\n  /**\n   * Verification result details\n   */\n  result?: unknown;\n\n  /**\n   * Additional verification data\n   */\n  data?: unknown;\n}\n\n/**\n * Custom error class for API-related errors\n */\nexport class APIError extends Error {\n  /**\n   * HTTP status code\n   */\n  public readonly status: number;\n\n  /**\n   * Error response from the server\n   */\n  public readonly response?: APIErrorResponse;\n\n  /**\n   * Creates a new APIError\n   *\n   * @param message - Error message\n   * @param status - HTTP status code\n   * @param response - Error response from the server\n   */\n  constructor(message: string, status: number, response?: APIErrorResponse) {\n    super(message);\n    this.name = 'APIError';\n    this.status = status;\n    this.response = response;\n\n    // Maintains proper stack trace for where our error was thrown (only available on V8)\n    if (Error.captureStackTrace) {\n      Error.captureStackTrace(this, APIError);\n    }\n  }\n}\n\n/**\n * Maps an HTTP status from the verify endpoint to an actionable message.\n *\n * @param status - HTTP status code\n * @param statusText - HTTP status text, used for statuses without a specific message\n * @returns Human-readable error message\n */\nfunction describeVerifyFailure(status: number, statusText: string): string {\n  switch (status) {\n    case 400:\n      return 'Verification failed: Invalid request or malformed JWE token';\n    case 401:\n      return 'Verification failed: Unauthorized - check API key';\n    case 403:\n      return 'Verification failed: Forbidden - insufficient permissions';\n    case 404:\n      // The path is usually right and the HOST usually wrong. The JWE is minted against the\n      // policy served by whichever backend the *authenticator* is configured for, and only\n      // that backend can verify it. Pointing the SDK at a different host produces exactly\n      // this 404, after registration and the assertion have both succeeded.\n      return (\n        'Verification failed: Endpoint not found (404). Check the verify URL is ' +\n        '/v4/fido2/verify AND that its host matches the backend the authenticator is ' +\n        'configured for.'\n      );\n    case 422:\n      return 'Verification failed: Invalid JWE token format';\n    case 500:\n      return 'Verification failed: Internal server error';\n    case 503:\n      return 'Verification failed: Service unavailable';\n    default:\n      return `Verification failed: ${status} ${statusText}`;\n  }\n}\n\n/**\n * API Client for FIDO2 backend communication\n *\n * This class provides methods to verify JWE tokens with the backend.\n * The SDK works in standalone mode - no initialization endpoint needed.\n *\n * @example\n * ```typescript\n * const config: SDKConfig = {\n *   apiKey: 'your-api-key',\n *   apiEndpoints: {\n *     verify: 'https://api.example.com/verify'\n *   },\n *   authenticators: { ... }\n * };\n *\n * const client = new APIClient(config);\n * const result = await client.verify(jweToken);\n * ```\n */\nexport class APIClient {\n  /**\n   * SDK configuration\n   */\n  private readonly config: SDKConfig;\n\n  /**\n   * Creates a new APIClient instance\n   *\n   * @param config - SDK configuration containing API endpoints and authentication\n   *\n   * @throws {Error} If config is missing required fields\n   */\n  constructor(config: SDKConfig) {\n    if (!config) {\n      throw new Error('APIClient: config is required');\n    }\n\n    if (!config.apiEndpoints) {\n      throw new Error('APIClient: config.apiEndpoints is required');\n    }\n\n    if (!config.apiEndpoints.verify) {\n      throw new Error('APIClient: config.apiEndpoints.verify is required');\n    }\n\n    this.config = config;\n  }\n\n  /**\n   * Verifies a JWE token with the backend\n   *\n   * This method sends a JWE (JSON Web Encryption) token to the verification\n   * endpoint for validation. The token typically contains encrypted biometric\n   * or authentication data from the FIDO2 authenticator.\n   *\n   * The verification endpoint validates the token and returns the decrypted\n   * user data and verification results.\n   *\n   * Based on the reference implementation in webauthn.js lines 321-340.\n   *\n   * @param jweToken - The JWE token to verify (typically from largeBlob)\n   * @returns Promise that resolves to the verification response\n   *\n   * @throws {APIError} If the request fails or returns an error status\n   * @throws {Error} If jweToken is empty or invalid\n   *\n   * @example\n   * ```typescript\n   * const result = await client.verify(jweToken);\n   * if (result.success) {\n   *   console.log('Verification successful:', result.userData);\n   * }\n   * ```\n   */\n  async verify(jweToken: string): Promise<VerifyResponse> {\n    // Validate input\n    if (typeof jweToken !== 'string') {\n      throw new Error('verify: jweToken is required and must be a string');\n    }\n\n    if (!jweToken || jweToken.trim().length === 0) {\n      throw new Error('verify: jweToken cannot be empty');\n    }\n\n    try {\n      // Make verification request\n      // Based on webauthn.js lines 321-340\n      const response = await fetch(this.config.apiEndpoints.verify, {\n        method: 'POST',\n        headers: {\n          'X-API-Key': this.config.apiKey || '',\n          'Content-Type': 'application/json'\n        },\n        body: JSON.stringify({ jwe_token: jweToken })\n      });\n\n      // Handle non-OK responses\n      if (!response.ok) {\n        let errorResponse: APIErrorResponse | undefined;\n\n        try {\n          errorResponse = await response.json();\n        } catch {\n          // Response body is not JSON\n        }\n\n        throw new APIError(\n          describeVerifyFailure(response.status, response.statusText),\n          response.status,\n          errorResponse\n        );\n      }\n\n      // Parse and return response\n      return await response.json();\n    } catch (error) {\n      // Re-throw APIError as-is\n      if (error instanceof APIError) {\n        throw error;\n      }\n\n      // Wrap other errors (network errors, etc.)\n      throw new APIError(\n        `Verification request failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n        0,\n        { message: error instanceof Error ? error.message : 'Unknown error' }\n      );\n    }\n  }\n\n  /**\n   * Verifies a JWE token with a custom endpoint and API key\n   *\n   * This method allows verification with any endpoint, supporting the\n   * VerificationMode pattern from iOS SDK.\n   *\n   * @param jweToken - The JWE token to verify\n   * @param endpoint - The verification endpoint URL\n   * @param apiKey - The API key for authentication\n   * @returns Promise that resolves to the verification response\n   *\n   * @throws {APIError} If the request fails or returns an error status\n   * @throws {Error} If jweToken is empty or invalid\n   *\n   * @example\n   * ```typescript\n   * // Use custom endpoint\n   * const result = await client.verifyWithEndpoint(\n   *   jweToken,\n   *   'https://api.example.com/verify',\n   *   'custom-api-key'\n   * );\n   * ```\n   */\n  async verifyWithEndpoint(\n    jweToken: string,\n    endpoint: string,\n    apiKey: string\n  ): Promise<VerifyResponse> {\n    // Validate input\n    if (typeof jweToken !== 'string') {\n      throw new Error('verifyWithEndpoint: jweToken is required and must be a string');\n    }\n\n    if (!jweToken || jweToken.trim().length === 0) {\n      throw new Error('verifyWithEndpoint: jweToken cannot be empty');\n    }\n\n    if (!endpoint || typeof endpoint !== 'string') {\n      throw new Error('verifyWithEndpoint: endpoint is required and must be a string');\n    }\n\n    if (!apiKey || typeof apiKey !== 'string') {\n      throw new Error('verifyWithEndpoint: apiKey is required and must be a string');\n    }\n\n    try {\n      // Make verification request\n      const response = await fetch(endpoint, {\n        method: 'POST',\n        headers: {\n          'X-API-Key': apiKey,\n          'Content-Type': 'application/json'\n        },\n        body: JSON.stringify({ jwe_token: jweToken })\n      });\n\n      // Handle non-OK responses\n      if (!response.ok) {\n        let errorResponse: APIErrorResponse | undefined;\n\n        try {\n          errorResponse = await response.json();\n        } catch {\n          // Response body is not JSON\n        }\n\n        throw new APIError(\n          describeVerifyFailure(response.status, response.statusText),\n          response.status,\n          errorResponse\n        );\n      }\n\n      // Parse and return response\n      return await response.json();\n    } catch (error) {\n      // Re-throw APIError as-is\n      if (error instanceof APIError) {\n        throw error;\n      }\n\n      // Wrap other errors (network errors, etc.)\n      throw new APIError(\n        `Verification request failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n        0,\n        { message: error instanceof Error ? error.message : 'Unknown error' }\n      );\n    }\n  }\n\n  /**\n   * Verifies a biometric-proof payload, sending it as the raw request body.\n   *\n   * Prefer this over {@link verifyWithEndpoint} when you have the `verifyPayload` from an\n   * authentication result. The current largeBlob format carries `jwe_token` alongside\n   * `device_uuid` and `version`, and the endpoint expects that whole object — wrapping it\n   * in another `{ jwe_token: ... }` field double-encodes it and the request fails.\n   *\n   * Mirrors `verifyJWEPayload` in the native iOS launcher, which assigns the payload\n   * directly to the HTTP body.\n   *\n   * A bare token (legacy blob format) is wrapped as `{ jwe_token }` for compatibility, so\n   * callers can pass `verifyPayload` without checking which format they received.\n   *\n   * @param payload - Raw payload from `AuthenticationResult.verifyPayload`\n   * @param endpoint - Verification endpoint URL\n   * @param apiKey - API key sent as X-API-Key\n   * @returns Promise resolving to the verification response\n   *\n   * @throws {APIError} If the request fails or returns an error status\n   * @throws {Error} If payload is empty\n   *\n   * @example\n   * ```typescript\n   * const result = await sdk.authenticate({ domain });\n   * if (result.verifyPayload) {\n   *   const response = await client.verifyPayload(result.verifyPayload, endpoint, apiKey);\n   * }\n   * ```\n   */\n  async verifyPayload(\n    payload: string,\n    endpoint: string,\n    apiKey: string\n  ): Promise<VerifyResponse> {\n    if (typeof payload !== 'string' || payload.trim().length === 0) {\n      throw new Error('verifyPayload: payload is required and must be a non-empty string');\n    }\n\n    if (!endpoint || typeof endpoint !== 'string') {\n      throw new Error('verifyPayload: endpoint is required and must be a string');\n    }\n\n    // Structured payloads go through untouched; a bare token gets the legacy wrapper.\n    let body = payload.trim();\n    if (!body.startsWith('{')) {\n      body = JSON.stringify({ jwe_token: body });\n    }\n\n    try {\n      const response = await fetch(endpoint, {\n        method: 'POST',\n        headers: {\n          'X-API-Key': apiKey || '',\n          'Content-Type': 'application/json'\n        },\n        body\n      });\n\n      if (!response.ok) {\n        let errorResponse: APIErrorResponse | undefined;\n\n        try {\n          errorResponse = await response.json();\n        } catch {\n          // Response body is not JSON\n        }\n\n        throw new APIError(\n          describeVerifyFailure(response.status, response.statusText),\n          response.status,\n          errorResponse\n        );\n      }\n\n      return await response.json();\n    } catch (error) {\n      if (error instanceof APIError) {\n        throw error;\n      }\n\n      throw new APIError(\n        `Verification request failed: ${error instanceof Error ? error.message : 'Unknown error'}`,\n        0,\n        { message: error instanceof Error ? error.message : 'Unknown error' }\n      );\n    }\n  }\n\n  /**\n   * Gets the current API configuration\n   *\n   * @returns The SDK configuration\n   */\n  getConfig(): Readonly<SDKConfig> {\n    return this.config;\n  }\n}\n","/**\n * Default configuration for FIDO2-JS SDK\n *\n * Provides sensible defaults including externalized AAGUID for UltraPass\n * authenticator and configurable API endpoints.\n *\n * @module config/defaults\n */\n\nimport { SDKConfig } from '../types/config';\n\n/**\n * Verify endpoint per environment.\n *\n * The path is `/v4/fido2/verify`. Earlier `/verify` and `/v2/verify` paths are superseded.\n *\n * Only the public production service has a default. Non-production deployments are\n * environment-specific and are deliberately not baked into this package — point\n * `apiEndpoints.verify` at your own backend, or set `FIDO2_VERIFY_URL`.\n *\n * **The verify host must match the backend the authenticator is configured against.** The JWE\n * is minted under the policy that host served, so verifying it elsewhere checks the proof\n * against the wrong policy and fails after registration has already succeeded.\n */\nexport const VERIFY_ENDPOINTS = {\n  production: 'https://fido2-server.privateid.com/v4/fido2/verify'\n} as const;\n\n/**\n * iOS UltraPass URL scheme per environment.\n *\n * Production and staging UltraPass are distinct apps installable side by side, each\n * registering its own scheme. The scheme must match the build on the device, and pairs with\n * the backend that build talks to.\n *\n * Non-production defaults to the staging app.\n */\nexport const ULTRAPASS_SCHEMES = {\n  development: 'ultrapass-staging',\n  staging: 'ultrapass-staging',\n  production: 'ultrapass'\n} as const;\n\n/**\n * Default SDK configuration\n *\n * This configuration externalizes the previously hardcoded AAGUID from\n * webauthn.js (lines 57-60) and provides environment variable support\n * for API endpoints.\n *\n * Users can override any of these values when creating the SDK instance.\n *\n * @example\n * ```typescript\n * const sdk = new FIDO2SDK({\n *   apiKey: 'your-api-key',\n *   authenticators: {\n *     ultrapass: {\n *       aaguid: 'custom-aaguid',\n *       name: 'Custom UltraPass'\n *     }\n *   }\n * });\n * ```\n */\nexport const DEFAULT_CONFIG: Omit<SDKConfig, 'apiKey'> = {\n  /**\n   * Supported authenticators with their AAGUIDs\n   *\n   * The AAGUID is extracted from the authenticator during registration\n   * and verified against these configured values.\n   */\n  authenticators: {\n    /**\n     * UltraPass authenticator configuration\n     *\n     * Both the Windows HID and plugin transports advertise the same value, because the plugin\n     * sources it from the service's `authenticatorGetInfo`.\n     *\n     * Two values are in the field, and which one is correct depends on the platform:\n     *\n     * - `80:48:2e:30:...:b1` — a fresh RFC 4122 v4 value from the July 2026 firmware revision,\n     *   shipped in the **1.0.13 Windows** build and since rolled out to the mobile apps.\n     * - `00:76:63:1b:...:79` — what every build up to and including 1.0.11 reported.\n     *\n     * Every platform currently accepts **both**, because both builds are in the field and a\n     * device sending the value its platform was not listed for is rejected outright — that is\n     * how this surfaced: an Android staging registration on 2026-08-11 came back with the new\n     * value against an Android list holding only the legacy one, and the ceremony failed after\n     * the user had already completed face capture.\n     *\n     * Accepting both costs only the ability to tell the two builds apart; it cannot admit a\n     * foreign authenticator, since both values are UltraPass. Observed status when this was\n     * last checked: desktop on both, Android rotated (2026-08-11), iOS still sending legacy\n     * (2026-08-10) — iOS carries the new value pre-emptively so its rotation is a non-event.\n     *\n     * The per-platform split is kept rather than collapsed into one list: it is the mechanism\n     * for tightening a platform back down to a single value once every install there has\n     * rotated, which is worth doing per platform as each one finishes.\n     */\n    ultrapass: {\n      // Fallback for platforms not named below (including 'Unknown').\n      aaguid: '00:76:63:1b:d4:a0:42:7f:57:73:0e:c7:1c:9e:02:79',\n      name: 'UltraPass',\n      platformAaguids: {\n        ios: [\n          '80:48:2e:30:06:9e:4d:f9:b5:3e:2f:ce:89:59:6b:b1',\n          '00:76:63:1b:d4:a0:42:7f:57:73:0e:c7:1c:9e:02:79'\n        ],\n        android: [\n          '80:48:2e:30:06:9e:4d:f9:b5:3e:2f:ce:89:59:6b:b1',\n          '00:76:63:1b:d4:a0:42:7f:57:73:0e:c7:1c:9e:02:79'\n        ],\n        desktop: [\n          '80:48:2e:30:06:9e:4d:f9:b5:3e:2f:ce:89:59:6b:b1',\n          '00:76:63:1b:d4:a0:42:7f:57:73:0e:c7:1c:9e:02:79'\n        ]\n      }\n    }\n  },\n\n  /**\n   * Backend API endpoint for JWE token verification\n   *\n   * Current: /v4/fido2/verify — matches the native iOS and Android launchers.\n   * Superseded: /verify, /v2/verify.\n   *\n   * Defaults to the public production service. For any other deployment, set this\n   * explicitly or export FIDO2_VERIFY_URL.\n   *\n   * Supports environment variable: FIDO2_VERIFY_URL\n   */\n  apiEndpoints: {\n    verify:\n      (typeof process !== 'undefined' && process.env?.FIDO2_VERIFY_URL) ||\n      VERIFY_ENDPOINTS.production\n  },\n\n  /**\n   * Target environment — selects the default verify endpoint.\n   *\n   * Only 'production' has a built-in endpoint. 'development' and 'staging' require an\n   * explicit `apiEndpoints.verify` (or FIDO2_VERIFY_URL).\n   */\n  environment: 'production',\n\n  /**\n   * Request largeBlob support at registration, matching native `.supportRequired`.\n   *\n   * Without this the biometric-proof JWE cannot be read back during authentication.\n   */\n  largeBlobSupport: 'required',\n\n  /**\n   * Declare blob support with the WebAuthn L3 `largeBlob` extension, matching the current\n   * launcher (`registrationRequest.largeBlob = .supportRequired`).\n   */\n  largeBlobExtension: 'largeBlob',\n\n  /**\n   * Which iOS deeplink host authentication uses.\n   *\n   * 'start' is the current unified entry point and the default. 'legacy-verify' is kept as an\n   * escape hatch for older UltraPass builds that predate the `start` host.\n   */\n  iosAuthPath: 'start',\n\n  /**\n   * Omit allowCredentials on the Phase 2 assertion and rely on resident-key discovery.\n   *\n   * This was `true`, justified by \"registration uses residentKey: 'preferred', so the credential\n   * may not be discoverable\". **That premise no longer holds** — `createCredential` now requests\n   * `residentKey: 'required'` (and `requireResidentKey: true`), so every credential this SDK\n   * creates is discoverable and discovery cannot come up empty for lack of a resident key.\n   *\n   * With the premise gone, the cost stands on its own: Phase 1 already captured the biometric\n   * inside the UltraPass app, and naming a credential explicitly makes the provider re-verify —\n   * surfacing a second face prompt, or refusing outright with `NotAllowedError`. An iOS log from\n   * 2026-08-04 shows exactly that: enrollment succeeded, then Phase 2 sent one allowCredential\n   * and Safari returned \"The request is not allowed by the user agent or the platform in the\n   * current context\" in 5.4s.\n   *\n   * Set to `true` to restore the old behaviour if a discovery-only assertion finds nothing —\n   * which would mean the credential is not resident after all, and is worth investigating rather\n   * than papering over.\n   */\n  phase2AllowCredentials: false,\n\n  /**\n   * Ceremony options that diverge between the deeplink flows and the desktop/Windows flow.\n   *\n   * All four default to 'auto', meaning: match the PingFederate adapter's templates on desktop\n   * (no PRF, no credProtect keys, no transports hint, AbortController-enforced timeout) and keep\n   * the deeplink behaviour on iOS/Android. Resolved in `FIDO2SDK.resolveCeremonyOptions()`.\n   */\n  prfExtension: 'auto',\n  credProtectExtension: 'auto',\n  allowCredentialsTransports: 'auto',\n  enforceTimeoutWithAbort: 'auto',\n\n  /**\n   * Policy ID for authenticator configuration\n   * Used for mobile deeplink flows\n   *\n   * IMPORTANT: This must match the policy configured in your backend.\n   * Common values: 'mobile', 'default', 'ultrapass-mobile'\n   * Contact your backend team to get the correct value.\n   */\n  policyId: 'mobile',\n\n  /**\n   * Default timeout for WebAuthn operations (60 seconds)\n   */\n  timeout: 60000,\n\n  /**\n   * Debug mode disabled by default\n   */\n  debug: false,\n\n  /**\n   * Mobile callback delay (5 seconds)\n   *\n   * CRITICAL for iOS Safari: After deeplink redirect, Safari needs time to render\n   * before WebAuthn can be triggered. This delay ensures reliable Phase 2 WebAuthn\n   * completion, especially on first-time flows when Safari is initializing.\n   *\n   * Increased to 5000ms to handle first-time callback scenarios where Safari\n   * needs more time to be ready for WebAuthn. Second+ attempts work faster\n   * because Safari is already initialized.\n   *\n   * @see iOS_IMPLEMENTATION_COMPARISON.md for detailed explanation\n   */\n  mobileCallbackDelay: 5000,\n\n  /**\n   * Android init deeplink delay (1 second)\n   *\n   * Time between firing `privateid://init` and starting the WebAuthn ceremony. Android runs\n   * both in the same page, so this wait is all the UltraPass app gets to register itself as a\n   * credential provider. Too short against a cold start surfaces as `NotReadableError` from\n   * Android's Credential Manager.\n   */\n  androidInitDelay: 1000\n};\n\n/**\n * Helper function to merge user configuration with defaults\n *\n * @param userConfig - User-provided configuration (may be partial)\n * @returns Complete SDK configuration\n *\n * @example\n * ```typescript\n * const config = mergeConfig({ apiKey: 'key', timeout: 30000 });\n * // Returns: { ...DEFAULT_CONFIG, apiKey: 'key', timeout: 30000 }\n * ```\n */\nexport function mergeConfig(userConfig: Partial<SDKConfig> & { apiKey: string }): SDKConfig {\n  const environment = userConfig.environment || DEFAULT_CONFIG.environment || 'production';\n\n  // Endpoint precedence: explicit user value > FIDO2_VERIFY_URL env var > environment default.\n  // Only 'production' has a built-in host. Non-production deployments differ per installation\n  // and are not shipped in this package, so they must be supplied by the caller — failing\n  // loudly here beats silently verifying against the wrong backend.\n  const envVarEndpoint =\n    typeof process !== 'undefined' ? process.env?.FIDO2_VERIFY_URL : undefined;\n  const environmentEndpoint =\n    environment === 'production' ? VERIFY_ENDPOINTS.production : undefined;\n  const verify = userConfig.apiEndpoints?.verify || envVarEndpoint || environmentEndpoint;\n\n  if (!verify) {\n    throw new Error(\n      `No verify endpoint for environment '${environment}'. Only 'production' has a built-in ` +\n        'endpoint; set apiEndpoints.verify (or the FIDO2_VERIFY_URL environment variable) to ' +\n        'the /v4/fido2/verify URL of the backend your authenticator is configured against.'\n    );\n  }\n\n  // Same precedence for the iOS app scheme: explicit value, else the environment's app.\n  const ultrapassScheme = userConfig.ultrapassScheme || ULTRAPASS_SCHEMES[environment];\n\n  return {\n    ...DEFAULT_CONFIG,\n    ...userConfig,\n    environment,\n    ultrapassScheme,\n    apiEndpoints: {\n      ...DEFAULT_CONFIG.apiEndpoints,\n      ...(userConfig.apiEndpoints || {}),\n      verify\n    },\n    authenticators: {\n      ...DEFAULT_CONFIG.authenticators,\n      ...(userConfig.authenticators || {})\n    }\n  };\n}\n","/**\n * UltraPass loopback control-plane client.\n *\n * The Windows authenticator service exposes a WebSocket control plane on localhost. This module\n * speaks the one route the browser SDK needs — `/payload` — plus a reachability check.\n *\n * ## Why this exists\n *\n * On Windows 11 24H2/25H2 the authenticator can register as a *plugin authenticator*: a COM object\n * Windows' own WebAuthn stack calls, rather than an emulated CTAP2 USB-HID device. That transport\n * carries a ceremony as exactly one CTAP command, and the platform does not forward the\n * `largeBlob` or `prf`/`hmac-secret` extensions across it — measured on 25H2 26200.8875, with\n * `credProtect` as the positive control that crossed in the same request.\n *\n * So on that transport `largeBlob: { read: true }` comes back empty no matter what the RP asks\n * for. The JWE is still minted during the assertion; it just has no route home. `/payload` is that\n * route: the page names the assertion it holds and the service hands the payload over.\n *\n * @module core/loopback\n */\n\n/**\n * Default loopback control-plane origin.\n *\n * Externalized because the port is the authenticator service's choice, not a protocol\n * constant.\n */\nexport const DEFAULT_LOOPBACK_URL = 'ws://127.0.0.1:47213';\n\n/**\n * Options for a loopback request.\n */\nexport interface LoopbackOptions {\n  /**\n   * Control-plane origin, without a path.\n   *\n   * @default DEFAULT_LOOPBACK_URL\n   */\n  url?: string;\n\n  /**\n   * How long to wait for the socket to open and answer, in milliseconds.\n   *\n   * A refused port fails fast, but a firewalled one can hang — the cap keeps the fallback from\n   * outlasting the ceremony it is meant to rescue.\n   *\n   * @default 3000\n   */\n  timeout?: number;\n\n  /**\n   * Whether to log progress.\n   */\n  debug?: boolean;\n}\n\n/**\n * Result of a loopback reachability check.\n */\nexport interface LoopbackReachability {\n  reachable: boolean;\n  detail: string;\n}\n\n/**\n * Sends one JSON frame to a loopback route and resolves with the parsed reply.\n *\n * The control plane is request/response per connection, so this opens, sends, reads one frame,\n * and closes.\n *\n * @param path - Route path, e.g. `/payload`\n * @param request - JSON-serializable request frame\n * @param options - Connection options\n * @returns The parsed reply, or null if the socket could not be reached or did not answer in time\n */\nfunction sendLoopbackFrame(\n  path: string,\n  request: unknown,\n  options: LoopbackOptions = {}\n): Promise<Record<string, unknown> | null> {\n  const base = options.url || DEFAULT_LOOPBACK_URL;\n  const timeout = options.timeout ?? 3000;\n\n  return new Promise((resolve) => {\n    if (typeof WebSocket === 'undefined') {\n      resolve(null);\n      return;\n    }\n\n    let socket: WebSocket | undefined;\n    let settled = false;\n\n    const done = (result: Record<string, unknown> | null, why?: string) => {\n      if (settled) return;\n      settled = true;\n      clearTimeout(timer);\n      if (socket) {\n        try {\n          socket.close();\n        } catch {\n          // Closing is best-effort; the reply is already in hand.\n        }\n      }\n      if (why && options.debug) {\n        console.log(`[FIDO2-JS] loopback ${path}: ${why}`);\n      }\n      resolve(result);\n    };\n\n    const timer = setTimeout(() => done(null, `no reply within ${timeout}ms`), timeout);\n\n    try {\n      socket = new WebSocket(base + path);\n    } catch (error: any) {\n      done(null, `could not open socket: ${error?.message}`);\n      return;\n    }\n\n    socket.onopen = () => {\n      try {\n        socket!.send(JSON.stringify(request));\n      } catch (error: any) {\n        done(null, `send failed: ${error?.message}`);\n      }\n    };\n\n    socket.onmessage = (event: MessageEvent) => {\n      try {\n        const parsed = JSON.parse(String(event.data));\n        done(parsed && typeof parsed === 'object' ? parsed : null, 'reply received');\n      } catch (error: any) {\n        done(null, `reply was not JSON: ${error?.message}`);\n      }\n    };\n\n    // The browser deliberately withholds the reason from script, so all of these look identical\n    // here: connection refused, an Origin the service rejected, and — the one that catches people\n    // out — the browser refusing to let a PUBLIC page origin reach loopback at all.\n    //\n    // That last case is the common one in development. A page served from an https tunnel\n    // (trycloudflare, ngrok) is a public origin, and browsers restrict public → private/loopback\n    // requests. The authenticator can be running perfectly and still be unreachable from such a\n    // page. Serving the page from http://localhost on the same machine removes the restriction.\n    socket.onerror = () =>\n      done(\n        null,\n        'could not connect — service not running, Origin rejected, or the browser blocked a ' +\n          'public page origin from reaching loopback'\n      );\n  });\n}\n\n/**\n * Checks whether the UltraPass loopback control plane is listening.\n *\n * Useful as a diagnostic: a missing authenticator and a refusing one both surface as\n * `NotAllowedError` from WebAuthn, which cannot tell them apart.\n *\n * Opens `/payload` and deliberately sends nothing — the routes that would do work either start a\n * face capture (`/faceauth`) or consume a one-shot payload.\n *\n * @param options - Connection options\n * @returns Whether the socket opened, with a human-readable detail\n */\nexport function checkLoopbackReachable(\n  options: LoopbackOptions = {}\n): Promise<LoopbackReachability> {\n  const base = options.url || DEFAULT_LOOPBACK_URL;\n  const timeout = options.timeout ?? 3000;\n\n  return new Promise((resolve) => {\n    if (typeof WebSocket === 'undefined') {\n      resolve({ reachable: false, detail: 'no WebSocket in this environment' });\n      return;\n    }\n\n    let socket: WebSocket | undefined;\n    let settled = false;\n\n    const done = (result: LoopbackReachability) => {\n      if (settled) return;\n      settled = true;\n      clearTimeout(timer);\n      if (socket) {\n        try {\n          socket.close();\n        } catch {\n          // best-effort\n        }\n      }\n      resolve(result);\n    };\n\n    const timer = setTimeout(\n      () => done({ reachable: false, detail: `no response within ${timeout}ms (firewalled?)` }),\n      timeout\n    );\n\n    try {\n      socket = new WebSocket(base + '/payload');\n    } catch (error: any) {\n      done({ reachable: false, detail: `WebSocket constructor threw: ${error?.message}` });\n      return;\n    }\n\n    socket.onopen = () => done({ reachable: true, detail: 'socket opened' });\n    socket.onerror = () => done({ reachable: false, detail: 'connection refused or blocked' });\n  });\n}\n\n/**\n * Collects the JWE payload minted during an assertion that could not return it via `largeBlob`.\n *\n * The base64 `clientDataJSON` both names the assertion and authorizes the handover — only the page\n * that ran the ceremony holds it, and the service hashes it to match. Base64url is accepted: the\n * service normalizes `-`/`_` itself. The payload is **one-shot** and expires 120 seconds after\n * minting, so this must be called promptly and its result reused rather than re-fetched.\n *\n * @param clientDataJSON - Base64 (or base64url) `assertion.response.clientDataJSON`\n * @param options - Connection options\n * @returns The payload as a JSON string ready for {@link parseLargeBlobPayload}, or null\n *\n * @example\n * ```typescript\n * const payload = await fetchAssertionPayload(bufferToBase64(response.clientDataJSON));\n * if (payload) {\n *   const { jweToken, verifyPayload } = parseLargeBlobPayload(payload);\n * }\n * ```\n */\nexport async function fetchAssertionPayload(\n  clientDataJSON: string,\n  options: LoopbackOptions = {}\n): Promise<string | null> {\n  if (!clientDataJSON) return null;\n\n  if (options.debug) {\n    console.log('[FIDO2-JS] largeBlob absent — requesting the JWE over the loopback /payload route');\n  }\n\n  const reply = await sendLoopbackFrame('/payload', { clientDataJSON }, options);\n\n  if (!reply) return null;\n\n  if (reply.status !== 'ok') {\n    // \"no payload for that assertion\" is the expected miss: this transport did deliver a blob, or\n    // the payload was already taken, or it aged out.\n    const rawReason = typeof reply.message === 'string' ? reply.message : '';\n    const safeReason =\n      rawReason.replace(/[\\x00-\\x1F\\x7F]+/g, ' ').replace(/\\s+/g, ' ').trim() || 'unknown reason';\n    const logSafeReason = JSON.stringify(safeReason) ?? '\"unknown reason\"';\n    console.warn('[FIDO2-JS] loopback /payload declined:', logSafeReason);\n    return null;\n  }\n\n  const payload = reply.payload;\n\n  if (payload == null) {\n    console.warn('[FIDO2-JS] loopback /payload returned ok with no payload field');\n    return null;\n  }\n\n  // The service parses the payload before replying, so it arrives as a JSON *object*.\n  // parseLargeBlobPayload takes the textual form, matching what largeBlob delivers.\n  const asText = typeof payload === 'string' ? payload : JSON.stringify(payload);\n\n  if (options.debug) {\n    const safeLength = Number.isFinite(Number(asText.length)) ? Number(asText.length) : 0;\n    console.log(`[FIDO2-JS] loopback /payload returned ${safeLength} chars`);\n  }\n\n  return asText;\n}\n","/**\n * FIDO2SDK - Main SDK Class\n *\n * The primary entry point for FIDO2-JS SDK. This class wraps all core modules\n * and provides a clean, high-level API for FIDO2 biometric authentication.\n *\n * @module sdk\n */\n\nimport { SDKConfig, PartialSDKConfig } from './types/config';\nimport { mergeConfig } from './config/defaults';\nimport { APIClient } from './core/api';\nimport {\n  createCredential,\n  getCredential,\n  WebAuthnError,\n  WebAuthnErrorCode,\n  type Credential,\n  type AuthenticationResult\n} from './core/webauthn';\nimport { parseVerifiedSummary, type VerifiedSummary } from './core/verified-summary';\nimport { fetchAssertionPayload, DEFAULT_LOOPBACK_URL } from './core/loopback';\nimport { checkAAGUID, checkAAGUIDAny, type AAGUIDVerificationResult } from './core/verifier';\nimport { checkWebAuthnSupport, detectPlatform } from './utils/platform';\nimport { base64ToBuffer } from './utils/buffer';\nimport type { CustomOptions } from './core/encoder';\nimport {\n  generateEnrollmentDeeplink,\n  generateVerificationDeeplink,\n  generateIOSStartDeeplink,\n  generateAndroidInitDeeplink,\n  generateAndroidResolveDeeplink,\n  buildReturnURLWithParams,\n  parseReturnURLStatus,\n  isDeeplinkSupported\n} from './core/deeplink';\nimport {\n  savePendingOperation,\n  getPendingOperation,\n  clearPendingOperation,\n  hasPendingOperation,\n  type SessionState\n} from './utils/session';\n\n/**\n * Verification mode for authentication results\n * Matches iOS SDK VerificationMode enum\n */\nexport type VerificationMode =\n  | 'none'       // No verification - just return JWE token\n  | 'default' // Use built-in default endpoint and API key\n  | { custom: { endpoint: string; apiKey: string } }; // Custom endpoint and API key\n\n/**\n * Options for registering a new credential\n */\nexport interface RegisterOptions {\n  /**\n   * Username for the credential\n   */\n  username: string;\n\n  /**\n   * Relying party domain (e.g., 'example.com')\n   */\n  domain: string;\n\n  /**\n   * Optional display name for the user\n   */\n  displayName?: string;\n\n  /**\n   * Optional authenticator name to verify (e.g., 'ultrapass')\n   * If provided, will verify the AAGUID matches the configured value\n   */\n  authenticator?: string;\n\n  /**\n   * Optional custom challenge for registration (base64-encoded string)\n   * If not provided, a random challenge will be generated\n   */\n  challenge?: string;\n\n  /**\n   * Optional user ID (base64-encoded string)\n   * Will be decoded to binary data internally\n   * If not provided, a random user ID will be generated\n   * Note: Should be base64-encoded binary data (like iOS SDK), typically received from backend\n   */\n  userId?: string;\n\n  /**\n   * Optional relying party name\n   */\n  rpName?: string;\n\n  /**\n   * Optional timeout in milliseconds\n   */\n  timeout?: number;\n\n  /**\n   * Enable mobile deeplink flow (two-phase authentication)\n   * When true, redirects to native app for biometric capture (Phase 1)\n   * then completes WebAuthn ceremony on callback (Phase 2)\n   *\n   * Only available on iOS and Android platforms\n   * @default false\n   */\n  useMobileFlow?: boolean;\n\n  /**\n   * Return URL for mobile deeplink callback\n   * Required if useMobileFlow is true\n   * The mobile app will redirect back to this URL after biometric capture\n   *\n   * @example 'https://example.com/auth/callback'\n   */\n  returnURL?: string;\n\n  /**\n   * Public key that unlocks `encryptedEmbedding` on the result, for local silent\n   * re-verification. Passed on the iOS enroll deeplink and stored by the app for the ceremony.\n   *\n   * This SDK has no key manager, so supply the key yourself; without it enrollment still\n   * succeeds but no encrypted embedding is ever produced.\n   *\n   * @platform iOS\n   */\n  verifyPublicKey?: string;\n\n  /**\n   * Caller-supplied age, used by the app to adapt enrollment — for instance skipping the\n   * document scan for under-16 users. Typically computed from a birthday collected at sign-up.\n   *\n   * @platform iOS\n   */\n  userAge?: number;\n\n  /**\n   * Optional authenticator attachment constraint.\n   * - 'cross-platform': Roaming/external authenticator (USB HID) — use for physical UltraPass device on desktop\n   * - 'platform': Built-in authenticator (Face ID, Touch ID, Windows Hello, Android biometrics)\n   * - undefined: No constraint — browser offers all available authenticators (default)\n   */\n  authenticatorAttachment?: AuthenticatorAttachment;\n}\n\n/**\n * Result from successful registration\n */\nexport interface RegisterResult extends Credential {\n  /**\n   * AAGUID verification result (if authenticator was specified)\n   */\n  verification?: AAGUIDVerificationResult;\n}\n\n/**\n * Options for authenticating with an existing credential\n */\nexport interface AuthenticateOptions {\n  /**\n   * Relying party domain (e.g., 'example.com')\n   */\n  domain: string;\n\n  /**\n   * Custom authentication options (liveness, age, geo-location checks)\n   */\n  customOptions?: CustomOptions;\n\n  /**\n   * Verification mode for JWE token\n   *\n   * - 'none': No verification - just return JWE token (default)\n   * - 'default': Use built-in default endpoint and API key\n   * - { custom: { endpoint, apiKey } }: Use custom endpoint\n   *\n   * @default 'none'\n   *\n   * @example\n   * ```typescript\n   * // No verification\n   * verification: 'none'\n   *\n   * // Use default endpoint (recommended)\n   * verification: 'default'\n   *\n   * // Custom endpoint\n   * verification: {\n   *   custom: {\n   *     endpoint: 'https://api.example.com/verify',\n   *     apiKey: 'your-api-key'\n   *   }\n   * }\n   * ```\n   */\n  verification?: VerificationMode;\n\n  /**\n   * Optional challenge for authentication (base64-encoded string)\n   * If not provided, a random challenge will be generated\n   */\n  challenge?: string;\n\n  /**\n   * Optional array of allowed credential IDs (base64-encoded strings)\n   */\n  allowCredentials?: string[];\n\n  /**\n   * Optional timeout in milliseconds\n   */\n  timeout?: number;\n\n  /**\n   * Enable mobile deeplink flow (two-phase authentication)\n   * When true, redirects to native app for biometric capture (Phase 1)\n   * then completes WebAuthn ceremony on callback (Phase 2)\n   *\n   * Only available on iOS and Android platforms\n   * @default false\n   */\n  useMobileFlow?: boolean;\n\n  /**\n   * Return URL for mobile deeplink callback\n   * Required if useMobileFlow is true\n   * The mobile app will redirect back to this URL after biometric capture\n   *\n   * @example 'https://example.com/auth/callback'\n   */\n  returnURL?: string;\n\n  /**\n   * Specific credential ID to verify against (base64-encoded)\n   * Used in mobile flows to specify which credential to use\n   */\n  credentialId?: string;\n\n  /**\n   * User ID associated with the credential (base64-encoded)\n   * Used in mobile flows for user identification\n   */\n  userId?: string;\n\n  /**\n   * Username to match a local credential against, sent on the iOS `start` deeplink.\n   *\n   * Also echoed on the return URL so the callback can recover which user was authenticating\n   * when sessionStorage does not survive the redirect.\n   */\n  username?: string;\n\n  /**\n   * Pre-select the biometric modality on iOS, skipping UltraPass's auth-method picker.\n   *\n   * Recognised by both the `start` host and the `mode=verify` branch of the app; anything\n   * other than 'face' or 'voice' is ignored there.\n   *\n   * @platform iOS\n   */\n  verifyMethod?: 'face' | 'voice';\n\n  /**\n   * Allow UltraPass to fall back to enrollment when no local credential matches, instead of\n   * returning `credential_invalid`.\n   *\n   * Defaults to false — an explicit `authenticate()` should fail rather than silently turn\n   * into a registration, which is the class of bug that stale-operation handling exists to\n   * catch. Set true only if you want `ultrapass://start` to behave as a combined\n   * sign-in-or-register entry point.\n   *\n   * @default false\n   * @platform iOS (`start` path only)\n   */\n  allowEnrollFallback?: boolean;\n}\n\n/**\n * Result from successful authentication\n */\nexport interface AuthenticateResult extends AuthenticationResult {\n  /**\n   * Raw verify response from the backend, when verification ran.\n   *\n   * Prefer {@link verifiedSummary} for typed access; use this for fields the summary\n   * does not surface.\n   */\n  verifiedData?: unknown;\n\n  /**\n   * Typed projection over the verify response, or null when verification was skipped.\n   *\n   * Gate access on `verifiedSummary.allChecksPassed` rather than on the absence of a\n   * thrown error: a verify call can succeed at the HTTP level while reporting that face\n   * match or liveness failed.\n   *\n   * @example\n   * ```typescript\n   * const result = await sdk.authenticate({ domain, verification: 'default' });\n   * if (result.verifiedSummary?.allChecksPassed) {\n   *   grantAccess();\n   * } else {\n   *   denyAccess(result.verifiedSummary?.errorDescription ?? 'checks did not pass');\n   * }\n   * ```\n   */\n  verifiedSummary?: VerifiedSummary | null;\n}\n\n/**\n * Main FIDO2SDK class\n *\n * This class provides the primary API for FIDO2 biometric authentication.\n * It integrates all core modules (API client, WebAuthn, verifier, encoder)\n * and provides a clean, type-safe interface.\n *\n * @example\n * ```typescript\n * // Initialize SDK\n * const sdk = new FIDO2SDK({\n *   apiKey: 'your-api-key'\n * });\n *\n * await sdk.init();\n *\n * // Register a new credential\n * const credential = await sdk.register({\n *   username: 'john.doe',\n *   domain: 'example.com',\n *   authenticator: 'ultrapass'\n * });\n *\n * // Authenticate\n * const result = await sdk.authenticate({\n *   domain: 'example.com',\n *   customOptions: {\n *     checkLiveness: true,\n *     checkAge: true,\n *     ageThreshold: 18\n *   }\n * });\n *\n * if (result.verifiedData) {\n *   console.log('Authentication successful:', result.verifiedData);\n * }\n * ```\n */\nexport class FIDO2SDK {\n  /**\n   * SDK configuration\n   */\n  private config: SDKConfig;\n\n  /**\n   * API client for backend communication\n   */\n  private api: APIClient;\n\n  /**\n   * Creates a new FIDO2SDK instance\n   *\n   * @param userConfig - Partial SDK configuration (apiKey is required)\n   *\n   * @throws {Error} If apiKey is not provided\n   *\n   * @example\n   * ```typescript\n   * const sdk = new FIDO2SDK({\n   *   apiKey: 'your-api-key',\n   *   timeout: 30000,\n   *   debug: true\n   * });\n   * ```\n   */\n  constructor(userConfig: PartialSDKConfig) {\n    // Validate required apiKey\n    if (!userConfig.apiKey || typeof userConfig.apiKey !== 'string') {\n      throw new Error('FIDO2SDK: apiKey is required and must be a string');\n    }\n\n    // Merge user config with defaults\n    this.config = mergeConfig(userConfig);\n\n    // Create API client\n    this.api = new APIClient(this.config);\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] SDK initialized with config:', {\n        apiEndpoints: this.config.apiEndpoints,\n        authenticators: Object.keys(this.config.authenticators),\n        timeout: this.config.timeout,\n        debug: this.config.debug\n      });\n    }\n  }\n\n  /**\n   * Resolves the `'auto'` ceremony options against the current platform.\n   *\n   * Four of our WebAuthn options diverge from the PingFederate adapter's templates\n   * (`ultrapass-pf-adapter`, branch `feat/usernameless-auth`) — the reference implementation\n   * known to work on Windows. It requests no PRF, no credProtect keys, and no `transports` hint,\n   * and it enforces the timeout with an AbortController because Windows ignores\n   * `publicKey.timeout`.\n   *\n   * `'auto'` therefore means: match the PF adapter on desktop, and keep today's behaviour on the\n   * deeplink platforms, where PRF is how custom biometric options reach UltraPass and the timing\n   * is tuned (see the iOS Phase 2 notes in `docs/`). Each knob is independently overridable so a\n   * Windows failure can be bisected rather than guessed at.\n   *\n   * @returns Concrete values to hand to `createCredential` / `getCredential`\n   */\n  private resolveCeremonyOptions(): {\n    requestPrf: boolean;\n    requestCredProtect: boolean;\n    transports: AuthenticatorTransport[] | null;\n    enforceTimeoutWithAbort: boolean;\n    fetchAssertionPayload?: (clientDataJSON: string) => Promise<string | null>;\n  } {\n    const usesDeeplink = isDeeplinkSupported(detectPlatform());\n\n    const prfSetting = this.config.prfExtension || 'auto';\n    const credProtectSetting = this.config.credProtectExtension ?? 'auto';\n    const transportsSetting = this.config.allowCredentialsTransports || 'auto';\n    const abortSetting = this.config.enforceTimeoutWithAbort ?? 'auto';\n    const loopbackSetting = this.config.loopbackPayloadFallback ?? 'auto';\n\n    const useLoopback = loopbackSetting === 'auto' ? !usesDeeplink : loopbackSetting === true;\n\n    const resolved = {\n      requestPrf: prfSetting === 'auto' ? usesDeeplink : prfSetting === 'always',\n      requestCredProtect:\n        credProtectSetting === 'auto' ? usesDeeplink : credProtectSetting === true,\n      transports:\n        transportsSetting === 'auto'\n          ? usesDeeplink\n            ? (['internal', 'hybrid', 'usb'] as AuthenticatorTransport[])\n            : null\n          : transportsSetting === 'none'\n            ? null\n            : transportsSetting,\n      enforceTimeoutWithAbort: abortSetting === 'auto' ? !usesDeeplink : abortSetting === true,\n      // Bound to config here so core/webauthn stays free of transport concerns; it only sees a\n      // callback it may or may not have been given.\n      ...(useLoopback && {\n        fetchAssertionPayload: (clientDataJSON: string) =>\n          fetchAssertionPayload(clientDataJSON, {\n            url: this.config.loopbackURL,\n            timeout: this.config.loopbackTimeout,\n            debug: this.config.debug,\n          }),\n      }),\n    };\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Ceremony options resolved:', {\n        usesDeeplink,\n        ...resolved,\n        transports: resolved.transports || '(omitted — PF-adapter behaviour)',\n        fetchAssertionPayload: useLoopback\n          ? `enabled (${this.config.loopbackURL || DEFAULT_LOOPBACK_URL}/payload)`\n          : 'disabled',\n      });\n    }\n\n    return resolved;\n  }\n\n  /**\n   * Registers a new FIDO2 credential\n   *\n   * This method creates a new WebAuthn credential and optionally verifies\n   * the authenticator AAGUID against the configured value.\n   *\n   * Works in standalone mode - challenges and userIds are auto-generated.\n   *\n   * @param options - Registration options\n   * @returns Promise that resolves to the created credential\n   *\n   * @throws {Error} If WebAuthn is not supported\n   * @throws {WebAuthnError} If credential creation fails\n   * @throws {Error} If AAGUID verification fails (when authenticator specified)\n   *\n   * @example\n   * ```typescript\n   * // Standalone mode - no init needed\n   * const credential = await sdk.register({\n   *   username: 'john.doe',\n   *   domain: 'example.com'\n   * });\n   *\n   * // With AAGUID verification\n   * const credential = await sdk.register({\n   *   username: 'john.doe',\n   *   domain: 'example.com',\n   *   authenticator: 'ultrapass'\n   * });\n   * ```\n   */\n  async register(options: RegisterOptions): Promise<RegisterResult> {\n    this.ensureWebAuthnSupported();\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Starting registration:', {\n        username: options.username,\n        domain: options.domain,\n        authenticator: options.authenticator,\n        useMobileFlow: options.useMobileFlow\n      });\n    }\n\n    // Handle mobile deeplink flow\n    if (options.useMobileFlow) {\n      const platform = detectPlatform();\n\n      if (!isDeeplinkSupported(platform)) {\n        throw new Error(\n          `Mobile deeplink flow is not supported on platform: ${platform}. ` +\n            'Deeplink flow is only available on iOS and Android.'\n        );\n      }\n\n      // Android: Init + Direct WebAuthn pattern (like webauthn_v2.js)\n      if (platform === 'Android') {\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Android detected: using init + direct WebAuthn flow');\n        }\n\n        // Generate init deeplink\n        const initDeeplink = generateAndroidInitDeeplink(\n          this.config.apiKey || '',\n          this.config.policyId || 'mobile'\n        );\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Opening Android app for initialization:', initDeeplink);\n        }\n\n        // this.config is already merged with DEFAULT_CONFIG, so the ?? only covers a caller\n        // that explicitly passed undefined.\n        const initDelay = this.config.androidInitDelay ?? 1000;\n\n        // Try to open the app (non-blocking)\n        // This initializes the UltraPass app but doesn't wait for callback\n        if (typeof window !== 'undefined') {\n          // Create a hidden iframe to trigger the deeplink without full page redirect\n          const iframe = document.createElement('iframe');\n          iframe.style.display = 'none';\n          iframe.src = initDeeplink;\n          document.body.appendChild(iframe);\n\n          // Clean up iframe after a moment\n          setTimeout(() => {\n            if (iframe.parentNode) {\n              iframe.parentNode.removeChild(iframe);\n            }\n          }, initDelay);\n        }\n\n        // Give the app a moment to initialize. Too short and the ceremony can start while the\n        // UltraPass app is still cold starting, which Android's Credential Manager surfaces as\n        // NotReadableError.\n        await new Promise(resolve => setTimeout(resolve, initDelay));\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Proceeding with direct WebAuthn registration');\n        }\n\n        // Fall through to direct WebAuthn flow below\n        // (Don't use two-phase callback pattern for Android)\n      } else {\n        // iOS: Two-phase callback pattern\n        if (!options.returnURL) {\n          throw new Error(\n            'returnURL is required when useMobileFlow is true on iOS. ' +\n              'Provide a HTTPS URL where the mobile app should redirect after biometric capture.'\n          );\n        }\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] iOS detected: using two-phase deeplink flow');\n        }\n\n        // Save pending operation to sessionStorage\n        const sessionState: SessionState = {\n          operation: 'enroll',\n          username: options.username,\n          domain: options.domain,\n          displayName: options.displayName,\n          challenge: options.challenge,\n          userId: options.userId,\n          timeout: options.timeout,\n          timestamp: Date.now()\n        };\n\n        savePendingOperation(sessionState);\n\n        // Generate iOS deeplink. generateEnrollmentDeeplink stamps op/username/apiKey onto the\n        // return URL itself, so no pre-processing is needed here.\n        const deeplink = generateEnrollmentDeeplink(platform, {\n          username: options.username,\n          rp: options.domain,\n          returnURL: options.returnURL,\n          policyId: this.config.policyId || 'mobile',\n          apiKey: this.config.apiKey || '',\n          userId: options.userId,\n          displayName: options.displayName,\n          verifyPublicKey: options.verifyPublicKey,\n          userAge: options.userAge,\n          scheme: this.config.ultrapassScheme\n        });\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Redirecting to iOS deeplink:', deeplink);\n        }\n\n        // Redirect to mobile app\n        if (typeof window !== 'undefined') {\n          window.location.href = deeplink;\n        }\n\n        // Return a pending promise that will never resolve\n        // The actual registration will complete in handleDeeplinkCallback after redirect\n        return new Promise(() => {});\n      }\n    }\n\n    // Direct WebAuthn flow (no mobile redirect)\n    // Create credential (convert string parameters to Uint8Array)\n    const ceremony = this.resolveCeremonyOptions();\n\n    const credential = await createCredential({\n      username: options.username,\n      domain: options.domain,\n      displayName: options.displayName,\n      challenge: options.challenge ? new Uint8Array(base64ToBuffer(options.challenge)) : undefined,\n      userId: options.userId ? new Uint8Array(base64ToBuffer(options.userId)) : undefined,\n      rpName: options.rpName,\n      timeout: options.timeout || this.config.timeout,\n      authenticatorAttachment: options.authenticatorAttachment,\n      largeBlobSupport: this.config.largeBlobSupport,\n      largeBlobExtension: this.config.largeBlobExtension,\n      requestPrf: ceremony.requestPrf,\n      requestCredProtect: ceremony.requestCredProtect,\n      enforceTimeoutWithAbort: ceremony.enforceTimeoutWithAbort\n    });\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Credential created:', credential.credentialId);\n      console.log('[FIDO2-JS] largeBlob supported by this credential:', credential.largeBlobSupported);\n    }\n\n    // Verify AAGUID if authenticator specified\n    let verification: AAGUIDVerificationResult | undefined;\n\n    if (options.authenticator) {\n      // Pass the platform we actually ran on rather than letting the verifier re-detect it, so\n      // the AAGUID set checked here cannot disagree with the one the ceremony was built for.\n      verification = checkAAGUID(\n        base64ToBuffer(credential.attestationObject),\n        options.authenticator,\n        this.config,\n        detectPlatform()\n      );\n\n      if (!verification.matches) {\n        throw new Error(\n          `Authenticator AAGUID mismatch: expected ${verification.targetHex}, got ${verification.foundHex} ` +\n            `(platform: ${detectPlatform()}). The authenticator used does not match the expected ` +\n            `\"${options.authenticator}\" authenticator. AAGUIDs are configured per platform — see ` +\n            'authenticators.<name>.platformAaguids.'\n        );\n      }\n\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] AAGUID verification passed:', verification.authenticatorName);\n      }\n    }\n\n    return {\n      ...credential,\n      verification\n    };\n  }\n\n  /**\n   * Authenticates with an existing FIDO2 credential\n   *\n   * This method retrieves a WebAuthn credential and optionally verifies\n   * the JWE token with the backend. Custom options (liveness, age, geo-location)\n   * can be encoded and passed to the authenticator via the PRF extension.\n   *\n   * Works in standalone mode - challenges are auto-generated.\n   *\n   * @param options - Authentication options\n   * @returns Promise that resolves to the authentication result\n   *\n   * @throws {Error} If WebAuthn is not supported\n   * @throws {WebAuthnError} If credential retrieval fails\n   * @throws {APIError} If backend verification fails (when verification is enabled)\n   *\n   * @example\n   * ```typescript\n   * // Option 1: No verification (default)\n   * const result = await sdk.authenticate({\n   *   domain: 'example.com'\n   * });\n   * // result.jweToken available, no verification\n   *\n   * // Option 2: Use default verification (recommended)\n   * const result = await sdk.authenticate({\n   *   domain: 'example.com',\n   *   verification: 'default'\n   * });\n   * // result.verifiedData contains decoded user data\n   *\n   * // Option 3: Custom verification endpoint\n   * const result = await sdk.authenticate({\n   *   domain: 'example.com',\n   *   verification: {\n   *     custom: {\n   *       endpoint: 'https://api.example.com/verify',\n   *       apiKey: 'your-api-key'\n   *     }\n   *   }\n   * });\n   *\n   * // With custom biometric options\n   * const result = await sdk.authenticate({\n   *   domain: 'example.com',\n   *   customOptions: {\n   *     checkLiveness: true,\n   *     checkAge: true,\n   *     ageThreshold: 18\n   *   },\n   *   verification: 'default'\n   * });\n   *\n   * if (result.verifiedData) {\n   *   console.log('User data:', result.verifiedData);\n   * }\n   * ```\n   */\n  async authenticate(options: AuthenticateOptions): Promise<AuthenticateResult> {\n    this.ensureWebAuthnSupported();\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Starting authentication:', {\n        domain: options.domain,\n        customOptions: options.customOptions,\n        verification: options.verification || 'none',\n        useMobileFlow: options.useMobileFlow\n      });\n    }\n\n    // Handle mobile deeplink flow\n    if (options.useMobileFlow) {\n      const platform = detectPlatform();\n\n      if (!isDeeplinkSupported(platform)) {\n        throw new Error(\n          `Mobile deeplink flow is not supported on platform: ${platform}. ` +\n            'Deeplink flow is only available on iOS and Android.'\n        );\n      }\n\n      // Android: Init + Direct WebAuthn pattern (like webauthn_v2.js)\n      if (platform === 'Android') {\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Android detected: using init + direct WebAuthn flow');\n        }\n\n        // Generate init deeplink\n        const initDeeplink = generateAndroidInitDeeplink(\n          this.config.apiKey || '',\n          this.config.policyId || 'mobile'\n        );\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Opening Android app for initialization:', initDeeplink);\n        }\n\n        // this.config is already merged with DEFAULT_CONFIG, so the ?? only covers a caller\n        // that explicitly passed undefined.\n        const initDelay = this.config.androidInitDelay ?? 1000;\n\n        // Try to open the app (non-blocking)\n        // This initializes the UltraPass app but doesn't wait for callback\n        if (typeof window !== 'undefined') {\n          // Create a hidden iframe to trigger the deeplink without full page redirect\n          const iframe = document.createElement('iframe');\n          iframe.style.display = 'none';\n          iframe.src = initDeeplink;\n          document.body.appendChild(iframe);\n\n          // Clean up iframe after a moment\n          setTimeout(() => {\n            if (iframe.parentNode) {\n              iframe.parentNode.removeChild(iframe);\n            }\n          }, initDelay);\n        }\n\n        // Give the app a moment to initialize. Too short and the ceremony can start while the\n        // UltraPass app is still cold starting, which Android's Credential Manager surfaces as\n        // NotReadableError.\n        await new Promise(resolve => setTimeout(resolve, initDelay));\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Proceeding with direct WebAuthn authentication');\n        }\n\n        // Fall through to direct WebAuthn flow below\n        // (Don't use two-phase callback pattern for Android)\n      } else {\n        // iOS: Two-phase callback pattern\n        if (!options.returnURL) {\n          throw new Error(\n            'returnURL is required when useMobileFlow is true on iOS. ' +\n              'Provide a HTTPS URL where the mobile app should redirect after biometric capture.'\n          );\n        }\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] iOS detected: using two-phase deeplink flow');\n        }\n\n        // Save pending operation to sessionStorage\n        const sessionState: SessionState = {\n          operation: 'verify',\n          username: options.username,\n          domain: options.domain,\n          customOptions: options.customOptions,\n          verification: options.verification,\n          challenge: options.challenge,\n          allowCredentials: options.allowCredentials,\n          credentialId: options.credentialId,\n          userId: options.userId,\n          timeout: options.timeout,\n          timestamp: Date.now()\n        };\n\n        savePendingOperation(sessionState);\n\n        // Generate iOS deeplink.\n        //\n        // Default to the unified `start` host: it is the current entry point, reads `options`\n        // (so custom biometric options survive), takes `credentialIds` as a CSV, and reports\n        // back which operation it ran via `mode` on the return URL.\n        //\n        // `verifyOnly: true` because this is an explicit sign-in — if no local credential\n        // matches, the app should return `credential_invalid` rather than quietly enrolling\n        // the user, which would turn an authenticate() call into a registration.\n        const useStartPath = (this.config.iosAuthPath || 'start') === 'start';\n\n        // The start builder is called directly rather than through generateVerificationDeeplink,\n        // so the return URL has to be stamped here. This is the fallback for the iOS Safari case\n        // where sessionStorage does not survive the redirect (notably a new-tab callback);\n        // `username` matters because the callback uses it to recover the credential from\n        // localStorage. The legacy branch below gets the same treatment inside its dispatcher.\n        //\n        // The start flow additionally appends its own `mode=`, reporting what it actually ran,\n        // which takes priority on the way back.\n        const deeplink = useStartPath\n          ? generateIOSStartDeeplink({\n              rpId: options.domain,\n              returnURL: buildReturnURLWithParams(options.returnURL, 'verify', {\n                username: options.username,\n                apiKey: this.config.apiKey,\n                verification:\n                  typeof options.verification === 'string' ? options.verification : undefined\n              }),\n              policyId: this.config.policyId || 'mobile',\n              apiKey: this.config.apiKey || '',\n              username: options.username,\n              userId: options.userId,\n              credentialIds:\n                options.allowCredentials ||\n                (options.credentialId ? [options.credentialId] : undefined),\n              options: options.customOptions,\n              verifyOnly: options.allowEnrollFallback !== true,\n              verifyMethod: options.verifyMethod,\n              scheme: this.config.ultrapassScheme\n            })\n          : generateVerificationDeeplink(platform, {\n              rpId: options.domain,\n              returnURL: options.returnURL,\n              policyId: this.config.policyId || 'mobile',\n              apiKey: this.config.apiKey || '',\n              credentialId: options.credentialId,\n              userId: options.userId,\n              options: options.customOptions,\n              // Only pass verification if it's a string (URL params can't encode objects)\n              verification:\n                typeof options.verification === 'string' ? options.verification : 'default',\n              scheme: this.config.ultrapassScheme\n            });\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Redirecting to iOS deeplink:', deeplink);\n        }\n\n        // Redirect to mobile app\n        if (typeof window !== 'undefined') {\n          window.location.href = deeplink;\n        }\n\n        // Return a pending promise that will never resolve\n        // The actual authentication will complete in handleDeeplinkCallback after redirect\n        return new Promise(() => {});\n      }\n    }\n\n    // Direct WebAuthn flow (no mobile redirect)\n    // Get credential (convert string parameters to Uint8Array)\n    const ceremony = this.resolveCeremonyOptions();\n\n    const result = await getCredential({\n      domain: options.domain,\n      customOptions: options.customOptions,\n      challenge: options.challenge ? new Uint8Array(base64ToBuffer(options.challenge)) : undefined,\n      allowedCredentials: options.allowCredentials,\n      timeout: options.timeout || this.config.timeout,\n      requestPrf: ceremony.requestPrf,\n      transports: ceremony.transports,\n      enforceTimeoutWithAbort: ceremony.enforceTimeoutWithAbort,\n      fetchAssertionPayload: ceremony.fetchAssertionPayload\n    });\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Credential retrieved:', {\n        credentialId: result.credentialId,\n        hasJweToken: !!result.jweToken,\n        hasPrfResults: !!result.prfResults\n      });\n    }\n\n    // Handle verification based on mode\n    let verifiedData: unknown;\n    let verifiedSummary: VerifiedSummary | null = null;\n    const verificationMode = options.verification || 'none';\n\n    if (verificationMode !== 'none') {\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Verification mode:', verificationMode);\n      }\n\n      // Verification was asked for but no biometric proof arrived. Previously this fell\n      // through and resolved successfully with verifiedData undefined, which reads as\n      // \"face verified\" to a caller that only checks for a thrown error. Fail instead.\n      if (!result.verifyPayload) {\n        // Several unrelated situations produce an empty blob, and this used to assert the\n        // Windows one as though it were the explanation — which reads as nonsense on a Mac\n        // authenticating over the cross-device QR, where loopback and HID are both irrelevant.\n        // List them as candidates instead, most likely first for the running platform.\n        const platform = detectPlatform();\n\n        const crossDevice =\n          'Cross-device (the QR / \"use a phone or tablet\" flow): largeBlob is not reliably ' +\n          'carried over the hybrid transport, so the assertion can succeed while the blob ' +\n          'comes back empty. Run the ceremony directly on the device holding the credential ' +\n          'instead of driving it from another machine.';\n        const windowsLoopback =\n          'Windows plugin-authenticator transport: it does not carry largeBlob at all, so the ' +\n          'JWE has to come over the loopback /payload route — and a page served from a PUBLIC ' +\n          'origin (an https trycloudflare/ngrok tunnel) is blocked by the browser from reaching ' +\n          'loopback, whatever the authenticator does. Serve the page from http://localhost on ' +\n          'that machine, or use the HID transport, where largeBlob does cross.';\n        const noBlobOnCredential =\n          'The credential itself may have no blob — check the registration log for an ' +\n          'unconfirmed largeBlob, and that the UltraPass app completed a face enrollment for ' +\n          'this user. If so, re-register; authenticating again will not help.';\n        const wrongAuthenticator = 'The authenticator that answered may not be UltraPass.';\n\n        const causes =\n          platform === 'Desktop'\n            ? [crossDevice, windowsLoopback, noBlobOnCredential, wrongAuthenticator]\n            : [noBlobOnCredential, crossDevice, wrongAuthenticator];\n\n        throw new WebAuthnError(\n          WebAuthnErrorCode.RETRIEVAL_FAILED,\n          'Verification was requested but the assertion carried no biometric proof ' +\n            `(no largeBlob payload). On ${platform}, in order of likelihood: ` +\n            causes.map((cause, i) => `(${i + 1}) ${cause}`).join(' '),\n          { credentialId: result.credentialId }\n        );\n      }\n\n      // Determine endpoint and API key based on verification mode\n      let endpoint: string;\n      let apiKey: string;\n\n      if (verificationMode === 'default') {\n        // Use default endpoint from config\n        endpoint = this.config.apiEndpoints.verify;\n        apiKey = this.config.apiKey || '';\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Using default verification endpoint:', endpoint);\n        }\n      } else if (typeof verificationMode === 'object' && verificationMode.custom) {\n        // Use custom endpoint\n        endpoint = verificationMode.custom.endpoint;\n        apiKey = verificationMode.custom.apiKey;\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Using custom verification endpoint:', endpoint);\n        }\n      } else {\n        throw new Error(\n          `Invalid verification mode: ${JSON.stringify(verificationMode)}. ` +\n            \"Expected 'none', 'default', or { custom: { endpoint, apiKey } }.\"\n        );\n      }\n\n      // Send the full payload as the raw body — see APIClient.verifyPayload for why this\n      // is not the same as posting result.jweToken.\n      try {\n        const verifyResponse = await this.api.verifyPayload(\n          result.verifyPayload,\n          endpoint,\n          apiKey\n        );\n        verifiedData = verifyResponse;\n        verifiedSummary = parseVerifiedSummary(verifyResponse);\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Verification complete:', {\n            verified: verifiedSummary?.verified,\n            faceMatch: verifiedSummary?.faceMatch,\n            livenessPass: verifiedSummary?.livenessPass,\n            agePass: verifiedSummary?.agePass,\n            allChecksPassed: verifiedSummary?.allChecksPassed\n          });\n        }\n      } catch (error) {\n        if (this.config.debug) {\n          console.error('[FIDO2-JS] Verification failed:', error);\n        }\n        throw error;\n      }\n    }\n\n    return {\n      ...result,\n      verifiedData,\n      verifiedSummary\n    };\n  }\n\n  /**\n   * Handles deeplink callback from mobile app\n   *\n   * This method should be called after the mobile app redirects back to your website\n   * following the biometric capture (Phase 1). It will:\n   * 1. Check the return URL status (success/error/cancelled)\n   * 2. Retrieve the pending operation from sessionStorage\n   * 3. Complete the WebAuthn ceremony (Phase 2) if successful\n   * 4. Clean up session state\n   *\n   * **Usage Pattern:**\n   * ```typescript\n   * // On your callback page\n   * const sdk = new FIDO2SDK({ apiKey: 'your-api-key' });\n   *\n   * if (sdk.hasPendingOperation()) {\n   *   const result = await sdk.handleDeeplinkCallback();\n   *   if (result) {\n   *     console.log('Authentication successful:', result);\n   *   }\n   * }\n   * ```\n   *\n   * @param url - Optional URL to parse (defaults to current window.location)\n   * @returns Promise that resolves to the result (RegisterResult or AuthenticateResult), or null if no pending operation\n   *\n   * @throws {Error} If status is error or cancelled\n   * @throws {Error} If WebAuthn ceremony fails\n   *\n   * @example\n   * ```typescript\n   * // Automatic handling on page load\n   * window.addEventListener('load', async () => {\n   *   const sdk = new FIDO2SDK({ apiKey: 'your-api-key' });\n   *\n   *   try {\n   *     const result = await sdk.handleDeeplinkCallback();\n   *     if (result) {\n   *       document.getElementById('status').textContent = 'Success!';\n   *     }\n   *   } catch (error) {\n   *     document.getElementById('status').textContent = `Error: ${error.message}`;\n   *   }\n   * });\n   * ```\n   */\n  async handleDeeplinkCallback(url?: string): Promise<RegisterResult | AuthenticateResult | null> {\n    // Check if there's a pending operation in sessionStorage\n    const hasPending = hasPendingOperation();\n\n    // Parse return URL status\n    const status = parseReturnURLStatus(url);\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Deeplink callback status:', status);\n      console.log('[FIDO2-JS] Has pending operation in sessionStorage:', hasPending);\n    }\n\n    // CRITICAL FIX: Parse URL params FIRST to check for operation type\n    // URL params are the source of truth since they come from the deeplink we generated\n    // sessionStorage might have stale data from a previous operation\n    let urlOperation: 'enroll' | 'verify' | null = null;\n    let urlUsername: string | undefined;\n    let urlApiKey: string | undefined;\n    let urlVerification: string | undefined;\n\n    if (typeof window !== 'undefined') {\n      try {\n        const urlObj = new URL(url || window.location.href);\n        const op = urlObj.searchParams.get('op');\n        urlUsername = urlObj.searchParams.get('username') || undefined;\n        urlApiKey = urlObj.searchParams.get('apiKey') || undefined;\n        urlVerification = urlObj.searchParams.get('verification') || undefined;\n\n        if (op === 'enroll' || op === 'verify') {\n          urlOperation = op;\n        }\n\n        // The unified `start` flow appends `mode=verify` / `mode=enroll` reporting which\n        // operation UltraPass actually performed. That is the app's own account of what\n        // happened, so it outranks `op`, which only records what the browser asked for. This\n        // is what makes `start` immune to the enroll/verify mismatch class of bug — the\n        // browser no longer has to guess correctly up front.\n        if (status.mode) {\n          if (this.config.debug && urlOperation && status.mode !== urlOperation) {\n            console.log(\n              `[FIDO2-JS] UltraPass reports mode=${status.mode} (requested op=${urlOperation}) — trusting the app`\n            );\n          }\n          urlOperation = status.mode;\n        }\n\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] URL params:', {\n            op: urlOperation,\n            mode: status.mode,\n            username: urlUsername,\n            apiKey: urlApiKey ? '***' : undefined,\n            verification: urlVerification\n          });\n        }\n      } catch (error) {\n        if (this.config.debug) {\n          console.warn('[FIDO2-JS] Failed to parse URL params:', error);\n        }\n      }\n    }\n\n    // Retrieve pending operation from sessionStorage\n    let pendingOp = getPendingOperation();\n\n    if (this.config.debug && pendingOp) {\n      console.log('[FIDO2-JS] sessionStorage operation type:', pendingOp.operation);\n    }\n\n    // CRITICAL: If URL has operation type that differs from sessionStorage, prioritize URL\n    // This fixes the bug where stale sessionStorage from previous operation causes wrong flow\n    if (urlOperation && pendingOp && urlOperation !== pendingOp.operation) {\n      if (this.config.debug) {\n        console.warn('[FIDO2-JS] ⚠️ Operation type mismatch detected!');\n        console.warn('[FIDO2-JS] URL says:', urlOperation, '(source of truth)');\n        console.warn('[FIDO2-JS] sessionStorage says:', pendingOp.operation, '(stale data)');\n        console.warn('[FIDO2-JS] Discarding sessionStorage and using URL params');\n      }\n\n      // Discard stale sessionStorage\n      pendingOp = null;\n    }\n\n    // If no valid pending operation, build from URL params\n    if (!pendingOp && urlOperation && typeof window !== 'undefined') {\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Building operation from URL params:', urlOperation);\n      }\n\n      pendingOp = {\n        operation: urlOperation,\n        username: urlUsername,\n        domain: window.location.host, // Use host (includes port) to match POC\n        verification: (urlVerification as 'default' | 'none') || 'default',\n        timestamp: Date.now()\n      };\n\n      // For authentication, try to recover allowCredentials from localStorage\n      // This is critical for new tab scenarios where sessionStorage is lost\n      if (urlOperation === 'verify' && urlUsername && typeof localStorage !== 'undefined') {\n        try {\n          const storedCreds = localStorage.getItem('fido2_credentials');\n          if (storedCreds) {\n            const creds = JSON.parse(storedCreds);\n            if (creds[urlUsername] && creds[urlUsername].credentialId) {\n              pendingOp.allowCredentials = [creds[urlUsername].credentialId];\n\n              if (this.config.debug) {\n                console.log('[FIDO2-JS] Recovered credential ID from localStorage for username:', urlUsername);\n                console.log('[FIDO2-JS] Credential ID:', creds[urlUsername].credentialId.substring(0, 50) + '...');\n              }\n            } else if (this.config.debug) {\n              console.warn('[FIDO2-JS] No stored credential found for username:', urlUsername);\n            }\n          }\n        } catch (error) {\n          if (this.config.debug) {\n            console.warn('[FIDO2-JS] Failed to recover credential from localStorage:', error);\n          }\n        }\n      }\n\n      // Update SDK config with apiKey from URL if available\n      if (urlApiKey && urlApiKey !== this.config.apiKey) {\n        if (this.config.debug) {\n          console.log('[FIDO2-JS] Recovered apiKey from URL params');\n        }\n        this.updateConfig({ apiKey: urlApiKey });\n      }\n\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Built operation from URL params:', {\n          operation: pendingOp.operation,\n          username: pendingOp.username,\n          domain: pendingOp.domain,\n          hasCredentials: !!pendingOp.allowCredentials\n        });\n      }\n    }\n\n    // If still no pending operation, return null\n    if (!pendingOp) {\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] No pending operation found (checked sessionStorage and URL params)');\n      }\n      return null;\n    }\n\n    // Clear pending operation from storage\n    clearPendingOperation();\n\n    // Handle error/cancelled status\n    if (!status.success) {\n      if (status.cancelled) {\n        throw new Error('Operation was cancelled by the user');\n      }\n      throw new Error(status.error || 'Biometric verification failed');\n    }\n\n    // Success - Wait before Phase 2 (iOS Safari needs time to render)\n    // Based on iOS dev reference implementation which uses 3-second countdown\n    const delay = this.config.mobileCallbackDelay ?? 3000;\n\n    if (delay > 0) {\n      if (this.config.debug) {\n        console.log(`[FIDO2-JS] Waiting ${delay}ms before Phase 2 (allows Safari to render)...`);\n      }\n\n      await new Promise(resolve => setTimeout(resolve, delay));\n    }\n\n    // Force repaint to ensure Safari finishes rendering before WebAuthn\n    // Based on POC single-page pattern (index.html lines 913-914)\n    // Critical for iOS Safari stability when triggering WebAuthn after deeplink redirect\n    if (typeof window !== 'undefined') {\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Forcing repaint before WebAuthn...');\n      }\n      window.scrollTo(0, 0);\n      document.body.offsetHeight;\n    }\n\n    // Sanitize username (iOS edge case: UltraPass may return URL in username field)\n    let username = pendingOp.username || '';\n    if (username.startsWith('http://') || username.startsWith('https://')) {\n      if (this.config.debug) {\n        console.warn('[FIDO2-JS] Username appears to be a URL, rejecting:', username);\n      }\n      username = '';\n    }\n\n    // Complete Phase 2 (WebAuthn ceremony)\n    if (pendingOp.operation === 'enroll') {\n      // Validate username for enrollment\n      if (!username) {\n        throw new Error(\n          'Username is required for enrollment. ' +\n            'The username was not found in sessionStorage or URL params.'\n        );\n      }\n\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Completing registration (Phase 2)');\n      }\n\n      return await this.register({\n        username,\n        domain: pendingOp.domain,\n        displayName: pendingOp.displayName,\n        challenge: pendingOp.challenge,\n        userId: pendingOp.userId,\n        timeout: pendingOp.timeout\n      });\n    } else if (pendingOp.operation === 'verify') {\n      // An Android resolve preflight is a different situation from an iOS Phase 2: no biometric\n      // has been captured yet, and UltraPass has just told us exactly which credential it found\n      // on the device. Passing that through is useful there.\n      //\n      // On iOS the opposite holds — allowCredentials must be omitted so resident-key discovery\n      // completes without re-prompting for a face scan, since the scan already happened in\n      // Phase 1. Hence the narrow condition rather than a general change.\n      const resolvedCredentialId =\n        status.resolve?.status === 'authenticate' ? status.resolve.credentialId : undefined;\n\n      // Credential selection for Phase 2, in priority order:\n      //   1. The credential the Android resolve preflight explicitly named.\n      //   2. The stored credential for this operation, when phase2AllowCredentials is on.\n      //   3. Nothing — pure resident-key discovery.\n      //\n      // (3) is the default. Registration requests `residentKey: 'required'`, so the credential is\n      // always discoverable and discovery cannot fail for lack of a resident key — which was the\n      // only reason (2) was ever the default. Naming a credential explicitly instead makes the\n      // UltraPass provider re-verify the biometric that Phase 1 already captured, which surfaces\n      // a second face prompt or an outright NotAllowedError. Set `phase2AllowCredentials: true`\n      // to restore (2).\n      //\n      // (1) still wins when present: the Android preflight resolves a specific credential, and\n      // that is a positive identification rather than a guess.\n      const storedCredentials =\n        this.config.phase2AllowCredentials !== false\n          ? pendingOp.allowCredentials ||\n            (pendingOp.credentialId ? [pendingOp.credentialId] : undefined)\n          : undefined;\n\n      const phase2Credentials = resolvedCredentialId ? [resolvedCredentialId] : storedCredentials;\n\n      if (this.config.debug) {\n        console.log('[FIDO2-JS] Completing authentication (Phase 2)');\n        if (resolvedCredentialId) {\n          console.log(\n            `[FIDO2-JS] Using credential named by the Android preflight: ${resolvedCredentialId.substring(0, 20)}...`\n          );\n        } else if (phase2Credentials?.length) {\n          console.log(\n            `[FIDO2-JS] Sending ${phase2Credentials.length} allowCredential(s) in Phase 2 (phase2AllowCredentials)`\n          );\n        } else {\n          console.log('[FIDO2-JS] No allowCredentials - relying on resident key discovery');\n        }\n      }\n\n      return await this.authenticate({\n        domain: pendingOp.domain,\n        customOptions: pendingOp.customOptions,\n        verification: pendingOp.verification,\n        challenge: pendingOp.challenge,\n        allowCredentials: phase2Credentials,\n        timeout: pendingOp.timeout\n      });\n    }\n\n    return null;\n  }\n\n  /**\n   * Runs Android's `resolve_profile_and_credentials` preflight.\n   *\n   * This is Android's analogue of the iOS `start` flow: a **scan-free** check that asks\n   * UltraPass whether a credential for this RP already exists on the device, so the browser\n   * learns whether to register or authenticate instead of guessing. The app's own docs call it\n   * the thing to use \"instead of `VERIFY_CREDENTIALS` before register/authenticate\".\n   *\n   * Like the iOS deeplink flows this redirects the page and does not resolve — UltraPass sends\n   * the outcome back to `returnURL`, where {@link handleDeeplinkCallback} picks it up and runs\n   * the ceremony the app selected. No biometric is captured during the preflight; the face scan\n   * happens later inside the WebAuthn ceremony.\n   *\n   * This is opt-in and does not change the default Android flow, which reaches UltraPass through\n   * a non-redirecting init deeplink followed by a direct WebAuthn ceremony.\n   *\n   * @param options - Resolve options\n   * @returns A promise that never resolves (the page redirects)\n   * @throws {Error} If called on a platform other than Android, or without a returnURL\n   *\n   * @example\n   * ```typescript\n   * // Before showing sign-in vs register buttons:\n   * await sdk.resolveAndroidCredentials({\n   *   domain: window.location.host,\n   *   returnURL: window.location.href,\n   *   credentialIds: knownCredentialIds\n   * });\n   * // ...page redirects; on return, handleDeeplinkCallback() runs the right ceremony.\n   * ```\n   */\n  async resolveAndroidCredentials(options: {\n    domain: string;\n    returnURL: string;\n    credentialIds?: string[];\n    username?: string;\n  }): Promise<never> {\n    const platform = detectPlatform();\n\n    if (platform !== 'Android') {\n      throw new Error(\n        `resolveAndroidCredentials() is Android-only, but the platform is ${platform}. ` +\n          'On iOS use authenticate({ useMobileFlow: true }), which routes through ultrapass://start.'\n      );\n    }\n\n    if (!options.returnURL) {\n      throw new Error(\n        'returnURL is required for the Android resolve preflight — UltraPass reports the outcome by redirecting to it.'\n      );\n    }\n\n    // Carry username and apiKey across the redirect, but deliberately NOT `op`: which\n    // operation to run is exactly what the preflight is being asked to determine, so\n    // pre-committing to one here would defeat the purpose. UltraPass supplies it as\n    // `status=authenticate|register`, which parseReturnURLStatus maps onto `mode`.\n    let returnURL = options.returnURL;\n    try {\n      const url = new URL(options.returnURL);\n      if (options.username) {\n        url.searchParams.set('username', options.username);\n      }\n      if (this.config.apiKey) {\n        url.searchParams.set('apiKey', this.config.apiKey);\n      }\n      returnURL = url.toString();\n    } catch (error) {\n      if (this.config.debug) {\n        console.warn('[FIDO2-JS] Could not augment resolve return URL:', error);\n      }\n    }\n\n    const deeplink = generateAndroidResolveDeeplink({\n      apiKey: this.config.apiKey || '',\n      policyId: this.config.policyId || 'mobile',\n      rpId: options.domain,\n      returnURL,\n      credentialIds: options.credentialIds\n    });\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Android resolve preflight:', deeplink);\n    }\n\n    if (typeof window !== 'undefined') {\n      window.location.href = deeplink;\n    }\n\n    // The page is navigating away; the flow continues in handleDeeplinkCallback.\n    return new Promise<never>(() => {});\n  }\n\n  /**\n   * Checks if there is a pending mobile deeplink operation\n   *\n   * Use this to detect if the current page load is a callback from a mobile app.\n   *\n   * @returns true if there is a pending operation\n   *\n   * @example\n   * ```typescript\n   * if (sdk.hasPendingOperation()) {\n   *   await sdk.handleDeeplinkCallback();\n   * }\n   * ```\n   */\n  hasPendingOperation(): boolean {\n    return hasPendingOperation();\n  }\n\n  /**\n   * Updates the SDK configuration\n   *\n   * This method allows updating the configuration after SDK creation.\n   * The API client will be recreated with the new configuration.\n   *\n   * @param newConfig - Partial configuration to merge with current config\n   *\n   * @example\n   * ```typescript\n   * sdk.updateConfig({\n   *   timeout: 30000,\n   *   debug: true\n   * });\n   * ```\n   */\n  updateConfig(newConfig: Partial<SDKConfig>): void {\n    // Merge new config with current config\n    // Ensure apiKey is preserved from current config if not provided\n    const configToMerge: PartialSDKConfig = {\n      apiKey: this.config.apiKey!,\n      ...this.config,\n      ...newConfig\n    };\n\n    // Switching environment must actually retarget the verify endpoint. The current config\n    // always carries a resolved `apiEndpoints.verify`, and an explicit endpoint outranks the\n    // environment in mergeConfig — so carrying it over would silently pin the old host.\n    // Drop it and let the new environment resolve, unless this call names an endpoint.\n    const switchingEnvironment =\n      newConfig.environment !== undefined && newConfig.environment !== this.config.environment;\n\n    if (switchingEnvironment && !newConfig.apiEndpoints?.verify) {\n      configToMerge.apiEndpoints = undefined;\n    }\n\n    // Same for the iOS app scheme — a carried-over value would keep pointing at the old\n    // environment's UltraPass build, which is worse than the endpoint case because the\n    // deeplink then opens the wrong app (or nothing) with no error.\n    if (switchingEnvironment && !newConfig.ultrapassScheme) {\n      configToMerge.ultrapassScheme = undefined;\n    }\n\n    this.config = mergeConfig(configToMerge);\n\n    // Recreate API client with new config\n    this.api = new APIClient(this.config);\n\n    if (this.config.debug) {\n      console.log('[FIDO2-JS] Config updated:', {\n        apiEndpoints: this.config.apiEndpoints,\n        authenticators: Object.keys(this.config.authenticators),\n        timeout: this.config.timeout,\n        debug: this.config.debug\n      });\n    }\n  }\n\n  /**\n   * Gets a read-only copy of the current configuration\n   *\n   * @returns Frozen copy of the SDK configuration\n   *\n   * @example\n   * ```typescript\n   * const config = sdk.getConfig();\n   * console.log('Timeout:', config.timeout);\n   * ```\n   */\n  getConfig(): Readonly<SDKConfig> {\n    return Object.freeze({ ...this.config });\n  }\n\n  /**\n   * Verifies an AAGUID without registration\n   *\n   * This is a utility method to check if an attestation object contains\n   * a specific authenticator AAGUID.\n   *\n   * @param attestationObject - Base64-encoded attestation object\n   * @param authenticatorName - Name of authenticator to verify against\n   * @returns AAGUID verification result\n   *\n   * @throws {VerificationError} If verification fails\n   *\n   * @example\n   * ```typescript\n   * const verification = sdk.verifyAAGUID(\n   *   credential.attestationObject,\n   *   'ultrapass'\n   * );\n   *\n   * if (verification.matches) {\n   *   console.log('Authenticator verified!');\n   * }\n   * ```\n   */\n  verifyAAGUID(\n    attestationObject: string,\n    authenticatorName: string\n  ): AAGUIDVerificationResult {\n    return checkAAGUID(base64ToBuffer(attestationObject), authenticatorName, this.config);\n  }\n\n  /**\n   * Verifies an AAGUID against any configured authenticator\n   *\n   * This is a utility method to check if an attestation object contains\n   * any of the configured authenticator AAGUIDs.\n   *\n   * @param attestationObject - Base64-encoded attestation object\n   * @returns AAGUID verification result\n   *\n   * @throws {VerificationError} If verification fails\n   *\n   * @example\n   * ```typescript\n   * const verification = sdk.verifyAAGUIDAny(credential.attestationObject);\n   *\n   * if (verification.matches) {\n   *   console.log('Matched authenticator:', verification.authenticatorName);\n   * }\n   * ```\n   */\n  verifyAAGUIDAny(attestationObject: string): AAGUIDVerificationResult {\n    return checkAAGUIDAny(base64ToBuffer(attestationObject), this.config);\n  }\n\n  /**\n   * Ensures WebAuthn is supported before operations\n   *\n   * @throws {Error} If WebAuthn is not supported\n   * @private\n   */\n  private ensureWebAuthnSupported(): void {\n    if (!checkWebAuthnSupport()) {\n      throw new Error(\n        'WebAuthn is not supported in this browser. ' +\n          'Please use a modern browser with WebAuthn support (Chrome 67+, Firefox 60+, Safari 13+, Edge 18+).'\n      );\n    }\n  }\n}\n"],"names":["WebAuthnErrorCode","position","bundledStrings","isLittleEndianMachine","Buffer","cborDecode"],"mappings":";;;;AAAA;;;;;;;AAOG;AAmEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2CG;AACG,SAAU,yBAAyB,CAAC,OAAA,GAAyB,EAAE,EAAA;;AAEnE,IAAA,IAAI,OAAO,CAAC,YAAY,KAAK,SAAS,EAAE;QACtC,IACE,CAAC,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,YAAY,CAAC;YACvC,OAAO,CAAC,YAAY,GAAG,CAAC;AACxB,YAAA,OAAO,CAAC,YAAY,GAAG,GAAG,EAC1B;AACA,YAAA,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC;QACtE;IACF;;AAGA,IAAA,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC;;AAG/B,IAAA,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI;;IAGd,IAAI,YAAY,GAAG,CAAC;AAEpB,IAAA,IAAI,OAAO,CAAC,aAAa,EAAE;AACzB,QAAA,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB;AACA,IAAA,IAAI,OAAO,CAAC,QAAQ,EAAE;AACpB,QAAA,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB;AACA,IAAA,IAAI,OAAO,CAAC,sBAAsB,EAAE;AAClC,QAAA,YAAY,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB;AACA,IAAA,IAAI,OAAO,CAAC,gBAAgB,EAAE;AAC5B,QAAA,YAAY,IAAI,CA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