{"version":3,"file":"passkeys.mjs","sources":["../../../../../../../web/src/utils/passkeys.ts"],"sourcesContent":["export enum Device {\n  DESKTOP = 'Desktop device',\n  MOBILE = 'Mobile device',\n  UNKNOWN = 'Unknown device',\n}\n\nexport const determineDeviceType = (userAgent: string): Device => {\n  // TODO: Add more device types/ make more fine grained\n  if (userAgent === '') {\n    return Device.UNKNOWN;\n  }\n\n  // eslint-disable-next-line lingui/no-unlocalized-strings\n  const mobileKeywords = ['mobile', 'android', 'iphone', 'ipad', 'windows phone'];\n  userAgent = userAgent.toLowerCase();\n  for (const keyword of mobileKeywords) {\n    if (userAgent.includes(keyword)) {\n      return Device.MOBILE;\n    }\n  }\n\n  return Device.DESKTOP;\n};\n\n// This commonly occurs when a user tries to register a Passkey using a QR code on a separate device\n// but the Passkey has already been sync'd to that device (e.g. the user registers an Apple passkey on their Macbook,\n// it then syncs to their iPhone, and then they try to register the same Passkey on their iPhone). At some point we\n// may be able to remove this logic when this is handled within the browser Passkeys UI.\nexport const SAFARI_CROSS_DEVICE_DUPLICATE_REG_ERROR_MESSAGE =\n  'At least one credential matches an entry of the excludeCredentials list in the platform attached authenticator.';\nexport const CHROME_CROSS_DEVICE_DUPLICATE_REG_ERROR_MESSAGE =\n  'The user attempted to register an authenticator that contains one of the credentials already registered with the relying party.';\n"],"names":["SAFARI_CROSS_DEVICE_DUPLICATE_REG_ERROR_MESSAGE","CHROME_CROSS_DEVICE_DUPLICATE_REG_ERROR_MESSAGE"],"mappings":"AAwBA;AACA;AACA;AACA;AACO,MAAMA,kDACX;AACK,MAAMC,kDACX;;;;"}