@loginid/websdk3 3.0.4 → 3.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,7 +19,7 @@ npm install @loginid/websdk3
19
19
 
20
20
  ## How to Use
21
21
 
22
- - visit our [API Reference documentation](https://docs.loginid.io/web/classes/LoginIDWebSDK/) for package implementation.
22
+ - visit our [API Reference documentation](https://docs.loginid.io/reference-documentation/web/web-sdk/) for package implementation.
23
23
 
24
24
  ## Contact and support
25
25
 
package/dist/index.cjs CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var J=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var me=(t,e)=>{for(var r in e)J(t,r,{get:e[r],enumerable:!0})},Fe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ne(e))!Ue.call(t,o)&&o!==r&&J(t,o,{get:()=>e[o],enumerable:!(s=De(e,o))||s.enumerable});return t};var Ke=t=>Fe(J({},"__esModule",{value:!0}),t);var et={};me(et,{AbortError:()=>V,ApiError:()=>m,LoginIDAPI:()=>se,LoginIDWebSDK:()=>de,PasskeyError:()=>c,WebAuthnHelper:()=>j,canCreatePasskey:()=>Oe,createPasskeyCredential:()=>S,default:()=>Ze,doesDeviceSupportPasskeys:()=>oe,getPasskeyCredential:()=>v,isConditionalUIAvailable:()=>Ie,isPlatformAuthenticatorAvailable:()=>re});module.exports=Ke(et);var M=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,r=this.config.baseUrl.match(e);if(r)return r[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},K=M;var Le=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),He=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],s=0;for(;s<t.length;){let i=t.charCodeAt(s++),a=t.charCodeAt(s++),u=t.charCodeAt(s++),l=i<<16|a<<8|u;r.push(e[l>>18&63]+e[l>>12&63]+e[l>>6&63]+e[l&63])}let o=r.join(""),n=t.length%3;return n?o.slice(0,n-3)+"===".slice(n||3):o},Ve=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r={},s=String.fromCharCode;for(let a=0;a<64;a++)r[e.charAt(a)]=a;let o=0,n=0,i="";for(let a of t){let u=r[a];if(u!==void 0)for(o=(o<<6)+u,n+=6;n>=8;)i+=s(o>>(n-=8)&255)}return i},p=t=>{let e="",r=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)e+=String.fromCharCode(r[o]);let s=He(e);return Le(s)},R=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=Ve(t),r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r.buffer},ye=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),fe=(t,e)=>{e.forEach(r=>{Object.getOwnPropertyNames(r.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(r.prototype,s)||Object.create(null))})})},w=t=>{try{let r=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},he=t=>{let r=`; ${document.cookie}`.split(`; ${t}=`);if(r&&r.length===2)return r.pop().split(";").shift()},Re=t=>{document.cookie=t},ge=t=>{document.cookie=`${t}=; expires=${new Date}`};var $=class{config;constructor(e){this.config=new K(e)}getToken(e){if(e.authzToken)return e.authzToken;{let r=this.getJwtCookie();return r||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=w(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let r=w(e),s=new Date(r.exp*1e3).toUTCString(),o=`${this.getJwtCookieName()}=${e}; expires=${s}`;Re(o)}getJwtCookie(){return he(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){ge(this.getJwtCookieName())}},be=$;var g=class{constructor(e){this.config=e}};var m=class extends Error{url;status;statusText;body;request;constructor(e,r,s){super(s),this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=e}};var D=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},b=class{#t;#r;#e;#o;#n;#i;#s;constructor(e){this.#t=!1,this.#r=!1,this.#e=!1,this.#o=[],this.#n=new Promise((r,s)=>{this.#i=r,this.#s=s;let o=a=>{this.#t||this.#r||this.#e||(this.#t=!0,this.#i&&this.#i(a))},n=a=>{this.#t||this.#r||this.#e||(this.#r=!0,this.#s&&this.#s(a))},i=a=>{this.#t||this.#r||this.#e||this.#o.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this.#t}),Object.defineProperty(i,"isRejected",{get:()=>this.#r}),Object.defineProperty(i,"isCancelled",{get:()=>this.#e}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,r){return this.#n.then(e,r)}catch(e){return this.#n.catch(e)}finally(e){return this.#n.finally(e)}cancel(){if(!(this.#t||this.#r||this.#e)){if(this.#e=!0,this.#o.length)try{for(let e of this.#o)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#o.length=0,this.#s&&this.#s(new D("Request aborted"))}}get isCancelled(){return this.#e}};var Y=t=>t!=null,N=t=>typeof t=="string",G=t=>N(t)&&t!=="",Q=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),Ce=t=>t instanceof FormData,We=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},_e=t=>{let e=[],r=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},s=(o,n)=>{Y(n)&&(Array.isArray(n)?n.forEach(i=>{s(o,i)}):typeof n=="object"?Object.entries(n).forEach(([i,a])=>{s(`${o}[${i}]`,a)}):r(o,n))};return Object.entries(t).forEach(([o,n])=>{s(o,n)}),e.length>0?`?${e.join("&")}`:""},je=(t,e)=>{let r=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>e.path?.hasOwnProperty(i)?r(String(e.path[i])):n),o=`${t.BASE}${s}`;return e.query?`${o}${_e(e.query)}`:o},ze=t=>{if(t.formData){let e=new FormData,r=(s,o)=>{N(o)||Q(o)?e.append(s,o):e.append(s,JSON.stringify(o))};return Object.entries(t.formData).filter(([s,o])=>Y(o)).forEach(([s,o])=>{Array.isArray(o)?o.forEach(n=>r(s,n)):r(s,o)}),e}},L=async(t,e)=>typeof e=="function"?e(t):e,Je=async(t,e)=>{let[r,s,o,n]=await Promise.all([L(e,t.TOKEN),L(e,t.USERNAME),L(e,t.PASSWORD),L(e,t.HEADERS)]),i=Object.entries({Accept:"application/json",...n,...e.headers}).filter(([a,u])=>Y(u)).reduce((a,[u,l])=>({...a,[u]:String(l)}),{});if(G(r)&&(i.Authorization=`Bearer ${r}`),G(s)&&G(o)){let a=We(`${s}:${o}`);i.Authorization=`Basic ${a}`}return e.body&&(e.mediaType?i["Content-Type"]=e.mediaType:Q(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":N(e.body)?i["Content-Type"]="text/plain":Ce(e.body)||(i["Content-Type"]="application/json")),new Headers(i)},Me=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):N(t.body)||Q(t.body)||Ce(t.body)?t.body:JSON.stringify(t.body)},$e=async(t,e,r,s,o,n,i)=>{let a=new AbortController,u={headers:n,body:s??o,method:e.method,signal:a.signal};return t.WITH_CREDENTIALS&&(u.credentials=t.CREDENTIALS),i(()=>a.abort()),await fetch(r,u)},Ge=(t,e)=>{if(e){let r=t.headers.get(e);if(N(r))return r}},Ye=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(o=>e.toLowerCase().startsWith(o))?await t.json():await t.text()}catch(e){console.error(e)}},Qe=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new m(t,e,s);if(!e.ok){let o=e.status??"unknown",n=e.statusText??"unknown",i=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new m(t,e,`Generic Error: status: ${o}; status text: ${n}; body: ${i}`)}},Pe=(t,e)=>new b(async(r,s,o)=>{try{let n=je(t,e),i=ze(e),a=Me(e),u=await Je(t,e);if(!o.isCancelled){let l=await $e(t,e,n,a,i,u,o),d=await Ye(l),F=Ge(l,e.responseHeader),z={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:F??d};Qe(e,z),r(z.body)}}catch(n){s(n)}});var H=class extends g{constructor(e){super(e)}request(e){return Pe(this.config,e)}};var C=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":r},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var P=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var q=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:r}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:r},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:r,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var A=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var I=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:r,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":r,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var O=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var T=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var x=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var k=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,r=H){this.request=new r({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new C(this.request),this.mgmt=new P(this.request),this.passkeys=new q(this.request),this.profile=new A(this.request),this.reg=new I(this.request),this.tx=new O(this.request),this.version=new T(this.request),this.wellKnown=new x(this.request)}};var X=class{config;service;session;constructor(e){this.config=new K(e),this.service=new k({BASE:e.baseUrl}),this.session=new be(e)}},y=X;var Z=class extends Error{constructor(e){super(e),this.name="AbortError"}},V=Z;var ee=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new V("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},h=ee;var f=(t,e,r)=>({...r,authzToken:e||r.authzToken||"",usernameType:r.usernameType||"email",displayName:r.displayName||t,callbacks:r.callbacks||{}}),qe=(t,e)=>({...f(t,"",e),txType:e.txType||"raw",nonce:e.nonce||ye()}),B=(t,e=!0,r=!1)=>({token:t,isAuthenticated:e,isFallback:r});var te=class extends y{constructor(e){super(e)}async validateOtp(e,r,s={}){let o=f(e,"",s),n={authCode:r,user:{username:e,usernameType:o.usernameType}},i=await this.service.auth.authAuthCodeVerify({requestBody:n}),a=B(i.jwtAccess);return h.renewWebAuthnAbortController(),this.session.setJwtCookie(a.token),a}async requestAndSendOtp(e,r="email",s={}){let o=f(e,"",s),n={user:{username:e,usernameType:o.usernameType}};switch(r){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:n});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:n});break;default:throw new Error("Invalid message method")}}},W=te;var Ae=require("ua-parser-js"),U=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},Xe=(t,e)=>{let r=t.split(".").map(Number),s=e.split(".").map(Number),o=Math.max(r.length,s.length);for(let n=0;n<o;n++){let i=n<r.length?r[n]:0,a=n<s.length?s[n]:0;if(i<a)return-1;if(i>a)return 1}return 0};async function re(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function Ie(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function oe(){let t=new Ae.UAParser(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&Xe(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function Oe(){let t=await re(),e=await oe();return t&&e.deviceSupported}var se={};me(se,{ApiError:()=>m,AuthService:()=>C,BaseHttpRequest:()=>g,CancelError:()=>D,CancelablePromise:()=>b,LoginIDService:()=>k,MgmtService:()=>P,OpenAPI:()=>Te,PasskeysService:()=>q,ProfileService:()=>A,RegService:()=>I,TxService:()=>O,VersionService:()=>T,WellKnownService:()=>x});var Te={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var ne=class extends y{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let r=f("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:U(),user:{username:"",usernameType:r.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(r){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",r instanceof m&&(e.code=r.body.msgCode||"unknown_error",e.message=r.body.msg||r.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},xe=ne;var ke=t=>`LoginID_${t}_device-id`,E=class{static persistDeviceId(e,r){r&&localStorage.setItem(ke(e),r)}static getDeviceId(e){return localStorage.getItem(ke(e))||""}};var Be=t=>[...t.crossAuthMethods,...t.fallbackMethods];var ie=class extends Error{code;constructor(e,r,s){super(e),this.code=r,this.cause=s}},c=ie;var ae=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},ue=ae;var Ee=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new c("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new c("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(r==="InvalidStateError")return new c("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(r==="NotAllowedError")return new c("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="NotSupportedError")return new c("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(r==="SecurityError"){let o=s?.rp?.id;if(o!==window.location.hostname)return new c(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new c("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Se=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="AbortError"&&e.signal instanceof AbortSignal)return new c("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(r==="NotAllowedError")return new c("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="SecurityError"){let o=s?.rpId;if(o!==window.location.hostname)return new c(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new c("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Cr=new ue("User needs to be logged in to perform this operation."),le=new ue("No login options available.");var S=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let o of t.excludeCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};e.push(n)}}let r=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:R(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:r,rp:t.rp,timeout:t.timeout,user:{...t.user,id:R(t.user.id)}}};try{let o=await navigator.credentials.create(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Ee(o,s):o}},v=async(t,e={})=>{let r;if(t.allowCredentials!==void 0){r=[];for(let o of t.allowCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};r.push(n)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:r,challenge:R(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let o=await navigator.credentials.get(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Se(o,s):o}};var pe=class extends W{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e;h.renewWebAuthnAbortController();let o=await S(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),l=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:p(n.attestationObject),clientDataJSON:p(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:p(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:p(u)},...l&&{transports:l}},session:s}}async createPasskey(e,r="",s={}){let o=this.config.getAppId(),n=U(E.getDeviceId(o)),i=f(e,r,s);i.authzToken=this.session.getToken(i),i.authzToken&&w(i.authzToken).username!==e&&(i.authzToken="");let a={app:{id:o},deviceInfo:n,user:{username:e,usernameType:i.usernameType,displayName:i.displayName}},u=await this.service.reg.regRegInit({requestBody:a,...i.authzToken&&{authorization:i.authzToken}}),l=await this.createNavigatorCredential(u),d=await this.service.reg.regRegComplete({requestBody:l}),F=B(d.jwtAccess);return this.session.setJwtCookie(d.jwtAccess),E.persistDeviceId(o,d.deviceID),F}async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e;r.abortController?h.assignWebAuthnAbortController(r.abortController):(h.renewWebAuthnAbortController(),r.abortController=h.abortController);let n=await v(s,r),i=n.response;return{assertionResult:{authenticatorData:p(i.authenticatorData),clientDataJSON:p(i.clientDataJSON),credentialId:n.id,signature:p(i.signature),...i.userHandle&&{userHandle:p(i.userHandle)}},session:o}}async authenticateWithPasskey(e="",r={}){let s=this.config.getAppId(),o=U(E.getDeviceId(s)),n=f(e,"",r),i={app:{id:s},deviceInfo:o,user:{username:e,usernameType:n.usernameType}},a=await this.service.auth.authAuthInit({requestBody:i});switch(a.action){case"proceed":{let u=await this.getNavigatorCredential(a,r),l=await this.service.auth.authAuthComplete({requestBody:u}),d=B(l.jwtAccess);return this.session.setJwtCookie(d.token),n?.callbacks?.onSuccess&&await n.callbacks.onSuccess(d),d}case"crossAuth":case"fallback":{if(n?.callbacks?.onFallback){let u=Be(a);return await n.callbacks.onFallback(e,u),B("",!1,!0)}throw le}default:throw le}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,r={}){if(r.authzToken=this.session.getToken(r),!r.authzToken){let o=await this.authenticateWithPasskey(e,r);r.authzToken=o.token}return await this.service.auth.authAuthCodeRequest({authorization:r.authzToken})}async confirmTransaction(e,r,s={}){let o=qe(e,s),n={username:e,txPayload:r,nonce:o.nonce,txType:o.txType},{assertionOptions:i,session:a}=await this.service.tx.txTxInit({requestBody:n}),u={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:i,session:a},{assertionResult:l}=await this.getNavigatorCredential(u),d={authenticatorData:l.authenticatorData,clientData:l.clientDataJSON,keyHandle:l.credentialId,session:a,signature:l.signature};return await this.service.tx.txTxComplete({requestBody:d})}},ve=pe;var ce=class extends y{constructor(e){super(e)}async listPasskeys(e={}){let r=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:r})}async renamePasskey(e,r,s={}){let o=this.session.getToken(s),n={name:r};await this.service.passkeys.passkeysPasskeyRename({authorization:o,id:e,requestBody:n})}async deletePasskey(e,r={}){let s=this.session.getToken(r);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},we=ce;var _=class extends y{constructor(e){super(e)}};fe(_,[y,ve,W,we,xe]);var de=_;var j=class{static async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e,n=await v(s,r),i=n.response;return{assertionResult:{authenticatorData:p(i.authenticatorData),clientDataJSON:p(i.clientDataJSON),credentialId:n.id,signature:p(i.signature),...i.userHandle&&{userHandle:p(i.userHandle)}},session:o}}static async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e,o=await S(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),l=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:p(n.attestationObject),clientDataJSON:p(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:p(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:p(u)},...l&&{transports:l}},session:s}}};var Ze=de;0&&(module.exports={AbortError,ApiError,LoginIDAPI,LoginIDWebSDK,PasskeyError,WebAuthnHelper,canCreatePasskey,createPasskeyCredential,doesDeviceSupportPasskeys,getPasskeyCredential,isConditionalUIAvailable,isPlatformAuthenticatorAvailable});
1
+ "use strict";var J=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ne=Object.getOwnPropertyNames;var Ue=Object.prototype.hasOwnProperty;var ce=(t,e)=>{for(var r in e)J(t,r,{get:e[r],enumerable:!0})},Fe=(t,e,r,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ne(e))!Ue.call(t,o)&&o!==r&&J(t,o,{get:()=>e[o],enumerable:!(s=De(e,o))||s.enumerable});return t};var Ke=t=>Fe(J({},"__esModule",{value:!0}),t);var et={};ce(et,{AbortError:()=>V,ApiError:()=>m,LoginIDAPI:()=>se,LoginIDWebSDK:()=>de,PasskeyError:()=>d,WebAuthnHelper:()=>_,canCreatePasskey:()=>Ie,createPasskeyCredential:()=>S,default:()=>Ze,doesDeviceSupportPasskeys:()=>oe,getPasskeyCredential:()=>v,isConditionalUIAvailable:()=>Ae,isPlatformAuthenticatorAvailable:()=>re});module.exports=Ke(et);var M=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,r=this.config.baseUrl.match(e);if(r)return r[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},K=M;var Le=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),He=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],s=0;for(;s<t.length;){let i=t.charCodeAt(s++),a=t.charCodeAt(s++),u=t.charCodeAt(s++),p=i<<16|a<<8|u;r.push(e[p>>18&63]+e[p>>12&63]+e[p>>6&63]+e[p&63])}let o=r.join(""),n=t.length%3;return n?o.slice(0,n-3)+"===".slice(n||3):o},Ve=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r={},s=String.fromCharCode;for(let a=0;a<64;a++)r[e.charAt(a)]=a;let o=0,n=0,i="";for(let a of t){let u=r[a];if(u!==void 0)for(o=(o<<6)+u,n+=6;n>=8;)i+=s(o>>(n-=8)&255)}return i},l=t=>{let e="",r=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)e+=String.fromCharCode(r[o]);let s=He(e);return Le(s)},R=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=Ve(t),r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r.buffer},me=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),ye=(t,e)=>{e.forEach(r=>{Object.getOwnPropertyNames(r.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(r.prototype,s)||Object.create(null))})})},w=t=>{try{let r=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},fe=t=>{let r=`; ${document.cookie}`.split(`; ${t}=`);if(r&&r.length===2)return r.pop().split(";").shift()},he=t=>{document.cookie=t},Re=t=>{document.cookie=`${t}=; expires=${new Date}`};var $=class{config;constructor(e){this.config=new K(e)}getToken(e){if(e.authzToken)return e.authzToken;{let r=this.getJwtCookie();return r||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=w(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let r=w(e),s=new Date(r.exp*1e3).toUTCString(),o=`${this.getJwtCookieName()}=${e}; expires=${s}`;he(o)}getJwtCookie(){return fe(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){Re(this.getJwtCookieName())}},ge=$;var g=class{constructor(e){this.config=e}};var m=class extends Error{url;status;statusText;body;request;constructor(e,r,s){super(s),this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=e}};var D=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},b=class{#t;#r;#e;#o;#n;#i;#s;constructor(e){this.#t=!1,this.#r=!1,this.#e=!1,this.#o=[],this.#n=new Promise((r,s)=>{this.#i=r,this.#s=s;let o=a=>{this.#t||this.#r||this.#e||(this.#t=!0,this.#i&&this.#i(a))},n=a=>{this.#t||this.#r||this.#e||(this.#r=!0,this.#s&&this.#s(a))},i=a=>{this.#t||this.#r||this.#e||this.#o.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this.#t}),Object.defineProperty(i,"isRejected",{get:()=>this.#r}),Object.defineProperty(i,"isCancelled",{get:()=>this.#e}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,r){return this.#n.then(e,r)}catch(e){return this.#n.catch(e)}finally(e){return this.#n.finally(e)}cancel(){if(!(this.#t||this.#r||this.#e)){if(this.#e=!0,this.#o.length)try{for(let e of this.#o)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#o.length=0,this.#s&&this.#s(new D("Request aborted"))}}get isCancelled(){return this.#e}};var Y=t=>t!=null,N=t=>typeof t=="string",G=t=>N(t)&&t!=="",Q=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),be=t=>t instanceof FormData,We=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},ze=t=>{let e=[],r=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},s=(o,n)=>{Y(n)&&(Array.isArray(n)?n.forEach(i=>{s(o,i)}):typeof n=="object"?Object.entries(n).forEach(([i,a])=>{s(`${o}[${i}]`,a)}):r(o,n))};return Object.entries(t).forEach(([o,n])=>{s(o,n)}),e.length>0?`?${e.join("&")}`:""},_e=(t,e)=>{let r=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>e.path?.hasOwnProperty(i)?r(String(e.path[i])):n),o=`${t.BASE}${s}`;return e.query?`${o}${ze(e.query)}`:o},je=t=>{if(t.formData){let e=new FormData,r=(s,o)=>{N(o)||Q(o)?e.append(s,o):e.append(s,JSON.stringify(o))};return Object.entries(t.formData).filter(([s,o])=>Y(o)).forEach(([s,o])=>{Array.isArray(o)?o.forEach(n=>r(s,n)):r(s,o)}),e}},L=async(t,e)=>typeof e=="function"?e(t):e,Je=async(t,e)=>{let[r,s,o,n]=await Promise.all([L(e,t.TOKEN),L(e,t.USERNAME),L(e,t.PASSWORD),L(e,t.HEADERS)]),i=Object.entries({Accept:"application/json",...n,...e.headers}).filter(([a,u])=>Y(u)).reduce((a,[u,p])=>({...a,[u]:String(p)}),{});if(G(r)&&(i.Authorization=`Bearer ${r}`),G(s)&&G(o)){let a=We(`${s}:${o}`);i.Authorization=`Basic ${a}`}return e.body&&(e.mediaType?i["Content-Type"]=e.mediaType:Q(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":N(e.body)?i["Content-Type"]="text/plain":be(e.body)||(i["Content-Type"]="application/json")),new Headers(i)},Me=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):N(t.body)||Q(t.body)||be(t.body)?t.body:JSON.stringify(t.body)},$e=async(t,e,r,s,o,n,i)=>{let a=new AbortController,u={headers:n,body:s??o,method:e.method,signal:a.signal};return t.WITH_CREDENTIALS&&(u.credentials=t.CREDENTIALS),i(()=>a.abort()),await fetch(r,u)},Ge=(t,e)=>{if(e){let r=t.headers.get(e);if(N(r))return r}},Ye=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(o=>e.toLowerCase().startsWith(o))?await t.json():await t.text()}catch(e){console.error(e)}},Qe=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new m(t,e,s);if(!e.ok){let o=e.status??"unknown",n=e.statusText??"unknown",i=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new m(t,e,`Generic Error: status: ${o}; status text: ${n}; body: ${i}`)}},Ce=(t,e)=>new b(async(r,s,o)=>{try{let n=_e(t,e),i=je(e),a=Me(e),u=await Je(t,e);if(!o.isCancelled){let p=await $e(t,e,n,a,i,u,o),c=await Ye(p),F=Ge(p,e.responseHeader),j={url:n,ok:p.ok,status:p.status,statusText:p.statusText,body:F??c};Qe(e,j),r(j.body)}}catch(n){s(n)}});var H=class extends g{constructor(e){super(e)}request(e){return Ce(this.config,e)}};var C=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":r},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var P=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var q=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:r}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:r},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:r,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var A=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var I=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:r,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":r,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var T=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var O=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var x=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var E=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,r=H){this.request=new r({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new C(this.request),this.mgmt=new P(this.request),this.passkeys=new q(this.request),this.profile=new A(this.request),this.reg=new I(this.request),this.tx=new T(this.request),this.version=new O(this.request),this.wellKnown=new x(this.request)}};var X=class{config;service;session;constructor(e){this.config=new K(e),this.service=new E({BASE:e.baseUrl}),this.session=new ge(e)}},y=X;var Z=class extends Error{constructor(e){super(e),this.name="AbortError"}},V=Z;var ee=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new V("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},h=ee;var f=(t,e,r)=>({...r,authzToken:e||r.authzToken||"",usernameType:r.usernameType||"other",displayName:r.displayName||t,callbacks:r.callbacks||{}}),Pe=(t,e)=>({...f(t,"",e),txType:e.txType||"raw",nonce:e.nonce||me()}),k=(t,e=!0,r=!1)=>({token:t,isAuthenticated:e,isFallback:r});var te=class extends y{constructor(e){super(e)}async validateOtp(e,r,s={}){let o=f(e,"",s),n={authCode:r,user:{username:e,usernameType:o.usernameType}},i=await this.service.auth.authAuthCodeVerify({requestBody:n}),a=k(i.jwtAccess);return h.renewWebAuthnAbortController(),this.session.setJwtCookie(a.token),a}async requestAndSendOtp(e,r="email",s={}){let o=f(e,"",s),n={user:{username:e,usernameType:o.usernameType}};switch(r){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:n});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:n});break;default:throw new Error("Invalid message method")}}},W=te;var qe=require("ua-parser-js"),U=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},Xe=(t,e)=>{let r=t.split(".").map(Number),s=e.split(".").map(Number),o=Math.max(r.length,s.length);for(let n=0;n<o;n++){let i=n<r.length?r[n]:0,a=n<s.length?s[n]:0;if(i<a)return-1;if(i>a)return 1}return 0};async function re(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function Ae(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function oe(){let t=new qe.UAParser(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&Xe(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function Ie(){let t=await re(),e=await oe();return t&&e.deviceSupported}var se={};ce(se,{ApiError:()=>m,AuthService:()=>C,BaseHttpRequest:()=>g,CancelError:()=>D,CancelablePromise:()=>b,LoginIDService:()=>E,MgmtService:()=>P,OpenAPI:()=>Te,PasskeysService:()=>q,ProfileService:()=>A,RegService:()=>I,TxService:()=>T,VersionService:()=>O,WellKnownService:()=>x});var Te={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var ne=class extends y{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let r=f("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:U(),user:{username:"",usernameType:r.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(r){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",r instanceof m&&(e.code=r.body.msgCode||"unknown_error",e.message=r.body.msg||r.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},Oe=ne;var xe=t=>`LoginID_${t}_device-id`,B=class{static persistDeviceId(e,r){r&&localStorage.setItem(xe(e),r)}static getDeviceId(e){return localStorage.getItem(xe(e))||""}};var Ee=t=>[...t.crossAuthMethods,...t.fallbackMethods];var ie=class extends Error{code;constructor(e,r,s){super(e),this.code=r,this.cause=s}},d=ie;var ae=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},ue=ae;var ke=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new d("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new d("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(r==="InvalidStateError")return new d("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(r==="NotAllowedError")return new d("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="NotSupportedError")return new d("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(r==="SecurityError"){let o=s?.rp?.id;if(o!==window.location.hostname)return new d(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new d("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Be=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="AbortError"&&e.signal instanceof AbortSignal)return new d("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(r==="NotAllowedError")return new d("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="SecurityError"){let o=s?.rpId;if(o!==window.location.hostname)return new d(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new d("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Cr=new ue("User needs to be logged in to perform this operation."),Se=new ue("No login options available.");var S=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let o of t.excludeCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};e.push(n)}}let r=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:R(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:r,rp:t.rp,timeout:t.timeout,user:{...t.user,id:R(t.user.id)}}};try{let o=await navigator.credentials.create(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?ke(o,s):o}},v=async(t,e={})=>{let r;if(t.allowCredentials!==void 0){r=[];for(let o of t.allowCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};r.push(n)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:r,challenge:R(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let o=await navigator.credentials.get(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Be(o,s):o}};var pe=class extends W{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e;h.renewWebAuthnAbortController();let o=await S(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),p=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:l(n.attestationObject),clientDataJSON:l(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:l(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:l(u)},...p&&{transports:p}},session:s}}async createPasskey(e,r="",s={}){let o=this.config.getAppId(),n=U(B.getDeviceId(o)),i=f(e,r,s);i.authzToken=this.session.getToken(i),i.authzToken&&w(i.authzToken).username!==e&&(i.authzToken="");let a={app:{id:o},deviceInfo:n,user:{username:e,usernameType:i.usernameType,displayName:i.displayName}},u=await this.service.reg.regRegInit({requestBody:a,...i.authzToken&&{authorization:i.authzToken}}),p=await this.createNavigatorCredential(u),c=await this.service.reg.regRegComplete({requestBody:p}),F=k(c.jwtAccess);return this.session.setJwtCookie(c.jwtAccess),B.persistDeviceId(o,c.deviceID),F}async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e;r.abortController?h.assignWebAuthnAbortController(r.abortController):(h.renewWebAuthnAbortController(),r.abortController=h.abortController);let n=await v(s,r),i=n.response;return{assertionResult:{authenticatorData:l(i.authenticatorData),clientDataJSON:l(i.clientDataJSON),credentialId:n.id,signature:l(i.signature),...i.userHandle&&{userHandle:l(i.userHandle)}},session:o}}async authenticateWithPasskey(e="",r={}){let s=this.config.getAppId(),o=U(B.getDeviceId(s)),n=f(e,"",r),i={app:{id:s},deviceInfo:o,user:{username:e,usernameType:n.usernameType}},a=await this.service.auth.authAuthInit({requestBody:i});switch(a.action){case"proceed":{let u=await this.getNavigatorCredential(a,r),p=await this.service.auth.authAuthComplete({requestBody:u}),c=k(p.jwtAccess);return this.session.setJwtCookie(c.token),n?.callbacks?.onSuccess&&await n.callbacks.onSuccess(c),c}case"crossAuth":case"fallback":{if(n?.callbacks?.onFallback){let u=Ee(a);await n.callbacks.onFallback(e,u)}return k("",!1,!0)}default:throw Se}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,r={}){if(r.authzToken=this.session.getToken(r),!r.authzToken){let o=await this.authenticateWithPasskey(e,r);r.authzToken=o.token}return await this.service.auth.authAuthCodeRequest({authorization:r.authzToken})}async confirmTransaction(e,r,s={}){let o=Pe(e,s),n={username:e,txPayload:r,nonce:o.nonce,txType:o.txType},{assertionOptions:i,session:a}=await this.service.tx.txTxInit({requestBody:n}),u={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:i,session:a},{assertionResult:p}=await this.getNavigatorCredential(u),c={authenticatorData:p.authenticatorData,clientData:p.clientDataJSON,keyHandle:p.credentialId,session:a,signature:p.signature};return await this.service.tx.txTxComplete({requestBody:c})}},ve=pe;var le=class extends y{constructor(e){super(e)}async listPasskeys(e={}){let r=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:r})}async renamePasskey(e,r,s={}){let o=this.session.getToken(s),n={name:r};await this.service.passkeys.passkeysPasskeyRename({authorization:o,id:e,requestBody:n})}async deletePasskey(e,r={}){let s=this.session.getToken(r);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},we=le;var z=class extends y{constructor(e){super(e)}};ye(z,[y,ve,W,we,Oe]);var de=z;var _=class{static async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e,n=await v(s,r),i=n.response;return{assertionResult:{authenticatorData:l(i.authenticatorData),clientDataJSON:l(i.clientDataJSON),credentialId:n.id,signature:l(i.signature),...i.userHandle&&{userHandle:l(i.userHandle)}},session:o}}static async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e,o=await S(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),p=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:l(n.attestationObject),clientDataJSON:l(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:l(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:l(u)},...p&&{transports:p}},session:s}}};var Ze=de;0&&(module.exports={AbortError,ApiError,LoginIDAPI,LoginIDWebSDK,PasskeyError,WebAuthnHelper,canCreatePasskey,createPasskeyCredential,doesDeviceSupportPasskeys,getPasskeyCredential,isConditionalUIAvailable,isPlatformAuthenticatorAvailable});
2
2
  //# sourceMappingURL=index.cjs.map
package/dist/index.d.cts CHANGED
@@ -54,6 +54,9 @@ declare abstract class BaseHttpRequest {
54
54
  abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
55
55
  }
56
56
 
57
+ /**
58
+ * Code generation result
59
+ */
57
60
  type AuthCode = {
58
61
  /**
59
62
  * Generated code
@@ -73,7 +76,7 @@ type UserLogin = {
73
76
  /**
74
77
  * Username type
75
78
  */
76
- usernameType: 'email' | 'phone';
79
+ usernameType?: 'email' | 'phone' | 'other';
77
80
  };
78
81
 
79
82
  type AuthCodeRequestSMSRequestBody = {
@@ -90,7 +93,8 @@ type AuthCodeVerifyRequestBody = {
90
93
 
91
94
  type AuthenticatorAssertionResponse = {
92
95
  /**
93
- * This attribute contains the authenticator data returned by the authenticator.
96
+ * A base64 encoded authenticator data structure encodes contextual bindings
97
+ * made by the authenticator.
94
98
  */
95
99
  authenticatorData: string;
96
100
  /**
@@ -129,6 +133,9 @@ type PubKeyCredentialDescriptor = {
129
133
  */
130
134
  id: string;
131
135
  transports?: Array<'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid' | 'cable' | 'smart-card'>;
136
+ /**
137
+ * The valid credential types.
138
+ */
132
139
  type: 'public-key';
133
140
  };
134
141
 
@@ -151,7 +158,7 @@ type PublicKeyCredentialRequestOptions = {
151
158
  * authenticator. For example, if transaction confirmation is sought from the
152
159
  * user, then the prompt string might be included as an extension.
153
160
  */
154
- extensions?: Record<string, string>;
161
+ extensions?: Record<string, any>;
155
162
  /**
156
163
  * The relying party identifier claimed by the caller. If omitted, its value will
157
164
  * be the CredentialsContainer object’s relevant settings object's origin's
@@ -165,15 +172,14 @@ type PublicKeyCredentialRequestOptions = {
165
172
  */
166
173
  timeout?: number;
167
174
  /**
168
- * The Relying Party's requirements regarding user verification for the get()
169
- * operation. The value SHOULD be a member of UserVerificationRequirement but
170
- * client platforms MUST ignore unknown values, treating an unknown value as if
171
- * the member does not exist. Eligible authenticators are filtered to only those
172
- * capable of satisfying this requirement.
175
+ * User verification requirement
173
176
  */
174
177
  userVerification?: 'required' | 'preferred' | 'discouraged';
175
178
  };
176
179
 
180
+ /**
181
+ * FIDO2 authentication response
182
+ */
177
183
  type AuthInit = {
178
184
  /**
179
185
  * An action to be performed by the front-end to complete the authentication flow.
@@ -587,7 +593,8 @@ type CreationResult = {
587
593
  */
588
594
  attestationObject: string;
589
595
  /**
590
- * This attribute contains the authenticator data contained within attestationObject.
596
+ * A base64 encoded authenticator data structure encodes contextual bindings
597
+ * made by the authenticator.
591
598
  */
592
599
  authenticatorData?: string;
593
600
  /**
@@ -637,7 +644,7 @@ type AuthenticatorSelectionCriteria = {
637
644
  */
638
645
  residentKey?: 'discouraged' | 'preferred' | 'required';
639
646
  /**
640
- * Resident key requirement
647
+ * User verification requirement
641
648
  */
642
649
  userVerification?: 'required' | 'preferred' | 'discouraged';
643
650
  };
@@ -652,6 +659,9 @@ type PublicKeyCredentialParameters = {
652
659
  * e.g., RSA or Elliptic Curve.
653
660
  */
654
661
  alg?: -7 | -35 | -36 | -257 | -8;
662
+ /**
663
+ * The valid credential types.
664
+ */
655
665
  type?: 'public-key';
656
666
  };
657
667
 
@@ -679,9 +689,6 @@ type PublicKeyCredentialUserEntity = {
679
689
  };
680
690
 
681
691
  type PublicKeyCredentialCreationOptions = {
682
- /**
683
- * A preference for attestation conveyance.
684
- */
685
692
  attestation?: 'none' | 'indirect' | 'direct' | 'enterprise';
686
693
  authenticatorSelection?: AuthenticatorSelectionCriteria;
687
694
  /**
@@ -700,7 +707,7 @@ type PublicKeyCredentialCreationOptions = {
700
707
  /**
701
708
  * Additional parameters requesting processing by the client and authenticator.
702
709
  */
703
- extensions?: Record<string, string>;
710
+ extensions?: Record<string, any>;
704
711
  /**
705
712
  * This member contains information about the desired properties of the credential
706
713
  * to be created. The sequence is ordered from most preferred to least preferred.
@@ -718,6 +725,9 @@ type PublicKeyCredentialCreationOptions = {
718
725
  user: PublicKeyCredentialUserEntity;
719
726
  };
720
727
 
728
+ /**
729
+ * FIDO2 registration response
730
+ */
721
731
  type RegInit = {
722
732
  /**
723
733
  * An action to be performed by the front-end to complete the registration flow.
@@ -749,7 +759,7 @@ type User = {
749
759
  /**
750
760
  * Username type
751
761
  */
752
- usernameType: 'email' | 'phone';
762
+ usernameType: 'email' | 'phone' | 'other';
753
763
  };
754
764
 
755
765
  type RegInitRequestBody = {
@@ -796,6 +806,9 @@ declare class RegService {
796
806
  }): CancelablePromise<RegInit>;
797
807
  }
798
808
 
809
+ /**
810
+ * Transaction Confirmation Complete response
811
+ */
799
812
  type TxComplete = {
800
813
  authCred?: Passkey;
801
814
  /**
@@ -834,6 +847,9 @@ type TxCompleteRequestBody = {
834
847
  signature: string;
835
848
  };
836
849
 
850
+ /**
851
+ * Transaction Confirmation Init response
852
+ */
837
853
  type TxInit = {
838
854
  assertionOptions: PublicKeyCredentialRequestOptions;
839
855
  /**
@@ -886,7 +902,7 @@ declare class TxService {
886
902
  }): CancelablePromise<TxInit>;
887
903
  }
888
904
 
889
- type Version = {
905
+ type Version3 = {
890
906
  /**
891
907
  * Version hash
892
908
  */
@@ -902,10 +918,10 @@ declare class VersionService {
902
918
  constructor(httpRequest: BaseHttpRequest);
903
919
  /**
904
920
  * Show software version
905
- * @returns Version OK response.
921
+ * @returns Version3 OK response.
906
922
  * @throws ApiError
907
923
  */
908
- versionVersionShow(): CancelablePromise<Version>;
924
+ versionVersionShow(): CancelablePromise<Version3>;
909
925
  }
910
926
 
911
927
  /**
@@ -997,6 +1013,83 @@ type BadRequestError = {
997
1013
  msgCode: string;
998
1014
  };
999
1015
 
1016
+ type CodeResult = {
1017
+ /**
1018
+ * Generated code
1019
+ */
1020
+ code: string;
1021
+ /**
1022
+ * Expiration time of the code
1023
+ */
1024
+ expiresAt: string;
1025
+ };
1026
+
1027
+ type ForbiddenError = {
1028
+ msg: string;
1029
+ msgCode: string;
1030
+ };
1031
+
1032
+ type InternalServerError = {
1033
+ msg: string;
1034
+ msgCode: string;
1035
+ };
1036
+
1037
+ type NotFoundError = {
1038
+ msg: string;
1039
+ msgCode: string;
1040
+ };
1041
+
1042
+ type PublicKeyCredential$1 = {
1043
+ /**
1044
+ * This base64 encoded byte array contains the credential ID
1045
+ * of the public key credential the caller is referring to.
1046
+ */
1047
+ id: string;
1048
+ /**
1049
+ * This enumeration defines hints as to how clients might communicate with a
1050
+ * particular authenticator in order to obtain an assertion for a specific
1051
+ * credential.
1052
+ */
1053
+ transport?: 'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid' | 'cable' | 'smart-card';
1054
+ /**
1055
+ * The type of the public key credential the caller is referring to.
1056
+ * The value SHOULD be a member of PublicKeyCredentialType but client
1057
+ * platforms MUST ignore any PublicKeyCredentialDescriptor with an unknown
1058
+ * type.
1059
+ */
1060
+ type?: 'public-key';
1061
+ };
1062
+
1063
+ type UnauthorizedError = {
1064
+ msg: string;
1065
+ msgCode: string;
1066
+ };
1067
+
1068
+ type Version = {
1069
+ /**
1070
+ * Version hash
1071
+ */
1072
+ hash?: string;
1073
+ /**
1074
+ * Software version
1075
+ */
1076
+ version: string;
1077
+ };
1078
+
1079
+ /**
1080
+ * Version
1081
+ */
1082
+ type Version2 = {
1083
+ /**
1084
+ * Version hash
1085
+ */
1086
+ hash?: string;
1087
+ /**
1088
+ * Software version
1089
+ */
1090
+ version: string;
1091
+ };
1092
+
1000
1093
  type index_ApiError = ApiError;
1001
1094
  declare const index_ApiError: typeof ApiError;
1002
1095
  type index_Application = Application;
@@ -1017,15 +1110,19 @@ type index_CancelError = CancelError;
1017
1110
  declare const index_CancelError: typeof CancelError;
1018
1111
  type index_CancelablePromise<T> = CancelablePromise<T>;
1019
1112
  declare const index_CancelablePromise: typeof CancelablePromise;
1113
+ type index_CodeResult = CodeResult;
1020
1114
  type index_CreationResult = CreationResult;
1021
1115
  type index_DeviceInfo = DeviceInfo;
1116
+ type index_ForbiddenError = ForbiddenError;
1022
1117
  type index_GrantCreateRequestBody = GrantCreateRequestBody;
1023
1118
  type index_GrantCreateResponseBody = GrantCreateResponseBody;
1119
+ type index_InternalServerError = InternalServerError;
1024
1120
  type index_JWT = JWT;
1025
1121
  type index_LoginIDService = LoginIDService;
1026
1122
  declare const index_LoginIDService: typeof LoginIDService;
1027
1123
  type index_MgmtService = MgmtService;
1028
1124
  declare const index_MgmtService: typeof MgmtService;
1125
+ type index_NotFoundError = NotFoundError;
1029
1126
  declare const index_OpenAPI: typeof OpenAPI;
1030
1127
  type index_OpenAPIConfig = OpenAPIConfig;
1031
1128
  type index_Passkey = Passkey;
@@ -1057,16 +1154,19 @@ type index_TxInit = TxInit;
1057
1154
  type index_TxInitRequestBody = TxInitRequestBody;
1058
1155
  type index_TxService = TxService;
1059
1156
  declare const index_TxService: typeof TxService;
1157
+ type index_UnauthorizedError = UnauthorizedError;
1060
1158
  type index_User = User;
1061
1159
  type index_UserLogin = UserLogin;
1062
1160
  type index_Version = Version;
1161
+ type index_Version2 = Version2;
1162
+ type index_Version3 = Version3;
1063
1163
  type index_VersionService = VersionService;
1064
1164
  declare const index_VersionService: typeof VersionService;
1065
1165
  type index_WellKnownJwks = WellKnownJwks;
1066
1166
  type index_WellKnownService = WellKnownService;
1067
1167
  declare const index_WellKnownService: typeof WellKnownService;
1068
1168
  declare namespace index {
1069
- export { index_ApiError as ApiError, type index_Application as Application, type index_AuthCode as AuthCode, type index_AuthCodeRequestSMSRequestBody as AuthCodeRequestSMSRequestBody, type index_AuthCodeVerifyRequestBody as AuthCodeVerifyRequestBody, type index_AuthCompleteRequestBody as AuthCompleteRequestBody, type index_AuthInit as AuthInit, type index_AuthInitRequestBody as AuthInitRequestBody, index_AuthService as AuthService, type index_AuthenticatorAssertionResponse as AuthenticatorAssertionResponse, type index_AuthenticatorSelectionCriteria as AuthenticatorSelectionCriteria, type index_BadRequestError as BadRequestError, index_BaseHttpRequest as BaseHttpRequest, index_CancelError as CancelError, index_CancelablePromise as CancelablePromise, type index_CreationResult as CreationResult, type index_DeviceInfo as DeviceInfo, type index_GrantCreateRequestBody as GrantCreateRequestBody, type index_GrantCreateResponseBody as GrantCreateResponseBody, type index_JWT as JWT, index_LoginIDService as LoginIDService, index_MgmtService as MgmtService, index_OpenAPI as OpenAPI, type index_OpenAPIConfig as OpenAPIConfig, type index_Passkey as Passkey, type index_PasskeyCollection as PasskeyCollection, type PasskeyOptions$1 as PasskeyOptions, type index_PasskeyRenameRequestBody as PasskeyRenameRequestBody, index_PasskeysService as PasskeysService, type index_ProfileEmailUpdateRequestBody as ProfileEmailUpdateRequestBody, type index_ProfilePhoneUpdateRequestBody as ProfilePhoneUpdateRequestBody, type index_ProfilePhoneVerifyRequestBody as ProfilePhoneVerifyRequestBody, index_ProfileService as ProfileService, type index_PubKeyCredentialDescriptor as PubKeyCredentialDescriptor, type index_PublicKeyCredentialCreationOptions as PublicKeyCredentialCreationOptions, type index_PublicKeyCredentialParameters as PublicKeyCredentialParameters, type index_PublicKeyCredentialRequestOptions as PublicKeyCredentialRequestOptions, type index_PublicKeyCredentialRpEntity as PublicKeyCredentialRpEntity, type index_PublicKeyCredentialUserEntity as PublicKeyCredentialUserEntity, type index_RegCompleteRequestBody as RegCompleteRequestBody, type index_RegInit as RegInit, type index_RegInitRequestBody as RegInitRequestBody, index_RegService as RegService, type index_ResultKey as ResultKey, type index_TokenVerifyRequestBody as TokenVerifyRequestBody, type index_TxComplete as TxComplete, type index_TxCompleteRequestBody as TxCompleteRequestBody, type index_TxInit as TxInit, type index_TxInitRequestBody as TxInitRequestBody, index_TxService as TxService, type index_User as User, type index_UserLogin as UserLogin, type index_Version as Version, index_VersionService as VersionService, type index_WellKnownJwks as WellKnownJwks, index_WellKnownService as WellKnownService };
1169
+ export { index_ApiError as ApiError, type index_Application as Application, type index_AuthCode as AuthCode, type index_AuthCodeRequestSMSRequestBody as AuthCodeRequestSMSRequestBody, type index_AuthCodeVerifyRequestBody as AuthCodeVerifyRequestBody, type index_AuthCompleteRequestBody as AuthCompleteRequestBody, type index_AuthInit as AuthInit, type index_AuthInitRequestBody as AuthInitRequestBody, index_AuthService as AuthService, type index_AuthenticatorAssertionResponse as AuthenticatorAssertionResponse, type index_AuthenticatorSelectionCriteria as AuthenticatorSelectionCriteria, type index_BadRequestError as BadRequestError, index_BaseHttpRequest as BaseHttpRequest, index_CancelError as CancelError, index_CancelablePromise as CancelablePromise, type index_CodeResult as CodeResult, type index_CreationResult as CreationResult, type index_DeviceInfo as DeviceInfo, type index_ForbiddenError as ForbiddenError, type index_GrantCreateRequestBody as GrantCreateRequestBody, type index_GrantCreateResponseBody as GrantCreateResponseBody, type index_InternalServerError as InternalServerError, type index_JWT as JWT, index_LoginIDService as LoginIDService, index_MgmtService as MgmtService, type index_NotFoundError as NotFoundError, index_OpenAPI as OpenAPI, type index_OpenAPIConfig as OpenAPIConfig, type index_Passkey as Passkey, type index_PasskeyCollection as PasskeyCollection, type PasskeyOptions$1 as PasskeyOptions, type index_PasskeyRenameRequestBody as PasskeyRenameRequestBody, index_PasskeysService as PasskeysService, type index_ProfileEmailUpdateRequestBody as ProfileEmailUpdateRequestBody, type index_ProfilePhoneUpdateRequestBody as ProfilePhoneUpdateRequestBody, type index_ProfilePhoneVerifyRequestBody as ProfilePhoneVerifyRequestBody, index_ProfileService as ProfileService, type index_PubKeyCredentialDescriptor as PubKeyCredentialDescriptor, type PublicKeyCredential$1 as PublicKeyCredential, type index_PublicKeyCredentialCreationOptions as PublicKeyCredentialCreationOptions, type index_PublicKeyCredentialParameters as PublicKeyCredentialParameters, type index_PublicKeyCredentialRequestOptions as PublicKeyCredentialRequestOptions, type index_PublicKeyCredentialRpEntity as PublicKeyCredentialRpEntity, type index_PublicKeyCredentialUserEntity as PublicKeyCredentialUserEntity, type index_RegCompleteRequestBody as RegCompleteRequestBody, type index_RegInit as RegInit, type index_RegInitRequestBody as RegInitRequestBody, index_RegService as RegService, type index_ResultKey as ResultKey, type index_TokenVerifyRequestBody as TokenVerifyRequestBody, type index_TxComplete as TxComplete, type index_TxCompleteRequestBody as TxCompleteRequestBody, type index_TxInit as TxInit, type index_TxInitRequestBody as TxInitRequestBody, index_TxService as TxService, type index_UnauthorizedError as UnauthorizedError, type index_User as User, type index_UserLogin as UserLogin, type index_Version as Version, type index_Version2 as Version2, type index_Version3 as Version3, index_VersionService as VersionService, type index_WellKnownJwks as WellKnownJwks, index_WellKnownService as WellKnownService };
1070
1170
  }
1071
1171
 
1072
1172
  type Complete<T> = {
@@ -1114,6 +1214,10 @@ interface PasskeyOptions {
1114
1214
  * Callback functions that can be triggered on various events during the authentication process.
1115
1215
  */
1116
1216
  callbacks?: Callbacks;
1217
+ /**
1218
+ * The type of username validation to be used. Defaults to **`other`**.
1219
+ */
1220
+ usernameType?: UsernameType;
1117
1221
  }
1118
1222
  /**
1119
1223
  * The base interface for passkey management options.
@@ -1184,6 +1288,10 @@ interface ConfirmTransactionOptions extends PasskeyOptions {
1184
1288
  * Request and send OTP options.
1185
1289
  */
1186
1290
  interface RequestAndSendOtpOptions {
1291
+ /**
1292
+ * The type of username validation to be used. Defaults to **`other`**.
1293
+ */
1294
+ usernameType?: UsernameType;
1187
1295
  }
1188
1296
  /**
1189
1297
  * Request OTP options.
package/dist/index.d.ts CHANGED
@@ -54,6 +54,9 @@ declare abstract class BaseHttpRequest {
54
54
  abstract request<T>(options: ApiRequestOptions): CancelablePromise<T>;
55
55
  }
56
56
 
57
+ /**
58
+ * Code generation result
59
+ */
57
60
  type AuthCode = {
58
61
  /**
59
62
  * Generated code
@@ -73,7 +76,7 @@ type UserLogin = {
73
76
  /**
74
77
  * Username type
75
78
  */
76
- usernameType: 'email' | 'phone';
79
+ usernameType?: 'email' | 'phone' | 'other';
77
80
  };
78
81
 
79
82
  type AuthCodeRequestSMSRequestBody = {
@@ -90,7 +93,8 @@ type AuthCodeVerifyRequestBody = {
90
93
 
91
94
  type AuthenticatorAssertionResponse = {
92
95
  /**
93
- * This attribute contains the authenticator data returned by the authenticator.
96
+ * A base64 encoded authenticator data structure encodes contextual bindings
97
+ * made by the authenticator.
94
98
  */
95
99
  authenticatorData: string;
96
100
  /**
@@ -129,6 +133,9 @@ type PubKeyCredentialDescriptor = {
129
133
  */
130
134
  id: string;
131
135
  transports?: Array<'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid' | 'cable' | 'smart-card'>;
136
+ /**
137
+ * The valid credential types.
138
+ */
132
139
  type: 'public-key';
133
140
  };
134
141
 
@@ -151,7 +158,7 @@ type PublicKeyCredentialRequestOptions = {
151
158
  * authenticator. For example, if transaction confirmation is sought from the
152
159
  * user, then the prompt string might be included as an extension.
153
160
  */
154
- extensions?: Record<string, string>;
161
+ extensions?: Record<string, any>;
155
162
  /**
156
163
  * The relying party identifier claimed by the caller. If omitted, its value will
157
164
  * be the CredentialsContainer object’s relevant settings object's origin's
@@ -165,15 +172,14 @@ type PublicKeyCredentialRequestOptions = {
165
172
  */
166
173
  timeout?: number;
167
174
  /**
168
- * The Relying Party's requirements regarding user verification for the get()
169
- * operation. The value SHOULD be a member of UserVerificationRequirement but
170
- * client platforms MUST ignore unknown values, treating an unknown value as if
171
- * the member does not exist. Eligible authenticators are filtered to only those
172
- * capable of satisfying this requirement.
175
+ * User verification requirement
173
176
  */
174
177
  userVerification?: 'required' | 'preferred' | 'discouraged';
175
178
  };
176
179
 
180
+ /**
181
+ * FIDO2 authentication response
182
+ */
177
183
  type AuthInit = {
178
184
  /**
179
185
  * An action to be performed by the front-end to complete the authentication flow.
@@ -587,7 +593,8 @@ type CreationResult = {
587
593
  */
588
594
  attestationObject: string;
589
595
  /**
590
- * This attribute contains the authenticator data contained within attestationObject.
596
+ * A base64 encoded authenticator data structure encodes contextual bindings
597
+ * made by the authenticator.
591
598
  */
592
599
  authenticatorData?: string;
593
600
  /**
@@ -637,7 +644,7 @@ type AuthenticatorSelectionCriteria = {
637
644
  */
638
645
  residentKey?: 'discouraged' | 'preferred' | 'required';
639
646
  /**
640
- * Resident key requirement
647
+ * User verification requirement
641
648
  */
642
649
  userVerification?: 'required' | 'preferred' | 'discouraged';
643
650
  };
@@ -652,6 +659,9 @@ type PublicKeyCredentialParameters = {
652
659
  * e.g., RSA or Elliptic Curve.
653
660
  */
654
661
  alg?: -7 | -35 | -36 | -257 | -8;
662
+ /**
663
+ * The valid credential types.
664
+ */
655
665
  type?: 'public-key';
656
666
  };
657
667
 
@@ -679,9 +689,6 @@ type PublicKeyCredentialUserEntity = {
679
689
  };
680
690
 
681
691
  type PublicKeyCredentialCreationOptions = {
682
- /**
683
- * A preference for attestation conveyance.
684
- */
685
692
  attestation?: 'none' | 'indirect' | 'direct' | 'enterprise';
686
693
  authenticatorSelection?: AuthenticatorSelectionCriteria;
687
694
  /**
@@ -700,7 +707,7 @@ type PublicKeyCredentialCreationOptions = {
700
707
  /**
701
708
  * Additional parameters requesting processing by the client and authenticator.
702
709
  */
703
- extensions?: Record<string, string>;
710
+ extensions?: Record<string, any>;
704
711
  /**
705
712
  * This member contains information about the desired properties of the credential
706
713
  * to be created. The sequence is ordered from most preferred to least preferred.
@@ -718,6 +725,9 @@ type PublicKeyCredentialCreationOptions = {
718
725
  user: PublicKeyCredentialUserEntity;
719
726
  };
720
727
 
728
+ /**
729
+ * FIDO2 registration response
730
+ */
721
731
  type RegInit = {
722
732
  /**
723
733
  * An action to be performed by the front-end to complete the registration flow.
@@ -749,7 +759,7 @@ type User = {
749
759
  /**
750
760
  * Username type
751
761
  */
752
- usernameType: 'email' | 'phone';
762
+ usernameType: 'email' | 'phone' | 'other';
753
763
  };
754
764
 
755
765
  type RegInitRequestBody = {
@@ -796,6 +806,9 @@ declare class RegService {
796
806
  }): CancelablePromise<RegInit>;
797
807
  }
798
808
 
809
+ /**
810
+ * Transaction Confirmation Complete response
811
+ */
799
812
  type TxComplete = {
800
813
  authCred?: Passkey;
801
814
  /**
@@ -834,6 +847,9 @@ type TxCompleteRequestBody = {
834
847
  signature: string;
835
848
  };
836
849
 
850
+ /**
851
+ * Transaction Confirmation Init response
852
+ */
837
853
  type TxInit = {
838
854
  assertionOptions: PublicKeyCredentialRequestOptions;
839
855
  /**
@@ -886,7 +902,7 @@ declare class TxService {
886
902
  }): CancelablePromise<TxInit>;
887
903
  }
888
904
 
889
- type Version = {
905
+ type Version3 = {
890
906
  /**
891
907
  * Version hash
892
908
  */
@@ -902,10 +918,10 @@ declare class VersionService {
902
918
  constructor(httpRequest: BaseHttpRequest);
903
919
  /**
904
920
  * Show software version
905
- * @returns Version OK response.
921
+ * @returns Version3 OK response.
906
922
  * @throws ApiError
907
923
  */
908
- versionVersionShow(): CancelablePromise<Version>;
924
+ versionVersionShow(): CancelablePromise<Version3>;
909
925
  }
910
926
 
911
927
  /**
@@ -997,6 +1013,83 @@ type BadRequestError = {
997
1013
  msgCode: string;
998
1014
  };
999
1015
 
1016
+ type CodeResult = {
1017
+ /**
1018
+ * Generated code
1019
+ */
1020
+ code: string;
1021
+ /**
1022
+ * Expiration time of the code
1023
+ */
1024
+ expiresAt: string;
1025
+ };
1026
+
1027
+ type ForbiddenError = {
1028
+ msg: string;
1029
+ msgCode: string;
1030
+ };
1031
+
1032
+ type InternalServerError = {
1033
+ msg: string;
1034
+ msgCode: string;
1035
+ };
1036
+
1037
+ type NotFoundError = {
1038
+ msg: string;
1039
+ msgCode: string;
1040
+ };
1041
+
1042
+ type PublicKeyCredential$1 = {
1043
+ /**
1044
+ * This base64 encoded byte array contains the credential ID
1045
+ * of the public key credential the caller is referring to.
1046
+ */
1047
+ id: string;
1048
+ /**
1049
+ * This enumeration defines hints as to how clients might communicate with a
1050
+ * particular authenticator in order to obtain an assertion for a specific
1051
+ * credential.
1052
+ */
1053
+ transport?: 'usb' | 'nfc' | 'ble' | 'internal' | 'hybrid' | 'cable' | 'smart-card';
1054
+ /**
1055
+ * The type of the public key credential the caller is referring to.
1056
+ * The value SHOULD be a member of PublicKeyCredentialType but client
1057
+ * platforms MUST ignore any PublicKeyCredentialDescriptor with an unknown
1058
+ * type.
1059
+ */
1060
+ type?: 'public-key';
1061
+ };
1062
+
1063
+ type UnauthorizedError = {
1064
+ msg: string;
1065
+ msgCode: string;
1066
+ };
1067
+
1068
+ type Version = {
1069
+ /**
1070
+ * Version hash
1071
+ */
1072
+ hash?: string;
1073
+ /**
1074
+ * Software version
1075
+ */
1076
+ version: string;
1077
+ };
1078
+
1079
+ /**
1080
+ * Version
1081
+ */
1082
+ type Version2 = {
1083
+ /**
1084
+ * Version hash
1085
+ */
1086
+ hash?: string;
1087
+ /**
1088
+ * Software version
1089
+ */
1090
+ version: string;
1091
+ };
1092
+
1000
1093
  type index_ApiError = ApiError;
1001
1094
  declare const index_ApiError: typeof ApiError;
1002
1095
  type index_Application = Application;
@@ -1017,15 +1110,19 @@ type index_CancelError = CancelError;
1017
1110
  declare const index_CancelError: typeof CancelError;
1018
1111
  type index_CancelablePromise<T> = CancelablePromise<T>;
1019
1112
  declare const index_CancelablePromise: typeof CancelablePromise;
1113
+ type index_CodeResult = CodeResult;
1020
1114
  type index_CreationResult = CreationResult;
1021
1115
  type index_DeviceInfo = DeviceInfo;
1116
+ type index_ForbiddenError = ForbiddenError;
1022
1117
  type index_GrantCreateRequestBody = GrantCreateRequestBody;
1023
1118
  type index_GrantCreateResponseBody = GrantCreateResponseBody;
1119
+ type index_InternalServerError = InternalServerError;
1024
1120
  type index_JWT = JWT;
1025
1121
  type index_LoginIDService = LoginIDService;
1026
1122
  declare const index_LoginIDService: typeof LoginIDService;
1027
1123
  type index_MgmtService = MgmtService;
1028
1124
  declare const index_MgmtService: typeof MgmtService;
1125
+ type index_NotFoundError = NotFoundError;
1029
1126
  declare const index_OpenAPI: typeof OpenAPI;
1030
1127
  type index_OpenAPIConfig = OpenAPIConfig;
1031
1128
  type index_Passkey = Passkey;
@@ -1057,16 +1154,19 @@ type index_TxInit = TxInit;
1057
1154
  type index_TxInitRequestBody = TxInitRequestBody;
1058
1155
  type index_TxService = TxService;
1059
1156
  declare const index_TxService: typeof TxService;
1157
+ type index_UnauthorizedError = UnauthorizedError;
1060
1158
  type index_User = User;
1061
1159
  type index_UserLogin = UserLogin;
1062
1160
  type index_Version = Version;
1161
+ type index_Version2 = Version2;
1162
+ type index_Version3 = Version3;
1063
1163
  type index_VersionService = VersionService;
1064
1164
  declare const index_VersionService: typeof VersionService;
1065
1165
  type index_WellKnownJwks = WellKnownJwks;
1066
1166
  type index_WellKnownService = WellKnownService;
1067
1167
  declare const index_WellKnownService: typeof WellKnownService;
1068
1168
  declare namespace index {
1069
- export { index_ApiError as ApiError, type index_Application as Application, type index_AuthCode as AuthCode, type index_AuthCodeRequestSMSRequestBody as AuthCodeRequestSMSRequestBody, type index_AuthCodeVerifyRequestBody as AuthCodeVerifyRequestBody, type index_AuthCompleteRequestBody as AuthCompleteRequestBody, type index_AuthInit as AuthInit, type index_AuthInitRequestBody as AuthInitRequestBody, index_AuthService as AuthService, type index_AuthenticatorAssertionResponse as AuthenticatorAssertionResponse, type index_AuthenticatorSelectionCriteria as AuthenticatorSelectionCriteria, type index_BadRequestError as BadRequestError, index_BaseHttpRequest as BaseHttpRequest, index_CancelError as CancelError, index_CancelablePromise as CancelablePromise, type index_CreationResult as CreationResult, type index_DeviceInfo as DeviceInfo, type index_GrantCreateRequestBody as GrantCreateRequestBody, type index_GrantCreateResponseBody as GrantCreateResponseBody, type index_JWT as JWT, index_LoginIDService as LoginIDService, index_MgmtService as MgmtService, index_OpenAPI as OpenAPI, type index_OpenAPIConfig as OpenAPIConfig, type index_Passkey as Passkey, type index_PasskeyCollection as PasskeyCollection, type PasskeyOptions$1 as PasskeyOptions, type index_PasskeyRenameRequestBody as PasskeyRenameRequestBody, index_PasskeysService as PasskeysService, type index_ProfileEmailUpdateRequestBody as ProfileEmailUpdateRequestBody, type index_ProfilePhoneUpdateRequestBody as ProfilePhoneUpdateRequestBody, type index_ProfilePhoneVerifyRequestBody as ProfilePhoneVerifyRequestBody, index_ProfileService as ProfileService, type index_PubKeyCredentialDescriptor as PubKeyCredentialDescriptor, type index_PublicKeyCredentialCreationOptions as PublicKeyCredentialCreationOptions, type index_PublicKeyCredentialParameters as PublicKeyCredentialParameters, type index_PublicKeyCredentialRequestOptions as PublicKeyCredentialRequestOptions, type index_PublicKeyCredentialRpEntity as PublicKeyCredentialRpEntity, type index_PublicKeyCredentialUserEntity as PublicKeyCredentialUserEntity, type index_RegCompleteRequestBody as RegCompleteRequestBody, type index_RegInit as RegInit, type index_RegInitRequestBody as RegInitRequestBody, index_RegService as RegService, type index_ResultKey as ResultKey, type index_TokenVerifyRequestBody as TokenVerifyRequestBody, type index_TxComplete as TxComplete, type index_TxCompleteRequestBody as TxCompleteRequestBody, type index_TxInit as TxInit, type index_TxInitRequestBody as TxInitRequestBody, index_TxService as TxService, type index_User as User, type index_UserLogin as UserLogin, type index_Version as Version, index_VersionService as VersionService, type index_WellKnownJwks as WellKnownJwks, index_WellKnownService as WellKnownService };
1169
+ export { index_ApiError as ApiError, type index_Application as Application, type index_AuthCode as AuthCode, type index_AuthCodeRequestSMSRequestBody as AuthCodeRequestSMSRequestBody, type index_AuthCodeVerifyRequestBody as AuthCodeVerifyRequestBody, type index_AuthCompleteRequestBody as AuthCompleteRequestBody, type index_AuthInit as AuthInit, type index_AuthInitRequestBody as AuthInitRequestBody, index_AuthService as AuthService, type index_AuthenticatorAssertionResponse as AuthenticatorAssertionResponse, type index_AuthenticatorSelectionCriteria as AuthenticatorSelectionCriteria, type index_BadRequestError as BadRequestError, index_BaseHttpRequest as BaseHttpRequest, index_CancelError as CancelError, index_CancelablePromise as CancelablePromise, type index_CodeResult as CodeResult, type index_CreationResult as CreationResult, type index_DeviceInfo as DeviceInfo, type index_ForbiddenError as ForbiddenError, type index_GrantCreateRequestBody as GrantCreateRequestBody, type index_GrantCreateResponseBody as GrantCreateResponseBody, type index_InternalServerError as InternalServerError, type index_JWT as JWT, index_LoginIDService as LoginIDService, index_MgmtService as MgmtService, type index_NotFoundError as NotFoundError, index_OpenAPI as OpenAPI, type index_OpenAPIConfig as OpenAPIConfig, type index_Passkey as Passkey, type index_PasskeyCollection as PasskeyCollection, type PasskeyOptions$1 as PasskeyOptions, type index_PasskeyRenameRequestBody as PasskeyRenameRequestBody, index_PasskeysService as PasskeysService, type index_ProfileEmailUpdateRequestBody as ProfileEmailUpdateRequestBody, type index_ProfilePhoneUpdateRequestBody as ProfilePhoneUpdateRequestBody, type index_ProfilePhoneVerifyRequestBody as ProfilePhoneVerifyRequestBody, index_ProfileService as ProfileService, type index_PubKeyCredentialDescriptor as PubKeyCredentialDescriptor, type PublicKeyCredential$1 as PublicKeyCredential, type index_PublicKeyCredentialCreationOptions as PublicKeyCredentialCreationOptions, type index_PublicKeyCredentialParameters as PublicKeyCredentialParameters, type index_PublicKeyCredentialRequestOptions as PublicKeyCredentialRequestOptions, type index_PublicKeyCredentialRpEntity as PublicKeyCredentialRpEntity, type index_PublicKeyCredentialUserEntity as PublicKeyCredentialUserEntity, type index_RegCompleteRequestBody as RegCompleteRequestBody, type index_RegInit as RegInit, type index_RegInitRequestBody as RegInitRequestBody, index_RegService as RegService, type index_ResultKey as ResultKey, type index_TokenVerifyRequestBody as TokenVerifyRequestBody, type index_TxComplete as TxComplete, type index_TxCompleteRequestBody as TxCompleteRequestBody, type index_TxInit as TxInit, type index_TxInitRequestBody as TxInitRequestBody, index_TxService as TxService, type index_UnauthorizedError as UnauthorizedError, type index_User as User, type index_UserLogin as UserLogin, type index_Version as Version, type index_Version2 as Version2, type index_Version3 as Version3, index_VersionService as VersionService, type index_WellKnownJwks as WellKnownJwks, index_WellKnownService as WellKnownService };
1070
1170
  }
1071
1171
 
1072
1172
  type Complete<T> = {
@@ -1114,6 +1214,10 @@ interface PasskeyOptions {
1114
1214
  * Callback functions that can be triggered on various events during the authentication process.
1115
1215
  */
1116
1216
  callbacks?: Callbacks;
1217
+ /**
1218
+ * The type of username validation to be used. Defaults to **`other`**.
1219
+ */
1220
+ usernameType?: UsernameType;
1117
1221
  }
1118
1222
  /**
1119
1223
  * The base interface for passkey management options.
@@ -1184,6 +1288,10 @@ interface ConfirmTransactionOptions extends PasskeyOptions {
1184
1288
  * Request and send OTP options.
1185
1289
  */
1186
1290
  interface RequestAndSendOtpOptions {
1291
+ /**
1292
+ * The type of username validation to be used. Defaults to **`other`**.
1293
+ */
1294
+ usernameType?: UsernameType;
1187
1295
  }
1188
1296
  /**
1189
1297
  * Request OTP options.
@@ -1,2 +1,2 @@
1
- "use strict";var LoginID=(()=>{var Ht=Object.create;var ge=Object.defineProperty;var Vt=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,jt=Object.prototype.hasOwnProperty;var Wt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),yt=(t,e)=>{for(var o in e)ge(t,o,{get:e[o],enumerable:!0})},ft=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Kt(e))!jt.call(t,r)&&r!==o&&ge(t,r,{get:()=>e[r],enumerable:!(s=Vt(e,r))||s.enumerable});return t};var Jt=(t,e,o)=>(o=t!=null?Ht(Mt(t)):{},ft(e||!t||!t.__esModule?ge(o,"default",{value:t,enumerable:!0}):o,t)),Gt=t=>ft(ge({},"__esModule",{value:!0}),t);var Pt=Wt((ae,qe)=>{"use strict";(function(t,e){"use strict";var o="1.0.37",s="",r="?",a="function",p="undefined",d="object",g="string",R="major",i="model",u="name",n="type",l="vendor",c="version",x="architecture",ee="console",f="mobile",h="tablet",P="smarttv",U="wearable",xe="embedded",Te=500,ue="Amazon",te="Apple",ot="ASUS",rt="BlackBerry",D="Browser",pe="Chrome",_t="Edge",ce="Firefox",de="Google",st="Huawei",Oe="LG",Ee="Microsoft",it="Motorola",me="Opera",ye="Samsung",nt="Sharp",fe="Sony",Ie="Xiaomi",Se="Zebra",at="Facebook",lt="Chromium OS",ut="Mac OS",Ft=function(b,C){var y={};for(var A in b)C[A]&&C[A].length%2===0?y[A]=C[A].concat(b[A]):y[A]=b[A];return y},he=function(b){for(var C={},y=0;y<b.length;y++)C[b[y].toUpperCase()]=b[y];return C},pt=function(b,C){return typeof b===g?oe(C).indexOf(oe(b))!==-1:!1},oe=function(b){return b.toLowerCase()},Lt=function(b){return typeof b===g?b.replace(/[^\d\.]/g,s).split(".")[0]:e},Be=function(b,C){if(typeof b===g)return b=b.replace(/^\s\s*/,s),typeof C===p?b:b.substring(0,Te)},re=function(b,C){for(var y=0,A,B,O,w,m,E;y<C.length&&!m;){var Ne=C[y],mt=C[y+1];for(A=B=0;A<Ne.length&&!m&&Ne[A];)if(m=Ne[A++].exec(b),m)for(O=0;O<mt.length;O++)E=m[++B],w=mt[O],typeof w===d&&w.length>0?w.length===2?typeof w[1]==a?this[w[0]]=w[1].call(this,E):this[w[0]]=w[1]:w.length===3?typeof w[1]===a&&!(w[1].exec&&w[1].test)?this[w[0]]=E?w[1].call(this,E,w[2]):e:this[w[0]]=E?E.replace(w[1],w[2]):e:w.length===4&&(this[w[0]]=E?w[3].call(this,E.replace(w[1],w[2])):e):this[w]=E||e;y+=2}},De=function(b,C){for(var y in C)if(typeof C[y]===d&&C[y].length>0){for(var A=0;A<C[y].length;A++)if(pt(C[y][A],b))return y===r?e:y}else if(pt(C[y],b))return y===r?e:y;return b},zt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},ct={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},dt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[c,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[c,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,c],[/opios[\/ ]+([\w\.]+)/i],[c,[u,me+" Mini"]],[/\bopr\/([\w\.]+)/i],[c,[u,me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[c,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,c],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[c,[u,"UC"+D]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[c,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[c,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[c,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[c,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[c,[u,"Smart Lenovo "+D]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+D],c],[/\bfocus\/([\w\.]+)/i],[c,[u,ce+" Focus"]],[/\bopt\/([\w\.]+)/i],[c,[u,me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[c,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[c,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[c,[u,me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[c,[u,"MIUI "+D]],[/fxios\/([-\w\.]+)/i],[c,[u,ce]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+D]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+D],c],[/samsungbrowser\/([\w\.]+)/i],[c,[u,ye+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],c],[/metasr[\/ ]?([\d\.]+)/i],[c,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],c],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,c],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,at],c],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,c],[/\bgsa\/([\w\.]+) .*safari\//i],[c,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[c,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[c,[u,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,pe+" WebView"],c],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[c,[u,"Android "+D]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,c],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[c,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[c,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[c,De,zt]],[/(webkit|khtml)\/([\w\.]+)/i],[u,c],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],c],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[c,[u,ce+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,c],[/(cobalt)\/([\w\.]+)/i],[u,[c,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[x,"amd64"]],[/(ia32(?=;))/i],[[x,oe]],[/((?:i[346]|x)86)[;\)]/i],[[x,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[x,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[x,"armhf"]],[/windows (ce|mobile); ppc;/i],[[x,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[x,/ower/,s,oe]],[/(sun4\w)[;\)]/i],[[x,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[x,oe]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[i,[l,ye],[n,h]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[i,[l,ye],[n,f]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[i,[l,te],[n,f]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[i,[l,te],[n,h]],[/(macintosh);/i],[i,[l,te]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[i,[l,nt],[n,f]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[i,[l,st],[n,h]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[i,[l,st],[n,f]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[i,/_/g," "],[l,Ie],[n,f]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[i,/_/g," "],[l,Ie],[n,h]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[i,[l,"OPPO"],[n,f]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[i,[l,"Vivo"],[n,f]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[i,[l,"Realme"],[n,f]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[i,[l,it],[n,f]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[i,[l,it],[n,h]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[i,[l,Oe],[n,h]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[i,[l,Oe],[n,f]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[i,[l,"Lenovo"],[n,h]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[i,/_/g," "],[l,"Nokia"],[n,f]],[/(pixel c)\b/i],[i,[l,de],[n,h]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[i,[l,de],[n,f]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[l,fe],[n,f]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[i,"Xperia Tablet"],[l,fe],[n,h]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[i,[l,"OnePlus"],[n,f]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[i,[l,ue],[n,h]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[i,/(.+)/g,"Fire Phone $1"],[l,ue],[n,f]],[/(playbook);[-\w\),; ]+(rim)/i],[i,l,[n,h]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[i,[l,rt],[n,f]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[i,[l,ot],[n,h]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[i,[l,ot],[n,f]],[/(nexus 9)/i],[i,[l,"HTC"],[n,h]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[l,[i,/_/g," "],[n,f]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[i,[l,"Acer"],[n,h]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[i,[l,"Meizu"],[n,f]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[i,[l,"Ulefone"],[n,f]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[l,i,[n,f]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[l,i,[n,h]],[/(surface duo)/i],[i,[l,Ee],[n,h]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[i,[l,"Fairphone"],[n,f]],[/(u304aa)/i],[i,[l,"AT&T"],[n,f]],[/\bsie-(\w*)/i],[i,[l,"Siemens"],[n,f]],[/\b(rct\w+) b/i],[i,[l,"RCA"],[n,h]],[/\b(venue[\d ]{2,7}) b/i],[i,[l,"Dell"],[n,h]],[/\b(q(?:mv|ta)\w+) b/i],[i,[l,"Verizon"],[n,h]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[i,[l,"Barnes & Noble"],[n,h]],[/\b(tm\d{3}\w+) b/i],[i,[l,"NuVision"],[n,h]],[/\b(k88) b/i],[i,[l,"ZTE"],[n,h]],[/\b(nx\d{3}j) b/i],[i,[l,"ZTE"],[n,f]],[/\b(gen\d{3}) b.+49h/i],[i,[l,"Swiss"],[n,f]],[/\b(zur\d{3}) b/i],[i,[l,"Swiss"],[n,h]],[/\b((zeki)?tb.*\b) b/i],[i,[l,"Zeki"],[n,h]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[l,"Dragon Touch"],i,[n,h]],[/\b(ns-?\w{0,9}) b/i],[i,[l,"Insignia"],[n,h]],[/\b((nxa|next)-?\w{0,9}) b/i],[i,[l,"NextBook"],[n,h]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[l,"Voice"],i,[n,f]],[/\b(lvtel\-)?(v1[12]) b/i],[[l,"LvTel"],i,[n,f]],[/\b(ph-1) /i],[i,[l,"Essential"],[n,f]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[i,[l,"Envizen"],[n,h]],[/\b(trio[-\w\. ]+) b/i],[i,[l,"MachSpeed"],[n,h]],[/\btu_(1491) b/i],[i,[l,"Rotor"],[n,h]],[/(shield[\w ]+) b/i],[i,[l,"Nvidia"],[n,h]],[/(sprint) (\w+)/i],[l,i,[n,f]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[l,Ee],[n,f]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[i,[l,Se],[n,h]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[i,[l,Se],[n,f]],[/smart-tv.+(samsung)/i],[l,[n,P]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[l,ye],[n,P]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[l,Oe],[n,P]],[/(apple) ?tv/i],[l,[i,te+" TV"],[n,P]],[/crkey/i],[[i,pe+"cast"],[l,de],[n,P]],[/droid.+aft(\w+)( bui|\))/i],[i,[l,ue],[n,P]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[i,[l,nt],[n,P]],[/(bravia[\w ]+)( bui|\))/i],[i,[l,fe],[n,P]],[/(mitv-\w{5}) bui/i],[i,[l,Ie],[n,P]],[/Hbbtv.*(technisat) (.*);/i],[l,i,[n,P]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[l,Be],[i,Be],[n,P]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[n,P]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[l,i,[n,ee]],[/droid.+; (shield) bui/i],[i,[l,"Nvidia"],[n,ee]],[/(playstation [345portablevi]+)/i],[i,[l,fe],[n,ee]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[i,[l,Ee],[n,ee]],[/((pebble))app/i],[l,i,[n,U]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[i,[l,te],[n,U]],[/droid.+; (glass) \d/i],[i,[l,de],[n,U]],[/droid.+; (wt63?0{2,3})\)/i],[i,[l,Se],[n,U]],[/(quest( 2| pro)?)/i],[i,[l,at],[n,U]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[l,[n,xe]],[/(aeobc)\b/i],[i,[l,ue],[n,xe]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[i,[n,f]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[i,[n,h]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[n,h]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[n,f]],[/(android[-\w\. ]{0,9});.+buil/i],[i,[l,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[c,[u,_t+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[c,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,c],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[c,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,c],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[c,De,ct]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,De,ct],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[c,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,ut],[c,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[c,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,c],[/\(bb(10);/i],[c,[u,rt]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[c,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[c,[u,ce+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[c,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[c,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[c,[u,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,lt],c],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,c],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],c],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,c]]},k=function(b,C){if(typeof b===d&&(C=b,b=e),!(this instanceof k))return new k(b,C).getResult();var y=typeof t!==p&&t.navigator?t.navigator:e,A=b||(y&&y.userAgent?y.userAgent:s),B=y&&y.userAgentData?y.userAgentData:e,O=C?Ft(dt,C):dt,w=y&&y.userAgent==A;return this.getBrowser=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.browser),m[R]=Lt(m[c]),w&&y&&y.brave&&typeof y.brave.isBrave==a&&(m[u]="Brave"),m},this.getCPU=function(){var m={};return m[x]=e,re.call(m,A,O.cpu),m},this.getDevice=function(){var m={};return m[l]=e,m[i]=e,m[n]=e,re.call(m,A,O.device),w&&!m[n]&&B&&B.mobile&&(m[n]=f),w&&m[i]=="Macintosh"&&y&&typeof y.standalone!==p&&y.maxTouchPoints&&y.maxTouchPoints>2&&(m[i]="iPad",m[n]=h),m},this.getEngine=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.engine),m},this.getOS=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.os),w&&!m[u]&&B&&B.platform!="Unknown"&&(m[u]=B.platform.replace(/chrome os/i,lt).replace(/macos/i,ut)),m},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return A},this.setUA=function(m){return A=typeof m===g&&m.length>Te?Be(m,Te):m,this},this.setUA(A),this};k.VERSION=o,k.BROWSER=he([u,c,R]),k.CPU=he([x]),k.DEVICE=he([i,l,n,ee,f,P,h,U,xe]),k.ENGINE=k.OS=he([u,c]),typeof ae!==p?(typeof qe!==p&&qe.exports&&(ae=qe.exports=k),ae.UAParser=k):typeof define===a&&define.amd?define(function(){return k}):typeof t!==p&&(t.UAParser=k);var _=typeof t!==p&&(t.jQuery||t.Zepto);if(_&&!_.ua){var be=new k;_.ua=be.getResult(),_.ua.get=function(){return be.getUA()},_.ua.set=function(b){be.setUA(b);var C=be.getResult();for(var y in C)_.ua[y]=C[y]}}})(typeof window=="object"?window:ae)});var po={};yt(po,{AbortError:()=>Ae,ApiError:()=>T,LoginIDAPI:()=>Je,LoginIDWebSDK:()=>tt,PasskeyError:()=>q,WebAuthnHelper:()=>ke,canCreatePasskey:()=>Tt,createPasskeyCredential:()=>Z,default:()=>uo,doesDeviceSupportPasskeys:()=>We,getPasskeyCredential:()=>Q,isConditionalUIAvailable:()=>xt,isPlatformAuthenticatorAvailable:()=>je});var Ue=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,o=this.config.baseUrl.match(e);if(o)return o[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},Re=Ue;var $t=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Yt=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],s=0;for(;s<t.length;){let p=t.charCodeAt(s++),d=t.charCodeAt(s++),g=t.charCodeAt(s++),R=p<<16|d<<8|g;o.push(e[R>>18&63]+e[R>>12&63]+e[R>>6&63]+e[R&63])}let r=o.join(""),a=t.length%3;return a?r.slice(0,a-3)+"===".slice(a||3):r},Xt=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o={},s=String.fromCharCode;for(let d=0;d<64;d++)o[e.charAt(d)]=d;let r=0,a=0,p="";for(let d of t){let g=o[d];if(g!==void 0)for(r=(r<<6)+g,a+=6;a>=8;)p+=s(r>>(a-=8)&255)}return p},v=t=>{let e="",o=new Uint8Array(t);for(let r=0;r<o.byteLength;r++)e+=String.fromCharCode(o[r]);let s=Yt(e);return $t(s)},F=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=Xt(t),o=new Uint8Array(e.length);for(let s=0;s<e.length;s++)o[s]=e.charCodeAt(s);return o.buffer},ht=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),bt=(t,e)=>{e.forEach(o=>{Object.getOwnPropertyNames(o.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(o.prototype,s)||Object.create(null))})})},se=t=>{try{let o=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(o).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},gt=t=>{let o=`; ${document.cookie}`.split(`; ${t}=`);if(o&&o.length===2)return o.pop().split(";").shift()},Rt=t=>{document.cookie=t},wt=t=>{document.cookie=`${t}=; expires=${new Date}`};var _e=class{config;constructor(e){this.config=new Re(e)}getToken(e){if(e.authzToken)return e.authzToken;{let o=this.getJwtCookie();return o||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=se(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let o=se(e),s=new Date(o.exp*1e3).toUTCString(),r=`${this.getJwtCookieName()}=${e}; expires=${s}`;Rt(r)}getJwtCookie(){return gt(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){wt(this.getJwtCookieName())}},Ct=_e;var L=class{constructor(e){this.config=e}};var T=class extends Error{url;status;statusText;body;request;constructor(e,o,s){super(s),this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.body,this.request=e}};var ie=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},z=class{#t;#o;#e;#r;#i;#n;#s;constructor(e){this.#t=!1,this.#o=!1,this.#e=!1,this.#r=[],this.#i=new Promise((o,s)=>{this.#n=o,this.#s=s;let r=d=>{this.#t||this.#o||this.#e||(this.#t=!0,this.#n&&this.#n(d))},a=d=>{this.#t||this.#o||this.#e||(this.#o=!0,this.#s&&this.#s(d))},p=d=>{this.#t||this.#o||this.#e||this.#r.push(d)};return Object.defineProperty(p,"isResolved",{get:()=>this.#t}),Object.defineProperty(p,"isRejected",{get:()=>this.#o}),Object.defineProperty(p,"isCancelled",{get:()=>this.#e}),e(r,a,p)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,o){return this.#i.then(e,o)}catch(e){return this.#i.catch(e)}finally(e){return this.#i.finally(e)}cancel(){if(!(this.#t||this.#o||this.#e)){if(this.#e=!0,this.#r.length)try{for(let e of this.#r)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#r.length=0,this.#s&&this.#s(new ie("Request aborted"))}}get isCancelled(){return this.#e}};var Le=t=>t!=null,ne=t=>typeof t=="string",Fe=t=>ne(t)&&t!=="",ze=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),At=t=>t instanceof FormData,Zt=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},Qt=t=>{let e=[],o=(r,a)=>{e.push(`${encodeURIComponent(r)}=${encodeURIComponent(String(a))}`)},s=(r,a)=>{Le(a)&&(Array.isArray(a)?a.forEach(p=>{s(r,p)}):typeof a=="object"?Object.entries(a).forEach(([p,d])=>{s(`${r}[${p}]`,d)}):o(r,a))};return Object.entries(t).forEach(([r,a])=>{s(r,a)}),e.length>0?`?${e.join("&")}`:""},eo=(t,e)=>{let o=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,p)=>e.path?.hasOwnProperty(p)?o(String(e.path[p])):a),r=`${t.BASE}${s}`;return e.query?`${r}${Qt(e.query)}`:r},to=t=>{if(t.formData){let e=new FormData,o=(s,r)=>{ne(r)||ze(r)?e.append(s,r):e.append(s,JSON.stringify(r))};return Object.entries(t.formData).filter(([s,r])=>Le(r)).forEach(([s,r])=>{Array.isArray(r)?r.forEach(a=>o(s,a)):o(s,r)}),e}},we=async(t,e)=>typeof e=="function"?e(t):e,oo=async(t,e)=>{let[o,s,r,a]=await Promise.all([we(e,t.TOKEN),we(e,t.USERNAME),we(e,t.PASSWORD),we(e,t.HEADERS)]),p=Object.entries({Accept:"application/json",...a,...e.headers}).filter(([d,g])=>Le(g)).reduce((d,[g,R])=>({...d,[g]:String(R)}),{});if(Fe(o)&&(p.Authorization=`Bearer ${o}`),Fe(s)&&Fe(r)){let d=Zt(`${s}:${r}`);p.Authorization=`Basic ${d}`}return e.body&&(e.mediaType?p["Content-Type"]=e.mediaType:ze(e.body)?p["Content-Type"]=e.body.type||"application/octet-stream":ne(e.body)?p["Content-Type"]="text/plain":At(e.body)||(p["Content-Type"]="application/json")),new Headers(p)},ro=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):ne(t.body)||ze(t.body)||At(t.body)?t.body:JSON.stringify(t.body)},so=async(t,e,o,s,r,a,p)=>{let d=new AbortController,g={headers:a,body:s??r,method:e.method,signal:d.signal};return t.WITH_CREDENTIALS&&(g.credentials=t.CREDENTIALS),p(()=>d.abort()),await fetch(o,g)},io=(t,e)=>{if(e){let o=t.headers.get(e);if(ne(o))return o}},no=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(r=>e.toLowerCase().startsWith(r))?await t.json():await t.text()}catch(e){console.error(e)}},ao=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new T(t,e,s);if(!e.ok){let r=e.status??"unknown",a=e.statusText??"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new T(t,e,`Generic Error: status: ${r}; status text: ${a}; body: ${p}`)}},vt=(t,e)=>new z(async(o,s,r)=>{try{let a=eo(t,e),p=to(e),d=ro(e),g=await oo(t,e);if(!r.isCancelled){let R=await so(t,e,a,d,p,g,r),i=await no(R),u=io(R,e.responseHeader),n={url:a,ok:R.ok,status:R.status,statusText:R.statusText,body:u??i};ao(e,n),o(n.body)}}catch(a){s(a)}});var Ce=class extends L{constructor(e){super(e)}request(e){return vt(this.config,e)}};var H=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":o},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var V=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var K=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:o}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:o},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:o,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var M=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var j=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:o,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":o,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var W=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var J=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var G=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var $=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,o=Ce){this.request=new o({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new H(this.request),this.mgmt=new V(this.request),this.passkeys=new K(this.request),this.profile=new M(this.request),this.reg=new j(this.request),this.tx=new W(this.request),this.version=new J(this.request),this.wellKnown=new G(this.request)}};var He=class{config;service;session;constructor(e){this.config=new Re(e),this.service=new $({BASE:e.baseUrl}),this.session=new Ct(e)}},I=He;var Ve=class extends Error{constructor(e){super(e),this.name="AbortError"}},Ae=Ve;var Ke=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new Ae("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},N=Ke;var S=(t,e,o)=>({...o,authzToken:e||o.authzToken||"",usernameType:o.usernameType||"email",displayName:o.displayName||t,callbacks:o.callbacks||{}}),qt=(t,e)=>({...S(t,"",e),txType:e.txType||"raw",nonce:e.nonce||ht()}),Y=(t,e=!0,o=!1)=>({token:t,isAuthenticated:e,isFallback:o});var Me=class extends I{constructor(e){super(e)}async validateOtp(e,o,s={}){let r=S(e,"",s),a={authCode:o,user:{username:e,usernameType:r.usernameType}},p=await this.service.auth.authAuthCodeVerify({requestBody:a}),d=Y(p.jwtAccess);return N.renewWebAuthnAbortController(),this.session.setJwtCookie(d.token),d}async requestAndSendOtp(e,o="email",s={}){let r=S(e,"",s),a={user:{username:e,usernameType:r.usernameType}};switch(o){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:a});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:a});break;default:throw new Error("Invalid message method")}}},ve=Me;var kt=Jt(Pt(),1),le=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},lo=(t,e)=>{let o=t.split(".").map(Number),s=e.split(".").map(Number),r=Math.max(o.length,s.length);for(let a=0;a<r;a++){let p=a<o.length?o[a]:0,d=a<s.length?s[a]:0;if(p<d)return-1;if(p>d)return 1}return 0};async function je(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function xt(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function We(){let t=new kt.UAParser(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&lo(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function Tt(){let t=await je(),e=await We();return t&&e.deviceSupported}var Je={};yt(Je,{ApiError:()=>T,AuthService:()=>H,BaseHttpRequest:()=>L,CancelError:()=>ie,CancelablePromise:()=>z,LoginIDService:()=>$,MgmtService:()=>V,OpenAPI:()=>Ot,PasskeysService:()=>K,ProfileService:()=>M,RegService:()=>j,TxService:()=>W,VersionService:()=>J,WellKnownService:()=>G});var Ot={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var Ge=class extends I{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let o=S("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:le(),user:{username:"",usernameType:o.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(o){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",o instanceof T&&(e.code=o.body.msgCode||"unknown_error",e.message=o.body.msg||o.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},Et=Ge;var It=t=>`LoginID_${t}_device-id`,X=class{static persistDeviceId(e,o){o&&localStorage.setItem(It(e),o)}static getDeviceId(e){return localStorage.getItem(It(e))||""}};var St=t=>[...t.crossAuthMethods,...t.fallbackMethods];var $e=class extends Error{code;constructor(e,o,s){super(e),this.code=o,this.cause=s}},q=$e;var Ye=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},Xe=Ye;var Bt=(t,e)=>{let o=t.name,{publicKey:s}=e;if(o==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new q("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new q("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(o==="InvalidStateError")return new q("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(o==="NotAllowedError")return new q("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(o==="NotSupportedError")return new q("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(o==="SecurityError"){let r=s?.rp?.id;if(r!==window.location.hostname)return new q(`The domain of the relying party (${r}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return o==="UnknownError"?new q("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Dt=(t,e)=>{let o=t.name,{publicKey:s}=e;if(o==="AbortError"&&e.signal instanceof AbortSignal)return new q("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(o==="NotAllowedError")return new q("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(o==="SecurityError"){let r=s?.rpId;if(r!==window.location.hostname)return new q(`The domain of the relying party (${r}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return o==="UnknownError"?new q("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Ir=new Xe("User needs to be logged in to perform this operation."),Ze=new Xe("No login options available.");var Z=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let r of t.excludeCredentials){let a={id:F(r.id),transports:r.transports,type:r.type};e.push(a)}}let o=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:F(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:o,rp:t.rp,timeout:t.timeout,user:{...t.user,id:F(t.user.id)}}};try{let r=await navigator.credentials.create(s);if(r===null)throw new Error("Failed to create the passkey credential.");return r}catch(r){throw r instanceof Error?Bt(r,s):r}},Q=async(t,e={})=>{let o;if(t.allowCredentials!==void 0){o=[];for(let r of t.allowCredentials){let a={id:F(r.id),transports:r.transports,type:r.type};o.push(a)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:o,challenge:F(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let r=await navigator.credentials.get(s);if(r===null)throw new Error("Failed to create the passkey credential.");return r}catch(r){throw r instanceof Error?Dt(r,s):r}};var Qe=class extends ve{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:o,session:s}=e;N.renewWebAuthnAbortController();let r=await Z(o),a=r.response,p=a.getPublicKey&&a.getPublicKey(),d=a.getPublicKeyAlgorithm&&a.getPublicKeyAlgorithm(),g=a.getAuthenticatorData&&a.getAuthenticatorData(),R=a.getTransports&&a.getTransports();return{creationResult:{attestationObject:v(a.attestationObject),clientDataJSON:v(a.clientDataJSON),credentialId:r.id,...p&&{publicKey:v(p)},...d&&{publicKeyAlgorithm:d},...g&&{authenticatorData:v(g)},...R&&{transports:R}},session:s}}async createPasskey(e,o="",s={}){let r=this.config.getAppId(),a=le(X.getDeviceId(r)),p=S(e,o,s);p.authzToken=this.session.getToken(p),p.authzToken&&se(p.authzToken).username!==e&&(p.authzToken="");let d={app:{id:r},deviceInfo:a,user:{username:e,usernameType:p.usernameType,displayName:p.displayName}},g=await this.service.reg.regRegInit({requestBody:d,...p.authzToken&&{authorization:p.authzToken}}),R=await this.createNavigatorCredential(g),i=await this.service.reg.regRegComplete({requestBody:R}),u=Y(i.jwtAccess);return this.session.setJwtCookie(i.jwtAccess),X.persistDeviceId(r,i.deviceID),u}async getNavigatorCredential(e,o={}){let{assertionOptions:s,session:r}=e;o.abortController?N.assignWebAuthnAbortController(o.abortController):(N.renewWebAuthnAbortController(),o.abortController=N.abortController);let a=await Q(s,o),p=a.response;return{assertionResult:{authenticatorData:v(p.authenticatorData),clientDataJSON:v(p.clientDataJSON),credentialId:a.id,signature:v(p.signature),...p.userHandle&&{userHandle:v(p.userHandle)}},session:r}}async authenticateWithPasskey(e="",o={}){let s=this.config.getAppId(),r=le(X.getDeviceId(s)),a=S(e,"",o),p={app:{id:s},deviceInfo:r,user:{username:e,usernameType:a.usernameType}},d=await this.service.auth.authAuthInit({requestBody:p});switch(d.action){case"proceed":{let g=await this.getNavigatorCredential(d,o),R=await this.service.auth.authAuthComplete({requestBody:g}),i=Y(R.jwtAccess);return this.session.setJwtCookie(i.token),a?.callbacks?.onSuccess&&await a.callbacks.onSuccess(i),i}case"crossAuth":case"fallback":{if(a?.callbacks?.onFallback){let g=St(d);return await a.callbacks.onFallback(e,g),Y("",!1,!0)}throw Ze}default:throw Ze}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,o={}){if(o.authzToken=this.session.getToken(o),!o.authzToken){let r=await this.authenticateWithPasskey(e,o);o.authzToken=r.token}return await this.service.auth.authAuthCodeRequest({authorization:o.authzToken})}async confirmTransaction(e,o,s={}){let r=qt(e,s),a={username:e,txPayload:o,nonce:r.nonce,txType:r.txType},{assertionOptions:p,session:d}=await this.service.tx.txTxInit({requestBody:a}),g={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:p,session:d},{assertionResult:R}=await this.getNavigatorCredential(g),i={authenticatorData:R.authenticatorData,clientData:R.clientDataJSON,keyHandle:R.credentialId,session:d,signature:R.signature};return await this.service.tx.txTxComplete({requestBody:i})}},Nt=Qe;var et=class extends I{constructor(e){super(e)}async listPasskeys(e={}){let o=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:o})}async renamePasskey(e,o,s={}){let r=this.session.getToken(s),a={name:o};await this.service.passkeys.passkeysPasskeyRename({authorization:r,id:e,requestBody:a})}async deletePasskey(e,o={}){let s=this.session.getToken(o);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},Ut=et;var Pe=class extends I{constructor(e){super(e)}};bt(Pe,[I,Nt,ve,Ut,Et]);var tt=Pe;var ke=class{static async getNavigatorCredential(e,o={}){let{assertionOptions:s,session:r}=e,a=await Q(s,o),p=a.response;return{assertionResult:{authenticatorData:v(p.authenticatorData),clientDataJSON:v(p.clientDataJSON),credentialId:a.id,signature:v(p.signature),...p.userHandle&&{userHandle:v(p.userHandle)}},session:r}}static async createNavigatorCredential(e){let{registrationRequestOptions:o,session:s}=e,r=await Z(o),a=r.response,p=a.getPublicKey&&a.getPublicKey(),d=a.getPublicKeyAlgorithm&&a.getPublicKeyAlgorithm(),g=a.getAuthenticatorData&&a.getAuthenticatorData(),R=a.getTransports&&a.getTransports();return{creationResult:{attestationObject:v(a.attestationObject),clientDataJSON:v(a.clientDataJSON),credentialId:r.id,...p&&{publicKey:v(p)},...d&&{publicKeyAlgorithm:d},...g&&{authenticatorData:v(g)},...R&&{transports:R}},session:s}}};var uo=tt;return Gt(po);})();
1
+ "use strict";var LoginID=(()=>{var Vt=Object.create;var ge=Object.defineProperty;var Ht=Object.getOwnPropertyDescriptor;var Kt=Object.getOwnPropertyNames;var Mt=Object.getPrototypeOf,jt=Object.prototype.hasOwnProperty;var Wt=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),mt=(t,e)=>{for(var o in e)ge(t,o,{get:e[o],enumerable:!0})},yt=(t,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Kt(e))!jt.call(t,r)&&r!==o&&ge(t,r,{get:()=>e[r],enumerable:!(s=Ht(e,r))||s.enumerable});return t};var Jt=(t,e,o)=>(o=t!=null?Vt(Mt(t)):{},yt(e||!t||!t.__esModule?ge(o,"default",{value:t,enumerable:!0}):o,t)),Gt=t=>yt(ge({},"__esModule",{value:!0}),t);var Pt=Wt((ae,Pe)=>{"use strict";(function(t,e){"use strict";var o="1.0.37",s="",r="?",a="function",p="undefined",d="object",g="string",R="major",i="model",u="name",n="type",l="vendor",c="version",k="architecture",ee="console",f="mobile",h="tablet",q="smarttv",U="wearable",ke="embedded",Te=500,ue="Amazon",te="Apple",tt="ASUS",ot="BlackBerry",D="Browser",pe="Chrome",_t="Edge",ce="Firefox",de="Google",rt="Huawei",Oe="LG",Ee="Microsoft",st="Motorola",me="Opera",ye="Samsung",it="Sharp",fe="Sony",Ie="Xiaomi",Se="Zebra",nt="Facebook",at="Chromium OS",lt="Mac OS",Ft=function(b,C){var y={};for(var A in b)C[A]&&C[A].length%2===0?y[A]=C[A].concat(b[A]):y[A]=b[A];return y},he=function(b){for(var C={},y=0;y<b.length;y++)C[b[y].toUpperCase()]=b[y];return C},ut=function(b,C){return typeof b===g?oe(C).indexOf(oe(b))!==-1:!1},oe=function(b){return b.toLowerCase()},Lt=function(b){return typeof b===g?b.replace(/[^\d\.]/g,s).split(".")[0]:e},Be=function(b,C){if(typeof b===g)return b=b.replace(/^\s\s*/,s),typeof C===p?b:b.substring(0,Te)},re=function(b,C){for(var y=0,A,B,O,w,m,E;y<C.length&&!m;){var Ne=C[y],dt=C[y+1];for(A=B=0;A<Ne.length&&!m&&Ne[A];)if(m=Ne[A++].exec(b),m)for(O=0;O<dt.length;O++)E=m[++B],w=dt[O],typeof w===d&&w.length>0?w.length===2?typeof w[1]==a?this[w[0]]=w[1].call(this,E):this[w[0]]=w[1]:w.length===3?typeof w[1]===a&&!(w[1].exec&&w[1].test)?this[w[0]]=E?w[1].call(this,E,w[2]):e:this[w[0]]=E?E.replace(w[1],w[2]):e:w.length===4&&(this[w[0]]=E?w[3].call(this,E.replace(w[1],w[2])):e):this[w]=E||e;y+=2}},De=function(b,C){for(var y in C)if(typeof C[y]===d&&C[y].length>0){for(var A=0;A<C[y].length;A++)if(ut(C[y][A],b))return y===r?e:y}else if(ut(C[y],b))return y===r?e:y;return b},zt={"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"},pt={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},ct={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[c,[u,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[c,[u,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[u,c],[/opios[\/ ]+([\w\.]+)/i],[c,[u,me+" Mini"]],[/\bopr\/([\w\.]+)/i],[c,[u,me]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[c,[u,"Baidu"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim)\s?(?:browser)?[\/ ]?([\w\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|qq|duckduckgo)\/([-\w\.]+)/i,/(heytap|ovi)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[u,c],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[c,[u,"UC"+D]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[c,[u,"WeChat"]],[/konqueror\/([\w\.]+)/i],[c,[u,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[c,[u,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[c,[u,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[c,[u,"Smart Lenovo "+D]],[/(avast|avg)\/([\w\.]+)/i],[[u,/(.+)/,"$1 Secure "+D],c],[/\bfocus\/([\w\.]+)/i],[c,[u,ce+" Focus"]],[/\bopt\/([\w\.]+)/i],[c,[u,me+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[c,[u,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[c,[u,"Dolphin"]],[/coast\/([\w\.]+)/i],[c,[u,me+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[c,[u,"MIUI "+D]],[/fxios\/([-\w\.]+)/i],[c,[u,ce]],[/\bqihu|(qi?ho?o?|360)browser/i],[[u,"360 "+D]],[/(oculus|sailfish|huawei|vivo)browser\/([\w\.]+)/i],[[u,/(.+)/,"$1 "+D],c],[/samsungbrowser\/([\w\.]+)/i],[c,[u,ye+" Internet"]],[/(comodo_dragon)\/([\w\.]+)/i],[[u,/_/g," "],c],[/metasr[\/ ]?([\d\.]+)/i],[c,[u,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[u,"Sogou Mobile"],c],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345Explorer)[\/ ]?([\w\.]+)/i],[u,c],[/(lbbrowser)/i,/\[(linkedin)app\]/i],[u],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[u,nt],c],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[u,c],[/\bgsa\/([\w\.]+) .*safari\//i],[c,[u,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[c,[u,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[c,[u,pe+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[u,pe+" WebView"],c],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[c,[u,"Android "+D]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[u,c],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[c,[u,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[c,u],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[u,[c,De,zt]],[/(webkit|khtml)\/([\w\.]+)/i],[u,c],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[u,"Netscape"],c],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[c,[u,ce+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror|klar)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir|obigo|mosaic|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/(links) \(([\w\.]+)/i,/panasonic;(viera)/i],[u,c],[/(cobalt)\/([\w\.]+)/i],[u,[c,/master.|lts./,""]]],cpu:[[/(?:(amd|x(?:(?:86|64)[-_])?|wow|win)64)[;\)]/i],[[k,"amd64"]],[/(ia32(?=;))/i],[[k,oe]],[/((?:i[346]|x)86)[;\)]/i],[[k,"ia32"]],[/\b(aarch64|arm(v?8e?l?|_?64))\b/i],[[k,"arm64"]],[/\b(arm(?:v[67])?ht?n?[fl]p?)\b/i],[[k,"armhf"]],[/windows (ce|mobile); ppc;/i],[[k,"arm"]],[/((?:ppc|powerpc)(?:64)?)(?: mac|;|\))/i],[[k,/ower/,s,oe]],[/(sun4\w)[;\)]/i],[[k,"sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|\barm(?=v(?:[1-7]|[5-7]1)l?|;|eabi)|(?=atmel )avr|(?:irix|mips|sparc)(?:64)?\b|pa-risc)/i],[[k,oe]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[i,[l,ye],[n,h]],[/\b((?:s[cgp]h|gt|sm)-\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]([-\w]+)/i,/sec-(sgh\w+)/i],[i,[l,ye],[n,f]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[i,[l,te],[n,f]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[i,[l,te],[n,h]],[/(macintosh);/i],[i,[l,te]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[i,[l,it],[n,f]],[/\b((?:ag[rs][23]?|bah2?|sht?|btv)-a?[lw]\d{2})\b(?!.+d\/s)/i],[i,[l,rt],[n,h]],[/(?:huawei|honor)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[i,[l,rt],[n,f]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite)?)(?: bui|\))/i],[[i,/_/g," "],[l,Ie],[n,f]],[/oid[^\)]+; (2\d{4}(283|rpbf)[cgl])( bui|\))/i,/\b(mi[-_ ]?(?:pad)(?:[\w_ ]+))(?: bui|\))/i],[[i,/_/g," "],[l,Ie],[n,h]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[i,[l,"OPPO"],[n,f]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[i,[l,"Vivo"],[n,f]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[i,[l,"Realme"],[n,f]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[i,[l,st],[n,f]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[i,[l,st],[n,h]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[i,[l,Oe],[n,h]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv)\w+)/i,/\blg-?([\d\w]+) bui/i],[i,[l,Oe],[n,f]],[/(ideatab[-\w ]+)/i,/lenovo ?(s[56]000[-\w]+|tab(?:[\w ]+)|yt[-\d\w]{6}|tb[-\d\w]{6})/i],[i,[l,"Lenovo"],[n,h]],[/(?:maemo|nokia).*(n900|lumia \d+)/i,/nokia[-_ ]?([-\w\.]*)/i],[[i,/_/g," "],[l,"Nokia"],[n,f]],[/(pixel c)\b/i],[i,[l,de],[n,h]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[i,[l,de],[n,f]],[/droid.+ (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[i,[l,fe],[n,f]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[i,"Xperia Tablet"],[l,fe],[n,h]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[i,[l,"OnePlus"],[n,f]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo[c-r]{2})( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[i,[l,ue],[n,h]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[i,/(.+)/g,"Fire Phone $1"],[l,ue],[n,f]],[/(playbook);[-\w\),; ]+(rim)/i],[i,l,[n,h]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[i,[l,ot],[n,f]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[i,[l,tt],[n,h]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[i,[l,tt],[n,f]],[/(nexus 9)/i],[i,[l,"HTC"],[n,h]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[l,[i,/_/g," "],[n,f]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[i,[l,"Acer"],[n,h]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[i,[l,"Meizu"],[n,f]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[i,[l,"Ulefone"],[n,f]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron|infinix|tecno)[-_ ]?([-\w]*)/i,/(hp) ([\w ]+\w)/i,/(asus)-?(\w+)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w]+)/i,/(jolla)/i,/(oppo) ?([\w ]+) bui/i],[l,i,[n,f]],[/(kobo)\s(ereader|touch)/i,/(archos) (gamepad2?)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[l,i,[n,h]],[/(surface duo)/i],[i,[l,Ee],[n,h]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[i,[l,"Fairphone"],[n,f]],[/(u304aa)/i],[i,[l,"AT&T"],[n,f]],[/\bsie-(\w*)/i],[i,[l,"Siemens"],[n,f]],[/\b(rct\w+) b/i],[i,[l,"RCA"],[n,h]],[/\b(venue[\d ]{2,7}) b/i],[i,[l,"Dell"],[n,h]],[/\b(q(?:mv|ta)\w+) b/i],[i,[l,"Verizon"],[n,h]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[i,[l,"Barnes & Noble"],[n,h]],[/\b(tm\d{3}\w+) b/i],[i,[l,"NuVision"],[n,h]],[/\b(k88) b/i],[i,[l,"ZTE"],[n,h]],[/\b(nx\d{3}j) b/i],[i,[l,"ZTE"],[n,f]],[/\b(gen\d{3}) b.+49h/i],[i,[l,"Swiss"],[n,f]],[/\b(zur\d{3}) b/i],[i,[l,"Swiss"],[n,h]],[/\b((zeki)?tb.*\b) b/i],[i,[l,"Zeki"],[n,h]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[l,"Dragon Touch"],i,[n,h]],[/\b(ns-?\w{0,9}) b/i],[i,[l,"Insignia"],[n,h]],[/\b((nxa|next)-?\w{0,9}) b/i],[i,[l,"NextBook"],[n,h]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[l,"Voice"],i,[n,f]],[/\b(lvtel\-)?(v1[12]) b/i],[[l,"LvTel"],i,[n,f]],[/\b(ph-1) /i],[i,[l,"Essential"],[n,f]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[i,[l,"Envizen"],[n,h]],[/\b(trio[-\w\. ]+) b/i],[i,[l,"MachSpeed"],[n,h]],[/\btu_(1491) b/i],[i,[l,"Rotor"],[n,h]],[/(shield[\w ]+) b/i],[i,[l,"Nvidia"],[n,h]],[/(sprint) (\w+)/i],[l,i,[n,f]],[/(kin\.[onetw]{3})/i],[[i,/\./g," "],[l,Ee],[n,f]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[i,[l,Se],[n,h]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[i,[l,Se],[n,f]],[/smart-tv.+(samsung)/i],[l,[n,q]],[/hbbtv.+maple;(\d+)/i],[[i,/^/,"SmartTV"],[l,ye],[n,q]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[l,Oe],[n,q]],[/(apple) ?tv/i],[l,[i,te+" TV"],[n,q]],[/crkey/i],[[i,pe+"cast"],[l,de],[n,q]],[/droid.+aft(\w+)( bui|\))/i],[i,[l,ue],[n,q]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[i,[l,it],[n,q]],[/(bravia[\w ]+)( bui|\))/i],[i,[l,fe],[n,q]],[/(mitv-\w{5}) bui/i],[i,[l,Ie],[n,q]],[/Hbbtv.*(technisat) (.*);/i],[l,i,[n,q]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[l,Be],[i,Be],[n,q]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[n,q]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[l,i,[n,ee]],[/droid.+; (shield) bui/i],[i,[l,"Nvidia"],[n,ee]],[/(playstation [345portablevi]+)/i],[i,[l,fe],[n,ee]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[i,[l,Ee],[n,ee]],[/((pebble))app/i],[l,i,[n,U]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[i,[l,te],[n,U]],[/droid.+; (glass) \d/i],[i,[l,de],[n,U]],[/droid.+; (wt63?0{2,3})\)/i],[i,[l,Se],[n,U]],[/(quest( 2| pro)?)/i],[i,[l,nt],[n,U]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[l,[n,ke]],[/(aeobc)\b/i],[i,[l,ue],[n,ke]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[i,[n,f]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[i,[n,h]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[n,h]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[n,f]],[/(android[-\w\. ]{0,9});.+buil/i],[i,[l,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[c,[u,_t+"HTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[c,[u,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[u,c],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[c,u]],os:[[/microsoft (windows) (vista|xp)/i],[u,c],[/(windows (?:phone(?: os)?|mobile))[\/ ]?([\d\.\w ]*)/i],[u,[c,De,pt]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]?([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[c,De,pt],[u,"Windows"]],[/ip[honead]{2,4}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[c,/_/g,"."],[u,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[u,lt],[c,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[c,u],[/(android|webos|qnx|bada|rim tablet os|maemo|meego|sailfish)[-\/ ]?([\w\.]*)/i,/(blackberry)\w*\/([\w\.]*)/i,/(tizen|kaios)[\/ ]([\w\.]+)/i,/\((series40);/i],[u,c],[/\(bb(10);/i],[c,[u,ot]],[/(?:symbian ?os|symbos|s60(?=;)|series60)[-\/ ]?([\w\.]*)/i],[c,[u,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[c,[u,ce+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[c,[u,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[c,[u,"watchOS"]],[/crkey\/([\d\.]+)/i],[c,[u,pe+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[u,at],c],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux) ?([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[u,c],[/(sunos) ?([\w\.\d]*)/i],[[u,"Solaris"],c],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[u,c]]},x=function(b,C){if(typeof b===d&&(C=b,b=e),!(this instanceof x))return new x(b,C).getResult();var y=typeof t!==p&&t.navigator?t.navigator:e,A=b||(y&&y.userAgent?y.userAgent:s),B=y&&y.userAgentData?y.userAgentData:e,O=C?Ft(ct,C):ct,w=y&&y.userAgent==A;return this.getBrowser=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.browser),m[R]=Lt(m[c]),w&&y&&y.brave&&typeof y.brave.isBrave==a&&(m[u]="Brave"),m},this.getCPU=function(){var m={};return m[k]=e,re.call(m,A,O.cpu),m},this.getDevice=function(){var m={};return m[l]=e,m[i]=e,m[n]=e,re.call(m,A,O.device),w&&!m[n]&&B&&B.mobile&&(m[n]=f),w&&m[i]=="Macintosh"&&y&&typeof y.standalone!==p&&y.maxTouchPoints&&y.maxTouchPoints>2&&(m[i]="iPad",m[n]=h),m},this.getEngine=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.engine),m},this.getOS=function(){var m={};return m[u]=e,m[c]=e,re.call(m,A,O.os),w&&!m[u]&&B&&B.platform!="Unknown"&&(m[u]=B.platform.replace(/chrome os/i,at).replace(/macos/i,lt)),m},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return A},this.setUA=function(m){return A=typeof m===g&&m.length>Te?Be(m,Te):m,this},this.setUA(A),this};x.VERSION=o,x.BROWSER=he([u,c,R]),x.CPU=he([k]),x.DEVICE=he([i,l,n,ee,f,q,h,U,ke]),x.ENGINE=x.OS=he([u,c]),typeof ae!==p?(typeof Pe!==p&&Pe.exports&&(ae=Pe.exports=x),ae.UAParser=x):typeof define===a&&define.amd?define(function(){return x}):typeof t!==p&&(t.UAParser=x);var _=typeof t!==p&&(t.jQuery||t.Zepto);if(_&&!_.ua){var be=new x;_.ua=be.getResult(),_.ua.get=function(){return be.getUA()},_.ua.set=function(b){be.setUA(b);var C=be.getResult();for(var y in C)_.ua[y]=C[y]}}})(typeof window=="object"?window:ae)});var po={};mt(po,{AbortError:()=>Ae,ApiError:()=>T,LoginIDAPI:()=>Je,LoginIDWebSDK:()=>et,PasskeyError:()=>P,WebAuthnHelper:()=>xe,canCreatePasskey:()=>kt,createPasskeyCredential:()=>Z,default:()=>uo,doesDeviceSupportPasskeys:()=>We,getPasskeyCredential:()=>Q,isConditionalUIAvailable:()=>xt,isPlatformAuthenticatorAvailable:()=>je});var Ue=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,o=this.config.baseUrl.match(e);if(o)return o[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},Re=Ue;var $t=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),Yt=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o=[],s=0;for(;s<t.length;){let p=t.charCodeAt(s++),d=t.charCodeAt(s++),g=t.charCodeAt(s++),R=p<<16|d<<8|g;o.push(e[R>>18&63]+e[R>>12&63]+e[R>>6&63]+e[R&63])}let r=o.join(""),a=t.length%3;return a?r.slice(0,a-3)+"===".slice(a||3):r},Xt=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",o={},s=String.fromCharCode;for(let d=0;d<64;d++)o[e.charAt(d)]=d;let r=0,a=0,p="";for(let d of t){let g=o[d];if(g!==void 0)for(r=(r<<6)+g,a+=6;a>=8;)p+=s(r>>(a-=8)&255)}return p},v=t=>{let e="",o=new Uint8Array(t);for(let r=0;r<o.byteLength;r++)e+=String.fromCharCode(o[r]);let s=Yt(e);return $t(s)},F=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=Xt(t),o=new Uint8Array(e.length);for(let s=0;s<e.length;s++)o[s]=e.charCodeAt(s);return o.buffer},ft=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),ht=(t,e)=>{e.forEach(o=>{Object.getOwnPropertyNames(o.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(o.prototype,s)||Object.create(null))})})},se=t=>{try{let o=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(o).split("").map(r=>"%"+("00"+r.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},bt=t=>{let o=`; ${document.cookie}`.split(`; ${t}=`);if(o&&o.length===2)return o.pop().split(";").shift()},gt=t=>{document.cookie=t},Rt=t=>{document.cookie=`${t}=; expires=${new Date}`};var _e=class{config;constructor(e){this.config=new Re(e)}getToken(e){if(e.authzToken)return e.authzToken;{let o=this.getJwtCookie();return o||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=se(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let o=se(e),s=new Date(o.exp*1e3).toUTCString(),r=`${this.getJwtCookieName()}=${e}; expires=${s}`;gt(r)}getJwtCookie(){return bt(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){Rt(this.getJwtCookieName())}},wt=_e;var L=class{constructor(e){this.config=e}};var T=class extends Error{url;status;statusText;body;request;constructor(e,o,s){super(s),this.name="ApiError",this.url=o.url,this.status=o.status,this.statusText=o.statusText,this.body=o.body,this.request=e}};var ie=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},z=class{#t;#o;#e;#r;#i;#n;#s;constructor(e){this.#t=!1,this.#o=!1,this.#e=!1,this.#r=[],this.#i=new Promise((o,s)=>{this.#n=o,this.#s=s;let r=d=>{this.#t||this.#o||this.#e||(this.#t=!0,this.#n&&this.#n(d))},a=d=>{this.#t||this.#o||this.#e||(this.#o=!0,this.#s&&this.#s(d))},p=d=>{this.#t||this.#o||this.#e||this.#r.push(d)};return Object.defineProperty(p,"isResolved",{get:()=>this.#t}),Object.defineProperty(p,"isRejected",{get:()=>this.#o}),Object.defineProperty(p,"isCancelled",{get:()=>this.#e}),e(r,a,p)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,o){return this.#i.then(e,o)}catch(e){return this.#i.catch(e)}finally(e){return this.#i.finally(e)}cancel(){if(!(this.#t||this.#o||this.#e)){if(this.#e=!0,this.#r.length)try{for(let e of this.#r)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#r.length=0,this.#s&&this.#s(new ie("Request aborted"))}}get isCancelled(){return this.#e}};var Le=t=>t!=null,ne=t=>typeof t=="string",Fe=t=>ne(t)&&t!=="",ze=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),Ct=t=>t instanceof FormData,Zt=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},Qt=t=>{let e=[],o=(r,a)=>{e.push(`${encodeURIComponent(r)}=${encodeURIComponent(String(a))}`)},s=(r,a)=>{Le(a)&&(Array.isArray(a)?a.forEach(p=>{s(r,p)}):typeof a=="object"?Object.entries(a).forEach(([p,d])=>{s(`${r}[${p}]`,d)}):o(r,a))};return Object.entries(t).forEach(([r,a])=>{s(r,a)}),e.length>0?`?${e.join("&")}`:""},eo=(t,e)=>{let o=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(a,p)=>e.path?.hasOwnProperty(p)?o(String(e.path[p])):a),r=`${t.BASE}${s}`;return e.query?`${r}${Qt(e.query)}`:r},to=t=>{if(t.formData){let e=new FormData,o=(s,r)=>{ne(r)||ze(r)?e.append(s,r):e.append(s,JSON.stringify(r))};return Object.entries(t.formData).filter(([s,r])=>Le(r)).forEach(([s,r])=>{Array.isArray(r)?r.forEach(a=>o(s,a)):o(s,r)}),e}},we=async(t,e)=>typeof e=="function"?e(t):e,oo=async(t,e)=>{let[o,s,r,a]=await Promise.all([we(e,t.TOKEN),we(e,t.USERNAME),we(e,t.PASSWORD),we(e,t.HEADERS)]),p=Object.entries({Accept:"application/json",...a,...e.headers}).filter(([d,g])=>Le(g)).reduce((d,[g,R])=>({...d,[g]:String(R)}),{});if(Fe(o)&&(p.Authorization=`Bearer ${o}`),Fe(s)&&Fe(r)){let d=Zt(`${s}:${r}`);p.Authorization=`Basic ${d}`}return e.body&&(e.mediaType?p["Content-Type"]=e.mediaType:ze(e.body)?p["Content-Type"]=e.body.type||"application/octet-stream":ne(e.body)?p["Content-Type"]="text/plain":Ct(e.body)||(p["Content-Type"]="application/json")),new Headers(p)},ro=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):ne(t.body)||ze(t.body)||Ct(t.body)?t.body:JSON.stringify(t.body)},so=async(t,e,o,s,r,a,p)=>{let d=new AbortController,g={headers:a,body:s??r,method:e.method,signal:d.signal};return t.WITH_CREDENTIALS&&(g.credentials=t.CREDENTIALS),p(()=>d.abort()),await fetch(o,g)},io=(t,e)=>{if(e){let o=t.headers.get(e);if(ne(o))return o}},no=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(r=>e.toLowerCase().startsWith(r))?await t.json():await t.text()}catch(e){console.error(e)}},ao=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new T(t,e,s);if(!e.ok){let r=e.status??"unknown",a=e.statusText??"unknown",p=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new T(t,e,`Generic Error: status: ${r}; status text: ${a}; body: ${p}`)}},At=(t,e)=>new z(async(o,s,r)=>{try{let a=eo(t,e),p=to(e),d=ro(e),g=await oo(t,e);if(!r.isCancelled){let R=await so(t,e,a,d,p,g,r),i=await no(R),u=io(R,e.responseHeader),n={url:a,ok:R.ok,status:R.status,statusText:R.statusText,body:u??i};ao(e,n),o(n.body)}}catch(a){s(a)}});var Ce=class extends L{constructor(e){super(e)}request(e){return At(this.config,e)}};var V=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":o},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var H=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var K=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:o}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:o},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:o,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var M=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:o}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:o,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var j=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:o,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":o,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var W=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var J=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var G=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var $=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,o=Ce){this.request=new o({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new V(this.request),this.mgmt=new H(this.request),this.passkeys=new K(this.request),this.profile=new M(this.request),this.reg=new j(this.request),this.tx=new W(this.request),this.version=new J(this.request),this.wellKnown=new G(this.request)}};var Ve=class{config;service;session;constructor(e){this.config=new Re(e),this.service=new $({BASE:e.baseUrl}),this.session=new wt(e)}},I=Ve;var He=class extends Error{constructor(e){super(e),this.name="AbortError"}},Ae=He;var Ke=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new Ae("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},N=Ke;var S=(t,e,o)=>({...o,authzToken:e||o.authzToken||"",usernameType:o.usernameType||"other",displayName:o.displayName||t,callbacks:o.callbacks||{}}),vt=(t,e)=>({...S(t,"",e),txType:e.txType||"raw",nonce:e.nonce||ft()}),Y=(t,e=!0,o=!1)=>({token:t,isAuthenticated:e,isFallback:o});var Me=class extends I{constructor(e){super(e)}async validateOtp(e,o,s={}){let r=S(e,"",s),a={authCode:o,user:{username:e,usernameType:r.usernameType}},p=await this.service.auth.authAuthCodeVerify({requestBody:a}),d=Y(p.jwtAccess);return N.renewWebAuthnAbortController(),this.session.setJwtCookie(d.token),d}async requestAndSendOtp(e,o="email",s={}){let r=S(e,"",s),a={user:{username:e,usernameType:r.usernameType}};switch(o){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:a});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:a});break;default:throw new Error("Invalid message method")}}},ve=Me;var qt=Jt(Pt(),1),le=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},lo=(t,e)=>{let o=t.split(".").map(Number),s=e.split(".").map(Number),r=Math.max(o.length,s.length);for(let a=0;a<r;a++){let p=a<o.length?o[a]:0,d=a<s.length?s[a]:0;if(p<d)return-1;if(p>d)return 1}return 0};async function je(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function xt(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function We(){let t=new qt.UAParser(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&lo(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function kt(){let t=await je(),e=await We();return t&&e.deviceSupported}var Je={};mt(Je,{ApiError:()=>T,AuthService:()=>V,BaseHttpRequest:()=>L,CancelError:()=>ie,CancelablePromise:()=>z,LoginIDService:()=>$,MgmtService:()=>H,OpenAPI:()=>Tt,PasskeysService:()=>K,ProfileService:()=>M,RegService:()=>j,TxService:()=>W,VersionService:()=>J,WellKnownService:()=>G});var Tt={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var Ge=class extends I{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let o=S("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:le(),user:{username:"",usernameType:o.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(o){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",o instanceof T&&(e.code=o.body.msgCode||"unknown_error",e.message=o.body.msg||o.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},Ot=Ge;var Et=t=>`LoginID_${t}_device-id`,X=class{static persistDeviceId(e,o){o&&localStorage.setItem(Et(e),o)}static getDeviceId(e){return localStorage.getItem(Et(e))||""}};var It=t=>[...t.crossAuthMethods,...t.fallbackMethods];var $e=class extends Error{code;constructor(e,o,s){super(e),this.code=o,this.cause=s}},P=$e;var Ye=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},Xe=Ye;var St=(t,e)=>{let o=t.name,{publicKey:s}=e;if(o==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new P("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new P("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(o==="InvalidStateError")return new P("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(o==="NotAllowedError")return new P("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(o==="NotSupportedError")return new P("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(o==="SecurityError"){let r=s?.rp?.id;if(r!==window.location.hostname)return new P(`The domain of the relying party (${r}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return o==="UnknownError"?new P("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Bt=(t,e)=>{let o=t.name,{publicKey:s}=e;if(o==="AbortError"&&e.signal instanceof AbortSignal)return new P("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(o==="NotAllowedError")return new P("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(o==="SecurityError"){let r=s?.rpId;if(r!==window.location.hostname)return new P(`The domain of the relying party (${r}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return o==="UnknownError"?new P("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Ir=new Xe("User needs to be logged in to perform this operation."),Dt=new Xe("No login options available.");var Z=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let r of t.excludeCredentials){let a={id:F(r.id),transports:r.transports,type:r.type};e.push(a)}}let o=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:F(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:o,rp:t.rp,timeout:t.timeout,user:{...t.user,id:F(t.user.id)}}};try{let r=await navigator.credentials.create(s);if(r===null)throw new Error("Failed to create the passkey credential.");return r}catch(r){throw r instanceof Error?St(r,s):r}},Q=async(t,e={})=>{let o;if(t.allowCredentials!==void 0){o=[];for(let r of t.allowCredentials){let a={id:F(r.id),transports:r.transports,type:r.type};o.push(a)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:o,challenge:F(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let r=await navigator.credentials.get(s);if(r===null)throw new Error("Failed to create the passkey credential.");return r}catch(r){throw r instanceof Error?Bt(r,s):r}};var Ze=class extends ve{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:o,session:s}=e;N.renewWebAuthnAbortController();let r=await Z(o),a=r.response,p=a.getPublicKey&&a.getPublicKey(),d=a.getPublicKeyAlgorithm&&a.getPublicKeyAlgorithm(),g=a.getAuthenticatorData&&a.getAuthenticatorData(),R=a.getTransports&&a.getTransports();return{creationResult:{attestationObject:v(a.attestationObject),clientDataJSON:v(a.clientDataJSON),credentialId:r.id,...p&&{publicKey:v(p)},...d&&{publicKeyAlgorithm:d},...g&&{authenticatorData:v(g)},...R&&{transports:R}},session:s}}async createPasskey(e,o="",s={}){let r=this.config.getAppId(),a=le(X.getDeviceId(r)),p=S(e,o,s);p.authzToken=this.session.getToken(p),p.authzToken&&se(p.authzToken).username!==e&&(p.authzToken="");let d={app:{id:r},deviceInfo:a,user:{username:e,usernameType:p.usernameType,displayName:p.displayName}},g=await this.service.reg.regRegInit({requestBody:d,...p.authzToken&&{authorization:p.authzToken}}),R=await this.createNavigatorCredential(g),i=await this.service.reg.regRegComplete({requestBody:R}),u=Y(i.jwtAccess);return this.session.setJwtCookie(i.jwtAccess),X.persistDeviceId(r,i.deviceID),u}async getNavigatorCredential(e,o={}){let{assertionOptions:s,session:r}=e;o.abortController?N.assignWebAuthnAbortController(o.abortController):(N.renewWebAuthnAbortController(),o.abortController=N.abortController);let a=await Q(s,o),p=a.response;return{assertionResult:{authenticatorData:v(p.authenticatorData),clientDataJSON:v(p.clientDataJSON),credentialId:a.id,signature:v(p.signature),...p.userHandle&&{userHandle:v(p.userHandle)}},session:r}}async authenticateWithPasskey(e="",o={}){let s=this.config.getAppId(),r=le(X.getDeviceId(s)),a=S(e,"",o),p={app:{id:s},deviceInfo:r,user:{username:e,usernameType:a.usernameType}},d=await this.service.auth.authAuthInit({requestBody:p});switch(d.action){case"proceed":{let g=await this.getNavigatorCredential(d,o),R=await this.service.auth.authAuthComplete({requestBody:g}),i=Y(R.jwtAccess);return this.session.setJwtCookie(i.token),a?.callbacks?.onSuccess&&await a.callbacks.onSuccess(i),i}case"crossAuth":case"fallback":{if(a?.callbacks?.onFallback){let g=It(d);await a.callbacks.onFallback(e,g)}return Y("",!1,!0)}default:throw Dt}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,o={}){if(o.authzToken=this.session.getToken(o),!o.authzToken){let r=await this.authenticateWithPasskey(e,o);o.authzToken=r.token}return await this.service.auth.authAuthCodeRequest({authorization:o.authzToken})}async confirmTransaction(e,o,s={}){let r=vt(e,s),a={username:e,txPayload:o,nonce:r.nonce,txType:r.txType},{assertionOptions:p,session:d}=await this.service.tx.txTxInit({requestBody:a}),g={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:p,session:d},{assertionResult:R}=await this.getNavigatorCredential(g),i={authenticatorData:R.authenticatorData,clientData:R.clientDataJSON,keyHandle:R.credentialId,session:d,signature:R.signature};return await this.service.tx.txTxComplete({requestBody:i})}},Nt=Ze;var Qe=class extends I{constructor(e){super(e)}async listPasskeys(e={}){let o=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:o})}async renamePasskey(e,o,s={}){let r=this.session.getToken(s),a={name:o};await this.service.passkeys.passkeysPasskeyRename({authorization:r,id:e,requestBody:a})}async deletePasskey(e,o={}){let s=this.session.getToken(o);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},Ut=Qe;var qe=class extends I{constructor(e){super(e)}};ht(qe,[I,Nt,ve,Ut,Ot]);var et=qe;var xe=class{static async getNavigatorCredential(e,o={}){let{assertionOptions:s,session:r}=e,a=await Q(s,o),p=a.response;return{assertionResult:{authenticatorData:v(p.authenticatorData),clientDataJSON:v(p.clientDataJSON),credentialId:a.id,signature:v(p.signature),...p.userHandle&&{userHandle:v(p.userHandle)}},session:r}}static async createNavigatorCredential(e){let{registrationRequestOptions:o,session:s}=e,r=await Z(o),a=r.response,p=a.getPublicKey&&a.getPublicKey(),d=a.getPublicKeyAlgorithm&&a.getPublicKeyAlgorithm(),g=a.getAuthenticatorData&&a.getAuthenticatorData(),R=a.getTransports&&a.getTransports();return{creationResult:{attestationObject:v(a.attestationObject),clientDataJSON:v(a.clientDataJSON),credentialId:r.id,...p&&{publicKey:v(p)},...d&&{publicKeyAlgorithm:d},...g&&{authenticatorData:v(g)},...R&&{transports:R}},session:s}}};var uo=et;return Gt(po);})();
2
2
  //# sourceMappingURL=index.global.js.map
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- var Be=Object.defineProperty;var Ee=(t,e)=>{for(var r in e)Be(t,r,{get:e[r],enumerable:!0})};var j=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,r=this.config.baseUrl.match(e);if(r)return r[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},K=j;var Se=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),ve=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],s=0;for(;s<t.length;){let i=t.charCodeAt(s++),a=t.charCodeAt(s++),u=t.charCodeAt(s++),l=i<<16|a<<8|u;r.push(e[l>>18&63]+e[l>>12&63]+e[l>>6&63]+e[l&63])}let o=r.join(""),n=t.length%3;return n?o.slice(0,n-3)+"===".slice(n||3):o},we=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r={},s=String.fromCharCode;for(let a=0;a<64;a++)r[e.charAt(a)]=a;let o=0,n=0,i="";for(let a of t){let u=r[a];if(u!==void 0)for(o=(o<<6)+u,n+=6;n>=8;)i+=s(o>>(n-=8)&255)}return i},p=t=>{let e="",r=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)e+=String.fromCharCode(r[o]);let s=ve(e);return Se(s)},R=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=we(t),r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r.buffer},ue=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),le=(t,e)=>{e.forEach(r=>{Object.getOwnPropertyNames(r.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(r.prototype,s)||Object.create(null))})})},S=t=>{try{let r=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},pe=t=>{let r=`; ${document.cookie}`.split(`; ${t}=`);if(r&&r.length===2)return r.pop().split(";").shift()},ce=t=>{document.cookie=t},de=t=>{document.cookie=`${t}=; expires=${new Date}`};var z=class{config;constructor(e){this.config=new K(e)}getToken(e){if(e.authzToken)return e.authzToken;{let r=this.getJwtCookie();return r||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=S(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let r=S(e),s=new Date(r.exp*1e3).toUTCString(),o=`${this.getJwtCookieName()}=${e}; expires=${s}`;ce(o)}getJwtCookie(){return pe(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){de(this.getJwtCookieName())}},me=z;var g=class{constructor(e){this.config=e}};var m=class extends Error{url;status;statusText;body;request;constructor(e,r,s){super(s),this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=e}};var v=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},b=class{#t;#r;#e;#o;#n;#i;#s;constructor(e){this.#t=!1,this.#r=!1,this.#e=!1,this.#o=[],this.#n=new Promise((r,s)=>{this.#i=r,this.#s=s;let o=a=>{this.#t||this.#r||this.#e||(this.#t=!0,this.#i&&this.#i(a))},n=a=>{this.#t||this.#r||this.#e||(this.#r=!0,this.#s&&this.#s(a))},i=a=>{this.#t||this.#r||this.#e||this.#o.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this.#t}),Object.defineProperty(i,"isRejected",{get:()=>this.#r}),Object.defineProperty(i,"isCancelled",{get:()=>this.#e}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,r){return this.#n.then(e,r)}catch(e){return this.#n.catch(e)}finally(e){return this.#n.finally(e)}cancel(){if(!(this.#t||this.#r||this.#e)){if(this.#e=!0,this.#o.length)try{for(let e of this.#o)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#o.length=0,this.#s&&this.#s(new v("Request aborted"))}}get isCancelled(){return this.#e}};var M=t=>t!=null,w=t=>typeof t=="string",J=t=>w(t)&&t!=="",$=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),ye=t=>t instanceof FormData,De=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},Ne=t=>{let e=[],r=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},s=(o,n)=>{M(n)&&(Array.isArray(n)?n.forEach(i=>{s(o,i)}):typeof n=="object"?Object.entries(n).forEach(([i,a])=>{s(`${o}[${i}]`,a)}):r(o,n))};return Object.entries(t).forEach(([o,n])=>{s(o,n)}),e.length>0?`?${e.join("&")}`:""},Ue=(t,e)=>{let r=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>e.path?.hasOwnProperty(i)?r(String(e.path[i])):n),o=`${t.BASE}${s}`;return e.query?`${o}${Ne(e.query)}`:o},Fe=t=>{if(t.formData){let e=new FormData,r=(s,o)=>{w(o)||$(o)?e.append(s,o):e.append(s,JSON.stringify(o))};return Object.entries(t.formData).filter(([s,o])=>M(o)).forEach(([s,o])=>{Array.isArray(o)?o.forEach(n=>r(s,n)):r(s,o)}),e}},L=async(t,e)=>typeof e=="function"?e(t):e,Ke=async(t,e)=>{let[r,s,o,n]=await Promise.all([L(e,t.TOKEN),L(e,t.USERNAME),L(e,t.PASSWORD),L(e,t.HEADERS)]),i=Object.entries({Accept:"application/json",...n,...e.headers}).filter(([a,u])=>M(u)).reduce((a,[u,l])=>({...a,[u]:String(l)}),{});if(J(r)&&(i.Authorization=`Bearer ${r}`),J(s)&&J(o)){let a=De(`${s}:${o}`);i.Authorization=`Basic ${a}`}return e.body&&(e.mediaType?i["Content-Type"]=e.mediaType:$(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":w(e.body)?i["Content-Type"]="text/plain":ye(e.body)||(i["Content-Type"]="application/json")),new Headers(i)},Le=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):w(t.body)||$(t.body)||ye(t.body)?t.body:JSON.stringify(t.body)},He=async(t,e,r,s,o,n,i)=>{let a=new AbortController,u={headers:n,body:s??o,method:e.method,signal:a.signal};return t.WITH_CREDENTIALS&&(u.credentials=t.CREDENTIALS),i(()=>a.abort()),await fetch(r,u)},Ve=(t,e)=>{if(e){let r=t.headers.get(e);if(w(r))return r}},We=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(o=>e.toLowerCase().startsWith(o))?await t.json():await t.text()}catch(e){console.error(e)}},_e=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new m(t,e,s);if(!e.ok){let o=e.status??"unknown",n=e.statusText??"unknown",i=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new m(t,e,`Generic Error: status: ${o}; status text: ${n}; body: ${i}`)}},fe=(t,e)=>new b(async(r,s,o)=>{try{let n=Ue(t,e),i=Fe(e),a=Le(e),u=await Ke(t,e);if(!o.isCancelled){let l=await He(t,e,n,a,i,u,o),c=await We(l),F=Ve(l,e.responseHeader),_={url:n,ok:l.ok,status:l.status,statusText:l.statusText,body:F??c};_e(e,_),r(_.body)}}catch(n){s(n)}});var H=class extends g{constructor(e){super(e)}request(e){return fe(this.config,e)}};var C=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":r},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var P=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var q=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:r}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:r},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:r,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var A=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var I=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:r,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":r,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var O=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var T=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var x=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var k=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,r=H){this.request=new r({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new C(this.request),this.mgmt=new P(this.request),this.passkeys=new q(this.request),this.profile=new A(this.request),this.reg=new I(this.request),this.tx=new O(this.request),this.version=new T(this.request),this.wellKnown=new x(this.request)}};var G=class{config;service;session;constructor(e){this.config=new K(e),this.service=new k({BASE:e.baseUrl}),this.session=new me(e)}},y=G;var Y=class extends Error{constructor(e){super(e),this.name="AbortError"}},Q=Y;var X=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new Q("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},h=X;var f=(t,e,r)=>({...r,authzToken:e||r.authzToken||"",usernameType:r.usernameType||"email",displayName:r.displayName||t,callbacks:r.callbacks||{}}),he=(t,e)=>({...f(t,"",e),txType:e.txType||"raw",nonce:e.nonce||ue()}),B=(t,e=!0,r=!1)=>({token:t,isAuthenticated:e,isFallback:r});var Z=class extends y{constructor(e){super(e)}async validateOtp(e,r,s={}){let o=f(e,"",s),n={authCode:r,user:{username:e,usernameType:o.usernameType}},i=await this.service.auth.authAuthCodeVerify({requestBody:n}),a=B(i.jwtAccess);return h.renewWebAuthnAbortController(),this.session.setJwtCookie(a.token),a}async requestAndSendOtp(e,r="email",s={}){let o=f(e,"",s),n={user:{username:e,usernameType:o.usernameType}};switch(r){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:n});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:n});break;default:throw new Error("Invalid message method")}}},V=Z;import{UAParser as je}from"ua-parser-js";var D=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},ze=(t,e)=>{let r=t.split(".").map(Number),s=e.split(".").map(Number),o=Math.max(r.length,s.length);for(let n=0;n<o;n++){let i=n<r.length?r[n]:0,a=n<s.length?s[n]:0;if(i<a)return-1;if(i>a)return 1}return 0};async function Re(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function Je(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function ge(){let t=new je(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&ze(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function Me(){let t=await Re(),e=await ge();return t&&e.deviceSupported}var Ce={};Ee(Ce,{ApiError:()=>m,AuthService:()=>C,BaseHttpRequest:()=>g,CancelError:()=>v,CancelablePromise:()=>b,LoginIDService:()=>k,MgmtService:()=>P,OpenAPI:()=>be,PasskeysService:()=>q,ProfileService:()=>A,RegService:()=>I,TxService:()=>O,VersionService:()=>T,WellKnownService:()=>x});var be={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var ee=class extends y{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let r=f("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:D(),user:{username:"",usernameType:r.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(r){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",r instanceof m&&(e.code=r.body.msgCode||"unknown_error",e.message=r.body.msg||r.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},Pe=ee;var qe=t=>`LoginID_${t}_device-id`,E=class{static persistDeviceId(e,r){r&&localStorage.setItem(qe(e),r)}static getDeviceId(e){return localStorage.getItem(qe(e))||""}};var Ae=t=>[...t.crossAuthMethods,...t.fallbackMethods];var te=class extends Error{code;constructor(e,r,s){super(e),this.code=r,this.cause=s}},d=te;var re=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},oe=re;var Ie=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new d("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new d("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(r==="InvalidStateError")return new d("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(r==="NotAllowedError")return new d("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="NotSupportedError")return new d("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(r==="SecurityError"){let o=s?.rp?.id;if(o!==window.location.hostname)return new d(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new d("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Oe=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="AbortError"&&e.signal instanceof AbortSignal)return new d("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(r==="NotAllowedError")return new d("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="SecurityError"){let o=s?.rpId;if(o!==window.location.hostname)return new d(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new d("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},yr=new oe("User needs to be logged in to perform this operation."),se=new oe("No login options available.");var N=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let o of t.excludeCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};e.push(n)}}let r=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:R(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:r,rp:t.rp,timeout:t.timeout,user:{...t.user,id:R(t.user.id)}}};try{let o=await navigator.credentials.create(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Ie(o,s):o}},U=async(t,e={})=>{let r;if(t.allowCredentials!==void 0){r=[];for(let o of t.allowCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};r.push(n)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:r,challenge:R(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let o=await navigator.credentials.get(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Oe(o,s):o}};var ne=class extends V{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e;h.renewWebAuthnAbortController();let o=await N(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),l=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:p(n.attestationObject),clientDataJSON:p(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:p(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:p(u)},...l&&{transports:l}},session:s}}async createPasskey(e,r="",s={}){let o=this.config.getAppId(),n=D(E.getDeviceId(o)),i=f(e,r,s);i.authzToken=this.session.getToken(i),i.authzToken&&S(i.authzToken).username!==e&&(i.authzToken="");let a={app:{id:o},deviceInfo:n,user:{username:e,usernameType:i.usernameType,displayName:i.displayName}},u=await this.service.reg.regRegInit({requestBody:a,...i.authzToken&&{authorization:i.authzToken}}),l=await this.createNavigatorCredential(u),c=await this.service.reg.regRegComplete({requestBody:l}),F=B(c.jwtAccess);return this.session.setJwtCookie(c.jwtAccess),E.persistDeviceId(o,c.deviceID),F}async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e;r.abortController?h.assignWebAuthnAbortController(r.abortController):(h.renewWebAuthnAbortController(),r.abortController=h.abortController);let n=await U(s,r),i=n.response;return{assertionResult:{authenticatorData:p(i.authenticatorData),clientDataJSON:p(i.clientDataJSON),credentialId:n.id,signature:p(i.signature),...i.userHandle&&{userHandle:p(i.userHandle)}},session:o}}async authenticateWithPasskey(e="",r={}){let s=this.config.getAppId(),o=D(E.getDeviceId(s)),n=f(e,"",r),i={app:{id:s},deviceInfo:o,user:{username:e,usernameType:n.usernameType}},a=await this.service.auth.authAuthInit({requestBody:i});switch(a.action){case"proceed":{let u=await this.getNavigatorCredential(a,r),l=await this.service.auth.authAuthComplete({requestBody:u}),c=B(l.jwtAccess);return this.session.setJwtCookie(c.token),n?.callbacks?.onSuccess&&await n.callbacks.onSuccess(c),c}case"crossAuth":case"fallback":{if(n?.callbacks?.onFallback){let u=Ae(a);return await n.callbacks.onFallback(e,u),B("",!1,!0)}throw se}default:throw se}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,r={}){if(r.authzToken=this.session.getToken(r),!r.authzToken){let o=await this.authenticateWithPasskey(e,r);r.authzToken=o.token}return await this.service.auth.authAuthCodeRequest({authorization:r.authzToken})}async confirmTransaction(e,r,s={}){let o=he(e,s),n={username:e,txPayload:r,nonce:o.nonce,txType:o.txType},{assertionOptions:i,session:a}=await this.service.tx.txTxInit({requestBody:n}),u={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:i,session:a},{assertionResult:l}=await this.getNavigatorCredential(u),c={authenticatorData:l.authenticatorData,clientData:l.clientDataJSON,keyHandle:l.credentialId,session:a,signature:l.signature};return await this.service.tx.txTxComplete({requestBody:c})}},Te=ne;var ie=class extends y{constructor(e){super(e)}async listPasskeys(e={}){let r=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:r})}async renamePasskey(e,r,s={}){let o=this.session.getToken(s),n={name:r};await this.service.passkeys.passkeysPasskeyRename({authorization:o,id:e,requestBody:n})}async deletePasskey(e,r={}){let s=this.session.getToken(r);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},xe=ie;var W=class extends y{constructor(e){super(e)}};le(W,[y,Te,V,xe,Pe]);var ke=W;var ae=class{static async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e,n=await U(s,r),i=n.response;return{assertionResult:{authenticatorData:p(i.authenticatorData),clientDataJSON:p(i.clientDataJSON),credentialId:n.id,signature:p(i.signature),...i.userHandle&&{userHandle:p(i.userHandle)}},session:o}}static async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e,o=await N(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),l=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:p(n.attestationObject),clientDataJSON:p(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:p(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:p(u)},...l&&{transports:l}},session:s}}};var Zr=ke;export{Q as AbortError,m as ApiError,Ce as LoginIDAPI,ke as LoginIDWebSDK,d as PasskeyError,ae as WebAuthnHelper,Me as canCreatePasskey,N as createPasskeyCredential,Zr as default,ge as doesDeviceSupportPasskeys,U as getPasskeyCredential,Je as isConditionalUIAvailable,Re as isPlatformAuthenticatorAvailable};
1
+ var ke=Object.defineProperty;var Be=(t,e)=>{for(var r in e)ke(t,r,{get:e[r],enumerable:!0})};var _=class{config;constructor(e){this.config=e}getAppId(){if(this.config.appId)return this.config.appId;let e=/https:\/\/([0-9a-fA-F-]+)\.api.*\.loginid\.io/,r=this.config.baseUrl.match(e);if(r)return r[1];throw new Error("Invalid LoginID base URL. App ID not found.")}},K=_;var Se=t=>t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""),ve=t=>{if(!t)return t;let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r=[],s=0;for(;s<t.length;){let i=t.charCodeAt(s++),a=t.charCodeAt(s++),u=t.charCodeAt(s++),p=i<<16|a<<8|u;r.push(e[p>>18&63]+e[p>>12&63]+e[p>>6&63]+e[p&63])}let o=r.join(""),n=t.length%3;return n?o.slice(0,n-3)+"===".slice(n||3):o},we=t=>{let e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",r={},s=String.fromCharCode;for(let a=0;a<64;a++)r[e.charAt(a)]=a;let o=0,n=0,i="";for(let a of t){let u=r[a];if(u!==void 0)for(o=(o<<6)+u,n+=6;n>=8;)i+=s(o>>(n-=8)&255)}return i},l=t=>{let e="",r=new Uint8Array(t);for(let o=0;o<r.byteLength;o++)e+=String.fromCharCode(r[o]);let s=ve(e);return Se(s)},R=t=>{t=t.replace(/-/g,"+").replace(/_/g,"/");let e=we(t),r=new Uint8Array(e.length);for(let s=0;s<e.length;s++)r[s]=e.charCodeAt(s);return r.buffer},ae=()=>crypto.randomUUID?crypto.randomUUID():window.crypto.getRandomValues(new Uint32Array(4)).join("-"),ue=(t,e)=>{e.forEach(r=>{Object.getOwnPropertyNames(r.prototype).forEach(s=>{Object.defineProperty(t.prototype,s,Object.getOwnPropertyDescriptor(r.prototype,s)||Object.create(null))})})},S=t=>{try{let r=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),s=decodeURIComponent(window.atob(r).split("").map(o=>"%"+("00"+o.charCodeAt(0).toString(16)).slice(-2)).join(""));return JSON.parse(s)}catch(e){console.error(e)}},pe=t=>{let r=`; ${document.cookie}`.split(`; ${t}=`);if(r&&r.length===2)return r.pop().split(";").shift()},le=t=>{document.cookie=t},de=t=>{document.cookie=`${t}=; expires=${new Date}`};var j=class{config;constructor(e){this.config=new K(e)}getToken(e){if(e.authzToken)return e.authzToken;{let r=this.getJwtCookie();return r||""}}getSessionInfo(){if(!this.isLoggedIn())return null;let e=S(this.getJwtCookie()||"{}");return{username:e.username,id:e.sub}}getJwtCookieName(){return`LoginID_${this.config.getAppId()}_token`}setJwtCookie(e){let r=S(e),s=new Date(r.exp*1e3).toUTCString(),o=`${this.getJwtCookieName()}=${e}; expires=${s}`;le(o)}getJwtCookie(){return pe(this.getJwtCookieName())}isLoggedIn(){return!!this.getJwtCookie()}logout(){de(this.getJwtCookieName())}},ce=j;var g=class{constructor(e){this.config=e}};var m=class extends Error{url;status;statusText;body;request;constructor(e,r,s){super(s),this.name="ApiError",this.url=r.url,this.status=r.status,this.statusText=r.statusText,this.body=r.body,this.request=e}};var v=class extends Error{constructor(e){super(e),this.name="CancelError"}get isCancelled(){return!0}},b=class{#t;#r;#e;#o;#n;#i;#s;constructor(e){this.#t=!1,this.#r=!1,this.#e=!1,this.#o=[],this.#n=new Promise((r,s)=>{this.#i=r,this.#s=s;let o=a=>{this.#t||this.#r||this.#e||(this.#t=!0,this.#i&&this.#i(a))},n=a=>{this.#t||this.#r||this.#e||(this.#r=!0,this.#s&&this.#s(a))},i=a=>{this.#t||this.#r||this.#e||this.#o.push(a)};return Object.defineProperty(i,"isResolved",{get:()=>this.#t}),Object.defineProperty(i,"isRejected",{get:()=>this.#r}),Object.defineProperty(i,"isCancelled",{get:()=>this.#e}),e(o,n,i)})}get[Symbol.toStringTag](){return"Cancellable Promise"}then(e,r){return this.#n.then(e,r)}catch(e){return this.#n.catch(e)}finally(e){return this.#n.finally(e)}cancel(){if(!(this.#t||this.#r||this.#e)){if(this.#e=!0,this.#o.length)try{for(let e of this.#o)e()}catch(e){console.warn("Cancellation threw an error",e);return}this.#o.length=0,this.#s&&this.#s(new v("Request aborted"))}}get isCancelled(){return this.#e}};var M=t=>t!=null,w=t=>typeof t=="string",J=t=>w(t)&&t!=="",$=t=>typeof t=="object"&&typeof t.type=="string"&&typeof t.stream=="function"&&typeof t.arrayBuffer=="function"&&typeof t.constructor=="function"&&typeof t.constructor.name=="string"&&/^(Blob|File)$/.test(t.constructor.name)&&/^(Blob|File)$/.test(t[Symbol.toStringTag]),me=t=>t instanceof FormData,De=t=>{try{return btoa(t)}catch{return Buffer.from(t).toString("base64")}},Ne=t=>{let e=[],r=(o,n)=>{e.push(`${encodeURIComponent(o)}=${encodeURIComponent(String(n))}`)},s=(o,n)=>{M(n)&&(Array.isArray(n)?n.forEach(i=>{s(o,i)}):typeof n=="object"?Object.entries(n).forEach(([i,a])=>{s(`${o}[${i}]`,a)}):r(o,n))};return Object.entries(t).forEach(([o,n])=>{s(o,n)}),e.length>0?`?${e.join("&")}`:""},Ue=(t,e)=>{let r=t.ENCODE_PATH||encodeURI,s=e.url.replace("{api-version}",t.VERSION).replace(/{(.*?)}/g,(n,i)=>e.path?.hasOwnProperty(i)?r(String(e.path[i])):n),o=`${t.BASE}${s}`;return e.query?`${o}${Ne(e.query)}`:o},Fe=t=>{if(t.formData){let e=new FormData,r=(s,o)=>{w(o)||$(o)?e.append(s,o):e.append(s,JSON.stringify(o))};return Object.entries(t.formData).filter(([s,o])=>M(o)).forEach(([s,o])=>{Array.isArray(o)?o.forEach(n=>r(s,n)):r(s,o)}),e}},L=async(t,e)=>typeof e=="function"?e(t):e,Ke=async(t,e)=>{let[r,s,o,n]=await Promise.all([L(e,t.TOKEN),L(e,t.USERNAME),L(e,t.PASSWORD),L(e,t.HEADERS)]),i=Object.entries({Accept:"application/json",...n,...e.headers}).filter(([a,u])=>M(u)).reduce((a,[u,p])=>({...a,[u]:String(p)}),{});if(J(r)&&(i.Authorization=`Bearer ${r}`),J(s)&&J(o)){let a=De(`${s}:${o}`);i.Authorization=`Basic ${a}`}return e.body&&(e.mediaType?i["Content-Type"]=e.mediaType:$(e.body)?i["Content-Type"]=e.body.type||"application/octet-stream":w(e.body)?i["Content-Type"]="text/plain":me(e.body)||(i["Content-Type"]="application/json")),new Headers(i)},Le=t=>{if(t.body!==void 0)return t.mediaType?.includes("/json")?JSON.stringify(t.body):w(t.body)||$(t.body)||me(t.body)?t.body:JSON.stringify(t.body)},He=async(t,e,r,s,o,n,i)=>{let a=new AbortController,u={headers:n,body:s??o,method:e.method,signal:a.signal};return t.WITH_CREDENTIALS&&(u.credentials=t.CREDENTIALS),i(()=>a.abort()),await fetch(r,u)},Ve=(t,e)=>{if(e){let r=t.headers.get(e);if(w(r))return r}},We=async t=>{if(t.status!==204)try{let e=t.headers.get("Content-Type");if(e)return["application/json","application/problem+json"].some(o=>e.toLowerCase().startsWith(o))?await t.json():await t.text()}catch(e){console.error(e)}},ze=(t,e)=>{let s={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable",...t.errors}[e.status];if(s)throw new m(t,e,s);if(!e.ok){let o=e.status??"unknown",n=e.statusText??"unknown",i=(()=>{try{return JSON.stringify(e.body,null,2)}catch{return}})();throw new m(t,e,`Generic Error: status: ${o}; status text: ${n}; body: ${i}`)}},ye=(t,e)=>new b(async(r,s,o)=>{try{let n=Ue(t,e),i=Fe(e),a=Le(e),u=await Ke(t,e);if(!o.isCancelled){let p=await He(t,e,n,a,i,u,o),d=await We(p),F=Ve(p,e.responseHeader),z={url:n,ok:p.ok,status:p.status,statusText:p.statusText,body:F??d};ze(e,z),r(z.body)}}catch(n){s(n)}});var H=class extends g{constructor(e){super(e)}request(e){return ye(this.config,e)}};var C=class{constructor(e){this.httpRequest=e}authAuthComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthInit({requestBody:e,userAgent:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/init",headers:{"User-Agent":r},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequest({authorization:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestEmail({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/email",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeRequestSms({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/sms",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}authAuthCodeVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/auth/otp/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var P=class{constructor(e){this.httpRequest=e}mgmtGrantCreate({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/grant",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}mgmtTokenVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/mgmt/token/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",500:"InternalServerError: Internal Server Error response."}})}};var q=class{constructor(e){this.httpRequest=e}passkeysPasskeysList({authorization:e}){return this.httpRequest.request({method:"GET",url:"/fido2/v2/passkeys",headers:{Authorization:e},errors:{401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyDelete({id:e,authorization:r}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:r},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}passkeysPasskeyRename({id:e,requestBody:r,authorization:s}){return this.httpRequest.request({method:"PUT",url:"/fido2/v2/passkeys/{id}",path:{id:e},headers:{Authorization:s},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var A=class{constructor(e){this.httpRequest=e}profileProfileDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}",path:{id:e},errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/email",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneDelete({id:e}){return this.httpRequest.request({method:"DELETE",url:"/fido2/v2/profile/{id}/phone",path:{id:e},errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneUpdate({id:e,requestBody:r}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/{id}/phone",path:{id:e},body:r,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfileEmailVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/email/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}profileProfilePhoneVerify({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/profile/phone/verify",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var I=class{constructor(e){this.httpRequest=e}regRegComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}regRegInit({requestBody:e,userAgent:r,authorization:s}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/reg/init",headers:{"User-Agent":r,Authorization:s},body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",401:"Unauthorized: Unauthorized response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}};var T=class{constructor(e){this.httpRequest=e}txTxComplete({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/complete",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",403:"Forbidden: Forbidden response.",500:"InternalServerError: Internal Server Error response."}})}txTxInit({requestBody:e}){return this.httpRequest.request({method:"POST",url:"/fido2/v2/tx/init",body:e,mediaType:"application/json",errors:{400:"BadRequest: Bad Request response.",404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var O=class{constructor(e){this.httpRequest=e}versionVersionShow(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/version"})}};var x=class{constructor(e){this.httpRequest=e}wellKnownJwks(){return this.httpRequest.request({method:"GET",url:"/fido2/v2/.well-known/jwks.json",errors:{404:"NotFound: Not Found response.",500:"InternalServerError: Internal Server Error response."}})}};var E=class{auth;mgmt;passkeys;profile;reg;tx;version;wellKnown;request;constructor(e,r=H){this.request=new r({BASE:e?.BASE??"https://api.loginid.io/fido2/v2",VERSION:e?.VERSION??"2.0",WITH_CREDENTIALS:e?.WITH_CREDENTIALS??!1,CREDENTIALS:e?.CREDENTIALS??"include",TOKEN:e?.TOKEN,USERNAME:e?.USERNAME,PASSWORD:e?.PASSWORD,HEADERS:e?.HEADERS,ENCODE_PATH:e?.ENCODE_PATH}),this.auth=new C(this.request),this.mgmt=new P(this.request),this.passkeys=new q(this.request),this.profile=new A(this.request),this.reg=new I(this.request),this.tx=new T(this.request),this.version=new O(this.request),this.wellKnown=new x(this.request)}};var G=class{config;service;session;constructor(e){this.config=new K(e),this.service=new E({BASE:e.baseUrl}),this.session=new ce(e)}},y=G;var Y=class extends Error{constructor(e){super(e),this.name="AbortError"}},Q=Y;var X=class t{static abortController=new AbortController;static abortWebAuthnRequest=()=>{let e=new Q("Cancelling current WebAuthn request");t.abortController.abort(e)};static renewWebAuthnAbortController=()=>{t.abortWebAuthnRequest();let e=new AbortController;t.abortController=e};static assignWebAuthnAbortController=e=>{t.abortWebAuthnRequest(),t.abortController=e}},h=X;var f=(t,e,r)=>({...r,authzToken:e||r.authzToken||"",usernameType:r.usernameType||"other",displayName:r.displayName||t,callbacks:r.callbacks||{}}),fe=(t,e)=>({...f(t,"",e),txType:e.txType||"raw",nonce:e.nonce||ae()}),k=(t,e=!0,r=!1)=>({token:t,isAuthenticated:e,isFallback:r});var Z=class extends y{constructor(e){super(e)}async validateOtp(e,r,s={}){let o=f(e,"",s),n={authCode:r,user:{username:e,usernameType:o.usernameType}},i=await this.service.auth.authAuthCodeVerify({requestBody:n}),a=k(i.jwtAccess);return h.renewWebAuthnAbortController(),this.session.setJwtCookie(a.token),a}async requestAndSendOtp(e,r="email",s={}){let o=f(e,"",s),n={user:{username:e,usernameType:o.usernameType}};switch(r){case"email":await this.service.auth.authAuthCodeRequestEmail({requestBody:n});break;case"sms":await this.service.auth.authAuthCodeRequestSms({requestBody:n});break;default:throw new Error("Invalid message method")}}},V=Z;import{UAParser as _e}from"ua-parser-js";var D=t=>{let e={clientType:"browser",screenWidth:window.screen.width,screenHeight:window.screen.height,clientName:"",clientVersion:"",osName:"",osVersion:"",osArch:""};return t&&(e.deviceId=t),e},je=(t,e)=>{let r=t.split(".").map(Number),s=e.split(".").map(Number),o=Math.max(r.length,s.length);for(let n=0;n<o;n++){let i=n<r.length?r[n]:0,a=n<s.length?s[n]:0;if(i<a)return-1;if(i>a)return 1}return 0};async function he(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable?!1:await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable()}catch{return!1}}async function Je(){try{return!window.PublicKeyCredential||!window.PublicKeyCredential.isConditionalMediationAvailable?!1:await window.PublicKeyCredential.isConditionalMediationAvailable()}catch{return!1}}async function Re(){let t=new _e(window.navigator.userAgent).getResult(),e={solution:"",deviceSupported:!1};if(!window.PublicKeyCredential)return e.solution="Your browser seems to be outdated. Please upgrade to the latest version.",e;if(!await window.PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable())switch(t.os.name){case"Mac OS":{let s=t.browser.version||"";return t.browser.name==="Firefox"&&je(s,"122.0")<0?(e.solution="Please update your Firefox browser to the latest version.",e):(e.solution="Enable Touch ID on your device.",e)}case"iOS":return e.solution="Enable Face ID or Touch ID on your device.",e;case"Windows":return e.solution="Enable Windows Hello on your device. See here: https://support.microsoft.com/en-us/windows/learn-about-windows-hello-and-set-it-up-dae28983-8242-bb2a-d3d1-87c9d265a5f0.",e;case"Android":return t.browser.name==="Firefox"?(e.solution="Passkeys may not be supported on your Firefox browser. Please switch to a Chromium browser.",e):(e.solution="Enable device unlock via fingerprint, PIN, or facial recognition on your device.",e);default:return e.solution="Enable device unlock features such as fingerprint, PIN, or facial recognition.",e}return e.deviceSupported=!0,e}async function Me(){let t=await he(),e=await Re();return t&&e.deviceSupported}var be={};Be(be,{ApiError:()=>m,AuthService:()=>C,BaseHttpRequest:()=>g,CancelError:()=>v,CancelablePromise:()=>b,LoginIDService:()=>E,MgmtService:()=>P,OpenAPI:()=>ge,PasskeysService:()=>q,ProfileService:()=>A,RegService:()=>I,TxService:()=>T,VersionService:()=>O,WellKnownService:()=>x});var ge={BASE:"https://api.loginid.io/fido2/v2",VERSION:"2.0",WITH_CREDENTIALS:!1,CREDENTIALS:"include",TOKEN:void 0,USERNAME:void 0,PASSWORD:void 0,HEADERS:void 0,ENCODE_PATH:void 0};var ee=class extends y{constructor(e){super(e)}async verifyConfigSettings(){let e={isValid:!0};try{this.config.getAppId()}catch{return e.isValid=!1,e.solution="Please verify that your base URL is correct.",e.code="invalid_app_id",e.message="Invalid app ID",e}try{let r=f("","",{}),s={app:{id:this.config.getAppId()},deviceInfo:D(),user:{username:"",usernameType:r.usernameType}};await this.service.auth.authAuthInit({requestBody:s})}catch(r){return e.isValid=!1,e.solution="Verify that your application exists and the base URL is correct.",e.code="unknown_error",e.message="Unknown error.",r instanceof m&&(e.code=r.body.msgCode||"unknown_error",e.message=r.body.msg||r.body.message||"Unknown error."),e}return e}getSessionInfo(){return this.session.getSessionInfo()}logout(){this.session.logout()}},Ce=ee;var Pe=t=>`LoginID_${t}_device-id`,B=class{static persistDeviceId(e,r){r&&localStorage.setItem(Pe(e),r)}static getDeviceId(e){return localStorage.getItem(Pe(e))||""}};var qe=t=>[...t.crossAuthMethods,...t.fallbackMethods];var te=class extends Error{code;constructor(e,r,s){super(e),this.code=r,this.cause=s}},c=te;var re=class extends Error{constructor(e){super(e),this.name="LoginIDError"}},oe=re;var Ae=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="ConstraintError"){if(s?.authenticatorSelection?.requireResidentKey===!0)return new c("Your device does not support discoverable credentials","ERROR_DISCOVERABLE_CREDENTIALS_UNSUPPORTED",t);if(s?.authenticatorSelection?.userVerification==="required")return new c("Your device does not support user verification","ERROR_USER_VERIFICATION_UNSUPPORTED",t)}if(r==="InvalidStateError")return new c("A passkey already exists on your device","ERROR_PASSKEY_EXISTS",t);if(r==="NotAllowedError")return new c("Passkey creation has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="NotSupportedError")return new c("Your device does not support the algorithms required for passkey creation","ERROR_ALGORITHMS_UNSUPPORTED",t);if(r==="SecurityError"){let o=s?.rp?.id;if(o!==window.location.hostname)return new c(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new c("Your device could not process the requested options or could not create a new passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},Ie=(t,e)=>{let r=t.name,{publicKey:s}=e;if(r==="AbortError"&&e.signal instanceof AbortSignal)return new c("Passkey authentication has been aborted","ERROR_PASSKEY_ABORTED",t);if(r==="NotAllowedError")return new c("Passkey authentication has failed","ERROR_GENERAL_ERROR_SEE_CAUSE_FIELD",t);if(r==="SecurityError"){let o=s?.rpId;if(o!==window.location.hostname)return new c(`The domain of the relying party (${o}) is invalid for this domain`,"ERROR_DOMAIN_MISMATCH",t)}return r==="UnknownError"?new c("Your device could not process the requested options or could not authenticate with a passkey","ERROR_AUTHENTICATOR_UNKNOWN_ERROR",t):t},yr=new oe("User needs to be logged in to perform this operation."),Te=new oe("No login options available.");var N=async t=>{let e;if(t.excludeCredentials!==void 0){e=[];for(let o of t.excludeCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};e.push(n)}}let r=t.pubKeyCredParams,s={publicKey:{attestation:t.attestation,authenticatorSelection:{...t.authenticatorSelection},challenge:R(t.challenge),excludeCredentials:e,extensions:t.extensions,pubKeyCredParams:r,rp:t.rp,timeout:t.timeout,user:{...t.user,id:R(t.user.id)}}};try{let o=await navigator.credentials.create(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Ae(o,s):o}},U=async(t,e={})=>{let r;if(t.allowCredentials!==void 0){r=[];for(let o of t.allowCredentials){let n={id:R(o.id),transports:o.transports,type:o.type};r.push(n)}}let s={...e.autoFill&&{mediation:"conditional"},...e.abortController&&{signal:e.abortController.signal},publicKey:{allowCredentials:r,challenge:R(t.challenge),extensions:t.extensions,rpId:t.rpId,timeout:t.timeout,userVerification:t.userVerification}};try{let o=await navigator.credentials.get(s);if(o===null)throw new Error("Failed to create the passkey credential.");return o}catch(o){throw o instanceof Error?Ie(o,s):o}};var se=class extends V{constructor(e){super(e)}async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e;h.renewWebAuthnAbortController();let o=await N(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),p=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:l(n.attestationObject),clientDataJSON:l(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:l(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:l(u)},...p&&{transports:p}},session:s}}async createPasskey(e,r="",s={}){let o=this.config.getAppId(),n=D(B.getDeviceId(o)),i=f(e,r,s);i.authzToken=this.session.getToken(i),i.authzToken&&S(i.authzToken).username!==e&&(i.authzToken="");let a={app:{id:o},deviceInfo:n,user:{username:e,usernameType:i.usernameType,displayName:i.displayName}},u=await this.service.reg.regRegInit({requestBody:a,...i.authzToken&&{authorization:i.authzToken}}),p=await this.createNavigatorCredential(u),d=await this.service.reg.regRegComplete({requestBody:p}),F=k(d.jwtAccess);return this.session.setJwtCookie(d.jwtAccess),B.persistDeviceId(o,d.deviceID),F}async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e;r.abortController?h.assignWebAuthnAbortController(r.abortController):(h.renewWebAuthnAbortController(),r.abortController=h.abortController);let n=await U(s,r),i=n.response;return{assertionResult:{authenticatorData:l(i.authenticatorData),clientDataJSON:l(i.clientDataJSON),credentialId:n.id,signature:l(i.signature),...i.userHandle&&{userHandle:l(i.userHandle)}},session:o}}async authenticateWithPasskey(e="",r={}){let s=this.config.getAppId(),o=D(B.getDeviceId(s)),n=f(e,"",r),i={app:{id:s},deviceInfo:o,user:{username:e,usernameType:n.usernameType}},a=await this.service.auth.authAuthInit({requestBody:i});switch(a.action){case"proceed":{let u=await this.getNavigatorCredential(a,r),p=await this.service.auth.authAuthComplete({requestBody:u}),d=k(p.jwtAccess);return this.session.setJwtCookie(d.token),n?.callbacks?.onSuccess&&await n.callbacks.onSuccess(d),d}case"crossAuth":case"fallback":{if(n?.callbacks?.onFallback){let u=qe(a);await n.callbacks.onFallback(e,u)}return k("",!1,!0)}default:throw Te}}async authenticateWithPasskeyAutofill(e={}){return e.autoFill=!0,await this.authenticateWithPasskey("",e)}async requestOtp(e,r={}){if(r.authzToken=this.session.getToken(r),!r.authzToken){let o=await this.authenticateWithPasskey(e,r);r.authzToken=o.token}return await this.service.auth.authAuthCodeRequest({authorization:r.authzToken})}async confirmTransaction(e,r,s={}){let o=fe(e,s),n={username:e,txPayload:r,nonce:o.nonce,txType:o.txType},{assertionOptions:i,session:a}=await this.service.tx.txTxInit({requestBody:n}),u={action:"proceed",crossAuthMethods:[],fallbackMethods:[],assertionOptions:i,session:a},{assertionResult:p}=await this.getNavigatorCredential(u),d={authenticatorData:p.authenticatorData,clientData:p.clientDataJSON,keyHandle:p.credentialId,session:a,signature:p.signature};return await this.service.tx.txTxComplete({requestBody:d})}},Oe=se;var ne=class extends y{constructor(e){super(e)}async listPasskeys(e={}){let r=this.session.getToken(e);return await this.service.passkeys.passkeysPasskeysList({authorization:r})}async renamePasskey(e,r,s={}){let o=this.session.getToken(s),n={name:r};await this.service.passkeys.passkeysPasskeyRename({authorization:o,id:e,requestBody:n})}async deletePasskey(e,r={}){let s=this.session.getToken(r);await this.service.passkeys.passkeysPasskeyDelete({authorization:s,id:e})}},xe=ne;var W=class extends y{constructor(e){super(e)}};ue(W,[y,Oe,V,xe,Ce]);var Ee=W;var ie=class{static async getNavigatorCredential(e,r={}){let{assertionOptions:s,session:o}=e,n=await U(s,r),i=n.response;return{assertionResult:{authenticatorData:l(i.authenticatorData),clientDataJSON:l(i.clientDataJSON),credentialId:n.id,signature:l(i.signature),...i.userHandle&&{userHandle:l(i.userHandle)}},session:o}}static async createNavigatorCredential(e){let{registrationRequestOptions:r,session:s}=e,o=await N(r),n=o.response,i=n.getPublicKey&&n.getPublicKey(),a=n.getPublicKeyAlgorithm&&n.getPublicKeyAlgorithm(),u=n.getAuthenticatorData&&n.getAuthenticatorData(),p=n.getTransports&&n.getTransports();return{creationResult:{attestationObject:l(n.attestationObject),clientDataJSON:l(n.clientDataJSON),credentialId:o.id,...i&&{publicKey:l(i)},...a&&{publicKeyAlgorithm:a},...u&&{authenticatorData:l(u)},...p&&{transports:p}},session:s}}};var Zr=Ee;export{Q as AbortError,m as ApiError,be as LoginIDAPI,Ee as LoginIDWebSDK,c as PasskeyError,ie as WebAuthnHelper,Me as canCreatePasskey,N as createPasskeyCredential,Zr as default,Re as doesDeviceSupportPasskeys,U as getPasskeyCredential,Je as isConditionalUIAvailable,he as isPlatformAuthenticatorAvailable};
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loginid/websdk3",
3
- "version": "3.0.4",
3
+ "version": "3.0.6",
4
4
  "description": "",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.js",