@authowl/core 0.12.0 → 0.14.0
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 +3 -2
- package/dist/chunk-MX7KKUAW.js +1 -0
- package/dist/chunk-T5SH3ZZP.js +1 -0
- package/dist/{client-1cjryEHU.d.cts → client-DOOkDLWg.d.cts} +31 -3
- package/dist/{client-CzV2XWt6.d.ts → client-jpaYv3wu.d.ts} +31 -3
- package/dist/index.cjs +3 -3
- package/dist/index.d.cts +11 -2
- package/dist/index.d.ts +11 -2
- package/dist/index.js +3 -3
- package/dist/messages.cjs +1 -1
- package/dist/messages.d.cts +1 -0
- package/dist/messages.d.ts +1 -0
- package/dist/messages.js +1 -1
- package/dist/native.cjs +2 -1
- package/dist/native.d.cts +2 -2
- package/dist/native.d.ts +2 -2
- package/dist/native.js +1 -1
- package/dist/server.cjs +2 -2
- package/dist/server.d.cts +894 -52
- package/dist/server.d.ts +894 -52
- package/dist/server.js +1 -1
- package/dist/session-handoff-6B5KZXQV.js +2 -0
- package/package.json +5 -1
- package/dist/chunk-SM5LS47O.js +0 -1
package/README.md
CHANGED
|
@@ -85,8 +85,9 @@ try {
|
|
|
85
85
|
}
|
|
86
86
|
```
|
|
87
87
|
|
|
88
|
-
See the full [Admin API reference](https://github.com/mstfash/authowl-sdk/blob/main/docs/admin-api.md)
|
|
89
|
-
|
|
88
|
+
See the full [Admin API reference](https://github.com/mstfash/authowl-sdk/blob/main/docs/admin-api.md),
|
|
89
|
+
the [phone OTP and Akedly Shield guide](https://github.com/mstfash/authowl-sdk/blob/main/docs/phone-otp.md),
|
|
90
|
+
and the [webhook signature guide](https://github.com/mstfash/authowl-sdk/blob/main/docs/webhooks.md).
|
|
90
91
|
Webhook receivers import `verifyWebhook` from `@authowl/core/server`; it works
|
|
91
92
|
in Node and worker Web Crypto runtimes.
|
|
92
93
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import {f,g,q as q$1,j as j$1,h,p,i,n,s,u,o,k,r,m as m$1,l}from'./chunk-KPXCQZUX.js';import {a}from'./chunk-T5SH3ZZP.js';function yi(e){let t=e?.enabledMethods??["password"],n=t.includes("password"),i=t.includes("passkey"),o=e?.authentication,a=e?.mfa;return {emailSignUp:o?.email.signUp??t.some(r=>r==="password"||r==="magic_link"||r==="email_otp"),passwordSignUp:o?.password.signUp??n,phoneSignUp:o?.phone.signUp??t.includes("phone_otp"),passwordSignIn:o?.email.signIn.includes("password")??n,passwordMinLength:o?.password.minLength??8,passwordMaxLength:o?.password.maxLength??128,magicLinkSignIn:o?.email.signIn.includes("magic_link")??t.includes("magic_link"),emailOtpSignIn:o?.email.signIn.includes("email_otp")??t.includes("email_otp"),phoneSignIn:o?.phone.signIn??t.includes("phone_otp"),usernameSignIn:o?.username.signIn??false,collectUsername:o?.username.collectOnSignUp??false,passkeySignIn:o?.passkey.signIn??i,passkeyAdd:o?.passkey.add??i,firstLastName:e?.userModel?.firstLastName??false,emailChange:e===null?false:e.userModel?.emailChange??true,accountDeletion:e?.userModel?.accountDeletion??e?.accountDeletion??false,emailVerificationRequired:e?.emailVerification?.required??e?.requireEmailVerification??false,emailVerificationMethod:e?.emailVerification?.method??"link",totp:a?.totp??e?.twoFactor??false,mfaRequired:a?.required??e?.mfaRequired??false,backupCodes:a?.backupCodes??e?.twoFactor??false,legacyNameField:e?.authentication===void 0}}var Qt="x-authowl-turnstile-token",Zt=1e4,en=32,tn=2e4;function N(e,t){return {post:(n,i,o,a)=>e.request(n,{method:"POST",body:i,fetchOptions:o,decode:a}),mutation:async(n,i)=>{let o=await n;return o.error===null&&(i===void 0||o.data!==null&&i(o.data))&&t(),o}}}function ke(e,t=e.projectBaseURL){return {async request(n,i={}){let o=rn(t,n,i.query),a=i.method??(i.body===void 0?"GET":"POST"),r=new Headers(i.fetchOptions?.headers);r.set("x-publishable-key",e.publishableKey),i.fetchOptions?.authChallengeToken&&r.set(Qt,i.fetchOptions.authChallengeToken),i.body!==void 0&&r.set("content-type","application/json");let d={method:a,headers:r,credentials:i.credentials??"include",...i.body===void 0?{}:{body:JSON.stringify(i.body)}},u=Object.freeze({method:a,path:n});await i.fetchOptions?.onRequest?.(u);let f$1=on(a,i.fetchOptions),h;try{h=await nn(e,o,{...d,signal:i.fetchOptions?.signal},f$1);}catch(w){let me=we(w);return await i.fetchOptions?.onError?.(ee(u,me,un(w))),{data:null,error:me}}let{response:S,requestId:s}=h,c=ln(n,h.data),g=c;if(S.ok)try{g=ne(c),i.decode&&(g=i.decode(g));}catch{let w=we(new f("invalid_response",s));return await i.fetchOptions?.onError?.(ee(u,w,"invalid_response")),{data:null,error:w}}let b=Object.freeze({...u,status:S.status,...s===void 0?{}:{requestId:s}});if(await i.fetchOptions?.onResponse?.(b),!S.ok){let w=an(S,c,s);return await i.fetchOptions?.onError?.(ee(u,w,"api")),{data:null,error:w}}return await i.fetchOptions?.onSuccess?.(b),{data:g,error:null}}}}async function nn(e,t,n,i){let o=Date.now()+Zt;for(let a=0;a<i;a+=1){let r=o-Date.now();if(r<=0)throw new f("timeout");try{let d=await g({fetchImpl:e.fetch??fetch,url:t,init:n,timeoutMs:Math.max(1,Math.ceil(r)),allowHttpLoopback:e.decoded.env==="test"});if(d.response.status<500||a===i-1)return d}catch(d){if(a===i-1||!(d instanceof f)||d.kind!=="network")throw d}await cn(50*2**a,n.signal,o);}throw new f("network")}function on(e,t){if(e!=="GET"||t?.authChallengeToken)return 1;let n=t?.retry;return typeof n!="number"||!Number.isFinite(n)?1:Math.min(Math.max(Math.trunc(n),0),3)+1}function rn(e,t,n){let i=new URL(`${e}${t.startsWith("/")?t:`/${t}`}`);for(let[o,a]of Object.entries(n??{}))a!==void 0&&i.searchParams.set(o,String(a));return i.toString()}function an(e,t,n){let i=F(t)?t:{},o=sn(i,e.headers);return {status:e.status,statusText:e.statusText,code:typeof i.code=="string"?i.code:void 0,...n===void 0?{}:{requestId:n},...typeof i.current_version=="number"?{currentVersion:i.current_version}:{},...o!==void 0?{retryAfterSeconds:o}:{},message:typeof i.message=="string"?i.message:typeof i.error=="string"?i.error:typeof i.detail=="string"?i.detail:e.statusText||"Request failed"}}function sn(e,t){let n=(typeof e.retryAfterSeconds=="number"&&Number.isFinite(e.retryAfterSeconds)?e.retryAfterSeconds:void 0)??be(t.get("retry-after"))??be(t.get("x-retry-after"));if(n!==void 0)return Math.min(Math.max(Math.trunc(n),1),86400)}function be(e){if(!e)return;let t=e.trim();if(!/^\d+$/.test(t))return;let n=Number(t);return Number.isFinite(n)?n:void 0}function we(e){let t=e instanceof f?e.kind:"network";return {status:0,...{aborted:{statusText:"ABORTED",code:"REQUEST_ABORTED",message:"The request was cancelled."},timeout:{statusText:"TIMEOUT",code:"REQUEST_TIMEOUT",message:"The request timed out."},response_too_large:{statusText:"INVALID_RESPONSE",code:"RESPONSE_TOO_LARGE",message:"The service response was too large."},invalid_response:{statusText:"INVALID_RESPONSE",code:"INVALID_RESPONSE",message:"The service returned an invalid response."},network:{statusText:"FETCH_ERROR",code:"FETCH_ERROR",message:"Network request failed."}}[t],...e instanceof f&&e.requestId?{requestId:e.requestId}:{}}}function ee(e,t,n){return Object.freeze({...e,status:t.status??0,...t.requestId===void 0?{}:{requestId:t.requestId},failure:n})}function un(e){return e instanceof f?e.kind:"network"}function cn(e,t,n){return new Promise((i,o)=>{if(t?.aborted){o(new f("aborted"));return}let a=n-Date.now();if(a<=0){o(new f("timeout"));return}let r=Math.min(e,a),d=()=>{clearTimeout(u),o(new f("aborted"));},u=setTimeout(()=>{t?.removeEventListener("abort",d),Date.now()>=n?o(new f("timeout")):i();},r);t?.addEventListener("abort",d,{once:true}),t?.aborted&&d();})}function ne(e,t="",n=0,i={nodes:0}){if(i.nodes+=1,n>en||i.nodes>tn)throw new Error("response traversal limit exceeded");if(typeof e=="string"&&/^(?:createdAt|updatedAt|expiresAt)$/.test(t)){let o=new Date(e);return Number.isNaN(o.getTime())?e:o}return Array.isArray(e)?e.map(o=>ne(o,"",n+1,i)):F(e)?Object.fromEntries(Object.entries(e).map(([o,a])=>[o,dn(o)?a:ne(a,o,n+1,i)])):e}function dn(e){return e==="metadata"||e==="public_metadata"||e==="unsafe_metadata"||e==="private_metadata"||e==="publicMetadata"||e==="unsafeMetadata"||e==="privateMetadata"}function ln(e,t){if(e==="/list-sessions"&&Array.isArray(t))return t.map(o=>F(o)?te(o):o);if(!F(t))return t;let i=e==="/change-password"||e==="/passkey/verify-authentication"||e==="/phone-otp/verify"||e==="/sign-up/email"||e.startsWith("/sign-in/")||e.startsWith("/two-factor/verify-")?te(t):t;return e==="/sign-up/email"&&!("sessionCreated"in i)&&(i={...i,sessionCreated:typeof t.token=="string"&&t.token.length>0}),(e==="/get-session"||e==="/passkey/verify-authentication")&&F(i.session)&&(i={...i,session:te(i.session)}),i}function te(e){if(!Object.hasOwn(e,"token"))return e;let t={...e};return delete t.token,t}function F(e){return !!e&&typeof e=="object"&&!Array.isArray(e)}function Se(){let e=globalThis.crypto.getRandomValues(new Uint8Array(16));e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,n=>n.toString(16).padStart(2,"0")).join("");return `${t.slice(0,8)}-${t.slice(8,12)}-${t.slice(12,16)}-${t.slice(16,20)}-${t.slice(20)}`}function Ie(e,t){let n=new Set,i=null,o=null,a=null,r,d=c=>{h(c);};r={data:null,isPending:true,isRefetching:false,error:null,refetch:d};function u(c){r=c;for(let g of n)g();}async function f(c){return e.request("/get-session",{query:c?.query,decode:Re})}async function h(c){a?.abort();let g=new AbortController;a=g,u({...r,isPending:r.data===null&&r.error===null,isRefetching:r.data!==null});let b=await e.request("/get-session",{query:c?.query,fetchOptions:{signal:g.signal},decode:Re});a===g&&(a=null,u({data:b.data,error:b.error,isPending:false,isRefetching:false,refetch:d}));}function S(){if(typeof window>"u"||o)return;let c=()=>{h();},g=()=>{document.visibilityState==="visible"&&h();};window.addEventListener("focus",c),document.addEventListener("visibilitychange",g),typeof BroadcastChannel<"u"&&(i=new BroadcastChannel(`authowl:${t}`),i.addEventListener("message",c)),o=()=>{window.removeEventListener("focus",c),document.removeEventListener("visibilitychange",g),i?.close(),i=null,o=null;};}function s(c){return n.add(c),n.size===1&&(S(),h()),()=>{n.delete(c),n.size===0&&(a?.abort(),a=null,o?.());}}return {store:{subscribe:s,getSnapshot:()=>r},getSession:f,notifyMutation(){i?.postMessage({type:"session-changed"}),n.size>0&&h({query:{disableCookieCache:true}});}}}function Re(e){if(e===null)return null;let t=h(e);return (t.session===void 0||t.user===void 0)&&p(),{session:o(t.session),user:n(t.user)}}async function Pe(e,t){return e.request("/user/metadata",{fetchOptions:t,decode:ve})}async function Te(e,t,n){return e.request("/user/metadata",{method:"PATCH",body:{expected_version:t.expectedVersion,unsafe_metadata:t.unsafeMetadata},fetchOptions:n,decode:ve})}function ve(e){let t=h(e),n=q$1(t.public_metadata),i=q$1(t.unsafe_metadata);if(!Number.isSafeInteger(t.metadata_version)||t.metadata_version<0)throw new TypeError("Invalid AuthOwl metadata response");return {publicMetadata:n,unsafeMetadata:i,metadataVersion:t.metadata_version}}function xe(e,t){let{post:n,mutation:i}=N(e,t);return {getMetadata:o=>Pe(e,o),updateUnsafeMetadata:(o,a)=>Te(e,o,a),updateProfile:(o,a)=>i(n("/update-user",o,a,q)),changeEmail:(o,a)=>i(n("/change-email",o,a,q)),changePassword:(o,a)=>i(n("/change-password",o,a,pn)),listSessions:o=>e.request("/list-sessions",{fetchOptions:o,decode:gn}),revokeSession:({sessionId:o},a)=>i(n("/revoke-session",{sessionId:o},a,q)),revokeOtherSessions:o=>i(n("/revoke-other-sessions",{},o,q)),listSocialAccounts:async o=>{let a=await e.request("/list-accounts",{fetchOptions:o,decode:fn});if(!a.data)return {data:null,error:a.error};let r=a.data.length>1;return {...a,data:a.data.filter(d=>d.providerId!=="credential").map(d=>({...d,canUnlink:r}))}},linkSocial:(o,a)=>n("/link-social",o,a,mn),unlinkSocial:(o,a)=>i(n("/unlink-account",o,a,q)),delete:(o={},a)=>i(n("/delete-user",o,a,hn))}}function q(e){let t=h(e);return {status:j$1(t.status)}}function pn(e){let t=h(e);return {user:n(t.user)}}function gn(e){return Array.isArray(e)||p(),e.map(t=>{let n=h(t);return {id:i(n.id),userId:i(n.userId),createdAt:k(n.createdAt),updatedAt:k(n.updatedAt),expiresAt:k(n.expiresAt),...Ce("ipAddress",m$1(n,"ipAddress")),...Ce("userAgent",m$1(n,"userAgent"))}})}function fn(e){return Array.isArray(e)||p(),e.map(t=>{let n=h(t);return {id:i(n.id),userId:i(n.userId),providerId:i(n.providerId),accountId:i(n.accountId),scopes:l(n.scopes),createdAt:k(n.createdAt),updatedAt:k(n.updatedAt)}})}function mn(e){let t=h(e);return {url:i(t.url),redirect:j$1(t.redirect)}}function hn(e){let t=h(e);return {success:j$1(t.success),message:i(t.message)}}function Ce(e,t){return t===void 0?{}:{[e]:t}}var An=new Set(["pending","accepted","rejected","canceled"]),De=1e4;function U(e,t,n){let i=h(e),o={id:m(i.id),name:m(i.name),slug:m(i.slug),createdAt:k(i.createdAt),...K("logo",m$1(i,"logo")),...K("metadata",i.metadata===void 0?void 0:r(i.metadata))};return z(o.id,t),z(o.slug,n),o}function ze(e){return E(e,U)}function ie(e,t,n){return e===null?null:(t===null&&p(),U(e,t,n))}function Ee(e,t,n){if(e===null)return null;let i=h(e),o=U(i,t,n);return {...o,members:E(i.members,a=>Je(a,o.id)),invitations:E(i.invitations,a=>x(a,void 0,o.id))}}function Ne(e,t){let n=E(e,i=>je(i));return j(n.map(i=>i.organizationId),t),n}function Ue(e,t,n){return e===null?null:(t===null&&p(),je(e,t,n))}function Me(e,t){let n=h(e);return (!Number.isSafeInteger(n.total)||n.total<0)&&p(),{members:yn(n.members,t),total:n.total}}function x(e,t,n){let i=h(e),o=m(i.status);An.has(o)||p();let a={id:m(i.id),organizationId:m(i.organizationId),email:m(i.email),role:m(i.role),status:o,inviterId:m(i.inviterId),expiresAt:k(i.expiresAt),createdAt:k(i.createdAt)};return z(a.id,t),z(a.organizationId,n),a}function _e(e,t){let n=E(e,i=>x(i));return j(n.map(i=>i.organizationId),t),n}function Le(e){return E(e,t=>{let n=h(t);return {...x(n),organizationName:m(n.organizationName)}})}function Fe(e,t){let n=h(e);return {...x(n,t),organizationName:m(n.organizationName),organizationSlug:m(n.organizationSlug),inviterEmail:m(n.inviterEmail)}}function qe(e,t){let n=h(e),i=x(n.invitation,t);return {invitation:i,member:M(n.member,void 0,i.organizationId)}}function Ve(e,t){let n=h(e);return n.member!==null&&p(),{invitation:n.invitation===null?null:x(n.invitation,t),member:null}}function He(e,t){return e===null?null:x(e,t)}function Be(e,t,n){let i=h(e);return {member:M(i.member,n,t)}}function M(e,t,n){let i=h(e),o={id:m(i.id),organizationId:m(i.organizationId),userId:m(i.userId),role:m(i.role),createdAt:k(i.createdAt),...i.user===void 0?{}:{user:Ge(i.user)}};return z(o.id,t),z(o.organizationId,n),o}function Ke(e,t){let n=E(e,i=>{let o=h(i);return {organizationId:m(o.organizationId),data:{role:m(o.role),...K("permission",o.permission===void 0?void 0:On(o.permission))}}});return j(n.map(i=>i.organizationId),t),n.map(i=>i.data)}function je(e,t,n){let i=h(e),o=i.updatedAt,a={id:m(i.id),name:m(i.name),organizationId:m(i.organizationId),createdAt:k(i.createdAt),...o===void 0?{}:{updatedAt:k(o)}};return z(a.id,t),z(a.organizationId,n),a}function Je(e,t){let n=h(e);return {...M(n,void 0,t),user:Ge(n.user)}}function yn(e,t){let n=E(e,i=>Je(i));return j(n.map(i=>i.organizationId),t),n}function On(e){let t=h(e),n={};for(let[i,o]of Object.entries(t))(i==="__proto__"||i==="constructor"||i==="prototype"||i.length===0||i.length>De||!Array.isArray(o))&&p(),n[i]=o.map(a=>m(a));return n}function m(e){let t=i(e);return (t.length===0||t.length>De)&&p(),t}function z(e,t){t!==void 0&&e!==t&&p();}function j(e,t){let n=t??e[0];n!==void 0&&e.some(i=>i!==n)&&p();}function Ge(e){let t=h(e);return {id:m(t.id),name:m(t.name),email:m(t.email),...K("image",m$1(t,"image"))}}function E(e,t){return Array.isArray(e)||p(),e.map(n=>t(n))}function K(e,t){return t===void 0?{}:{[e]:t}}function We(e,t,n=()=>null){let{post:i,mutation:o}=N(e,t),a=(r,d,u,f)=>e.request(r,{query:d,fetchOptions:u,decode:f});return {create:(r,d)=>o(i("/organization/create",r,d,U)),list:r=>a("/organization/list",void 0,r,ze),get:(r={},d)=>a("/organization/get-full-organization",{organizationId:r.organizationId,organizationSlug:r.organizationSlug,membersLimit:r.membersLimit},d,u=>Ee(u,r.organizationId,r.organizationSlug)),setActive:(r,d)=>o(i("/organization/set-active",r,d,u=>ie(u,r.organizationId,r.organizationSlug))),listTeams:(r={},d)=>a("/organization/list-teams",{organizationId:r.organizationId},d,u=>Ne(u,r.organizationId)),setActiveTeam:(r,d)=>o(i("/organization/set-active-team",r,d,u=>Ue(u,r.teamId))),update:(r,d)=>o(i("/organization/update",r,d,u=>ie(u,r.organizationId))),delete:(r,d)=>o(i("/organization/delete",r,d,u=>U(u,r.organizationId))),listMembers:(r={},d)=>a("/organization/list-members",{organizationId:r.organizationId,organizationSlug:r.organizationSlug,limit:r.limit,offset:r.offset,sortBy:r.sortBy,sortDirection:r.sortDirection,filterField:r.filterField,filterValue:r.filterValue,filterOperator:r.filterOperator},d,u=>Me(u,r.organizationId)),inviteMember:(r,d)=>o(i("/organization/invite-member",r,d,u=>x(u,void 0,r.organizationId))),listInvitations:(r={},d)=>a("/organization/list-invitations",{organizationId:r.organizationId},d,u=>_e(u,r.organizationId)),listUserInvitations:r=>a("/organization/list-user-invitations",void 0,r,Le),getInvitation:(r,d)=>a("/organization/get-invitation",{id:r.id},d,u=>Fe(u,r.id)),acceptInvitation:(r,d)=>o(i("/organization/accept-invitation",r,d,u=>qe(u,r.invitationId))),rejectInvitation:(r,d)=>o(i("/organization/reject-invitation",r,d,u=>Ve(u,r.invitationId))),cancelInvitation:(r,d)=>o(i("/organization/cancel-invitation",r,d,u=>He(u,r.invitationId))),removeMember:(r,d)=>o(i("/organization/remove-member",r,d,u=>Be(u,r.organizationId,r.memberIdOrEmail.includes("@")?void 0:r.memberIdOrEmail))),updateMemberRole:(r,d)=>o(i("/organization/update-member-role",r,d,u=>M(u,r.memberId,r.organizationId))),leave:(r,d)=>o(i("/organization/leave",r,d,u=>M(u,void 0,r.organizationId))),listRoles:(r={},d)=>a("/organization/list-roles",{organizationId:r.organizationId},d,u=>Ke(u,r.organizationId)),has:r=>u(n(),r),hasPermission:r=>s(n(),r.permission)}}var Xe=4096,bn=4096,wn=100,kn=256,Sn=16,Rn=64,In=12;function re(e){let t=h(e);return t.twoFactorRedirect===true?((t.user!==void 0||t.redirect!==void 0||t.url!==void 0)&&p(),{twoFactorRedirect:true,...t.twoFactorMethods===void 0?{}:{twoFactorMethods:gt(t.twoFactorMethods,Sn,Rn)}}):(t.twoFactorRedirect!==void 0&&p(),{redirect:j$1(t.redirect),...xn(t,"url"),user:n(t.user)})}function $e(e){let t=h(e);return {user:n(t.user)}}function Ye(e){let t=h(e);return {sessionCreated:j$1(t.sessionCreated),user:n(t.user)}}function Qe(e,t){let n$1=h(e),i=j$1(n$1.redirect);n$1.user===null&&p();let o=n$1.user!==void 0&&n$1.user!==null,a=n$1.url!==void 0&&n$1.url!==null;return i?((o||!a)&&p(),{redirect:true,url:oe(n$1.url,t)}):(o===a&&p(),o?{redirect:false,user:n(n$1.user)}:{redirect:false,url:oe(n$1.url,t)})}function Ze(e,t){let n=h(e);return (n.redirect!==true||n.user!==void 0)&&p(),{redirect:true,url:oe(n.url,t)}}function et(e){return {status:j$1(h(e).status)}}function tt(e){return {success:j$1(h(e).success)}}function nt(e){return h(e).status!=="pending"&&p(),{status:"pending"}}function it(e){let t=h(e);if(t.kind==="authowl_turnstile")return {kind:"authowl_turnstile"};t.kind!=="akedly_shield_v1_2"&&p();let n=h(t.turnstile),i$1=n.siteKey===null?null:i(n.siteKey);return {kind:"akedly_shield_v1_2",connectionId:i(t.connectionId),challenge:i(t.challenge),difficulty:Pn(t.difficulty),challengeToken:i(t.challengeToken),challengeRequired:j$1(t.challengeRequired),turnstile:{required:j$1(n.required),siteKey:i$1}}}function Pn(e){return (!Number.isSafeInteger(e)||Number(e)<0||Number(e)>In)&&p(),Number(e)}function ot(e){let t=h(e);return (t.status!==true||t.sessionCreated!==true)&&p(),{status:true,sessionCreated:true,user:Tn(t.user)}}function ae(e){return {status:j$1(h(e).status)}}function rt(e){return {status:j$1(h(e).status)}}function at(e){let t=h(e);return {status:j$1(t.status),user:n(t.user)}}function st(e){return {success:j$1(h(e).success)}}function ut(e){let t=h(e);return {totpURI:Cn(t.totpURI),backupCodes:pt(t.backupCodes)}}function ct(e){return {status:j$1(h(e).status)}}function J(e){return h(e).status!==true&&p(),{status:true}}function dt(e){return {status:j$1(h(e).status)}}function lt(e){let t=h(e);return t.status!==void 0&&t.status!==true&&p(),{backupCodes:pt(t.backupCodes)}}function Tn(e){let t=h(e);return {id:_(t.id,512),...Dn(t,"name",1024),phoneNumber:_(t.phoneNumber,64),phoneNumberVerified:j$1(t.phoneNumberVerified),...t.createdAt===void 0?{}:{createdAt:k(t.createdAt)},...t.updatedAt===void 0?{}:{updatedAt:k(t.updatedAt)}}}function oe(e,t){let n=_(e,Xe);/[\u0000-\u0020\u007f]/u.test(n)&&p();let i;try{i=new URL(n);}catch{return p()}return (i.username||i.password)&&p(),i.protocol==="https:"||t&&i.protocol==="http:"&&vn(i.hostname)?i.href:p()}function vn(e){let t=e.toLowerCase();return t==="localhost"||t==="127.0.0.1"||t==="[::1]"}function Cn(e){let t=_(e,bn),n;try{n=new URL(t);}catch{return p()}let i=n.searchParams.get("secret");return (n.protocol!=="otpauth:"||n.hostname.toLowerCase()!=="totp"||n.username||n.password||n.hash||i===null||i.length===0||i.length>512||/\s/u.test(i))&&p(),t}function pt(e){return gt(e,wn,kn)}function gt(e,t,n){(!Array.isArray(e)||e.length===0||e.length>t)&&p();let i=e.map(o=>_(o,n));return i.some(o=>o.trim().length===0)&&p(),new Set(i).size!==i.length&&p(),i}function _(e,t){let n=i(e);return (n.length===0||n.length>t)&&p(),n}function xn(e,t){let n=e[t];return n==null?{}:{[t]:_(n,Xe)}}function Dn(e,t,n){let i=m$1(e,t);return i===void 0?{}:(i!==null&&i.length>n&&p(),{[t]:i})}var ft=new Set([1564,8206,8207,8234,8235,8236,8237,8238,8294,8295,8296,8297]),G=new Set([9,10,11,12,13,32,133,160,5760,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8232,8233,8239,8287,12288,65279]);function W(e){if(e===void 0)return {valid:true,value:void 0};for(let n of e){let i=n.codePointAt(0);if(i===void 0||ht(n,i)||mt(i)||ft.has(i))return {valid:false}}let t=zn(e);return se(t)?{valid:true,value:t}:{valid:false}}function se(e){let t=0,n,i;for(let o of e){if(t+=1,t>256)return false;let a=o.codePointAt(0);if(a===void 0||ht(o,a)||mt(a)||ft.has(a))return false;n??=a,i=a;}return t>0&&n!==void 0&&i!==void 0&&!G.has(n)&&!G.has(i)}function X(){return {data:null,error:{status:400,statusText:"BAD_REQUEST",code:"INVALID_PASSKEY_NAME",message:"Passkey names must contain 1 to 256 safe Unicode characters."}}}function zn(e){let t=0,n=e.length;for(;t<n;){let i=e.codePointAt(t);if(i===void 0||!G.has(i))break;t+=i>65535?2:1;}for(;n>t;){let i=e.codePointAt(n-1);if(i===void 0)break;let a=i>=56320&&i<=57343?n-2:n-1,r=e.codePointAt(a);if(r===void 0||!G.has(r))break;n=a;}return e.slice(t,n)}function mt(e){return e>=0&&e<=31||e>=127&&e<=159}function ht(e,t){return e.length===1&&t>=55296&&t<=57343}var Ot=12,bt=5e3,En=8,Nn=1e3,Un=16,At=512,wt=100,kt=8192,Mn=32768,ue=1024,yt=256,de=64,_n=6e5,Ln=/^[A-Za-z0-9_-]+$/u,Fn=/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/u,qn=/[\u0000-\u001f\u007f-\u009f\u061c\u200e\u200f\u202a-\u202e\u2066-\u2069]/u,Vn=/^[A-Za-z0-9](?:[A-Za-z0-9-]{0,61}[A-Za-z0-9])?$/u,Hn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/iu,St=new Set(["discouraged","preferred","required"]),Bn=new Set(["singleDevice","multiDevice"]),Rt=new Set(["ble","cable","hybrid","internal","nfc","smart-card","usb"]),It=new Set(["hybrid","security-key","client-device"]),Kn=new Set(["none","indirect","direct","enterprise"]),jn=new Set(["fido-u2f","packed","android-safetynet","android-key","tpm","apple","none"]),Jn=new Set(["platform","cross-platform"]),Gn=new Set(["discouraged","preferred","required"]),Wn=new Set([-8,-7,-257]);function Pt(e){let t=q$1(e,Ot,bt);return {challenge:Mt(t.challenge),...O("timeout",Nt(t.timeout)),...O("rpId",_t(t.rpId)),...O("allowCredentials",Et(t.allowCredentials)),...O("userVerification",V(t.userVerification,St)),...O("hints",$(t.hints,It)),...O("extensions",Ut(t.extensions))}}function Tt(e){let t=q$1(e,Ot,bt);return {challenge:Mt(t.challenge),rp:Xn(t.rp),user:$n(t.user),pubKeyCredParams:Yn(t.pubKeyCredParams),...O("timeout",Nt(t.timeout)),...O("excludeCredentials",Et(t.excludeCredentials)),...O("authenticatorSelection",Qn(t.authenticatorSelection)),...O("attestation",V(t.attestation,Kn)),...O("attestationFormats",$(t.attestationFormats,jn)),...O("hints",$(t.hints,It)),...O("extensions",Ut(t.extensions))}}function vt(e){let t=h(e),n$1=o(t.session),i=n(t.user);return n$1.userId!==i.id&&p(),{session:n$1,user:i}}function le(e){let t=h(e),n=t.counter;(!Number.isSafeInteger(n)||n<0)&&p();let i=pe(t.deviceType,Bn),o=j$1(t.backedUp);return o&&i!=="multiDevice"&&p(),{id:L(t.id,yt),...ti(t),publicKey:Zn(t.publicKey,Mn),userId:L(t.userId,yt),credentialID:Q(t.credentialID,kt),counter:n,deviceType:i,backedUp:o,...ni(t),createdAt:k(t.createdAt),...ii(t)}}function Ct(e,t,n){let i=le(e);return (i.credentialID!==t||(n===void 0?i.name!==void 0&&i.name!==null:i.name!==n))&&p(),i}function xt(e){(!Array.isArray(e)||e.length>wt)&&p();let t=e.map(le);return Y(t.map(n=>n.id)),Y(t.map(n=>n.credentialID)),t.length>1&&t.some(n=>n.userId!==t[0]?.userId)&&p(),t}function Dt(e,t,n){let i=h(e),o=le(i.passkey);return (o.id!==t||o.name!==n)&&p(),{passkey:o}}function zt(e){return h(e).status!==true&&p(),{status:true}}function Xn(e){let t=h(e);return {name:ce(t.name,ue),...O("id",_t(t.id))}}function $n(e){let t=h(e);return {id:Q(t.id,128,1,64),name:ce(t.name,ue),displayName:ce(t.displayName,ue)}}function Yn(e){(!Array.isArray(e)||e.length===0||e.length>de)&&p();let t=e.map(n=>{let i=h(n);return (i.type!=="public-key"||!Number.isSafeInteger(i.alg)||!Wn.has(i.alg))&&p(),{type:"public-key",alg:i.alg}});return oi(t.map(n=>n.alg)),t}function Et(e){if(e===void 0)return;(!Array.isArray(e)||e.length>wt)&&p();let t=e.map(n=>{let i=h(n);return i.type!=="public-key"&&p(),{type:"public-key",id:Q(i.id,kt),...O("transports",$(i.transports,Rt))}});return Y(t.map(n=>n.id)),t}function Qn(e){if(e===void 0)return;let t=h(e);t.requireResidentKey!==void 0&&typeof t.requireResidentKey!="boolean"&&p();let n=V(t.residentKey,Gn);return t.requireResidentKey!==void 0&&n!==void 0&&t.requireResidentKey!==(n==="required")&&p(),{...O("authenticatorAttachment",V(t.authenticatorAttachment,Jn)),...O("residentKey",n),...O("requireResidentKey",t.requireResidentKey),...O("userVerification",V(t.userVerification,St))}}function Nt(e){return e!==void 0&&(typeof e!="number"||!Number.isFinite(e)||e<0||e>_n)&&p(),e}function Ut(e){return e===void 0?void 0:q$1(e,En,Nn)}function $(e,t){if(e===void 0)return;(!Array.isArray(e)||e.length>de)&&p();let n=e.map(i=>pe(i,t));return Y(n),n}function V(e,t){if(e!==void 0)return pe(e,t)}function Mt(e){return Q(e,Math.ceil(At*4/3),Un,At)}function Q(e,t,n=1,i=Number.POSITIVE_INFINITY){let o=L(e,t),a=o.length%4,r=ei(o.at(-1)??""),d=Math.floor(o.length*3/4);return (!Ln.test(o)||a===1||a===2&&(r&15)!==0||a===3&&(r&3)!==0||d<n||d>i)&&p(),o}function L(e,t){let n=i(e);return (n.length===0||n.length>t)&&p(),n}function ce(e,t){let n=L(e,t);return qn.test(n)&&p(),n}function _t(e){if(e===void 0)return;let t=L(e,253);return t!=="localhost"&&(t.endsWith(".")||!t.includes(".")||t.split(".").some(n=>!Vn.test(n)))&&p(),t}function Zn(e,t){let n=L(e,t),i=n.endsWith("=="),o=!i&&n.endsWith("="),a=n.at(i?-3:o?-2:-1)??"",r=Lt(a);return (n.length%4!==0||!Fn.test(n)||i&&(r&15)!==0||o&&(r&3)!==0)&&p(),n}function ei(e){return Lt(e,true)}function Lt(e,t=false){return (t?"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/").indexOf(e)}function ti(e){let t=m$1(e,"name");return t===void 0?{}:(t!==null&&!se(t)&&p(),{name:t})}function ni(e){let t=m$1(e,"transports");if(t==null||t==="")return t===void 0?{}:{transports:t};let n=t.split(",");return (n.length>de||n.some(i=>!Rt.has(i))||new Set(n).size!==n.length)&&p(),{transports:t}}function ii(e){let t=m$1(e,"aaguid");return t==null?t===void 0?{}:{aaguid:null}:(Hn.test(t)||p(),{aaguid:t})}function pe(e,t){let n=i(e);return t.has(n)||p(),n}function O(e,t){return t===void 0?{}:{[e]:t}}function Y(e){new Set(e).size!==e.length&&p();}function oi(e){new Set(e).size!==e.length&&p();}function ri(e,t){if(!t)return e;let n=t.catch(()=>{});return n.then(()=>{n=null;}),{async request(i,o){return n&&await n,e.request(i,o)}}}var Ft=new Map;function ai(e,t){let n=Ft.get(t);return n||(n=import('./session-handoff-6B5KZXQV.js').then(i=>i.completeCrossSiteSignIn(e)),Ft.set(t,n)),n}function qt(e){return !a()||e.idToken||e.disableRedirect?"legacy":"first-party"}function si(e,t=()=>{},n=di){let i=ke(e),o=a()?ai(i,e.decoded.projectId):void 0,a$1=ri(i,o),r=Ie(a$1,e.decoded.projectId),d=n(a$1,r.notifyMutation),u=()=>{r.notifyMutation(),t();},{post:f,mutation:h}=N(a$1,u),S=e.decoded.env==="test";return {sessionStore:r.store,getSession:r.getSession,account:xe(a$1,u),organization:We(a$1,u,()=>r.store.getSnapshot().data?.session.membership??null),signIn:{email:(s,c)=>h(f("/sign-in/email",s,c,re),g=>!("twoFactorRedirect"in g)),username:(s,c)=>h(f("/sign-in/username",s,c,re),g=>!("twoFactorRedirect"in g)),social:async(s,c)=>{if(qt(s)==="first-party"){let{beginCrossSiteSignIn:b}=await import('./session-handoff-6B5KZXQV.js'),w=await b(e,{kind:"social",provider:s.provider,callbackURL:s.callbackURL,errorCallbackURL:s.errorCallbackURL,newUserCallbackURL:s.newUserCallbackURL,scopes:s.scopes,loginHint:s.loginHint,requestSignUp:s.requestSignUp});if(w)return window.location.assign(w),{data:{redirect:true,url:w},error:null}}let g=await h(f("/sign-in/social",s,c,b=>Qe(b,S)),b=>"user"in b);return g.error!==null||g.data===null||"url"in g.data&&g.data.redirect&&!s.disableRedirect&&typeof window<"u"&&window.location.assign(g.data.url),g},sso:async(s,c)=>{if(qt(s)==="first-party"){let{beginCrossSiteSignIn:b}=await import('./session-handoff-6B5KZXQV.js'),w=await b(e,{kind:"sso",email:s.email,providerId:s.providerId,domain:s.domain,organizationSlug:s.organizationSlug,callbackURL:s.callbackURL,errorCallbackURL:s.errorCallbackURL,newUserCallbackURL:s.newUserCallbackURL});if(w)return window.location.assign(w),{data:{url:w,redirect:true},error:null}}let g=await f("/sign-in/sso",s,c,b=>Ze(b,S));return g.error!==null||g.data===null||typeof window<"u"&&window.location.assign(g.data.url),g},magicLink:(s,c)=>f("/sign-in/magic-link",s,c,et),emailOtp:(s,c)=>h(f("/sign-in/email-otp",s,c,$e)),passkey:(s,c)=>d.signIn(s,c)},signUp:{email:(s,c)=>h(f("/sign-up/email",s,c,Ye),g=>g.sessionCreated)},emailOtp:{sendVerificationOtp:(s,c)=>f("/email-otp/send-verification-otp",s,c,tt),verifyEmail:(s,c)=>h(f("/email-otp/verify-email",s,c,at))},phoneOtp:{prepare:s=>f("/phone-otp/challenge",{},s,it),start:(s,c)=>f("/phone-otp/start",{...s,idempotencyKey:s.idempotencyKey??Se()},c,nt),verify:(s,c)=>h(f("/phone-otp/verify",s,c,ot))},requestPasswordReset:(s,c)=>f("/request-password-reset",s,c,ae),resetPassword:(s,c)=>f("/reset-password",s,c,ae),sendVerificationEmail:(s,c)=>f("/send-verification-email",s,c,rt),passkey:{addPasskey:(s,c)=>d.add(s,c),listUserPasskeys:()=>a$1.request("/passkey/list-user-passkeys",{decode:xt}),updatePasskey:async(s,c)=>{let g=W(s.name);if(!g.valid||g.value===void 0)return X();let b=g.value;return f("/passkey/update-passkey",{...s,name:b},c,w=>Dt(w,s.id,b))},deletePasskey:(s,c)=>f("/passkey/delete-passkey",s,c,zt)},twoFactor:{enable:(s,c)=>f("/two-factor/enable",s,c,ut),disable:(s,c)=>h(f("/two-factor/disable",s,c,ct),g=>g.status),verifyTotp:(s,c)=>h(f("/two-factor/verify-totp",s,c,J)),verifyBackupCode:(s,c)=>h(f("/two-factor/verify-backup-code",s,c,J)),sendOtp:(s={},c)=>f("/two-factor/send-otp",s,c,dt),verifyOtp:(s,c)=>h(f("/two-factor/verify-otp",s,c,J)),generateBackupCodes:(s,c)=>f("/two-factor/generate-backup-codes",s,c,lt)},signOut:s=>h(a$1.request("/sign-out",{method:"POST",body:{},fetchOptions:s,decode:st}),c=>c.success)}}function Qi(e,t=()=>{},n){let i=si(e,t,n);return n?{...i,signIn:{email:i.signIn.email,username:i.signIn.username,social:Vt(i),magicLink:i.signIn.magicLink,emailOtp:i.signIn.emailOtp,passkey:i.signIn.passkey},passkey:{listUserPasskeys:i.passkey.listUserPasskeys,updatePasskey:i.passkey.updatePasskey,deletePasskey:i.passkey.deletePasskey,addPasskey:i.passkey.addPasskey}}:{...i,signIn:{email:i.signIn.email,username:i.signIn.username,social:Vt(i),magicLink:i.signIn.magicLink,emailOtp:i.signIn.emailOtp},passkey:{listUserPasskeys:i.passkey.listUserPasskeys,updatePasskey:i.passkey.updatePasskey,deletePasskey:i.passkey.deletePasskey}}}function Vt(e){return async(t,n)=>{if(!t?.idToken||typeof t.idToken.token!="string"||t.idToken.token==="")return ui();let i=await e.signIn.social({...t,disableRedirect:true},n);return i.data!==null&&"url"in i.data?ci():i}}function ui(){return Promise.resolve({data:null,error:{status:400,statusText:"BAD_REQUEST",code:"NATIVE_SOCIAL_ID_TOKEN_REQUIRED",message:"Native social sign-in requires a provider ID token."}})}function ci(){return Promise.resolve({data:null,error:{status:502,statusText:"BAD_GATEWAY",code:"INVALID_NATIVE_SOCIAL_RESPONSE",message:"The server returned a redirect for native ID-token sign-in."}})}function di(){return {signIn:()=>Ht(),add:()=>Ht()}}function Ht(){return Promise.resolve({data:null,error:{status:400,statusText:"BAD_REQUEST",code:"PASSKEY_BROWSER_REQUIRED",message:"This passkey ceremony requires a browser with WebAuthn."}})}function no(e,t,n){let i=new Map;return {async signIn(o={},a){let r=await e.request("/passkey/generate-authenticate-options");if(!r.data)return jt(r.error);let d;try{d=Pt(r.data);}catch{return Bt()}let u;try{u=await n.authenticate({optionsJSON:d,useBrowserAutofill:o.autoFill});}catch(c){return Jt(n,c,"AUTH_CANCELLED","Passkey authentication was cancelled.")}if(!li(u))return Kt();let{clientExtensionResults:f,...h}=u,S=i.get(u.id);if(S)return S;let s=(async()=>{let c=await e.request("/passkey/verify-authentication",{method:"POST",body:{response:h},fetchOptions:a,decode:vt});return c.data&&t(),c})();i.set(u.id,s);try{return await s}finally{i.get(u.id)===s&&i.delete(u.id);}},async add(o={},a){let r=W(o.name);if(!r.valid)return X();let d=await e.request("/passkey/generate-register-options",{query:{name:r.value,authenticatorAttachment:o.authenticatorAttachment}});if(!d.data)return jt(d.error);let u;try{u=Tt(d.data);}catch{return Bt()}let f;try{f=await n.register({optionsJSON:u});}catch(c){return Jt(n,c,"REGISTRATION_CANCELLED","Passkey registration was cancelled.")}if(!pi(f))return Kt();let{clientExtensionResults:h,...S}=f,s=await e.request("/passkey/verify-registration",{method:"POST",body:{response:S,name:r.value},fetchOptions:a,decode:c=>Ct(c,f.id,r.value)});return s.data&&t(),s}}}function Bt(){return {data:null,error:{status:502,statusText:"BAD_GATEWAY",code:"INVALID_WEBAUTHN_OPTIONS",message:"The server returned invalid WebAuthn options."}}}function Kt(){return {data:null,error:{status:400,statusText:"BAD_REQUEST",code:"INVALID_WEBAUTHN_RESPONSE",message:"The platform returned an invalid passkey response."}}}function Gt(e){if(!e||typeof e!="object")return false;let t=e;return typeof t.id=="string"&&t.id.length>0&&typeof t.rawId=="string"&&t.rawId.length>0&&t.type==="public-key"&&!!t.response&&typeof t.response=="object"}function li(e){if(!Gt(e))return false;let t=e.response;return typeof t.clientDataJSON=="string"&&typeof t.authenticatorData=="string"&&typeof t.signature=="string"&&(t.userHandle===void 0||typeof t.userHandle=="string")}function pi(e){if(!Gt(e))return false;let t=e.response;return typeof t.clientDataJSON=="string"&&typeof t.attestationObject=="string"}function jt(e){return {data:null,error:e??{status:502,statusText:"BAD_GATEWAY",code:"INVALID_WEBAUTHN_OPTIONS",message:"The server returned no WebAuthn options."}}}function Jt(e,t,n,i){let o=fi(t,"page does not have focus"),a=e.errorCode?.(t),r=a!==void 0?a==="ERROR_CEREMONY_ABORTED":gi(t)==="AbortError";return {data:null,error:{status:400,statusText:"BAD_REQUEST",code:o?"PASSKEY_PAGE_NOT_FOCUSED":r?n:a??"PASSKEY_BROWSER_ERROR",message:o?"Keep this page focused while completing the passkey prompt.":r?i:n==="AUTH_CANCELLED"?"Passkey authentication could not be completed by this browser.":"Passkey registration could not be completed by this browser."}}}function gi(e){return e&&typeof e=="object"&&"name"in e&&typeof e.name=="string"?e.name:void 0}function fi(e,t){let n=t.toLowerCase(),i=new Set,o=e;for(;o&&typeof o=="object"&&!i.has(o);){if(i.add(o),"message"in o&&typeof o.message=="string"&&o.message.toLowerCase().includes(n))return true;o="cause"in o?o.cause:void 0;}return false}var ge=class extends Error{status;requestId;constructor(t,n,i){super(`${t} request failed with status ${n.status}.`),this.name="AuthOwlHttpError",this.status=n.status,this.requestId=i;}};function Wt(e,t,n={}){let i=new Headers(n.init?.headers);return i.set("x-publishable-key",e.publishableKey),g({fetchImpl:e.fetch??fetch,url:t,init:{...n.init,headers:i},allowHttpLoopback:e.decoded.env==="test",...n.timeoutMs===void 0?{}:{timeoutMs:n.timeoutMs},...n.maxResponseBytes===void 0?{}:{maxResponseBytes:n.maxResponseBytes},...n.decode===void 0?{}:{decode:n.decode}})}function Xt(e,t){if(!e.response.ok)throw new ge(t,e.response,e.requestId);return e.data}async function uo(e){let n=`${new URL(e.apiUrl).origin}/api/projects/${e.decoded.projectId}/public-config`;return Xt(await Wt(e,n,{init:{method:"GET",credentials:"omit"},maxResponseBytes:256*1024,decode:i=>mi(i,e)}),"public-config")}function mi(e,t){let n=q$1(e),i=n.environmentId,o=n.environmentType,a=`${new URL(t.apiUrl).origin}/api/projects/${t.decoded.projectId}/auth`;if(typeof n.applicationId!="string"||!hi(n.applicationId)||i!==t.decoded.projectId||o!=="development"&&o!=="production"||n.authBaseUrl!==a)throw v();let r=R(n.branding),d=R(n.legal);if(!fe(n.enabledMethods,64)||!fe(n.socialProviders,64)||!Yt(r,["appName","logoUrl","primaryColor"])||r.showAppName!==void 0&&typeof r.showAppName!="boolean"||r.alignment!==void 0&&r.alignment!=="left"&&r.alignment!=="center"&&r.alignment!=="right"||r.theme!==void 0&&r.theme!=="light"&&r.theme!=="dark"&&r.theme!=="system"||!Yt(d,["termsUrl","privacyUrl"])||!Number.isSafeInteger(d.version)||d.version<0||typeof d.required!="boolean")throw v();if(n.socialProviderClientIds!==void 0){let u=R(n.socialProviderClientIds);if(Object.keys(u).length>64||Object.values(u).some(f=>typeof f!="string"||f.length>2048))throw v()}if(!D(n,["requireEmailVerification","twoFactor","mfaRequired","accountDeletion","organizations","sso","badge"])||!$t(n.turnstileSiteKey)||!$t(n.authTurnstileSiteKey)||typeof n.locale!="string"||n.locale.length===0||n.locale.length>64||!Number.isSafeInteger(n.configVersion)||n.configVersion<0)throw v();if(n.jwtIssuer!==null){let u=R(n.jwtIssuer);if(u.issuer!==a||u.jwksUrl!==`${a}/jwks`||u.aud!==t.decoded.projectId)throw v()}if(n.signUp!==void 0){let u=R(n.signUp).mode;if(typeof u!="string"||!["open","restricted","allowlist","waitlist"].includes(u))throw v()}if(n.authentication!==void 0&&Ai(n.authentication),n.emailVerification!==void 0){let u=R(n.emailVerification);if(!D(u,["required"])||u.method!=="link"&&u.method!=="code")throw v()}if(n.userModel!==void 0&&!D(R(n.userModel),["requireEmail","firstLastName","emailChange","accountDeletion"]))throw v();if(n.mfa!==void 0){let u=R(n.mfa);if(!D(u,["totp","required","backupCodes"])||(u.required===true||u.backupCodes===true)&&u.totp!==true)throw v()}return n}function hi(e){return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(e)}function v(){return new TypeError("public-config returned an invalid response")}function R(e){if(!e||typeof e!="object"||Array.isArray(e))throw v();return e}function $t(e){return e===null||typeof e=="string"&&e.length<=4096}function Ai(e){let t=R(e),n=R(t.email),i=R(t.password),o=i.minLength!==void 0||i.maxLength!==void 0;if(!D(n,["signUp"])||!fe(n.signIn,3)||n.signIn.some(a=>a!=="password"&&a!=="magic_link"&&a!=="email_otp")||!D(R(t.phone),["signUp","signIn"])||!D(i,["signUp","add"])||o&&(!Number.isSafeInteger(i.minLength)||!Number.isSafeInteger(i.maxLength)||i.minLength<1||i.maxLength>4096||i.minLength>i.maxLength)||!D(R(t.passkey),["signIn","add"])||!D(R(t.username),["collectOnSignUp","signIn"]))throw v()}function D(e,t){return t.every(n=>typeof e[n]=="boolean")}function Yt(e,t){return t.every(n=>e[n]===void 0||typeof e[n]=="string"&&e[n].length<=4096)}function fe(e,t){return Array.isArray(e)&&e.length<=t&&e.every(n=>typeof n=="string"&&n.length<=128)&&new Set(e).size===e.length}export{yi as a,Qt as b,ke as c,Se as d,si as e,Qi as f,no as g,ge as h,Wt as i,Xt as j,uo as k};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function e(){return typeof window<"u"&&typeof document<"u"&&typeof crypto<"u"&&typeof crypto.subtle?.digest=="function"}export{e as a};
|
|
@@ -939,12 +939,38 @@ interface VerifyEmailOtpData {
|
|
|
939
939
|
status: boolean;
|
|
940
940
|
user: AuthUser;
|
|
941
941
|
}
|
|
942
|
+
type PhoneOtpChallengeData = Readonly<{
|
|
943
|
+
kind: 'authowl_turnstile';
|
|
944
|
+
}> | Readonly<{
|
|
945
|
+
kind: 'akedly_shield_v1_2';
|
|
946
|
+
connectionId: string;
|
|
947
|
+
challenge: string;
|
|
948
|
+
difficulty: number;
|
|
949
|
+
challengeToken: string;
|
|
950
|
+
challengeRequired: boolean;
|
|
951
|
+
turnstile: Readonly<{
|
|
952
|
+
required: boolean;
|
|
953
|
+
siteKey: string | null;
|
|
954
|
+
}>;
|
|
955
|
+
}>;
|
|
956
|
+
type AkedlyShieldStartProof = Readonly<{
|
|
957
|
+
connectionId: string;
|
|
958
|
+
challengeToken?: string;
|
|
959
|
+
nonce?: number;
|
|
960
|
+
turnstileToken?: string;
|
|
961
|
+
}>;
|
|
942
962
|
/** Start an Egyptian phone OTP sign-in. Reuse idempotencyKey after an ambiguous retry. */
|
|
943
|
-
|
|
963
|
+
type PhoneOtpStartOptions = Readonly<{
|
|
944
964
|
phoneNumber: string;
|
|
945
965
|
turnstileToken: string;
|
|
966
|
+
akedlyShield?: never;
|
|
946
967
|
idempotencyKey?: string;
|
|
947
|
-
}
|
|
968
|
+
}> | Readonly<{
|
|
969
|
+
phoneNumber: string;
|
|
970
|
+
turnstileToken?: never;
|
|
971
|
+
akedlyShield: AkedlyShieldStartProof;
|
|
972
|
+
idempotencyKey?: string;
|
|
973
|
+
}>;
|
|
948
974
|
interface PhoneOtpStartData {
|
|
949
975
|
status: 'pending';
|
|
950
976
|
}
|
|
@@ -1201,6 +1227,8 @@ interface AuthOwlClient {
|
|
|
1201
1227
|
};
|
|
1202
1228
|
/** Managed Egyptian phone OTP. Start sends the code; verify establishes the session. */
|
|
1203
1229
|
phoneOtp: {
|
|
1230
|
+
/** Discover the server-selected anti-abuse ceremony without exposing provider credentials. */
|
|
1231
|
+
prepare(fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpChallengeData>>;
|
|
1204
1232
|
start(params: PhoneOtpStartOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpStartData>>;
|
|
1205
1233
|
verify(params: PhoneOtpVerifyOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpVerifyData>>;
|
|
1206
1234
|
};
|
|
@@ -1291,4 +1319,4 @@ interface AuthOwlClient {
|
|
|
1291
1319
|
*/
|
|
1292
1320
|
declare function createAuthOwlClient(config: ResolvedAuthConfig): AuthOwlClient;
|
|
1293
1321
|
|
|
1294
|
-
export { type
|
|
1322
|
+
export { type ListOrganizationMembersOptions as $, type AkedlyShieldStartProof as A, type DisableTwoFactorOptions as B, type ChangeEmailOptions as C, type DeleteAccountData as D, type EmailAuthData as E, type EmailOtpAuthData as F, type EmailOtpSignInOptions as G, type EmailOtpType as H, type EmailSignInOptions as I, type EmailSignUpData as J, type EmailSignUpOptions as K, type EnableTwoFactorOptions as L, type EnvironmentType as M, type GenerateBackupCodesOptions as N, type GetOrganizationInvitationOptions as O, type PhoneOtpChallengeData as P, type GetOrganizationOptions as Q, type GetToken as R, type GetTokenOptions as S, type InviteOrganizationMemberOptions as T, type JsonObject as U, type JsonPrimitive as V, type JsonValue as W, type LeaveOrganizationOptions as X, type LinkSocialData as Y, type LinkSocialOptions as Z, type ListOrganizationInvitationsOptions as _, AUTH_CHALLENGE_HEADER as a, type UsernameSignInOptions as a$, type ListOrganizationRolesOptions as a0, type ListOrganizationTeamsOptions as a1, type MagicLinkData as a2, type MagicLinkSignInOptions as a3, type Organization as a4, type OrganizationClient as a5, type OrganizationDetails as a6, type OrganizationFilterOperator as a7, type OrganizationInvitation as a8, type OrganizationInvitationActionOptions as a9, type SendOtpData as aA, type SendTwoFactorOtpData as aB, type SendTwoFactorOtpOptions as aC, type SendVerificationOtpOptions as aD, type SessionState as aE, type SessionStore as aF, type SetActiveOrganizationOptions as aG, type SetActiveTeamOptions as aH, type SignOutData as aI, type SocialAccount as aJ, type SocialAuthData as aK, type SocialIdTokenOptions as aL, type SocialSignInOptions as aM, type TokenClient as aN, type TwoFactorBackupCodesData as aO, type TwoFactorEnableData as aP, type TwoFactorRedirectData as aQ, type TwoFactorStatusData as aR, type TwoFactorVerifyData as aS, type UnlinkSocialOptions as aT, type UpdateOrganizationMemberRoleOptions as aU, type UpdateOrganizationOptions as aV, type UpdatePasskeyData as aW, type UpdatePasskeyOptions as aX, type UpdateProfileOptions as aY, type UpdateUnsafeMetadataOptions as aZ, type UserMetadata as a_, type OrganizationInvitationDetails as aa, type OrganizationInvitationStatus as ab, type OrganizationMember as ac, type OrganizationMemberUser as ad, type OrganizationMemberWithUser as ae, type OrganizationMembersData as af, type OrganizationRoleSummary as ag, type OrganizationSelector as ah, type OrganizationTeam as ai, type OrganizationUserInvitation as aj, type PasskeyAuthData as ak, type PasskeySignInOptions as al, type PasswordResetData as am, type PhoneAuthUser as an, type PhoneOtpStartData as ao, type PhoneOtpStartOptions as ap, type PhoneOtpVerifyData as aq, type PhoneOtpVerifyOptions as ar, type ProjectCapabilities as as, type PublicConfig as at, type RejectOrganizationInvitationData as au, type RemoveOrganizationMemberData as av, type RemoveOrganizationMemberOptions as aw, type RequestPasswordResetOptions as ax, type ResetPasswordOptions as ay, type RevokeSessionOptions as az, type AcceptOrganizationInvitationData as b, type VerifyBackupCodeOptions as b0, type VerifyEmailOtpData as b1, type VerifyEmailOtpOptions as b2, type VerifyTotpOptions as b3, type VerifyTwoFactorOtpOptions as b4, type WaitlistJoinData as b5, type WaitlistJoinOptions as b6, acceptConsent as b7, createAuthOwlClient as b8, createTokenClient as b9, getConsentStatus as ba, getPublicConfig as bb, resolveProjectCapabilities as bc, createAuthHttpClient as bd, type AuthHttpClient as be, type AccountClient as c, type AccountSession as d, type AccountStatusData as e, type ActionFetchOptions as f, type AddPasskeyOptions as g, type AuthActionResult as h, type AuthClientError as i, type AuthErrorContext as j, type AuthOwlClient as k, type AuthOwlErrorCode as l, type AuthPasskey as m, type AuthRequestContext as n, type AuthResponseContext as o, type AuthSession as p, type AuthUser as q, type ChangePasswordData as r, type ChangePasswordOptions as s, type ConsentAcceptResult as t, type ConsentStatus as u, type CreateOrganizationOptions as v, type DeleteAccountOptions as w, type DeleteOrganizationOptions as x, type DeletePasskeyData as y, type DeletePasskeyOptions as z };
|
|
@@ -939,12 +939,38 @@ interface VerifyEmailOtpData {
|
|
|
939
939
|
status: boolean;
|
|
940
940
|
user: AuthUser;
|
|
941
941
|
}
|
|
942
|
+
type PhoneOtpChallengeData = Readonly<{
|
|
943
|
+
kind: 'authowl_turnstile';
|
|
944
|
+
}> | Readonly<{
|
|
945
|
+
kind: 'akedly_shield_v1_2';
|
|
946
|
+
connectionId: string;
|
|
947
|
+
challenge: string;
|
|
948
|
+
difficulty: number;
|
|
949
|
+
challengeToken: string;
|
|
950
|
+
challengeRequired: boolean;
|
|
951
|
+
turnstile: Readonly<{
|
|
952
|
+
required: boolean;
|
|
953
|
+
siteKey: string | null;
|
|
954
|
+
}>;
|
|
955
|
+
}>;
|
|
956
|
+
type AkedlyShieldStartProof = Readonly<{
|
|
957
|
+
connectionId: string;
|
|
958
|
+
challengeToken?: string;
|
|
959
|
+
nonce?: number;
|
|
960
|
+
turnstileToken?: string;
|
|
961
|
+
}>;
|
|
942
962
|
/** Start an Egyptian phone OTP sign-in. Reuse idempotencyKey after an ambiguous retry. */
|
|
943
|
-
|
|
963
|
+
type PhoneOtpStartOptions = Readonly<{
|
|
944
964
|
phoneNumber: string;
|
|
945
965
|
turnstileToken: string;
|
|
966
|
+
akedlyShield?: never;
|
|
946
967
|
idempotencyKey?: string;
|
|
947
|
-
}
|
|
968
|
+
}> | Readonly<{
|
|
969
|
+
phoneNumber: string;
|
|
970
|
+
turnstileToken?: never;
|
|
971
|
+
akedlyShield: AkedlyShieldStartProof;
|
|
972
|
+
idempotencyKey?: string;
|
|
973
|
+
}>;
|
|
948
974
|
interface PhoneOtpStartData {
|
|
949
975
|
status: 'pending';
|
|
950
976
|
}
|
|
@@ -1201,6 +1227,8 @@ interface AuthOwlClient {
|
|
|
1201
1227
|
};
|
|
1202
1228
|
/** Managed Egyptian phone OTP. Start sends the code; verify establishes the session. */
|
|
1203
1229
|
phoneOtp: {
|
|
1230
|
+
/** Discover the server-selected anti-abuse ceremony without exposing provider credentials. */
|
|
1231
|
+
prepare(fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpChallengeData>>;
|
|
1204
1232
|
start(params: PhoneOtpStartOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpStartData>>;
|
|
1205
1233
|
verify(params: PhoneOtpVerifyOptions, fetchOptions?: ActionFetchOptions): Promise<AuthActionResult<PhoneOtpVerifyData>>;
|
|
1206
1234
|
};
|
|
@@ -1291,4 +1319,4 @@ interface AuthOwlClient {
|
|
|
1291
1319
|
*/
|
|
1292
1320
|
declare function createAuthOwlClient(config: ResolvedAuthConfig): AuthOwlClient;
|
|
1293
1321
|
|
|
1294
|
-
export { type
|
|
1322
|
+
export { type ListOrganizationMembersOptions as $, type AkedlyShieldStartProof as A, type DisableTwoFactorOptions as B, type ChangeEmailOptions as C, type DeleteAccountData as D, type EmailAuthData as E, type EmailOtpAuthData as F, type EmailOtpSignInOptions as G, type EmailOtpType as H, type EmailSignInOptions as I, type EmailSignUpData as J, type EmailSignUpOptions as K, type EnableTwoFactorOptions as L, type EnvironmentType as M, type GenerateBackupCodesOptions as N, type GetOrganizationInvitationOptions as O, type PhoneOtpChallengeData as P, type GetOrganizationOptions as Q, type GetToken as R, type GetTokenOptions as S, type InviteOrganizationMemberOptions as T, type JsonObject as U, type JsonPrimitive as V, type JsonValue as W, type LeaveOrganizationOptions as X, type LinkSocialData as Y, type LinkSocialOptions as Z, type ListOrganizationInvitationsOptions as _, AUTH_CHALLENGE_HEADER as a, type UsernameSignInOptions as a$, type ListOrganizationRolesOptions as a0, type ListOrganizationTeamsOptions as a1, type MagicLinkData as a2, type MagicLinkSignInOptions as a3, type Organization as a4, type OrganizationClient as a5, type OrganizationDetails as a6, type OrganizationFilterOperator as a7, type OrganizationInvitation as a8, type OrganizationInvitationActionOptions as a9, type SendOtpData as aA, type SendTwoFactorOtpData as aB, type SendTwoFactorOtpOptions as aC, type SendVerificationOtpOptions as aD, type SessionState as aE, type SessionStore as aF, type SetActiveOrganizationOptions as aG, type SetActiveTeamOptions as aH, type SignOutData as aI, type SocialAccount as aJ, type SocialAuthData as aK, type SocialIdTokenOptions as aL, type SocialSignInOptions as aM, type TokenClient as aN, type TwoFactorBackupCodesData as aO, type TwoFactorEnableData as aP, type TwoFactorRedirectData as aQ, type TwoFactorStatusData as aR, type TwoFactorVerifyData as aS, type UnlinkSocialOptions as aT, type UpdateOrganizationMemberRoleOptions as aU, type UpdateOrganizationOptions as aV, type UpdatePasskeyData as aW, type UpdatePasskeyOptions as aX, type UpdateProfileOptions as aY, type UpdateUnsafeMetadataOptions as aZ, type UserMetadata as a_, type OrganizationInvitationDetails as aa, type OrganizationInvitationStatus as ab, type OrganizationMember as ac, type OrganizationMemberUser as ad, type OrganizationMemberWithUser as ae, type OrganizationMembersData as af, type OrganizationRoleSummary as ag, type OrganizationSelector as ah, type OrganizationTeam as ai, type OrganizationUserInvitation as aj, type PasskeyAuthData as ak, type PasskeySignInOptions as al, type PasswordResetData as am, type PhoneAuthUser as an, type PhoneOtpStartData as ao, type PhoneOtpStartOptions as ap, type PhoneOtpVerifyData as aq, type PhoneOtpVerifyOptions as ar, type ProjectCapabilities as as, type PublicConfig as at, type RejectOrganizationInvitationData as au, type RemoveOrganizationMemberData as av, type RemoveOrganizationMemberOptions as aw, type RequestPasswordResetOptions as ax, type ResetPasswordOptions as ay, type RevokeSessionOptions as az, type AcceptOrganizationInvitationData as b, type VerifyBackupCodeOptions as b0, type VerifyEmailOtpData as b1, type VerifyEmailOtpOptions as b2, type VerifyTotpOptions as b3, type VerifyTwoFactorOtpOptions as b4, type WaitlistJoinData as b5, type WaitlistJoinOptions as b6, acceptConsent as b7, createAuthOwlClient as b8, createTokenClient as b9, getConsentStatus as ba, getPublicConfig as bb, resolveProjectCapabilities as bc, createAuthHttpClient as bd, type AuthHttpClient as be, type AccountClient as c, type AccountSession as d, type AccountStatusData as e, type ActionFetchOptions as f, type AddPasskeyOptions as g, type AuthActionResult as h, type AuthClientError as i, type AuthErrorContext as j, type AuthOwlClient as k, type AuthOwlErrorCode as l, type AuthPasskey as m, type AuthRequestContext as n, type AuthResponseContext as o, type AuthSession as p, type AuthUser as q, type ChangePasswordData as r, type ChangePasswordOptions as s, type ConsentAcceptResult as t, type ConsentStatus as u, type CreateOrganizationOptions as v, type DeleteAccountOptions as w, type DeleteOrganizationOptions as x, type DeletePasskeyData as y, type DeletePasskeyOptions as z };
|