@openfort/openfort-js 0.10.36-beta.1 → 0.10.36-beta.3

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.
Files changed (36) hide show
  1. package/dist/cjs/packages/internal/openapi-clients/dist/index.js +1 -1
  2. package/dist/cjs/sdk/src/api/auth.js +1 -1
  3. package/dist/cjs/sdk/src/api/embeddedWallet.js +1 -1
  4. package/dist/cjs/sdk/src/auth/authManager.js +1 -1
  5. package/dist/cjs/sdk/src/core/configuration/account.js +1 -1
  6. package/dist/cjs/sdk/src/core/errors/sentry.js +1 -1
  7. package/dist/cjs/sdk/src/core/openfort.js +1 -1
  8. package/dist/cjs/sdk/src/core/openfortInternal.js +1 -1
  9. package/dist/cjs/sdk/src/storage/lazyStorage.js +1 -1
  10. package/dist/cjs/sdk/src/storage/scopedStorage.js +1 -0
  11. package/dist/cjs/sdk/src/utils/chains/index.js +1 -1
  12. package/dist/cjs/sdk/src/version.js +1 -1
  13. package/dist/cjs/sdk/src/wallets/embedded.js +1 -1
  14. package/dist/cjs/sdk/src/wallets/evm/getAssets.js +1 -1
  15. package/dist/cjs/sdk/src/wallets/evm/registerSession.js +1 -1
  16. package/dist/cjs/sdk/src/wallets/evm/revokeSession.js +1 -1
  17. package/dist/cjs/sdk/src/wallets/evm/sendCallSync.js +1 -1
  18. package/dist/index.d.ts +320 -59
  19. package/dist/packages/internal/openapi-clients/dist/index.js +1 -1
  20. package/dist/sdk/src/api/auth.js +1 -1
  21. package/dist/sdk/src/api/embeddedWallet.js +1 -1
  22. package/dist/sdk/src/auth/authManager.js +1 -1
  23. package/dist/sdk/src/core/configuration/account.js +1 -1
  24. package/dist/sdk/src/core/errors/sentry.js +1 -1
  25. package/dist/sdk/src/core/openfort.js +1 -1
  26. package/dist/sdk/src/core/openfortInternal.js +1 -1
  27. package/dist/sdk/src/storage/lazyStorage.js +1 -1
  28. package/dist/sdk/src/storage/scopedStorage.js +1 -0
  29. package/dist/sdk/src/utils/chains/index.js +1 -1
  30. package/dist/sdk/src/version.js +1 -1
  31. package/dist/sdk/src/wallets/embedded.js +1 -1
  32. package/dist/sdk/src/wallets/evm/getAssets.js +1 -1
  33. package/dist/sdk/src/wallets/evm/registerSession.js +1 -1
  34. package/dist/sdk/src/wallets/evm/revokeSession.js +1 -1
  35. package/dist/sdk/src/wallets/evm/sendCallSync.js +1 -1
  36. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";var e=require("axios"),t=require("axios-retry");const s="https://api.openfort.io".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(t,n=s,a=e){this.basePath=n,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const o="https://example.com",i=function(e,t,s){if(null==s)throw new a(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},r=async function(e,t){if(t&&t.accessToken){const s="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+s}};function c(e,t,s=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach(t=>c(e,t,s)):Object.keys(t).forEach(n=>c(e,t[n],`${s}${""!==s?".":""}${n}`)):e.has(s)?e.append(s,t):e.set(s,t))}const h=function(e,...t){const s=new URLSearchParams(e.search);c(s,t),e.search=s.toString()},u=function(e,t,s){const n="string"!=typeof e;return(n&&s&&s.isJsonMime?s.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,s,n){return(a=t,o=s)=>{const i={...e.options,url:(n?.basePath||a.defaults.baseURL||o)+e.url};return a.request(i)}},p=function(t){const n=function(e){return{cancelTransferOwnership:async(t,s,n={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",s);const a="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},completeRecovery:async(t,s,n={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",s);const a="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},createAccount:async(t,s={})=>{i("createAccount","createAccountRequest",t);const n=new URL("/v1/accounts",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},createAccountV2:async(t,s={})=>{i("createAccountV2","createAccountRequestV2",t);const n=new URL("/v2/accounts",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},deployAccount:async(t,s,n={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",s);const a="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},disableAccount:async(t,s={})=>{i("disableAccount","id",t);const n="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccount:async(t,s,n={})=>{i("getAccount","id",t);const a="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getAccountV2:async(t,s={})=>{i("getAccountV2","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccounts:async(t,s,n,a,i,c,u,l={})=>{const p=new URL("/v1/accounts",o);let P;e&&(P=e.baseOptions);const w={method:"GET",...P,...l},y={},m={};await r(y,e),void 0!==t&&(m.limit=t),void 0!==s&&(m.skip=s),void 0!==n&&(m.order=n),void 0!==a&&(m.chainId=a),void 0!==i&&(m.player=i),void 0!==c&&(m.address=c),u&&(m.expand=u),h(p,m);let g=P&&P.headers?P.headers:{};return w.headers={...y,...g,...l.headers},{url:d(p),options:w}},getAccountsV2:async(t,s,n,a,i,c,u,l,p={})=>{const P=new URL("/v2/accounts",o);let w;e&&(w=e.baseOptions);const y={method:"GET",...w,...p},m={},g={};await r(m,e),void 0!==t&&(g.limit=t),void 0!==s&&(g.skip=s),void 0!==n&&(g.order=n),void 0!==a&&(g.chainId=a),void 0!==i&&(g.user=i),void 0!==c&&(g.chainType=c),void 0!==u&&(g.accountType=u),void 0!==l&&(g.address=l),h(P,g);let f=w&&w.headers?w.headers:{};return y.headers={...m,...f,...p.headers},{url:d(P),options:y}},getSignerIdByAddress:async(t,s={})=>{i("getSignerIdByAddress","address",t);const n=new URL("/v2/accounts/signer",o);let a;e&&(a=e.baseOptions);const c={method:"GET",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.address=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},removeAccount:async(t,s={})=>{i("removeAccount","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"DELETE",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},requestTransferOwnership:async(t,s,n={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",s);const a="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},signPayload:async(t,s,n={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",s);const a="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},startRecovery:async(t,s,n={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",s);const a="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},switchChainV2:async(t,s={})=>{i("switchChainV2","switchChainQueriesV2",t);const n=new URL("/v2/accounts/switch-chain",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},syncAccount:async(t,s={})=>{i("syncAccount","id",t);const n="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}}}}(t);return{async cancelTransferOwnership(a,o,i){const r=await n.cancelTransferOwnership(a,o,i);return l(r,e,s,t)},async completeRecovery(a,o,i){const r=await n.completeRecovery(a,o,i);return l(r,e,s,t)},async createAccount(a,o){const i=await n.createAccount(a,o);return l(i,e,s,t)},async createAccountV2(a,o){const i=await n.createAccountV2(a,o);return l(i,e,s,t)},async deployAccount(a,o,i){const r=await n.deployAccount(a,o,i);return l(r,e,s,t)},async disableAccount(a,o){const i=await n.disableAccount(a,o);return l(i,e,s,t)},async getAccount(a,o,i){const r=await n.getAccount(a,o,i);return l(r,e,s,t)},async getAccountV2(a,o){const i=await n.getAccountV2(a,o);return l(i,e,s,t)},async getAccounts(a,o,i,r,c,h,u,d){const p=await n.getAccounts(a,o,i,r,c,h,u,d);return l(p,e,s,t)},async getAccountsV2(a,o,i,r,c,h,u,d,p){const P=await n.getAccountsV2(a,o,i,r,c,h,u,d,p);return l(P,e,s,t)},async getSignerIdByAddress(a,o){const i=await n.getSignerIdByAddress(a,o);return l(i,e,s,t)},async removeAccount(a,o){const i=await n.removeAccount(a,o);return l(i,e,s,t)},async requestTransferOwnership(a,o,i){const r=await n.requestTransferOwnership(a,o,i);return l(r,e,s,t)},async signPayload(a,o,i){const r=await n.signPayload(a,o,i);return l(r,e,s,t)},async startRecovery(a,o,i){const r=await n.startRecovery(a,o,i);return l(r,e,s,t)},async switchChainV2(a,o){const i=await n.switchChainV2(a,o);return l(i,e,s,t)},async syncAccount(a,o){const i=await n.syncAccount(a,o);return l(i,e,s,t)}}};class P extends n{cancelTransferOwnership(e,t){return p(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}completeRecovery(e,t){return p(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}createAccount(e,t){return p(this.configuration).createAccount(e.createAccountRequest,t).then(e=>e(this.axios,this.basePath))}createAccountV2(e,t){return p(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}deployAccount(e,t){return p(this.configuration).deployAccount(e.id,e.deployRequest,t).then(e=>e(this.axios,this.basePath))}disableAccount(e,t){return p(this.configuration).disableAccount(e.id,t).then(e=>e(this.axios,this.basePath))}getAccount(e,t){return p(this.configuration).getAccount(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return p(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccounts(e={},t){return p(this.configuration).getAccounts(e.limit,e.skip,e.order,e.chainId,e.player,e.address,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return p(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return p(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}removeAccount(e,t){return p(this.configuration).removeAccount(e.id,t).then(e=>e(this.axios,this.basePath))}requestTransferOwnership(e,t){return p(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}signPayload(e,t){return p(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then(e=>e(this.axios,this.basePath))}startRecovery(e,t){return p(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return p(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}syncAccount(e,t){return p(this.configuration).syncAccount(e.id,t).then(e=>e(this.axios,this.basePath))}}const w=function(t){const n=function(e){return{signInAnonymousPost:async(t={})=>{const s=new URL("/sign-in/anonymous",o);let n;e&&(n=e.baseOptions);const a={method:"POST",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}}}}(t);return{async signInAnonymousPost(a){const o=await n.signInAnonymousPost(a);return l(o,e,s,t)}}};class y extends n{signInAnonymousPost(e){return w(this.configuration).signInAnonymousPost(e).then(e=>e(this.axios,this.basePath))}}const m=function(t){const n=function(e){return{authenticateSIWE:async(t,s={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/authenticate",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getJwks:async(t,s={})=>{i("getJwks","publishableKey",t);const n="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),a=new URL(n,o);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...s};h(a,{});let u=r&&r.headers?r.headers:{};return c.headers={...u,...s.headers},{url:d(a),options:c}},initOAuth:async(t,s,n={})=>{i("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},initSIWE:async(t,s,n={})=>{i("initSIWE","sIWERequest",t);const a=new URL("/iam/v1/siwe/init",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkEmail:async(t,s,n={})=>{i("linkEmail","loginRequest",t);const a=new URL("/iam/v1/password/link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkOAuth:async(t,s,n={})=>{i("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkSIWE:async(t,s={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/link",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkThirdParty:async(t,s,n={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},loginEmailPassword:async(t,s,n={})=>{i("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginOIDC:async(t,s,n={})=>{i("loginOIDC","loginOIDCRequest",t);const a=new URL("/iam/v1/oidc/login",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginWithIdToken:async(t,s={})=>{i("loginWithIdToken","loginWithIdTokenRequest",t);const n=new URL("/iam/v1/oauth/login_id_token",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},logout:async(t,s={})=>{i("logout","logoutRequest",t);const n=new URL("/iam/v1/sessions/logout",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},me:async(t={})=>{const s=new URL("/iam/v1/me",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},poolOAuth:async(t,s={})=>{i("poolOAuth","key",t);const n=new URL("/iam/v1/oauth/pool",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.key=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},refresh:async(t,s={})=>{i("refresh","refreshTokenRequest",t);const n=new URL("/iam/v1/sessions",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},registerGuest:async(t,s={})=>{const n=new URL("/iam/v1/guest",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},c={};await r(c,e),null!=t&&(c["x-game"]=String(t)),h(n,{});let u=a&&a.headers?a.headers:{};return i.headers={...c,...u,...s.headers},{url:d(n),options:i}},requestEmailVerification:async(t,s={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const n=new URL("/iam/v1/password/request_email_verification",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},requestResetPassword:async(t,s={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const n=new URL("/iam/v1/password/request_reset",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},resetPassword:async(t,s={})=>{i("resetPassword","resetPasswordRequest",t);const n=new URL("/iam/v1/password/reset",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},signupEmailPassword:async(t,s,n={})=>{i("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},thirdParty:async(t,s,n={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const a=new URL("/iam/v1/oauth/third_party",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},unlinkEmail:async(t,s={})=>{i("unlinkEmail","unlinkEmailRequest",t);const n=new URL("/iam/v1/password/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkOAuth:async(t,s={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const n=new URL("/iam/v1/oauth/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkSIWE:async(t,s={})=>{i("unlinkSIWE","sIWERequest",t);const n=new URL("/iam/v1/siwe/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},verifyEmail:async(t,s={})=>{i("verifyEmail","verifyEmailRequest",t);const n=new URL("/iam/v1/password/verify_email",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},verifyOAuthToken:async(t,s={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const n=new URL("/iam/v1/oauth/verify",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}}}}(t);return{async authenticateSIWE(a,o){const i=await n.authenticateSIWE(a,o);return l(i,e,s,t)},async getJwks(a,o){const i=await n.getJwks(a,o);return l(i,e,s,t)},async initOAuth(a,o,i){const r=await n.initOAuth(a,o,i);return l(r,e,s,t)},async initSIWE(a,o,i){const r=await n.initSIWE(a,o,i);return l(r,e,s,t)},async linkEmail(a,o,i){const r=await n.linkEmail(a,o,i);return l(r,e,s,t)},async linkOAuth(a,o,i){const r=await n.linkOAuth(a,o,i);return l(r,e,s,t)},async linkSIWE(a,o){const i=await n.linkSIWE(a,o);return l(i,e,s,t)},async linkThirdParty(a,o,i){const r=await n.linkThirdParty(a,o,i);return l(r,e,s,t)},async loginEmailPassword(a,o,i){const r=await n.loginEmailPassword(a,o,i);return l(r,e,s,t)},async loginOIDC(a,o,i){const r=await n.loginOIDC(a,o,i);return l(r,e,s,t)},async loginWithIdToken(a,o){const i=await n.loginWithIdToken(a,o);return l(i,e,s,t)},async logout(a,o){const i=await n.logout(a,o);return l(i,e,s,t)},async me(a){const o=await n.me(a);return l(o,e,s,t)},async poolOAuth(a,o){const i=await n.poolOAuth(a,o);return l(i,e,s,t)},async refresh(a,o){const i=await n.refresh(a,o);return l(i,e,s,t)},async registerGuest(a,o){const i=await n.registerGuest(a,o);return l(i,e,s,t)},async requestEmailVerification(a,o){const i=await n.requestEmailVerification(a,o);return l(i,e,s,t)},async requestResetPassword(a,o){const i=await n.requestResetPassword(a,o);return l(i,e,s,t)},async resetPassword(a,o){const i=await n.resetPassword(a,o);return l(i,e,s,t)},async signupEmailPassword(a,o,i){const r=await n.signupEmailPassword(a,o,i);return l(r,e,s,t)},async thirdParty(a,o,i){const r=await n.thirdParty(a,o,i);return l(r,e,s,t)},async unlinkEmail(a,o){const i=await n.unlinkEmail(a,o);return l(i,e,s,t)},async unlinkOAuth(a,o){const i=await n.unlinkOAuth(a,o);return l(i,e,s,t)},async unlinkSIWE(a,o){const i=await n.unlinkSIWE(a,o);return l(i,e,s,t)},async verifyEmail(a,o){const i=await n.verifyEmail(a,o);return l(i,e,s,t)},async verifyOAuthToken(a,o){const i=await n.verifyOAuthToken(a,o);return l(i,e,s,t)}}};class g extends n{authenticateSIWE(e,t){return m(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}getJwks(e,t){return m(this.configuration).getJwks(e.publishableKey,t).then(e=>e(this.axios,this.basePath))}initOAuth(e,t){return m(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}initSIWE(e,t){return m(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkEmail(e,t){return m(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkOAuth(e,t){return m(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkSIWE(e,t){return m(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}linkThirdParty(e,t){return m(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginEmailPassword(e,t){return m(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginOIDC(e,t){return m(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginWithIdToken(e,t){return m(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then(e=>e(this.axios,this.basePath))}logout(e,t){return m(this.configuration).logout(e.logoutRequest,t).then(e=>e(this.axios,this.basePath))}me(e){return m(this.configuration).me(e).then(e=>e(this.axios,this.basePath))}poolOAuth(e,t){return m(this.configuration).poolOAuth(e.key,t).then(e=>e(this.axios,this.basePath))}refresh(e,t){return m(this.configuration).refresh(e.refreshTokenRequest,t).then(e=>e(this.axios,this.basePath))}registerGuest(e={},t){return m(this.configuration).registerGuest(e.xGame,t).then(e=>e(this.axios,this.basePath))}requestEmailVerification(e,t){return m(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}requestResetPassword(e,t){return m(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}resetPassword(e,t){return m(this.configuration).resetPassword(e.resetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}signupEmailPassword(e,t){return m(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}thirdParty(e,t){return m(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}unlinkEmail(e,t){return m(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then(e=>e(this.axios,this.basePath))}unlinkOAuth(e,t){return m(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then(e=>e(this.axios,this.basePath))}unlinkSIWE(e,t){return m(this.configuration).unlinkSIWE(e.sIWERequest,t).then(e=>e(this.axios,this.basePath))}verifyEmail(e,t){return m(this.configuration).verifyEmail(e.verifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}verifyOAuthToken(e,t){return m(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const f=function(t){const n=function(e){return{meV2:async(t={})=>{const s=new URL("/iam/v2/me",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}}}}(t);return{async meV2(a){const o=await n.meV2(a);return l(o,e,s,t)}}};class R extends n{meV2(e){return f(this.configuration).meV2(e).then(e=>e(this.axios,this.basePath))}}const O=function(t){const n=function(e){return{accountInfoPost:async(t,s={})=>{i("accountInfoPost","accountInfoPostRequest",t);const n=new URL("/account-info",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},changeEmailPost:async(t,s={})=>{i("changeEmailPost","changeEmailPostRequest",t);const n=new URL("/change-email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},changePasswordPost:async(t,s={})=>{i("changePasswordPost","changePasswordPostRequest",t);const n=new URL("/change-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},deleteUserCallbackGet:async(t,s,n={})=>{const a=new URL("/delete-user/callback",o);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},c={};void 0!==t&&(c.token=t),void 0!==s&&(c.callbackURL=s),h(a,c);let u=i&&i.headers?i.headers:{};return r.headers={...u,...n.headers},{url:d(a),options:r}},deleteUserPost:async(t,s={})=>{i("deleteUserPost","deleteUserPostRequest",t);const n=new URL("/delete-user",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},errorGet:async(t={})=>{const s=new URL("/error",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},forgetPasswordPost:async(t,s={})=>{i("forgetPasswordPost","forgetPasswordPostRequest",t);const n=new URL("/forget-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},getAccessTokenPost:async(t,s={})=>{i("getAccessTokenPost","refreshTokenPostRequest",t);const n=new URL("/get-access-token",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},getSessionGet:async(t,s={})=>{const n=new URL("/get-session",o);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...s},r={};void 0!==t&&(r.disableCookieCache=t),h(n,r);let c=a&&a.headers?a.headers:{};return i.headers={...c,...s.headers},{url:d(n),options:i}},linkSocialPost:async(t,s={})=>{i("linkSocialPost","linkSocialPostRequest",t);const n=new URL("/link-social",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},listAccountsGet:async(t={})=>{const s=new URL("/list-accounts",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},listSessionsGet:async(t={})=>{const s=new URL("/list-sessions",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},okGet:async(t={})=>{const s=new URL("/ok",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},refreshTokenPost:async(t,s={})=>{i("refreshTokenPost","refreshTokenPostRequest",t);const n=new URL("/refresh-token",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},requestPasswordResetPost:async(t,s={})=>{i("requestPasswordResetPost","forgetPasswordPostRequest",t);const n=new URL("/request-password-reset",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},resetPasswordPost:async(t,s={})=>{i("resetPasswordPost","resetPasswordPostRequest",t);const n=new URL("/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},resetPasswordTokenGet:async(t,s,n={})=>{i("resetPasswordTokenGet","token",t);const a="/reset-password/{token}".replace("{token}",encodeURIComponent(String(t))),r=new URL(a,o);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...n},l={};void 0!==s&&(l.callbackURL=s),h(r,l);let p=c&&c.headers?c.headers:{};return u.headers={...p,...n.headers},{url:d(r),options:u}},revokeOtherSessionsPost:async(t,s={})=>{const n=new URL("/revoke-other-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionPost:async(t,s={})=>{const n=new URL("/revoke-session",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionsPost:async(t,s={})=>{const n=new URL("/revoke-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},sendVerificationEmailPost:async(t,s={})=>{const n=new URL("/send-verification-email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signInEmailPost:async(t,s={})=>{i("signInEmailPost","signInEmailPostRequest",t);const n=new URL("/sign-in/email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signOutPost:async(t,s={})=>{const n=new URL("/sign-out",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signUpEmailPost:async(t,s={})=>{const n=new URL("/sign-up/email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},socialSignIn:async(t,s={})=>{i("socialSignIn","socialSignInRequest",t);const n=new URL("/sign-in/social",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkAccountPost:async(t,s={})=>{i("unlinkAccountPost","unlinkAccountPostRequest",t);const n=new URL("/unlink-account",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},updateUserPost:async(t,s={})=>{const n=new URL("/update-user",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},verifyEmailGet:async(t,s,n={})=>{i("verifyEmailGet","token",t);const a=new URL("/verify-email",o);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...n},u={};void 0!==t&&(u.token=t),void 0!==s&&(u.callbackURL=s),h(a,u);let l=r&&r.headers?r.headers:{};return c.headers={...l,...n.headers},{url:d(a),options:c}}}}(t);return{async accountInfoPost(a,o){const i=await n.accountInfoPost(a,o);return l(i,e,s,t)},async changeEmailPost(a,o){const i=await n.changeEmailPost(a,o);return l(i,e,s,t)},async changePasswordPost(a,o){const i=await n.changePasswordPost(a,o);return l(i,e,s,t)},async deleteUserCallbackGet(a,o,i){const r=await n.deleteUserCallbackGet(a,o,i);return l(r,e,s,t)},async deleteUserPost(a,o){const i=await n.deleteUserPost(a,o);return l(i,e,s,t)},async errorGet(a){const o=await n.errorGet(a);return l(o,e,s,t)},async forgetPasswordPost(a,o){const i=await n.forgetPasswordPost(a,o);return l(i,e,s,t)},async getAccessTokenPost(a,o){const i=await n.getAccessTokenPost(a,o);return l(i,e,s,t)},async getSessionGet(a,o){const i=await n.getSessionGet(a,o);return l(i,e,s,t)},async linkSocialPost(a,o){const i=await n.linkSocialPost(a,o);return l(i,e,s,t)},async listAccountsGet(a){const o=await n.listAccountsGet(a);return l(o,e,s,t)},async listSessionsGet(a){const o=await n.listSessionsGet(a);return l(o,e,s,t)},async okGet(a){const o=await n.okGet(a);return l(o,e,s,t)},async refreshTokenPost(a,o){const i=await n.refreshTokenPost(a,o);return l(i,e,s,t)},async requestPasswordResetPost(a,o){const i=await n.requestPasswordResetPost(a,o);return l(i,e,s,t)},async resetPasswordPost(a,o){const i=await n.resetPasswordPost(a,o);return l(i,e,s,t)},async resetPasswordTokenGet(a,o,i){const r=await n.resetPasswordTokenGet(a,o,i);return l(r,e,s,t)},async revokeOtherSessionsPost(a,o){const i=await n.revokeOtherSessionsPost(a,o);return l(i,e,s,t)},async revokeSessionPost(a,o){const i=await n.revokeSessionPost(a,o);return l(i,e,s,t)},async revokeSessionsPost(a,o){const i=await n.revokeSessionsPost(a,o);return l(i,e,s,t)},async sendVerificationEmailPost(a,o){const i=await n.sendVerificationEmailPost(a,o);return l(i,e,s,t)},async signInEmailPost(a,o){const i=await n.signInEmailPost(a,o);return l(i,e,s,t)},async signOutPost(a,o){const i=await n.signOutPost(a,o);return l(i,e,s,t)},async signUpEmailPost(a,o){const i=await n.signUpEmailPost(a,o);return l(i,e,s,t)},async socialSignIn(a,o){const i=await n.socialSignIn(a,o);return l(i,e,s,t)},async unlinkAccountPost(a,o){const i=await n.unlinkAccountPost(a,o);return l(i,e,s,t)},async updateUserPost(a,o){const i=await n.updateUserPost(a,o);return l(i,e,s,t)},async verifyEmailGet(a,o,i){const r=await n.verifyEmailGet(a,o,i);return l(r,e,s,t)}}};class b extends n{accountInfoPost(e,t){return O(this.configuration).accountInfoPost(e.accountInfoPostRequest,t).then(e=>e(this.axios,this.basePath))}changeEmailPost(e,t){return O(this.configuration).changeEmailPost(e.changeEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}changePasswordPost(e,t){return O(this.configuration).changePasswordPost(e.changePasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}deleteUserCallbackGet(e={},t){return O(this.configuration).deleteUserCallbackGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}deleteUserPost(e,t){return O(this.configuration).deleteUserPost(e.deleteUserPostRequest,t).then(e=>e(this.axios,this.basePath))}errorGet(e){return O(this.configuration).errorGet(e).then(e=>e(this.axios,this.basePath))}forgetPasswordPost(e,t){return O(this.configuration).forgetPasswordPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}getAccessTokenPost(e,t){return O(this.configuration).getAccessTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}getSessionGet(e={},t){return O(this.configuration).getSessionGet(e.disableCookieCache,t).then(e=>e(this.axios,this.basePath))}linkSocialPost(e,t){return O(this.configuration).linkSocialPost(e.linkSocialPostRequest,t).then(e=>e(this.axios,this.basePath))}listAccountsGet(e){return O(this.configuration).listAccountsGet(e).then(e=>e(this.axios,this.basePath))}listSessionsGet(e){return O(this.configuration).listSessionsGet(e).then(e=>e(this.axios,this.basePath))}okGet(e){return O(this.configuration).okGet(e).then(e=>e(this.axios,this.basePath))}refreshTokenPost(e,t){return O(this.configuration).refreshTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}requestPasswordResetPost(e,t){return O(this.configuration).requestPasswordResetPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordPost(e,t){return O(this.configuration).resetPasswordPost(e.resetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordTokenGet(e,t){return O(this.configuration).resetPasswordTokenGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}revokeOtherSessionsPost(e={},t){return O(this.configuration).revokeOtherSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}revokeSessionPost(e={},t){return O(this.configuration).revokeSessionPost(e.revokeSessionPostRequest,t).then(e=>e(this.axios,this.basePath))}revokeSessionsPost(e={},t){return O(this.configuration).revokeSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}sendVerificationEmailPost(e={},t){return O(this.configuration).sendVerificationEmailPost(e.sendVerificationEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailPost(e,t){return O(this.configuration).signInEmailPost(e.signInEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signOutPost(e={},t){return O(this.configuration).signOutPost(e.body,t).then(e=>e(this.axios,this.basePath))}signUpEmailPost(e={},t){return O(this.configuration).signUpEmailPost(e.signUpEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}socialSignIn(e,t){return O(this.configuration).socialSignIn(e.socialSignInRequest,t).then(e=>e(this.axios,this.basePath))}unlinkAccountPost(e,t){return O(this.configuration).unlinkAccountPost(e.unlinkAccountPostRequest,t).then(e=>e(this.axios,this.basePath))}updateUserPost(e={},t){return O(this.configuration).updateUserPost(e.updateUserPostRequest,t).then(e=>e(this.axios,this.basePath))}verifyEmailGet(e,t){return O(this.configuration).verifyEmailGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}}const T=function(t){const n=function(e){return{checkVerificationOtp:async(t,s={})=>{i("checkVerificationOtp","checkVerificationOtpRequest",t);const n=new URL("/email-otp/check-verification-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpResetPasswordPost:async(t,s={})=>{i("emailOtpResetPasswordPost","emailOtpResetPasswordPostRequest",t);const n=new URL("/email-otp/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpSendVerificationOtpPost:async(t,s={})=>{i("emailOtpSendVerificationOtpPost","emailOtpSendVerificationOtpPostRequest",t);const n=new URL("/email-otp/send-verification-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpVerifyEmailPost:async(t,s={})=>{i("emailOtpVerifyEmailPost","emailOtpVerifyEmailPostRequest",t);const n=new URL("/email-otp/verify-email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},forgetPasswordEmailOtpPost:async(t,s={})=>{i("forgetPasswordEmailOtpPost","forgetPasswordEmailOtpPostRequest",t);const n=new URL("/forget-password/email-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signInEmailOtpPost:async(t,s={})=>{i("signInEmailOtpPost","signInEmailOtpPostRequest",t);const n=new URL("/sign-in/email-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async checkVerificationOtp(a,o){const i=await n.checkVerificationOtp(a,o);return l(i,e,s,t)},async emailOtpResetPasswordPost(a,o){const i=await n.emailOtpResetPasswordPost(a,o);return l(i,e,s,t)},async emailOtpSendVerificationOtpPost(a,o){const i=await n.emailOtpSendVerificationOtpPost(a,o);return l(i,e,s,t)},async emailOtpVerifyEmailPost(a,o){const i=await n.emailOtpVerifyEmailPost(a,o);return l(i,e,s,t)},async forgetPasswordEmailOtpPost(a,o){const i=await n.forgetPasswordEmailOtpPost(a,o);return l(i,e,s,t)},async signInEmailOtpPost(a,o){const i=await n.signInEmailOtpPost(a,o);return l(i,e,s,t)}}};class S extends n{checkVerificationOtp(e,t){return T(this.configuration).checkVerificationOtp(e.checkVerificationOtpRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpResetPasswordPost(e,t){return T(this.configuration).emailOtpResetPasswordPost(e.emailOtpResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpSendVerificationOtpPost(e,t){return T(this.configuration).emailOtpSendVerificationOtpPost(e.emailOtpSendVerificationOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpVerifyEmailPost(e,t){return T(this.configuration).emailOtpVerifyEmailPost(e.emailOtpVerifyEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordEmailOtpPost(e,t){return T(this.configuration).forgetPasswordEmailOtpPost(e.forgetPasswordEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailOtpPost(e,t){return T(this.configuration).signInEmailOtpPost(e.signInEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}}const k=function(t){const n=function(e){return{phoneNumberForgetPasswordPost:async(t,s={})=>{i("phoneNumberForgetPasswordPost","phoneNumberForgetPasswordPostRequest",t);const n=new URL("/phone-number/forget-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberRequestPasswordResetPost:async(t,s={})=>{i("phoneNumberRequestPasswordResetPost","phoneNumberRequestPasswordResetPostRequest",t);const n=new URL("/phone-number/request-password-reset",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberResetPasswordPost:async(t,s={})=>{i("phoneNumberResetPasswordPost","phoneNumberResetPasswordPostRequest",t);const n=new URL("/phone-number/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberSendOtpPost:async(t,s={})=>{i("phoneNumberSendOtpPost","phoneNumberSendOtpPostRequest",t);const n=new URL("/phone-number/send-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberVerifyPost:async(t,s={})=>{i("phoneNumberVerifyPost","phoneNumberVerifyPostRequest",t);const n=new URL("/phone-number/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signInPhoneNumberPost:async(t,s={})=>{i("signInPhoneNumberPost","signInPhoneNumberPostRequest",t);const n=new URL("/sign-in/phone-number",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async phoneNumberForgetPasswordPost(a,o){const i=await n.phoneNumberForgetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberRequestPasswordResetPost(a,o){const i=await n.phoneNumberRequestPasswordResetPost(a,o);return l(i,e,s,t)},async phoneNumberResetPasswordPost(a,o){const i=await n.phoneNumberResetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberSendOtpPost(a,o){const i=await n.phoneNumberSendOtpPost(a,o);return l(i,e,s,t)},async phoneNumberVerifyPost(a,o){const i=await n.phoneNumberVerifyPost(a,o);return l(i,e,s,t)},async signInPhoneNumberPost(a,o){const i=await n.signInPhoneNumberPost(a,o);return l(i,e,s,t)}}};class v extends n{phoneNumberForgetPasswordPost(e,t){return k(this.configuration).phoneNumberForgetPasswordPost(e.phoneNumberForgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberRequestPasswordResetPost(e,t){return k(this.configuration).phoneNumberRequestPasswordResetPost(e.phoneNumberRequestPasswordResetPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberResetPasswordPost(e,t){return k(this.configuration).phoneNumberResetPasswordPost(e.phoneNumberResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberSendOtpPost(e,t){return k(this.configuration).phoneNumberSendOtpPost(e.phoneNumberSendOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberVerifyPost(e,t){return k(this.configuration).phoneNumberVerifyPost(e.phoneNumberVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}signInPhoneNumberPost(e,t){return k(this.configuration).signInPhoneNumberPost(e.signInPhoneNumberPostRequest,t).then(e=>e(this.axios,this.basePath))}}const q=function(t){const n=function(e){return{handleRpcRequest:async(t,s={})=>{i("handleRpcRequest","jsonRpcRequest",t);const n=new URL("/rpc",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async handleRpcRequest(a,o){const i=await n.handleRpcRequest(a,o);return l(i,e,s,t)}}};class I extends n{handleRpcRequest(e,t){return q(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const x=function(t){const n=function(e){return{linkSiweListWalletsGet:async(t={})=>{const s=new URL("/link-siwe/list-wallets",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},linkSiweNoncePost:async(t,s={})=>{i("linkSiweNoncePost","siweNoncePostRequest",t);const n=new URL("/link-siwe/nonce",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkSiweUnlinkPost:async(t,s={})=>{i("linkSiweUnlinkPost","linkSiweUnlinkPostRequest",t);const n=new URL("/link-siwe/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkSiweVerifyPost:async(t,s={})=>{i("linkSiweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/link-siwe/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},siweNoncePost:async(t,s={})=>{i("siweNoncePost","siweNoncePostRequest",t);const n=new URL("/siwe/nonce",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},siweVerifyPost:async(t,s={})=>{i("siweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/siwe/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async linkSiweListWalletsGet(a){const o=await n.linkSiweListWalletsGet(a);return l(o,e,s,t)},async linkSiweNoncePost(a,o){const i=await n.linkSiweNoncePost(a,o);return l(i,e,s,t)},async linkSiweUnlinkPost(a,o){const i=await n.linkSiweUnlinkPost(a,o);return l(i,e,s,t)},async linkSiweVerifyPost(a,o){const i=await n.linkSiweVerifyPost(a,o);return l(i,e,s,t)},async siweNoncePost(a,o){const i=await n.siweNoncePost(a,o);return l(i,e,s,t)},async siweVerifyPost(a,o){const i=await n.siweVerifyPost(a,o);return l(i,e,s,t)}}};class A extends n{linkSiweListWalletsGet(e){return x(this.configuration).linkSiweListWalletsGet(e).then(e=>e(this.axios,this.basePath))}linkSiweNoncePost(e,t){return x(this.configuration).linkSiweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweUnlinkPost(e,t){return x(this.configuration).linkSiweUnlinkPost(e.linkSiweUnlinkPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweVerifyPost(e,t){return x(this.configuration).linkSiweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}siweNoncePost(e,t){return x(this.configuration).siweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}siweVerifyPost(e,t){return x(this.configuration).siweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}}const E=function(t){const n=function(e){return{createSession:async(t,s,n={})=>{i("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,s,n,a,c,u={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",o);let p;e&&(p=e.baseOptions);const P={method:"GET",...p,...u},w={},y={};await r(w,e),void 0!==s&&(y.limit=s),void 0!==n&&(y.skip=n),void 0!==a&&(y.order=a),void 0!==t&&(y.player=t),c&&(y.expand=c),h(l,y);let m=p&&p.headers?p.headers:{};return P.headers={...w,...m,...u.headers},{url:d(l),options:P}},getSession:async(t,s,n={})=>{i("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},revokeSession:async(t,s,n={})=>{i("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},signatureSession:async(t,s,n={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",s);const a="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createSession(a,o,i){const r=await n.createSession(a,o,i);return l(r,e,s,t)},async getPlayerSessions(a,o,i,r,c,h){const u=await n.getPlayerSessions(a,o,i,r,c,h);return l(u,e,s,t)},async getSession(a,o,i){const r=await n.getSession(a,o,i);return l(r,e,s,t)},async revokeSession(a,o,i){const r=await n.revokeSession(a,o,i);return l(r,e,s,t)},async signatureSession(a,o,i){const r=await n.signatureSession(a,o,i);return l(r,e,s,t)}}};class U extends n{createSession(e,t){return E(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return E(this.configuration).getPlayerSessions(e.player,e.limit,e.skip,e.order,e.expand,t).then(e=>e(this.axios,this.basePath))}getSession(e,t){return E(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return E(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return E(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const C=function(t){const n=function(e){return{createTransactionIntent:async(t,s,n={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const a=new URL("/v1/transaction_intents",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},estimateTransactionIntentCost:async(t,s={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const n=new URL("/v1/transaction_intents/estimate_gas_cost",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getTransactionIntent:async(t,s,n={})=>{i("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getTransactionIntents:async(t,s,n,a,i,c,u,l,p,P={})=>{const w=new URL("/v1/transaction_intents",o);let y;e&&(y=e.baseOptions);const m={method:"GET",...y,...P},g={},f={};await r(g,e),void 0!==t&&(f.limit=t),void 0!==s&&(f.skip=s),void 0!==n&&(f.order=n),a&&(f.expand=a),void 0!==i&&(f.chainId=i),c&&(f.account=c),u&&(f.player=u),void 0!==l&&(f.status=l),p&&(f.policy=p),h(w,f);let R=y&&y.headers?y.headers:{};return m.headers={...g,...R,...P.headers},{url:d(w),options:m}},signature:async(t,s,n={})=>{i("signature","id",t),i("signature","signatureRequest",s);const a="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createTransactionIntent(a,o,i){const r=await n.createTransactionIntent(a,o,i);return l(r,e,s,t)},async estimateTransactionIntentCost(a,o){const i=await n.estimateTransactionIntentCost(a,o);return l(i,e,s,t)},async getTransactionIntent(a,o,i){const r=await n.getTransactionIntent(a,o,i);return l(r,e,s,t)},async getTransactionIntents(a,o,i,r,c,h,u,d,p,P){const w=await n.getTransactionIntents(a,o,i,r,c,h,u,d,p,P);return l(w,e,s,t)},async signature(a,o,i){const r=await n.signature(a,o,i);return l(r,e,s,t)}}};class L extends n{createTransactionIntent(e,t){return C(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return C(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return C(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return C(this.configuration).getTransactionIntents(e.limit,e.skip,e.order,e.expand,e.chainId,e.account,e.player,e.status,e.policy,t).then(e=>e(this.axios,this.basePath))}signature(e,t){return C(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}class V{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const j=({basePath:e,accessToken:t,nativeAppIdentifier:s})=>{if(!e.trim())throw Error("basePath can not be empty");const n={basePath:e,accessToken:t};return s&&(n.baseOptions={headers:{"x-native-app-identifier":s}}),new V(n)};exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;rpcApi;sessionsApi;emailOTPApi;userApi;anonymousApi;siweApi;smsOTPApi;authenticationApi;authenticationV2Api;storage;onLogout;axiosInstance;constructor(s){this.storage=s.storage,this.onLogout=s.onLogout,this.axiosInstance=e.create(),t(this.axiosInstance,{retries:3,retryDelay:t.exponentialDelay,retryCondition:t.isRetryableError}),this.setupInterceptors();const n={basePath:s.basePath,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier};this.config={backend:j(n)};const a={basePath:`${s.basePath}/iam/v2/auth`,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier},o=j(a);this.emailOTPApi=new S(o,void 0,this.axiosInstance),this.smsOTPApi=new v(o,void 0,this.axiosInstance),this.anonymousApi=new y(o,void 0,this.axiosInstance),this.authenticationV2Api=new b(o,void 0,this.axiosInstance),this.authenticationApi=new g(this.config.backend,void 0,this.axiosInstance),this.siweApi=new A(o,void 0,this.axiosInstance),this.userApi=new R(this.config.backend,void 0,this.axiosInstance),this.transactionIntentsApi=new L(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new P(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new U(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new I(this.config.backend,void 0,this.axiosInstance)}setupInterceptors(){this.axiosInstance.interceptors.response.use(e=>e,async e=>(401===e.response?.status&&(await this.clearAuthenticationState(),this.emitLogoutEvent()),Promise.reject(e)))}async clearAuthenticationState(){if(this.storage)try{this.storage.remove("openfort.authentication"),this.storage.remove("openfort.account"),this.storage.remove("openfort.session"),this.storage.remove("openfort.pkce_state"),this.storage.remove("openfort.pkce_verifier")}catch(e){}}emitLogoutEvent(){if(this.onLogout)try{this.onLogout()}catch(e){}}},exports.createConfig=j;
1
+ "use strict";var e=require("axios"),t=require("axios-retry");const s="https://api.openfort.io".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(t,n=s,a=e){this.basePath=n,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const o="https://example.com",i=function(e,t,s){if(null==s)throw new a(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},r=async function(e,t){if(t&&t.accessToken){const s="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+s}};function c(e,t,s=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach(t=>c(e,t,s)):Object.keys(t).forEach(n=>c(e,t[n],`${s}${""!==s?".":""}${n}`)):e.has(s)?e.append(s,t):e.set(s,t))}const h=function(e,...t){const s=new URLSearchParams(e.search);c(s,t),e.search=s.toString()},u=function(e,t,s){const n="string"!=typeof e;return(n&&s&&s.isJsonMime?s.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,s,n){return(a=t,o=s)=>{const i={...e.options,url:(n?.basePath||a.defaults.baseURL||o)+e.url};return a.request(i)}},p=function(t){const n=function(e){return{cancelTransferOwnership:async(t,s,n={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",s);const a="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},completeRecovery:async(t,s,n={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",s);const a="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},createAccount:async(t,s={})=>{i("createAccount","createAccountRequest",t);const n=new URL("/v1/accounts",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},createAccountV2:async(t,s={})=>{i("createAccountV2","createAccountRequestV2",t);const n=new URL("/v2/accounts",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},deployAccount:async(t,s,n={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",s);const a="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},disableAccount:async(t,s={})=>{i("disableAccount","id",t);const n="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccount:async(t,s,n={})=>{i("getAccount","id",t);const a="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getAccountV2:async(t,s={})=>{i("getAccountV2","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccounts:async(t,s,n,a,i,c,u,l={})=>{const p=new URL("/v1/accounts",o);let P;e&&(P=e.baseOptions);const w={method:"GET",...P,...l},y={},m={};await r(y,e),void 0!==t&&(m.limit=t),void 0!==s&&(m.skip=s),void 0!==n&&(m.order=n),void 0!==a&&(m.chainId=a),void 0!==i&&(m.player=i),void 0!==c&&(m.address=c),u&&(m.expand=u),h(p,m);let g=P&&P.headers?P.headers:{};return w.headers={...y,...g,...l.headers},{url:d(p),options:w}},getAccountsV2:async(t,s,n,a,i,c,u,l,p={})=>{const P=new URL("/v2/accounts",o);let w;e&&(w=e.baseOptions);const y={method:"GET",...w,...p},m={},g={};await r(m,e),void 0!==t&&(g.limit=t),void 0!==s&&(g.skip=s),void 0!==n&&(g.order=n),void 0!==a&&(g.chainId=a),void 0!==i&&(g.user=i),void 0!==c&&(g.chainType=c),void 0!==u&&(g.accountType=u),void 0!==l&&(g.address=l),h(P,g);let R=w&&w.headers?w.headers:{};return y.headers={...m,...R,...p.headers},{url:d(P),options:y}},getSignerIdByAddress:async(t,s={})=>{i("getSignerIdByAddress","address",t);const n=new URL("/v2/accounts/signer",o);let a;e&&(a=e.baseOptions);const c={method:"GET",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.address=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},removeAccount:async(t,s={})=>{i("removeAccount","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"DELETE",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},requestTransferOwnership:async(t,s,n={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",s);const a="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},signPayload:async(t,s,n={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",s);const a="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},startRecovery:async(t,s,n={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",s);const a="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},switchChainV2:async(t,s={})=>{i("switchChainV2","switchChainQueriesV2",t);const n=new URL("/v2/accounts/switch-chain",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},syncAccount:async(t,s={})=>{i("syncAccount","id",t);const n="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}}}}(t);return{async cancelTransferOwnership(a,o,i){const r=await n.cancelTransferOwnership(a,o,i);return l(r,e,s,t)},async completeRecovery(a,o,i){const r=await n.completeRecovery(a,o,i);return l(r,e,s,t)},async createAccount(a,o){const i=await n.createAccount(a,o);return l(i,e,s,t)},async createAccountV2(a,o){const i=await n.createAccountV2(a,o);return l(i,e,s,t)},async deployAccount(a,o,i){const r=await n.deployAccount(a,o,i);return l(r,e,s,t)},async disableAccount(a,o){const i=await n.disableAccount(a,o);return l(i,e,s,t)},async getAccount(a,o,i){const r=await n.getAccount(a,o,i);return l(r,e,s,t)},async getAccountV2(a,o){const i=await n.getAccountV2(a,o);return l(i,e,s,t)},async getAccounts(a,o,i,r,c,h,u,d){const p=await n.getAccounts(a,o,i,r,c,h,u,d);return l(p,e,s,t)},async getAccountsV2(a,o,i,r,c,h,u,d,p){const P=await n.getAccountsV2(a,o,i,r,c,h,u,d,p);return l(P,e,s,t)},async getSignerIdByAddress(a,o){const i=await n.getSignerIdByAddress(a,o);return l(i,e,s,t)},async removeAccount(a,o){const i=await n.removeAccount(a,o);return l(i,e,s,t)},async requestTransferOwnership(a,o,i){const r=await n.requestTransferOwnership(a,o,i);return l(r,e,s,t)},async signPayload(a,o,i){const r=await n.signPayload(a,o,i);return l(r,e,s,t)},async startRecovery(a,o,i){const r=await n.startRecovery(a,o,i);return l(r,e,s,t)},async switchChainV2(a,o){const i=await n.switchChainV2(a,o);return l(i,e,s,t)},async syncAccount(a,o){const i=await n.syncAccount(a,o);return l(i,e,s,t)}}};class P extends n{cancelTransferOwnership(e,t){return p(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}completeRecovery(e,t){return p(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}createAccount(e,t){return p(this.configuration).createAccount(e.createAccountRequest,t).then(e=>e(this.axios,this.basePath))}createAccountV2(e,t){return p(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}deployAccount(e,t){return p(this.configuration).deployAccount(e.id,e.deployRequest,t).then(e=>e(this.axios,this.basePath))}disableAccount(e,t){return p(this.configuration).disableAccount(e.id,t).then(e=>e(this.axios,this.basePath))}getAccount(e,t){return p(this.configuration).getAccount(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return p(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccounts(e={},t){return p(this.configuration).getAccounts(e.limit,e.skip,e.order,e.chainId,e.player,e.address,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return p(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return p(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}removeAccount(e,t){return p(this.configuration).removeAccount(e.id,t).then(e=>e(this.axios,this.basePath))}requestTransferOwnership(e,t){return p(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}signPayload(e,t){return p(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then(e=>e(this.axios,this.basePath))}startRecovery(e,t){return p(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return p(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}syncAccount(e,t){return p(this.configuration).syncAccount(e.id,t).then(e=>e(this.axios,this.basePath))}}const w=function(t){const n=function(e){return{signInAnonymousPost:async(t={})=>{const s=new URL("/sign-in/anonymous",o);let n;e&&(n=e.baseOptions);const a={method:"POST",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}}}}(t);return{async signInAnonymousPost(a){const o=await n.signInAnonymousPost(a);return l(o,e,s,t)}}};class y extends n{signInAnonymousPost(e){return w(this.configuration).signInAnonymousPost(e).then(e=>e(this.axios,this.basePath))}}const m=function(t){const n=function(e){return{authenticateSIWE:async(t,s={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/authenticate",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getJwks:async(t,s={})=>{i("getJwks","publishableKey",t);const n="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),a=new URL(n,o);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...s};h(a,{});let u=r&&r.headers?r.headers:{};return c.headers={...u,...s.headers},{url:d(a),options:c}},initOAuth:async(t,s,n={})=>{i("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},initSIWE:async(t,s,n={})=>{i("initSIWE","sIWERequest",t);const a=new URL("/iam/v1/siwe/init",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkEmail:async(t,s,n={})=>{i("linkEmail","loginRequest",t);const a=new URL("/iam/v1/password/link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkOAuth:async(t,s,n={})=>{i("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkSIWE:async(t,s={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/link",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkThirdParty:async(t,s,n={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",o);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},loginEmailPassword:async(t,s,n={})=>{i("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginOIDC:async(t,s,n={})=>{i("loginOIDC","loginOIDCRequest",t);const a=new URL("/iam/v1/oidc/login",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginWithIdToken:async(t,s={})=>{i("loginWithIdToken","loginWithIdTokenRequest",t);const n=new URL("/iam/v1/oauth/login_id_token",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},logout:async(t,s={})=>{i("logout","logoutRequest",t);const n=new URL("/iam/v1/sessions/logout",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},me:async(t={})=>{const s=new URL("/iam/v1/me",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},poolOAuth:async(t,s={})=>{i("poolOAuth","key",t);const n=new URL("/iam/v1/oauth/pool",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.key=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},refresh:async(t,s={})=>{i("refresh","refreshTokenRequest",t);const n=new URL("/iam/v1/sessions",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},registerGuest:async(t,s={})=>{const n=new URL("/iam/v1/guest",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},c={};await r(c,e),null!=t&&(c["x-game"]=String(t)),h(n,{});let u=a&&a.headers?a.headers:{};return i.headers={...c,...u,...s.headers},{url:d(n),options:i}},requestEmailVerification:async(t,s={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const n=new URL("/iam/v1/password/request_email_verification",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},requestResetPassword:async(t,s={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const n=new URL("/iam/v1/password/request_reset",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},resetPassword:async(t,s={})=>{i("resetPassword","resetPasswordRequest",t);const n=new URL("/iam/v1/password/reset",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},signupEmailPassword:async(t,s,n={})=>{i("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},thirdParty:async(t,s,n={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const a=new URL("/iam/v1/oauth/third_party",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},unlinkEmail:async(t,s={})=>{i("unlinkEmail","unlinkEmailRequest",t);const n=new URL("/iam/v1/password/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkOAuth:async(t,s={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const n=new URL("/iam/v1/oauth/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkSIWE:async(t,s={})=>{i("unlinkSIWE","sIWERequest",t);const n=new URL("/iam/v1/siwe/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},verifyEmail:async(t,s={})=>{i("verifyEmail","verifyEmailRequest",t);const n=new URL("/iam/v1/password/verify_email",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},verifyOAuthToken:async(t,s={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const n=new URL("/iam/v1/oauth/verify",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}}}}(t);return{async authenticateSIWE(a,o){const i=await n.authenticateSIWE(a,o);return l(i,e,s,t)},async getJwks(a,o){const i=await n.getJwks(a,o);return l(i,e,s,t)},async initOAuth(a,o,i){const r=await n.initOAuth(a,o,i);return l(r,e,s,t)},async initSIWE(a,o,i){const r=await n.initSIWE(a,o,i);return l(r,e,s,t)},async linkEmail(a,o,i){const r=await n.linkEmail(a,o,i);return l(r,e,s,t)},async linkOAuth(a,o,i){const r=await n.linkOAuth(a,o,i);return l(r,e,s,t)},async linkSIWE(a,o){const i=await n.linkSIWE(a,o);return l(i,e,s,t)},async linkThirdParty(a,o,i){const r=await n.linkThirdParty(a,o,i);return l(r,e,s,t)},async loginEmailPassword(a,o,i){const r=await n.loginEmailPassword(a,o,i);return l(r,e,s,t)},async loginOIDC(a,o,i){const r=await n.loginOIDC(a,o,i);return l(r,e,s,t)},async loginWithIdToken(a,o){const i=await n.loginWithIdToken(a,o);return l(i,e,s,t)},async logout(a,o){const i=await n.logout(a,o);return l(i,e,s,t)},async me(a){const o=await n.me(a);return l(o,e,s,t)},async poolOAuth(a,o){const i=await n.poolOAuth(a,o);return l(i,e,s,t)},async refresh(a,o){const i=await n.refresh(a,o);return l(i,e,s,t)},async registerGuest(a,o){const i=await n.registerGuest(a,o);return l(i,e,s,t)},async requestEmailVerification(a,o){const i=await n.requestEmailVerification(a,o);return l(i,e,s,t)},async requestResetPassword(a,o){const i=await n.requestResetPassword(a,o);return l(i,e,s,t)},async resetPassword(a,o){const i=await n.resetPassword(a,o);return l(i,e,s,t)},async signupEmailPassword(a,o,i){const r=await n.signupEmailPassword(a,o,i);return l(r,e,s,t)},async thirdParty(a,o,i){const r=await n.thirdParty(a,o,i);return l(r,e,s,t)},async unlinkEmail(a,o){const i=await n.unlinkEmail(a,o);return l(i,e,s,t)},async unlinkOAuth(a,o){const i=await n.unlinkOAuth(a,o);return l(i,e,s,t)},async unlinkSIWE(a,o){const i=await n.unlinkSIWE(a,o);return l(i,e,s,t)},async verifyEmail(a,o){const i=await n.verifyEmail(a,o);return l(i,e,s,t)},async verifyOAuthToken(a,o){const i=await n.verifyOAuthToken(a,o);return l(i,e,s,t)}}};class g extends n{authenticateSIWE(e,t){return m(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}getJwks(e,t){return m(this.configuration).getJwks(e.publishableKey,t).then(e=>e(this.axios,this.basePath))}initOAuth(e,t){return m(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}initSIWE(e,t){return m(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkEmail(e,t){return m(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkOAuth(e,t){return m(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkSIWE(e,t){return m(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}linkThirdParty(e,t){return m(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginEmailPassword(e,t){return m(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginOIDC(e,t){return m(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginWithIdToken(e,t){return m(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then(e=>e(this.axios,this.basePath))}logout(e,t){return m(this.configuration).logout(e.logoutRequest,t).then(e=>e(this.axios,this.basePath))}me(e){return m(this.configuration).me(e).then(e=>e(this.axios,this.basePath))}poolOAuth(e,t){return m(this.configuration).poolOAuth(e.key,t).then(e=>e(this.axios,this.basePath))}refresh(e,t){return m(this.configuration).refresh(e.refreshTokenRequest,t).then(e=>e(this.axios,this.basePath))}registerGuest(e={},t){return m(this.configuration).registerGuest(e.xGame,t).then(e=>e(this.axios,this.basePath))}requestEmailVerification(e,t){return m(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}requestResetPassword(e,t){return m(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}resetPassword(e,t){return m(this.configuration).resetPassword(e.resetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}signupEmailPassword(e,t){return m(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}thirdParty(e,t){return m(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}unlinkEmail(e,t){return m(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then(e=>e(this.axios,this.basePath))}unlinkOAuth(e,t){return m(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then(e=>e(this.axios,this.basePath))}unlinkSIWE(e,t){return m(this.configuration).unlinkSIWE(e.sIWERequest,t).then(e=>e(this.axios,this.basePath))}verifyEmail(e,t){return m(this.configuration).verifyEmail(e.verifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}verifyOAuthToken(e,t){return m(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const R=function(t){const n=function(e){return{meV2:async(t={})=>{const s=new URL("/iam/v2/me",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},thirdPartyV2:async(t,s={})=>{i("thirdPartyV2","thirdPartyOAuthRequest",t);const n=new URL("/iam/v2/user/third_party",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}}}}(t);return{async meV2(a){const o=await n.meV2(a);return l(o,e,s,t)},async thirdPartyV2(a,o){const i=await n.thirdPartyV2(a,o);return l(i,e,s,t)}}};class f extends n{meV2(e){return R(this.configuration).meV2(e).then(e=>e(this.axios,this.basePath))}thirdPartyV2(e,t){return R(this.configuration).thirdPartyV2(e.thirdPartyOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const O=function(t){const n=function(e){return{accountInfoPost:async(t,s={})=>{i("accountInfoPost","accountInfoPostRequest",t);const n=new URL("/account-info",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},changeEmailPost:async(t,s={})=>{i("changeEmailPost","changeEmailPostRequest",t);const n=new URL("/change-email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},changePasswordPost:async(t,s={})=>{i("changePasswordPost","changePasswordPostRequest",t);const n=new URL("/change-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},deleteUserCallbackGet:async(t,s,n={})=>{const a=new URL("/delete-user/callback",o);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},c={};void 0!==t&&(c.token=t),void 0!==s&&(c.callbackURL=s),h(a,c);let u=i&&i.headers?i.headers:{};return r.headers={...u,...n.headers},{url:d(a),options:r}},deleteUserPost:async(t,s={})=>{i("deleteUserPost","deleteUserPostRequest",t);const n=new URL("/delete-user",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},errorGet:async(t={})=>{const s=new URL("/error",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},forgetPasswordPost:async(t,s={})=>{i("forgetPasswordPost","forgetPasswordPostRequest",t);const n=new URL("/forget-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},getAccessTokenPost:async(t,s={})=>{i("getAccessTokenPost","refreshTokenPostRequest",t);const n=new URL("/get-access-token",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},getSessionGet:async(t,s={})=>{const n=new URL("/get-session",o);let a;e&&(a=e.baseOptions);const i={method:"GET",...a,...s},r={};void 0!==t&&(r.disableCookieCache=t),h(n,r);let c=a&&a.headers?a.headers:{};return i.headers={...c,...s.headers},{url:d(n),options:i}},linkSocialPost:async(t,s={})=>{i("linkSocialPost","linkSocialPostRequest",t);const n=new URL("/link-social",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},listAccountsGet:async(t={})=>{const s=new URL("/list-accounts",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},listSessionsGet:async(t={})=>{const s=new URL("/list-sessions",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},okGet:async(t={})=>{const s=new URL("/ok",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},refreshTokenPost:async(t,s={})=>{i("refreshTokenPost","refreshTokenPostRequest",t);const n=new URL("/refresh-token",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},requestPasswordResetPost:async(t,s={})=>{i("requestPasswordResetPost","forgetPasswordPostRequest",t);const n=new URL("/request-password-reset",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},resetPasswordPost:async(t,s={})=>{i("resetPasswordPost","resetPasswordPostRequest",t);const n=new URL("/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},resetPasswordTokenGet:async(t,s,n={})=>{i("resetPasswordTokenGet","token",t);const a="/reset-password/{token}".replace("{token}",encodeURIComponent(String(t))),r=new URL(a,o);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...n},l={};void 0!==s&&(l.callbackURL=s),h(r,l);let p=c&&c.headers?c.headers:{};return u.headers={...p,...n.headers},{url:d(r),options:u}},revokeOtherSessionsPost:async(t,s={})=>{const n=new URL("/revoke-other-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionPost:async(t,s={})=>{const n=new URL("/revoke-session",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionsPost:async(t,s={})=>{const n=new URL("/revoke-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},sendVerificationEmailPost:async(t,s={})=>{const n=new URL("/send-verification-email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signInEmailPost:async(t,s={})=>{i("signInEmailPost","signInEmailPostRequest",t);const n=new URL("/sign-in/email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signOutPost:async(t,s={})=>{const n=new URL("/sign-out",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signUpEmailPost:async(t,s={})=>{const n=new URL("/sign-up/email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},socialSignIn:async(t,s={})=>{i("socialSignIn","socialSignInRequest",t);const n=new URL("/sign-in/social",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkAccountPost:async(t,s={})=>{i("unlinkAccountPost","unlinkAccountPostRequest",t);const n=new URL("/unlink-account",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},updateUserPost:async(t,s={})=>{const n=new URL("/update-user",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},verifyEmailGet:async(t,s,n={})=>{i("verifyEmailGet","token",t);const a=new URL("/verify-email",o);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...n},u={};void 0!==t&&(u.token=t),void 0!==s&&(u.callbackURL=s),h(a,u);let l=r&&r.headers?r.headers:{};return c.headers={...l,...n.headers},{url:d(a),options:c}}}}(t);return{async accountInfoPost(a,o){const i=await n.accountInfoPost(a,o);return l(i,e,s,t)},async changeEmailPost(a,o){const i=await n.changeEmailPost(a,o);return l(i,e,s,t)},async changePasswordPost(a,o){const i=await n.changePasswordPost(a,o);return l(i,e,s,t)},async deleteUserCallbackGet(a,o,i){const r=await n.deleteUserCallbackGet(a,o,i);return l(r,e,s,t)},async deleteUserPost(a,o){const i=await n.deleteUserPost(a,o);return l(i,e,s,t)},async errorGet(a){const o=await n.errorGet(a);return l(o,e,s,t)},async forgetPasswordPost(a,o){const i=await n.forgetPasswordPost(a,o);return l(i,e,s,t)},async getAccessTokenPost(a,o){const i=await n.getAccessTokenPost(a,o);return l(i,e,s,t)},async getSessionGet(a,o){const i=await n.getSessionGet(a,o);return l(i,e,s,t)},async linkSocialPost(a,o){const i=await n.linkSocialPost(a,o);return l(i,e,s,t)},async listAccountsGet(a){const o=await n.listAccountsGet(a);return l(o,e,s,t)},async listSessionsGet(a){const o=await n.listSessionsGet(a);return l(o,e,s,t)},async okGet(a){const o=await n.okGet(a);return l(o,e,s,t)},async refreshTokenPost(a,o){const i=await n.refreshTokenPost(a,o);return l(i,e,s,t)},async requestPasswordResetPost(a,o){const i=await n.requestPasswordResetPost(a,o);return l(i,e,s,t)},async resetPasswordPost(a,o){const i=await n.resetPasswordPost(a,o);return l(i,e,s,t)},async resetPasswordTokenGet(a,o,i){const r=await n.resetPasswordTokenGet(a,o,i);return l(r,e,s,t)},async revokeOtherSessionsPost(a,o){const i=await n.revokeOtherSessionsPost(a,o);return l(i,e,s,t)},async revokeSessionPost(a,o){const i=await n.revokeSessionPost(a,o);return l(i,e,s,t)},async revokeSessionsPost(a,o){const i=await n.revokeSessionsPost(a,o);return l(i,e,s,t)},async sendVerificationEmailPost(a,o){const i=await n.sendVerificationEmailPost(a,o);return l(i,e,s,t)},async signInEmailPost(a,o){const i=await n.signInEmailPost(a,o);return l(i,e,s,t)},async signOutPost(a,o){const i=await n.signOutPost(a,o);return l(i,e,s,t)},async signUpEmailPost(a,o){const i=await n.signUpEmailPost(a,o);return l(i,e,s,t)},async socialSignIn(a,o){const i=await n.socialSignIn(a,o);return l(i,e,s,t)},async unlinkAccountPost(a,o){const i=await n.unlinkAccountPost(a,o);return l(i,e,s,t)},async updateUserPost(a,o){const i=await n.updateUserPost(a,o);return l(i,e,s,t)},async verifyEmailGet(a,o,i){const r=await n.verifyEmailGet(a,o,i);return l(r,e,s,t)}}};class b extends n{accountInfoPost(e,t){return O(this.configuration).accountInfoPost(e.accountInfoPostRequest,t).then(e=>e(this.axios,this.basePath))}changeEmailPost(e,t){return O(this.configuration).changeEmailPost(e.changeEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}changePasswordPost(e,t){return O(this.configuration).changePasswordPost(e.changePasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}deleteUserCallbackGet(e={},t){return O(this.configuration).deleteUserCallbackGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}deleteUserPost(e,t){return O(this.configuration).deleteUserPost(e.deleteUserPostRequest,t).then(e=>e(this.axios,this.basePath))}errorGet(e){return O(this.configuration).errorGet(e).then(e=>e(this.axios,this.basePath))}forgetPasswordPost(e,t){return O(this.configuration).forgetPasswordPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}getAccessTokenPost(e,t){return O(this.configuration).getAccessTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}getSessionGet(e={},t){return O(this.configuration).getSessionGet(e.disableCookieCache,t).then(e=>e(this.axios,this.basePath))}linkSocialPost(e,t){return O(this.configuration).linkSocialPost(e.linkSocialPostRequest,t).then(e=>e(this.axios,this.basePath))}listAccountsGet(e){return O(this.configuration).listAccountsGet(e).then(e=>e(this.axios,this.basePath))}listSessionsGet(e){return O(this.configuration).listSessionsGet(e).then(e=>e(this.axios,this.basePath))}okGet(e){return O(this.configuration).okGet(e).then(e=>e(this.axios,this.basePath))}refreshTokenPost(e,t){return O(this.configuration).refreshTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}requestPasswordResetPost(e,t){return O(this.configuration).requestPasswordResetPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordPost(e,t){return O(this.configuration).resetPasswordPost(e.resetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordTokenGet(e,t){return O(this.configuration).resetPasswordTokenGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}revokeOtherSessionsPost(e={},t){return O(this.configuration).revokeOtherSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}revokeSessionPost(e={},t){return O(this.configuration).revokeSessionPost(e.revokeSessionPostRequest,t).then(e=>e(this.axios,this.basePath))}revokeSessionsPost(e={},t){return O(this.configuration).revokeSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}sendVerificationEmailPost(e={},t){return O(this.configuration).sendVerificationEmailPost(e.sendVerificationEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailPost(e,t){return O(this.configuration).signInEmailPost(e.signInEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signOutPost(e={},t){return O(this.configuration).signOutPost(e.body,t).then(e=>e(this.axios,this.basePath))}signUpEmailPost(e={},t){return O(this.configuration).signUpEmailPost(e.signUpEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}socialSignIn(e,t){return O(this.configuration).socialSignIn(e.socialSignInRequest,t).then(e=>e(this.axios,this.basePath))}unlinkAccountPost(e,t){return O(this.configuration).unlinkAccountPost(e.unlinkAccountPostRequest,t).then(e=>e(this.axios,this.basePath))}updateUserPost(e={},t){return O(this.configuration).updateUserPost(e.updateUserPostRequest,t).then(e=>e(this.axios,this.basePath))}verifyEmailGet(e,t){return O(this.configuration).verifyEmailGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}}const T=function(t){const n=function(e){return{checkVerificationOtp:async(t,s={})=>{i("checkVerificationOtp","checkVerificationOtpRequest",t);const n=new URL("/email-otp/check-verification-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpResetPasswordPost:async(t,s={})=>{i("emailOtpResetPasswordPost","emailOtpResetPasswordPostRequest",t);const n=new URL("/email-otp/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpSendVerificationOtpPost:async(t,s={})=>{i("emailOtpSendVerificationOtpPost","emailOtpSendVerificationOtpPostRequest",t);const n=new URL("/email-otp/send-verification-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},emailOtpVerifyEmailPost:async(t,s={})=>{i("emailOtpVerifyEmailPost","emailOtpVerifyEmailPostRequest",t);const n=new URL("/email-otp/verify-email",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},forgetPasswordEmailOtpPost:async(t,s={})=>{i("forgetPasswordEmailOtpPost","forgetPasswordEmailOtpPostRequest",t);const n=new URL("/forget-password/email-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signInEmailOtpPost:async(t,s={})=>{i("signInEmailOtpPost","signInEmailOtpPostRequest",t);const n=new URL("/sign-in/email-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async checkVerificationOtp(a,o){const i=await n.checkVerificationOtp(a,o);return l(i,e,s,t)},async emailOtpResetPasswordPost(a,o){const i=await n.emailOtpResetPasswordPost(a,o);return l(i,e,s,t)},async emailOtpSendVerificationOtpPost(a,o){const i=await n.emailOtpSendVerificationOtpPost(a,o);return l(i,e,s,t)},async emailOtpVerifyEmailPost(a,o){const i=await n.emailOtpVerifyEmailPost(a,o);return l(i,e,s,t)},async forgetPasswordEmailOtpPost(a,o){const i=await n.forgetPasswordEmailOtpPost(a,o);return l(i,e,s,t)},async signInEmailOtpPost(a,o){const i=await n.signInEmailOtpPost(a,o);return l(i,e,s,t)}}};class S extends n{checkVerificationOtp(e,t){return T(this.configuration).checkVerificationOtp(e.checkVerificationOtpRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpResetPasswordPost(e,t){return T(this.configuration).emailOtpResetPasswordPost(e.emailOtpResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpSendVerificationOtpPost(e,t){return T(this.configuration).emailOtpSendVerificationOtpPost(e.emailOtpSendVerificationOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpVerifyEmailPost(e,t){return T(this.configuration).emailOtpVerifyEmailPost(e.emailOtpVerifyEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordEmailOtpPost(e,t){return T(this.configuration).forgetPasswordEmailOtpPost(e.forgetPasswordEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailOtpPost(e,t){return T(this.configuration).signInEmailOtpPost(e.signInEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}}const k=function(t){const n=function(e){return{phoneNumberForgetPasswordPost:async(t,s={})=>{i("phoneNumberForgetPasswordPost","phoneNumberForgetPasswordPostRequest",t);const n=new URL("/phone-number/forget-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberRequestPasswordResetPost:async(t,s={})=>{i("phoneNumberRequestPasswordResetPost","phoneNumberRequestPasswordResetPostRequest",t);const n=new URL("/phone-number/request-password-reset",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberResetPasswordPost:async(t,s={})=>{i("phoneNumberResetPasswordPost","phoneNumberResetPasswordPostRequest",t);const n=new URL("/phone-number/reset-password",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberSendOtpPost:async(t,s={})=>{i("phoneNumberSendOtpPost","phoneNumberSendOtpPostRequest",t);const n=new URL("/phone-number/send-otp",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},phoneNumberVerifyPost:async(t,s={})=>{i("phoneNumberVerifyPost","phoneNumberVerifyPostRequest",t);const n=new URL("/phone-number/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},signInPhoneNumberPost:async(t,s={})=>{i("signInPhoneNumberPost","signInPhoneNumberPostRequest",t);const n=new URL("/sign-in/phone-number",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async phoneNumberForgetPasswordPost(a,o){const i=await n.phoneNumberForgetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberRequestPasswordResetPost(a,o){const i=await n.phoneNumberRequestPasswordResetPost(a,o);return l(i,e,s,t)},async phoneNumberResetPasswordPost(a,o){const i=await n.phoneNumberResetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberSendOtpPost(a,o){const i=await n.phoneNumberSendOtpPost(a,o);return l(i,e,s,t)},async phoneNumberVerifyPost(a,o){const i=await n.phoneNumberVerifyPost(a,o);return l(i,e,s,t)},async signInPhoneNumberPost(a,o){const i=await n.signInPhoneNumberPost(a,o);return l(i,e,s,t)}}};class q extends n{phoneNumberForgetPasswordPost(e,t){return k(this.configuration).phoneNumberForgetPasswordPost(e.phoneNumberForgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberRequestPasswordResetPost(e,t){return k(this.configuration).phoneNumberRequestPasswordResetPost(e.phoneNumberRequestPasswordResetPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberResetPasswordPost(e,t){return k(this.configuration).phoneNumberResetPasswordPost(e.phoneNumberResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberSendOtpPost(e,t){return k(this.configuration).phoneNumberSendOtpPost(e.phoneNumberSendOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberVerifyPost(e,t){return k(this.configuration).phoneNumberVerifyPost(e.phoneNumberVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}signInPhoneNumberPost(e,t){return k(this.configuration).signInPhoneNumberPost(e.signInPhoneNumberPostRequest,t).then(e=>e(this.axios,this.basePath))}}const v=function(t){const n=function(e){return{handleChainRpcRequest:async(t,s,n={})=>{i("handleChainRpcRequest","chainId",t),i("handleChainRpcRequest","jsonRpcRequest",s);const a="/rpc/{chainId}".replace("{chainId}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},handleRpcRequest:async(t,s={})=>{i("handleRpcRequest","jsonRpcRequest",t);const n=new URL("/rpc",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async handleChainRpcRequest(a,o,i){const r=await n.handleChainRpcRequest(a,o,i);return l(r,e,s,t)},async handleRpcRequest(a,o){const i=await n.handleRpcRequest(a,o);return l(i,e,s,t)}}};class I extends n{handleChainRpcRequest(e,t){return v(this.configuration).handleChainRpcRequest(e.chainId,e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}handleRpcRequest(e,t){return v(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const x=function(t){const n=function(e){return{linkSiweListWalletsGet:async(t={})=>{const s=new URL("/link-siwe/list-wallets",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},linkSiweNoncePost:async(t,s={})=>{i("linkSiweNoncePost","siweNoncePostRequest",t);const n=new URL("/link-siwe/nonce",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkSiweUnlinkPost:async(t,s={})=>{i("linkSiweUnlinkPost","linkSiweUnlinkPostRequest",t);const n=new URL("/link-siwe/unlink",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkSiweVerifyPost:async(t,s={})=>{i("linkSiweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/link-siwe/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},siweNoncePost:async(t,s={})=>{i("siweNoncePost","siweNoncePostRequest",t);const n=new URL("/siwe/nonce",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},siweVerifyPost:async(t,s={})=>{i("siweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/siwe/verify",o);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async linkSiweListWalletsGet(a){const o=await n.linkSiweListWalletsGet(a);return l(o,e,s,t)},async linkSiweNoncePost(a,o){const i=await n.linkSiweNoncePost(a,o);return l(i,e,s,t)},async linkSiweUnlinkPost(a,o){const i=await n.linkSiweUnlinkPost(a,o);return l(i,e,s,t)},async linkSiweVerifyPost(a,o){const i=await n.linkSiweVerifyPost(a,o);return l(i,e,s,t)},async siweNoncePost(a,o){const i=await n.siweNoncePost(a,o);return l(i,e,s,t)},async siweVerifyPost(a,o){const i=await n.siweVerifyPost(a,o);return l(i,e,s,t)}}};class A extends n{linkSiweListWalletsGet(e){return x(this.configuration).linkSiweListWalletsGet(e).then(e=>e(this.axios,this.basePath))}linkSiweNoncePost(e,t){return x(this.configuration).linkSiweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweUnlinkPost(e,t){return x(this.configuration).linkSiweUnlinkPost(e.linkSiweUnlinkPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweVerifyPost(e,t){return x(this.configuration).linkSiweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}siweNoncePost(e,t){return x(this.configuration).siweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}siweVerifyPost(e,t){return x(this.configuration).siweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}}const E=function(t){const n=function(e){return{createSession:async(t,s,n={})=>{i("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,s,n,a,c,u={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",o);let p;e&&(p=e.baseOptions);const P={method:"GET",...p,...u},w={},y={};await r(w,e),void 0!==s&&(y.limit=s),void 0!==n&&(y.skip=n),void 0!==a&&(y.order=a),void 0!==t&&(y.player=t),c&&(y.expand=c),h(l,y);let m=p&&p.headers?p.headers:{};return P.headers={...w,...m,...u.headers},{url:d(l),options:P}},getSession:async(t,s,n={})=>{i("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},revokeSession:async(t,s,n={})=>{i("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},signatureSession:async(t,s,n={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",s);const a="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createSession(a,o,i){const r=await n.createSession(a,o,i);return l(r,e,s,t)},async getPlayerSessions(a,o,i,r,c,h){const u=await n.getPlayerSessions(a,o,i,r,c,h);return l(u,e,s,t)},async getSession(a,o,i){const r=await n.getSession(a,o,i);return l(r,e,s,t)},async revokeSession(a,o,i){const r=await n.revokeSession(a,o,i);return l(r,e,s,t)},async signatureSession(a,o,i){const r=await n.signatureSession(a,o,i);return l(r,e,s,t)}}};class U extends n{createSession(e,t){return E(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return E(this.configuration).getPlayerSessions(e.player,e.limit,e.skip,e.order,e.expand,t).then(e=>e(this.axios,this.basePath))}getSession(e,t){return E(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return E(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return E(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const C=function(t){const n=function(e){return{createTransactionIntent:async(t,s,n={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const a=new URL("/v1/transaction_intents",o);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},estimateTransactionIntentCost:async(t,s={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const n=new URL("/v1/transaction_intents/estimate_gas_cost",o);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getTransactionIntent:async(t,s,n={})=>{i("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getTransactionIntents:async(t,s,n,a,i,c,u,l,p,P={})=>{const w=new URL("/v1/transaction_intents",o);let y;e&&(y=e.baseOptions);const m={method:"GET",...y,...P},g={},R={};await r(g,e),void 0!==t&&(R.limit=t),void 0!==s&&(R.skip=s),void 0!==n&&(R.order=n),a&&(R.expand=a),void 0!==i&&(R.chainId=i),c&&(R.account=c),u&&(R.player=u),void 0!==l&&(R.status=l),p&&(R.policy=p),h(w,R);let f=y&&y.headers?y.headers:{};return m.headers={...g,...f,...P.headers},{url:d(w),options:m}},signature:async(t,s,n={})=>{i("signature","id",t),i("signature","signatureRequest",s);const a="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createTransactionIntent(a,o,i){const r=await n.createTransactionIntent(a,o,i);return l(r,e,s,t)},async estimateTransactionIntentCost(a,o){const i=await n.estimateTransactionIntentCost(a,o);return l(i,e,s,t)},async getTransactionIntent(a,o,i){const r=await n.getTransactionIntent(a,o,i);return l(r,e,s,t)},async getTransactionIntents(a,o,i,r,c,h,u,d,p,P){const w=await n.getTransactionIntents(a,o,i,r,c,h,u,d,p,P);return l(w,e,s,t)},async signature(a,o,i){const r=await n.signature(a,o,i);return l(r,e,s,t)}}};class L extends n{createTransactionIntent(e,t){return C(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return C(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return C(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return C(this.configuration).getTransactionIntents(e.limit,e.skip,e.order,e.expand,e.chainId,e.account,e.player,e.status,e.policy,t).then(e=>e(this.axios,this.basePath))}signature(e,t){return C(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}class V{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const j=({basePath:e,accessToken:t,nativeAppIdentifier:s})=>{if(!e.trim())throw Error("basePath can not be empty");const n={basePath:e,accessToken:t};return s&&(n.baseOptions={headers:{"x-native-app-identifier":s}}),new V(n)};exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;rpcApi;sessionsApi;emailOTPApi;userApi;anonymousApi;siweApi;smsOTPApi;authenticationApi;authenticationV2Api;storage;onLogout;axiosInstance;constructor(s){this.storage=s.storage,this.onLogout=s.onLogout,this.axiosInstance=e.create(),t(this.axiosInstance,{retries:3,retryDelay:t.exponentialDelay,retryCondition:t.isRetryableError}),this.setupInterceptors();const n={basePath:s.basePath,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier};this.config={backend:j(n)};const a={basePath:`${s.basePath}/iam/v2/auth`,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier},o=j(a);this.emailOTPApi=new S(o,void 0,this.axiosInstance),this.smsOTPApi=new q(o,void 0,this.axiosInstance),this.anonymousApi=new y(o,void 0,this.axiosInstance),this.authenticationV2Api=new b(o,void 0,this.axiosInstance),this.authenticationApi=new g(this.config.backend,void 0,this.axiosInstance),this.siweApi=new A(o,void 0,this.axiosInstance),this.userApi=new f(this.config.backend,void 0,this.axiosInstance),this.transactionIntentsApi=new L(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new P(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new U(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new I(this.config.backend,void 0,this.axiosInstance)}setupInterceptors(){this.axiosInstance.interceptors.response.use(e=>e,async e=>(401===e.response?.status&&(await this.clearAuthenticationState(),this.emitLogoutEvent()),Promise.reject(e)))}async clearAuthenticationState(){if(this.storage)try{this.storage.remove("openfort.authentication"),this.storage.remove("openfort.account"),this.storage.remove("openfort.session"),this.storage.remove("openfort.pkce_state"),this.storage.remove("openfort.pkce_verifier")}catch(e){}}emitLogoutEvent(){if(this.onLogout)try{this.onLogout()}catch(e){}}},exports.createConfig=j;
@@ -1 +1 @@
1
- "use strict";var t=require("../core/configuration/authentication.js"),e=require("../core/errors/authErrorCodes.js"),i=require("../core/errors/openfortError.js"),a=require("../types/types.js");exports.AuthApi=class{storage;authManager;validateAndRefreshToken;ensureInitialized;eventEmitter;constructor(t,e,i,a,n){this.storage=t,this.authManager=e,this.validateAndRefreshToken=i,this.ensureInitialized=a,this.eventEmitter=n}async logInWithEmailPassword({email:n,password:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=await this.authManager.loginEmailPassword(n,r);return null===e?.token||(new t.Authentication("session",e.token,e.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async signUpGuest(){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"guest"});try{const e=await this.authManager.registerGuest();return new t.Authentication("session",e.token,e?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async signUpWithEmailPassword({email:n,password:r,name:s,callbackURL:o}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=s||n,i=await this.authManager.signupEmailPassword(n,r,e,o);return i instanceof Object&&"action"in i||(new t.Authentication("session",i.token,i?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,i)),i}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async initOAuth({provider:n,redirectTo:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"oauth",provider:n});try{return await this.authManager.initOAuth(n,r)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async logInWithIdToken({provider:n,token:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"idToken",provider:n});try{const e=await this.authManager.loginWithIdToken(n,r);return new t.Authentication("session",e.token,e?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async storeCredentials({token:e,userId:a}){if(await this.ensureInitialized(),!a)throw new i.ConfigurationError("User ID is required to store credentials");const n=encodeURIComponent(e);new t.Authentication("session",n,a).save(this.storage)}async logout(){const e=await t.Authentication.fromStorage(this.storage);if(e){try{"third_party"!==e.type&&await this.authManager.logout(e)}catch(t){}t.Authentication.clear(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_LOGOUT)}}async requestEmailOtp({email:n}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_REQUEST,{method:"email"});try{await this.authManager.requestEmailOTP(n)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_FAILURE,t),t}}async logInWithEmailOtp({email:n,otp:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=await this.authManager.loginWithEmailOTP(n,r);return null===e?.token||(new t.Authentication("session",e.token,e?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async requestPhoneOtp({phoneNumber:n}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_REQUEST,{method:"phone",provider:"phone"});try{await this.authManager.requestPhoneOtp(n)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_FAILURE,t),t}}async logInWithPhoneOtp({phoneNumber:n,otp:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"phone"});try{const e=await this.authManager.loginWithSMSOTP(n,r);return null===e?.token||(new t.Authentication("session",e.token,e?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async requestResetPassword({email:t,redirectUrl:e}){await this.ensureInitialized(),await this.authManager.requestResetPassword(t,e)}async resetPassword({password:t,token:e}){await this.ensureInitialized(),await this.authManager.resetPassword(t,e)}async requestEmailVerification({email:t,redirectUrl:e}){await this.ensureInitialized(),await this.authManager.requestEmailVerification(t,e)}async verifyEmail({token:t,callbackURL:e}){await this.ensureInitialized(),await this.authManager.verifyEmail(t,e)}async initLinkOAuth({provider:n,options:r}){await this.validateAndRefreshToken();const s=await t.Authentication.fromStorage(this.storage);if(!s)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"oauth",provider:n}),await this.authManager.linkOAuth(s,n,r)}async unlinkOAuth({provider:a}){await this.validateAndRefreshToken();const n=await t.Authentication.fromStorage(this.storage);if(!n)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkOAuth(a,n)}async initSIWE({address:t,chainId:e}){return await this.ensureInitialized(),await this.authManager.initSIWE(t,e)}async authenticateWithSIWE({signature:n,message:r,walletClientType:s,connectorType:o,address:h,chainId:E}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"siwe"});try{const e=await this.authManager.authenticateSIWE(n,r,s,o,h,E);return new t.Authentication("session",e.token,e?.user.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async linkWallet({signature:a,message:n,walletClientType:r,connectorType:s,address:o,chainId:h}){await this.validateAndRefreshToken();const E=await t.Authentication.fromStorage(this.storage);if(!E)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.linkWallet(a,n,r,s,o,h,E)}async unlinkWallet({address:a,chainId:n}){await this.validateAndRefreshToken();const r=await t.Authentication.fromStorage(this.storage);if(!r)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkWallet(a,n,r)}async unlinkEmail(){await this.validateAndRefreshToken();const a=await t.Authentication.fromStorage(this.storage);if(!a)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkEmail(a)}async linkEmailPassword({name:a,email:n,password:r}){await this.validateAndRefreshToken();const s=await t.Authentication.fromStorage(this.storage);if(!s)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.linkEmail(a,n,r,s)}async unlinkEmailPassword(){await this.validateAndRefreshToken();const a=await t.Authentication.fromStorage(this.storage);if(!a)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkEmail(a)}};
1
+ "use strict";var t=require("../core/configuration/authentication.js"),e=require("../core/errors/authErrorCodes.js"),i=require("../core/errors/openfortError.js"),a=require("../types/types.js");exports.AuthApi=class{storage;authManager;validateAndRefreshToken;ensureInitialized;eventEmitter;constructor(t,e,i,a,n){this.storage=t,this.authManager=e,this.validateAndRefreshToken=i,this.ensureInitialized=a,this.eventEmitter=n}async logInWithEmailPassword({email:n,password:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=await this.authManager.loginEmailPassword(n,r);return null===e?.token||(new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async signUpGuest(){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"guest"});try{const e=await this.authManager.registerGuest();return new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async signUpWithEmailPassword({email:n,password:r,name:s,callbackURL:o}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=s||n,i=await this.authManager.signupEmailPassword(n,r,e,o);return i instanceof Object&&"action"in i||(new t.Authentication("session",i.token,i.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,i)),i}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async initOAuth({provider:n,redirectTo:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"oauth",provider:n});try{return await this.authManager.initOAuth(n,r)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async linkOAuthToAnonymous({provider:e,redirectTo:i}){await this.ensureInitialized();const n=await t.Authentication.fromStorage(this.storage);if(!n)throw new Error("Must be signed in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"oauth",provider:e});try{return await this.authManager.linkOAuthToAnonymous(n,e,i)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async logInWithIdToken({provider:n,token:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"idToken",provider:n});try{const e=await this.authManager.loginWithIdToken(n,r);return new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async storeCredentials({token:e,userId:a}){if(await this.ensureInitialized(),!a)throw new i.ConfigurationError("User ID is required to store credentials");const n=encodeURIComponent(e);new t.Authentication("session",n,a).save(this.storage)}async logout(){const e=await t.Authentication.fromStorage(this.storage);if(e){try{"third_party"!==e.type&&await this.authManager.logout(e)}catch(t){}t.Authentication.clear(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_LOGOUT)}}async requestEmailOtp({email:n}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_REQUEST,{method:"email"});try{await this.authManager.requestEmailOTP(n)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_FAILURE,t),t}}async logInWithEmailOtp({email:n,otp:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"email"});try{const e=await this.authManager.loginWithEmailOTP(n,r);return null===e?.token||(new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async requestPhoneOtp({phoneNumber:n}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_REQUEST,{method:"phone",provider:"phone"});try{await this.authManager.requestPhoneOtp(n)}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_OTP_FAILURE,t),t}}async logInWithPhoneOtp({phoneNumber:n,otp:r}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"phone"});try{const e=await this.authManager.loginWithSMSOTP(n,r);return null===e?.token||(new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e)),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async requestResetPassword({email:t,redirectUrl:e}){await this.ensureInitialized(),await this.authManager.requestResetPassword(t,e)}async resetPassword({password:t,token:e}){await this.ensureInitialized(),await this.authManager.resetPassword(t,e)}async requestEmailVerification({email:t,redirectUrl:e}){await this.ensureInitialized(),await this.authManager.requestEmailVerification(t,e)}async verifyEmail({token:t,callbackURL:e}){await this.ensureInitialized(),await this.authManager.verifyEmail(t,e)}async initLinkOAuth({provider:n,options:r}){await this.validateAndRefreshToken();const s=await t.Authentication.fromStorage(this.storage);if(!s)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"oauth",provider:n}),await this.authManager.linkOAuth(s,n,r)}async unlinkOAuth({provider:a}){await this.validateAndRefreshToken();const n=await t.Authentication.fromStorage(this.storage);if(!n)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkOAuth(a,n)}async initSIWE({address:t,chainId:e}){return await this.ensureInitialized(),await this.authManager.initSIWE(t,e)}async linkSIWE({address:a,chainId:n}){await this.ensureInitialized();const r=await t.Authentication.fromStorage(this.storage);if(!r)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.linkSIWE(a,r,n)}async authenticateWithSIWE({signature:n,message:r,walletClientType:s,connectorType:o,address:h,chainId:E}){await this.ensureInitialized();if(await t.Authentication.fromStorage(this.storage))throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.ALREADY_LOGGED_IN,"Already logged in");this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_INIT,{method:"siwe"});try{const e=await this.authManager.authenticateSIWE(n,r,s,o,h,E);return new t.Authentication("session",e.token,e.user?.id).save(this.storage),this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_SUCCESS,e),e}catch(t){throw this.eventEmitter.emit(a.OpenfortEvents.ON_AUTH_FAILURE,t),t}}async linkWallet({signature:a,message:n,walletClientType:r,connectorType:s,address:o,chainId:h}){await this.validateAndRefreshToken();const E=await t.Authentication.fromStorage(this.storage);if(!E)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.linkWallet(a,n,r,s,o,h,E)}async unlinkWallet({address:a,chainId:n}){await this.validateAndRefreshToken();const r=await t.Authentication.fromStorage(this.storage);if(!r)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkWallet(a,n,r)}async unlinkEmail(){await this.validateAndRefreshToken();const a=await t.Authentication.fromStorage(this.storage);if(!a)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkEmail(a)}async linkEmailPassword({name:a,email:n,password:r}){await this.validateAndRefreshToken();const s=await t.Authentication.fromStorage(this.storage);if(!s)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.linkEmail(a,n,r,s)}async unlinkEmailPassword(){await this.validateAndRefreshToken();const a=await t.Authentication.fromStorage(this.storage);if(!a)throw new i.SessionError(e.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No authentication found");return await this.authManager.unlinkEmail(a)}};
@@ -1 +1 @@
1
- "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.js"),r=require("../core/configuration/passkey.js"),t=require("../core/config/config.js"),s=require("../core/configuration/account.js"),a=require("../core/configuration/authentication.js"),i=require("../core/errors/authErrorCodes.js"),n=require("../core/errors/openfortError.js"),o=require("../core/errors/withApiError.js"),d=require("../types/types.js"),c=require("../utils/debug.js"),g=require("../wallets/embedded.js"),h=require("../wallets/evm/evmProvider.js");require("../wallets/evm/types.js");var u=require("../wallets/evm/provider/eip6963.js"),y=require("../wallets/evm/walletHelpers.js"),m=require("../wallets/iframeManager.js"),l=require("../wallets/messaging/ReactNativeMessenger.js");require("../wallets/messaging/browserMessenger/backwardCompatibility.js");var p=require("../wallets/messaging/browserMessenger/messengers/WindowMessenger.js");exports.EmbeddedWalletApi=class{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,r,t,s,a){this.storage=e,this.validateAndRefreshToken=r,this.ensureInitialized=t,this.eventEmitter=s,this.passkeyHandler=a,this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,()=>{c.debugLog("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const r=t.SDKConfiguration.getInstance();if(!r)throw new n.ConfigurationError("Configuration not found");return new e.BackendApiClients({basePath:r.backendUrl,accessToken:r.baseConfiguration.publishableKey,nativeAppIdentifier:r.nativeAppIdentifier})}async getIframeManager(){if(c.debugLog("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager&&this.iframeManager.hasFailed&&(c.debugLog("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;c.debugLog("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return c.debugLog("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,c.debugLog("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw c.debugLog("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){c.debugLog("[HANDSHAKE DEBUG] createIframeManager starting");const e=t.SDKConfiguration.getInstance();if(!e)throw c.debugLog("[HANDSHAKE DEBUG] Configuration not found"),new n.ConfigurationError("Configuration not found");let r;if(c.debugLog("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)c.debugLog("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(c.debugLog("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new l.ReactNativeMessenger(this.messagePoster),c.debugLog("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),r=this.messenger;else{c.debugLog("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const t=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;r=new p({remoteWindow:t.contentWindow,allowedOrigins:[s]}),c.debugLog("[HANDSHAKE DEBUG] Created WindowMessenger")}return c.debugLog("[HANDSHAKE DEBUG] Creating IframeManager instance"),new m.IframeManager(e,this.storage,r)}async ensureSigner(){if(this.iframeManager&&this.iframeManager.hasFailed&&(c.debugLog("IframeManager has failed, clearing signer for recreation"),this.signer=null),this.signer)return this.signer;if(this.signerPromise)return this.signerPromise;this.signerPromise=this.createSigner();try{return this.signer=await this.signerPromise,this.signer}catch(e){throw this.signerPromise=null,e}finally{this.signerPromise=null}}async createSigner(){const e=await this.getIframeManager();return new g.EmbeddedSigner(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new n.ConfigurationError("Document is not available. Please provide a message poster for non-browser environments.");const r=document.getElementById("openfort-iframe");r&&r.remove();const t=document.createElement("iframe");return t.style.display="none",t.id="openfort-iframe",t.src=e,document.body.appendChild(t),t}async getPasskeyKey(e){const r=await a.Authentication.fromStorage(this.storage);return await this.passkeyHandler.deriveAndExportKey({id:e,seed:r.userId})}async getEntropy(e){switch(e.recoveryMethod){case d.RecoveryMethod.PASSWORD:return{recoveryPassword:e.password};case d.RecoveryMethod.AUTOMATIC:return{encryptionSession:e.encryptionSession};case d.RecoveryMethod.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new n.ConfigurationError("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},[t,i,n]=await Promise.all([a.Authentication.fromStorage(this.storage),this.ensureSigner(),this.getEntropy(r)]),o={chainId:e.chainId,entropy:n,accountType:e.accountType??d.AccountTypeEnum.SMART_ACCOUNT,chainType:e.chainType??d.ChainTypeEnum.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},c=await i.configure(o);return{id:c.id,chainId:c.chainId,user:t.userId,address:c.address,ownerAddress:c.ownerAddress,chainType:c.chainType,accountType:c.accountType,implementationType:c.implementationType,factoryAddress:c.factoryAddress,salt:c.salt,createdAt:c.createdAt,implementationAddress:c.implementationAddress,recoveryMethod:s.Account.parseRecoveryMethod(c.recoveryMethod),recoveryMethodDetails:c.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},o=await a.Authentication.fromStorage(this.storage);if(!o)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.PasskeyHandler.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:o?.userId});t.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[c,g]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),h=await c.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:g}),u={id:h.id,chainId:h.chainId,user:o.userId,address:h.address,ownerAddress:h.ownerAddress,chainType:h.chainType,accountType:h.accountType,implementationType:h.implementationType,factoryAddress:h.factoryAddress,salt:h.salt,createdAt:h.createdAt,implementationAddress:h.implementationAddress,recoveryMethod:s.Account.parseRecoveryMethod(h.recoveryMethod),recoveryMethodDetails:h.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,u),u}async recover(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC};if(r.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!r.passkeyInfo?.passkeyId)throw new n.ConfigurationError("Passkey ID must be provided for passkey recovery");r.passkeyInfo={passkeyId:r.passkeyInfo.passkeyId}}const[t,i,o]=await Promise.all([this.ensureSigner(),this.getEntropy(r),a.Authentication.fromStorage(this.storage)]),c=await t.recover({account:e.account,entropy:i}),g={id:c.id,chainId:c.chainId,user:o.userId,address:c.address,ownerAddress:c.ownerAddress,chainType:c.chainType,accountType:c.accountType,implementationType:c.implementationType,createdAt:c.createdAt,recoveryMethod:s.Account.parseRecoveryMethod(c.recoveryMethod),recoveryMethodDetails:c.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,g),g}async signMessage(e,r){await this.validateAndRefreshToken();const t=await this.ensureSigner(),{hashMessage:a=!0,arrayifyMessage:i=!1}=r||{},n=await s.Account.fromStorage(this.storage);return await t.sign(e,i,a,n?.chainType)}async signTypedData(e,r,t){await this.validateAndRefreshToken();const a=await this.ensureSigner(),o=await s.Account.fromStorage(this.storage);if(!o)throw new n.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No account found");const d={...r};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),g=c.hash(e,d,t);return await y.signMessage({hash:g,implementationType:o.implementationType||o.type,chainId:Number(o.chainId),signer:a,address:o.address,ownerAddress:o.ownerAddress,factoryAddress:o.factoryAddress,salt:o.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,t){await this.validateAndRefreshToken();const o=await this.ensureSigner(),c=await a.Authentication.fromStorage(this.storage);if(!c)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");let g,h,u,y;if(e.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await s.Account.fromStorage(this.storage);if(!e)throw new n.ConfigurationError("missing account");const r=e?.recoveryMethodDetails?.passkeyId;if(!r)throw new n.ConfigurationError("missing passkey id for account");u={passkeyId:r,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:r,seed:c.userId})}}else if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.PasskeyHandler.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:c.userId});u={passkeyId:e.id,passkeyKey:e.key},y={passkeyId:e.id}}if(e.recoveryMethod===d.RecoveryMethod.PASSWORD?g=e.password:t.recoveryMethod===d.RecoveryMethod.PASSWORD&&(g=t.password),e.recoveryMethod===d.RecoveryMethod.AUTOMATIC?h=e.encryptionSession:t.recoveryMethod===d.RecoveryMethod.AUTOMATIC&&(h=t.encryptionSession),!g&&!h)throw new n.ConfigurationError("Password or encryption session is not provided");await o.setRecoveryMethod({recoveryMethod:t.recoveryMethod,recoveryPassword:g,encryptionSession:h,passkeyInfo:u});const m=await s.Account.fromStorage(this.storage);m&&new s.Account({...m,recoveryMethod:t.recoveryMethod,recoveryMethodDetails:y}).save(this.storage)}async get(){const e=await s.Account.fromStorage(this.storage);if(!e)throw new n.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No signer configured");const r=await a.Authentication.fromStorage(this.storage);if(!r)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return{id:e.id,chainId:e.chainId,user:r.userId,address:e.address,ownerAddress:e.ownerAddress,factoryAddress:e.factoryAddress,salt:e.salt,chainType:e.chainType,accountType:e.accountType,implementationAddress:e.implementationAddress,implementationType:e.implementationType,createdAt:e.createdAt,recoveryMethod:s.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){const r={accountType:d.AccountTypeEnum.SMART_ACCOUNT,...e},c=t.SDKConfiguration.getInstance();if(!c)throw new n.ConfigurationError("Configuration not found");const g=await a.Authentication.fromStorage(this.storage);if(!g)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),o.withApiError(async()=>(await this.backendApiClients.accountsApi.getAccountsV2(r,{headers:g.thirdPartyProvider?{authorization:`Bearer ${c.baseConfiguration.publishableKey}`,"x-player-token":g.token,"x-auth-provider":g.thirdPartyProvider,"x-token-type":g.thirdPartyTokenType}:{authorization:`Bearer ${g.token}`,"x-project-key":c.baseConfiguration.publishableKey}})).data.data.map(e=>({user:e.user,chainType:e.chainType,id:e.id,address:e.address,active:e.smartAccount?.active,ownerAddress:e.ownerAddress,factoryAddress:e.smartAccount?.factoryAddress,salt:e.smartAccount?.salt,accountType:e.accountType,implementationAddress:e.smartAccount?.implementationAddress,createdAt:e.createdAt,implementationType:e.smartAccount?.implementationType,chainId:e.chainId,recoveryMethod:s.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await a.Authentication.fromStorage(this.storage))return d.EmbeddedState.UNAUTHENTICATED;return await s.Account.fromStorage(this.storage)?d.EmbeddedState.READY:d.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return c.debugLog("Failed to get embedded state:",e),d.EmbeddedState.UNAUTHENTICATED}}async getEthereumProvider(e){await this.ensureInitialized();const r={announceProvider:!0,...e},t=await a.Authentication.fromStorage(this.storage),i=await s.Account.fromStorage(this.storage);return this.provider?this.provider&&r.policy&&this.provider.updatePolicy(r.policy):(this.provider=new h.EvmProvider({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:i||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,policyId:r.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:r.chains}),r.announceProvider&&u.announceProvider({info:{...u.openfortProviderInfo,...r.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(r=>{setTimeout(r,e)});const r=await this.getIframeManager();if(!r.isLoaded())return!1;const t=await a.Authentication.fromStorage(this.storage);if(t)try{return await r.getCurrentDevice(t.userId),!0}catch(e){return!1}return r.isLoaded()}catch(e){return c.debugLog("Ping failed:",e),!1}}getURL(){const e=t.SDKConfiguration.getInstance();if(!e)throw new n.ConfigurationError("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new n.ConfigurationError("Invalid message poster");this.messagePoster=e,this.messenger&&this.messenger.destroy(),this.iframeManager&&this.iframeManager.destroy(),this.signer=null,this.signerPromise=null,this.iframeManager=null,this.iframeManagerPromise=null,this.messenger=null}async handleLogout(){const e=await this.ensureSigner();await e.disconnect(),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,this.signerPromise=null}async onMessage(e){if(!e||"object"!=typeof e)return void c.debugLog("Invalid message received:",e);c.debugLog("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const r="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(r&&this.messenger&&this.messagePoster)return c.debugLog("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const t=await this.getIframeManager();c.debugLog(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${t.isLoaded()}`),r&&!t.isLoaded()&&c.debugLog("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),c.debugLog("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await t.onMessage(e),c.debugLog("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}};
1
+ "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.js"),r=require("../core/configuration/passkey.js"),t=require("../core/config/config.js"),s=require("../core/configuration/account.js"),a=require("../core/configuration/authentication.js"),i=require("../core/errors/authErrorCodes.js"),n=require("../core/errors/openfortError.js"),o=require("../core/errors/withApiError.js"),d=require("../types/types.js"),c=require("../utils/debug.js"),g=require("../wallets/embedded.js"),h=require("../wallets/evm/evmProvider.js");require("../wallets/evm/types.js");var u=require("../wallets/evm/provider/eip6963.js"),y=require("../wallets/evm/walletHelpers.js"),m=require("../wallets/iframeManager.js"),l=require("../wallets/messaging/ReactNativeMessenger.js");require("../wallets/messaging/browserMessenger/backwardCompatibility.js");var p=require("../wallets/messaging/browserMessenger/messengers/WindowMessenger.js");exports.EmbeddedWalletApi=class{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,r,t,s,a){this.storage=e,this.validateAndRefreshToken=r,this.ensureInitialized=t,this.eventEmitter=s,this.passkeyHandler=a,this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,()=>{c.debugLog("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const r=t.SDKConfiguration.getInstance();if(!r)throw new n.ConfigurationError("Configuration not found");return new e.BackendApiClients({basePath:r.backendUrl,accessToken:r.baseConfiguration.publishableKey,nativeAppIdentifier:r.nativeAppIdentifier})}async getIframeManager(){if(c.debugLog("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager&&this.iframeManager.hasFailed&&(c.debugLog("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;c.debugLog("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return c.debugLog("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,c.debugLog("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw c.debugLog("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){c.debugLog("[HANDSHAKE DEBUG] createIframeManager starting");const e=t.SDKConfiguration.getInstance();if(!e)throw c.debugLog("[HANDSHAKE DEBUG] Configuration not found"),new n.ConfigurationError("Configuration not found");let r;if(c.debugLog("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)c.debugLog("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(c.debugLog("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new l.ReactNativeMessenger(this.messagePoster),c.debugLog("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),r=this.messenger;else{c.debugLog("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const t=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;r=new p({remoteWindow:t.contentWindow,allowedOrigins:[s]}),c.debugLog("[HANDSHAKE DEBUG] Created WindowMessenger")}return c.debugLog("[HANDSHAKE DEBUG] Creating IframeManager instance"),new m.IframeManager(e,this.storage,r)}async ensureSigner(){if(this.iframeManager&&this.iframeManager.hasFailed&&(c.debugLog("IframeManager has failed, clearing signer for recreation"),this.signer=null),this.signer)return this.signer;if(this.signerPromise)return this.signerPromise;this.signerPromise=this.createSigner();try{return this.signer=await this.signerPromise,this.signer}catch(e){throw this.signerPromise=null,e}finally{this.signerPromise=null}}async createSigner(){const e=await this.getIframeManager();return new g.EmbeddedSigner(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new n.ConfigurationError("Document is not available. Please provide a message poster for non-browser environments.");const r=document.getElementById("openfort-iframe");r&&r.remove();const t=document.createElement("iframe");return t.style.display="none",t.id="openfort-iframe",t.src=e,document.body.appendChild(t),t}async getPasskeyKey(e){const r=await a.Authentication.fromStorage(this.storage);return await this.passkeyHandler.deriveAndExportKey({id:e,seed:r?.userId??""})}async getEntropy(e){switch(e.recoveryMethod){case d.RecoveryMethod.PASSWORD:return{recoveryPassword:e.password};case d.RecoveryMethod.AUTOMATIC:return{encryptionSession:e.encryptionSession};case d.RecoveryMethod.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new n.ConfigurationError("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},[t,a]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),i={chainId:e.chainId,entropy:a,accountType:e.accountType??d.AccountTypeEnum.SMART_ACCOUNT,chainType:e.chainType??d.ChainTypeEnum.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},n=await t.configure(i);return{id:n.id,chainId:n.chainId,user:n.user,address:n.address,ownerAddress:n.ownerAddress,chainType:n.chainType,accountType:n.accountType,implementationType:n.implementationType,factoryAddress:n.factoryAddress,salt:n.salt,createdAt:n.createdAt,implementationAddress:n.implementationAddress,recoveryMethod:s.Account.parseRecoveryMethod(n.recoveryMethod),recoveryMethodDetails:n.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},o=await a.Authentication.fromStorage(this.storage);if(!o)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.PasskeyHandler.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:o?.userId});t.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[c,g]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),h=await c.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:g}),u={id:h.id,chainId:h.chainId,user:o?.userId,address:h.address,ownerAddress:h.ownerAddress,chainType:h.chainType,accountType:h.accountType,implementationType:h.implementationType,factoryAddress:h.factoryAddress,salt:h.salt,createdAt:h.createdAt,implementationAddress:h.implementationAddress,recoveryMethod:s.Account.parseRecoveryMethod(h.recoveryMethod),recoveryMethodDetails:h.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,u),u}async recover(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC};if(r.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!r.passkeyInfo?.passkeyId)throw new n.ConfigurationError("Passkey ID must be provided for passkey recovery");r.passkeyInfo={passkeyId:r.passkeyInfo.passkeyId}}const[t,a]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),i=await t.recover({account:e.account,entropy:a}),o={id:i.id,chainId:i.chainId,implementationAddress:i.implementationAddress,factoryAddress:i.factoryAddress,salt:i.salt,user:i.user,address:i.address,ownerAddress:i.ownerAddress,chainType:i.chainType,accountType:i.accountType,implementationType:i.implementationType,createdAt:i.createdAt,recoveryMethod:s.Account.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o),o}async signMessage(e,r){await this.validateAndRefreshToken();const t=await this.ensureSigner(),{hashMessage:a=!0,arrayifyMessage:i=!1}=r||{},n=await s.Account.fromStorage(this.storage);return await t.sign(e,i,a,n?.chainType)}async signTypedData(e,r,t){await this.validateAndRefreshToken();const a=await this.ensureSigner(),o=await s.Account.fromStorage(this.storage);if(!o)throw new n.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No account found");const d={...r};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),g=c.hash(e,d,t);return await y.signMessage({hash:g,implementationType:o.implementationType||o.type,chainId:Number(o.chainId),signer:a,address:o.address,ownerAddress:o.ownerAddress,factoryAddress:o.factoryAddress,salt:o.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,t){await this.validateAndRefreshToken();const o=await this.ensureSigner(),c=await a.Authentication.fromStorage(this.storage);if(!c)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");let g,h,u,y;if(e.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await s.Account.fromStorage(this.storage);if(!e)throw new n.ConfigurationError("missing account");const r=e?.recoveryMethodDetails?.passkeyId;if(!r)throw new n.ConfigurationError("missing passkey id for account");u={passkeyId:r,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:r,seed:c.userId})}}else if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.PasskeyHandler.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:c.userId});u={passkeyId:e.id,passkeyKey:e.key},y={passkeyId:e.id}}if(e.recoveryMethod===d.RecoveryMethod.PASSWORD?g=e.password:t.recoveryMethod===d.RecoveryMethod.PASSWORD&&(g=t.password),e.recoveryMethod===d.RecoveryMethod.AUTOMATIC?h=e.encryptionSession:t.recoveryMethod===d.RecoveryMethod.AUTOMATIC&&(h=t.encryptionSession),!g&&!h)throw new n.ConfigurationError("Password or encryption session is not provided");await o.setRecoveryMethod({recoveryMethod:t.recoveryMethod,recoveryPassword:g,encryptionSession:h,passkeyInfo:u});const m=await s.Account.fromStorage(this.storage);m&&new s.Account({...m,recoveryMethod:t.recoveryMethod,recoveryMethodDetails:y}).save(this.storage)}async get(){const e=await s.Account.fromStorage(this.storage);if(!e)throw new n.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No signer configured");const r=await a.Authentication.fromStorage(this.storage);if(!r)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return{id:e.id,chainId:e.chainId,user:r.userId,address:e.address,ownerAddress:e.ownerAddress,factoryAddress:e.factoryAddress,salt:e.salt,chainType:e.chainType,accountType:e.accountType,implementationAddress:e.implementationAddress,implementationType:e.implementationType,createdAt:e.createdAt,recoveryMethod:s.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){const r={accountType:d.AccountTypeEnum.SMART_ACCOUNT,...e},c=t.SDKConfiguration.getInstance();if(!c)throw new n.ConfigurationError("Configuration not found");const g=await a.Authentication.fromStorage(this.storage);if(!g)throw new n.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),o.withApiError(async()=>(await this.backendApiClients.accountsApi.getAccountsV2(r,{headers:g.thirdPartyProvider?{authorization:`Bearer ${c.baseConfiguration.publishableKey}`,"x-player-token":g.token,"x-auth-provider":g.thirdPartyProvider,"x-token-type":g.thirdPartyTokenType}:{authorization:`Bearer ${g.token}`,"x-project-key":c.baseConfiguration.publishableKey}})).data.data.map(e=>({user:e.user,chainType:e.chainType,id:e.id,address:e.address,active:e.smartAccount?.active,ownerAddress:e.ownerAddress,factoryAddress:e.smartAccount?.factoryAddress,salt:e.smartAccount?.salt,accountType:e.accountType,implementationAddress:e.smartAccount?.implementationAddress,createdAt:e.createdAt,implementationType:e.smartAccount?.implementationType,chainId:e.chainId,recoveryMethod:s.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await a.Authentication.fromStorage(this.storage))return d.EmbeddedState.UNAUTHENTICATED;return await s.Account.fromStorage(this.storage)?d.EmbeddedState.READY:d.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return c.debugLog("Failed to get embedded state:",e),d.EmbeddedState.UNAUTHENTICATED}}async getEthereumProvider(e){await this.ensureInitialized();const r={announceProvider:!0,...e},t=await a.Authentication.fromStorage(this.storage),i=await s.Account.fromStorage(this.storage);return this.provider?this.provider&&r.policy&&this.provider.updatePolicy(r.policy):(this.provider=new h.EvmProvider({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:i||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,policyId:r.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:r.chains}),r.announceProvider&&u.announceProvider({info:{...u.openfortProviderInfo,...r.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(r=>{setTimeout(r,e)});const r=await this.getIframeManager();if(!r.isLoaded())return!1;const t=await a.Authentication.fromStorage(this.storage);if(t)try{return await r.getCurrentDevice(t.userId),!0}catch(e){return!1}return r.isLoaded()}catch(e){return c.debugLog("Ping failed:",e),!1}}getURL(){const e=t.SDKConfiguration.getInstance();if(!e)throw new n.ConfigurationError("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new n.ConfigurationError("Invalid message poster");this.messagePoster=e,this.messenger&&this.messenger.destroy(),this.iframeManager&&this.iframeManager.destroy(),this.signer=null,this.signerPromise=null,this.iframeManager=null,this.iframeManagerPromise=null,this.messenger=null}async handleLogout(){const e=await this.ensureSigner();await e.disconnect(),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,this.signerPromise=null}async onMessage(e){if(!e||"object"!=typeof e)return void c.debugLog("Invalid message received:",e);c.debugLog("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const r="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(r&&this.messenger&&this.messagePoster)return c.debugLog("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const t=await this.getIframeManager();c.debugLog(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${t.isLoaded()}`),r&&!t.isLoaded()&&c.debugLog("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),c.debugLog("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await t.onMessage(e),c.debugLog("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}};
@@ -1 +1 @@
1
- "use strict";var e=require("../utils/debug.js"),t=require("../core/errors/authErrorCodes.js"),i=require("../core/errors/openfortError.js"),a=require("../core/errors/withApiError.js"),r=require("../types/types.js");function n(e){if(!e)throw new i.OpenfortError(t.OPENFORT_AUTH_ERROR_CODES.INTERNAL_ERROR,"User data is missing");return{id:e.id||"",email:e.email,name:e.name??void 0,image:e.image??void 0,emailVerified:e.emailVerified,isAnonymous:e.isAnonymous,createdAt:e.createdAt,updatedAt:e.updatedAt}}function s(e){if(e)return{id:e.id,token:e.token,userId:e.userId,expiresAt:e.expiresAt,createdAt:e.createdAt,updatedAt:e.updatedAt}}exports.AuthManager=class{backendApiClientsInstance;publishableKeyInstance;setBackendApiClients(e,t){this.backendApiClientsInstance=e,this.publishableKeyInstance=t}get backendApiClients(){if(!this.backendApiClientsInstance)throw new i.ConfigurationError("Backend API clients not initialized");return this.backendApiClientsInstance}get publishableKey(){if(!this.publishableKeyInstance)throw new i.ConfigurationError("Publishable key not initialized");return this.publishableKeyInstance}async initOAuth(e,t){return await a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.socialSignIn({socialSignInRequest:{provider:e,callbackURL:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data.url||"",{context:"initOAuth"})}async registerGuest(){return a.withApiError(async()=>{const e=await this.backendApiClients.anonymousApi.signInAnonymousPost({headers:{"x-project-key":`${this.publishableKey}`}});return{token:e.data.token,user:n(e.data.user)}},{context:"registerGuest"})}async loginWithIdToken(e,t){const i={socialSignInRequest:{provider:e,token:t}};return await a.withApiError(async()=>{const e=await this.backendApiClients.authenticationV2Api.socialSignIn(i);return{token:e.data.token,user:n(e.data.user)}},{context:"loginWithIdToken"})}async authenticateThirdParty(e,t,i){const r={thirdPartyOAuthRequest:{provider:e,token:t,tokenType:i}};return a.withApiError(async()=>({userId:(await this.backendApiClients.authenticationApi.thirdParty(r,{headers:{"x-project-key":`${this.publishableKey}`}})).data.id}),{context:"authenticateThirdParty"})}async initSIWE(e,t){const i={siweNoncePostRequest:{walletAddress:e,chainId:t||1}};return{address:e,nonce:(await a.withApiError(async()=>this.backendApiClients.siweApi.siweNoncePost(i,{headers:{"x-project-key":`${this.publishableKey}`}}),{context:"initSIWE"})).data.nonce}}async authenticateSIWE(e,t,i,r,s,o){const h={siweVerifyPostRequest:{signature:e,walletAddress:s,chainId:o||1,message:t,walletClientType:i,connectorType:r}};return a.withApiError(async()=>{const e=await this.backendApiClients.siweApi.siweVerifyPost(h,{headers:{"x-project-key":`${this.publishableKey}`}}),t=e.data.user;return{token:e.data.token,user:n(t)}},{context:"authenticateSIWE"})}async loginEmailPassword(e,t){return a.withApiError(async()=>{const i=(await this.backendApiClients.authenticationV2Api.signInEmailPost({signInEmailPostRequest:{email:e,password:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginEmailPassword"})}async requestResetPassword(e,t){await a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.forgetPasswordPost({forgetPasswordPostRequest:{email:e,redirectTo:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"requestResetPassword"})}async resetPassword(e,t){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.resetPasswordPost({resetPasswordPostRequest:{newPassword:e,token:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"resetPassword"})}async requestEmailVerification(e,t){await a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.sendVerificationEmailPost({sendVerificationEmailPostRequest:{email:e,callbackURL:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"requestEmailVerification"})}async verifyEmail(e,t){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.verifyEmailGet({token:e,callbackURL:t})},{context:"verifyEmail"})}async signupEmailPassword(e,t,i,s){return a.withApiError(async()=>{const a=(await this.backendApiClients.authenticationV2Api.signUpEmailPost({signUpEmailPostRequest:{email:e,password:t,name:i,callbackURL:s}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return a.token?{token:a.token,user:n(a.user)}:{action:r.AuthActionRequiredActions.ACTION_VERIFY_EMAIL}},{context:"signupEmailPassword"})}async validateCredentials(t,i){e.debugLog("Validating credentials with token:",t.token);const a=await this.getSessionWithToken(t,i);return{token:a.session.token,user:n(a.user),session:s(a.session)}}async logout(e){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.signOutPost(void 0,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})},{context:"logout"})}async getUser(e){return a.withApiError(async()=>n((await this.backendApiClients.userApi.meV2({headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data),{context:"getUser"})}async listAccounts(e){return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.listAccountsGet({headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"listAccounts"})}async linkOAuth(e,t,i){const r=i?.skipBrowserRedirect??!1,n={linkSocialPostRequest:{provider:t,callbackURL:i?.redirectTo,scopes:i?.scopes?.split(" "),disableRedirect:r}},s=await a.withApiError(async()=>this.backendApiClients.authenticationV2Api.linkSocialPost(n,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}}),{context:"linkOAuth"});return"undefined"!=typeof window&&!r&&s.data.url&&window.location.assign(s.data.url),s.data.url||""}async unlinkOAuth(e,t){const i={unlinkAccountPostRequest:{providerId:e}};return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.unlinkAccountPost(i,{headers:t.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t.token,"x-auth-provider":t.thirdPartyProvider,"x-token-type":t.thirdPartyTokenType}:{authorization:`Bearer ${t.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"unlinkOAuth"})}async linkEmail(e,t,i,r){const s={signUpEmailPostRequest:{name:e,email:t,password:i}};return a.withApiError(async()=>{const e=await this.backendApiClients.authenticationV2Api.signUpEmailPost(s,{headers:r.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":r.token,"x-auth-provider":r.thirdPartyProvider,"x-token-type":r.thirdPartyTokenType}:{authorization:`Bearer ${r.token}`,"x-project-key":`${this.publishableKey}`}});return{token:e.data.token,user:n(e.data.user)}},{context:"linkEmail"})}async unlinkEmail(e){const t={unlinkAccountPostRequest:{providerId:"credential"}};return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.unlinkAccountPost(t,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data.status,{context:"unlinkEmail"})}async unlinkWallet(e,t,i){const r={linkSiweUnlinkPostRequest:{walletAddress:e,chaindId:t}};return a.withApiError(async()=>(await this.backendApiClients.siweApi.linkSiweUnlinkPost(r,{headers:i.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"unlinkWallet"})}async linkWallet(e,t,i,r,n,s,o){const h={siweVerifyPostRequest:{signature:e,message:t,walletAddress:n,chainId:s,walletClientType:i,connectorType:r}};return a.withApiError(async()=>(await this.backendApiClients.siweApi.linkSiweVerifyPost(h,{headers:o.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}:{authorization:`Bearer ${o.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"linkWallet"})}async requestEmailOTP(e){const t={emailOtpSendVerificationOtpPostRequest:{email:e,type:"sign-in"}};await a.withApiError(async()=>(await this.backendApiClients.emailOTPApi.emailOtpSendVerificationOtpPost(t,{headers:{"x-project-key":`${this.publishableKey}`}})).data,{context:"requestEmailOTP"})}async loginWithEmailOTP(e,t){return await a.withApiError(async()=>{const i=(await this.backendApiClients.emailOTPApi.signInEmailOtpPost({signInEmailOtpPostRequest:{email:e,otp:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginWithEmailOTP"})}async requestPhoneOtp(e){const t={phoneNumberSendOtpPostRequest:{phoneNumber:e}};await a.withApiError(async()=>(await this.backendApiClients.smsOTPApi.phoneNumberSendOtpPost(t,{headers:{"x-project-key":`${this.publishableKey}`}})).data,{context:"requestPhoneOtp"})}async loginWithSMSOTP(e,t){return await a.withApiError(async()=>{const i=(await this.backendApiClients.smsOTPApi.phoneNumberVerifyPost({phoneNumberVerifyPostRequest:{code:t,phoneNumber:e}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginWithSMSOTP"})}async getSessionWithToken(e,t){return await a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.getSessionGet({disableCookieCache:t},{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"getSessionWithToken"})}};
1
+ "use strict";var e=require("../utils/debug.js"),t=require("../core/errors/authErrorCodes.js"),i=require("../core/errors/openfortError.js"),a=require("../core/errors/withApiError.js"),r=require("../types/types.js");function n(e){if(!e)throw new i.OpenfortError(t.OPENFORT_AUTH_ERROR_CODES.INTERNAL_ERROR,"User data is missing");return{id:e.id||"",email:e.email,name:e.name??void 0,image:e.image??void 0,emailVerified:e.emailVerified,isAnonymous:e.isAnonymous,createdAt:e.createdAt,updatedAt:e.updatedAt}}function s(e){if(e)return{id:e.id,token:e.token,userId:e.userId,expiresAt:e.expiresAt,createdAt:e.createdAt,updatedAt:e.updatedAt}}exports.AuthManager=class{backendApiClientsInstance;publishableKeyInstance;setBackendApiClients(e,t){this.backendApiClientsInstance=e,this.publishableKeyInstance=t}get backendApiClients(){if(!this.backendApiClientsInstance)throw new i.ConfigurationError("Backend API clients not initialized");return this.backendApiClientsInstance}get publishableKey(){if(!this.publishableKeyInstance)throw new i.ConfigurationError("Publishable key not initialized");return this.publishableKeyInstance}async initOAuth(e,t){return await a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.socialSignIn({socialSignInRequest:{provider:e,callbackURL:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data.url||"",{context:"initOAuth"})}async linkOAuthToAnonymous(e,t,i){return await a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.socialSignIn({socialSignInRequest:{provider:t,callbackURL:i}},{headers:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data.url||"",{context:"initOAuth"})}async registerGuest(){return a.withApiError(async()=>{const e=await this.backendApiClients.anonymousApi.signInAnonymousPost({headers:{"x-project-key":`${this.publishableKey}`}});return{token:e.data.token,user:n(e.data.user)}},{context:"registerGuest"})}async loginWithIdToken(e,t){const i={socialSignInRequest:{provider:e,token:t}};return await a.withApiError(async()=>{const e=await this.backendApiClients.authenticationV2Api.socialSignIn(i);return{token:e.data.token,user:n(e.data.user)}},{context:"loginWithIdToken"})}async authenticateThirdParty(e,t){const i={thirdPartyOAuthRequest:{provider:e,token:t}};return a.withApiError(async()=>({userId:(await this.backendApiClients.userApi.thirdPartyV2(i,{headers:{"x-project-key":`${this.publishableKey}`}})).data.id}),{context:"authenticateThirdParty"})}async initSIWE(e,t){const i={siweNoncePostRequest:{walletAddress:e,chainId:t||1}};return{address:e,nonce:(await a.withApiError(async()=>this.backendApiClients.siweApi.siweNoncePost(i,{headers:{"x-project-key":`${this.publishableKey}`}}),{context:"initSIWE"})).data.nonce}}async linkSIWE(e,t,i){const r={siweNoncePostRequest:{walletAddress:e,chainId:i||1}};return{address:e,nonce:(await a.withApiError(async()=>this.backendApiClients.siweApi.linkSiweNoncePost(r,{headers:{authorization:`Bearer ${t.token}`,"x-project-key":`${this.publishableKey}`}}),{context:"linkSIWE"})).data.nonce}}async authenticateSIWE(e,t,i,r,s,o){const h={siweVerifyPostRequest:{signature:e,walletAddress:s,chainId:o||1,message:t,walletClientType:i,connectorType:r}};return a.withApiError(async()=>{const e=await this.backendApiClients.siweApi.siweVerifyPost(h,{headers:{"x-project-key":`${this.publishableKey}`}}),t=e.data.user;return{token:e.data.token,user:n(t)}},{context:"authenticateSIWE"})}async loginEmailPassword(e,t){return a.withApiError(async()=>{const i=(await this.backendApiClients.authenticationV2Api.signInEmailPost({signInEmailPostRequest:{email:e,password:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginEmailPassword"})}async requestResetPassword(e,t){await a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.requestPasswordResetPost({forgetPasswordPostRequest:{email:e,redirectTo:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"requestResetPassword"})}async resetPassword(e,t){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.resetPasswordPost({resetPasswordPostRequest:{newPassword:e,token:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"resetPassword"})}async requestEmailVerification(e,t){await a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.sendVerificationEmailPost({sendVerificationEmailPostRequest:{email:e,callbackURL:t}},{headers:{"x-project-key":`${this.publishableKey}`}})},{context:"requestEmailVerification"})}async verifyEmail(e,t){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.verifyEmailGet({token:e,callbackURL:t})},{context:"verifyEmail"})}async signupEmailPassword(e,t,i,s){return a.withApiError(async()=>{const a=(await this.backendApiClients.authenticationV2Api.signUpEmailPost({signUpEmailPostRequest:{email:e,password:t,name:i,callbackURL:s}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return a.token?{token:a.token,user:n(a.user)}:{action:r.AuthActionRequiredActions.ACTION_VERIFY_EMAIL}},{context:"signupEmailPassword"})}async validateCredentials(t,i){e.debugLog("Validating credentials with token:",t.token);const a=await this.getSessionWithToken(t,i);return{token:a.session.token,user:n(a.user),session:s(a.session)}}async logout(e){return a.withApiError(async()=>{await this.backendApiClients.authenticationV2Api.signOutPost(void 0,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})},{context:"logout"})}async getUser(e){return a.withApiError(async()=>n((await this.backendApiClients.userApi.meV2({headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data),{context:"getUser"})}async listAccounts(e){return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.listAccountsGet({headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"listAccounts"})}async linkOAuth(e,t,i){const r=i?.skipBrowserRedirect??!1,n={linkSocialPostRequest:{provider:t,callbackURL:i?.redirectTo,scopes:i?.scopes?.split(" "),disableRedirect:r}},s=await a.withApiError(async()=>this.backendApiClients.authenticationV2Api.linkSocialPost(n,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}}),{context:"linkOAuth"});return"undefined"!=typeof window&&!r&&s.data.url&&window.location.assign(s.data.url),s.data.url||""}async unlinkOAuth(e,t){const i={unlinkAccountPostRequest:{providerId:e}};return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.unlinkAccountPost(i,{headers:t.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t.token,"x-auth-provider":t.thirdPartyProvider,"x-token-type":t.thirdPartyTokenType}:{authorization:`Bearer ${t.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"unlinkOAuth"})}async linkEmail(e,t,i,r){const s={signUpEmailPostRequest:{name:e,email:t,password:i}};return a.withApiError(async()=>{const e=await this.backendApiClients.authenticationV2Api.signUpEmailPost(s,{headers:r.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":r.token,"x-auth-provider":r.thirdPartyProvider,"x-token-type":r.thirdPartyTokenType}:{authorization:`Bearer ${r.token}`,"x-project-key":`${this.publishableKey}`}});return{token:e.data.token,user:n(e.data.user)}},{context:"linkEmail"})}async unlinkEmail(e){const t={unlinkAccountPostRequest:{providerId:"credential"}};return a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.unlinkAccountPost(t,{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data.status,{context:"unlinkEmail"})}async unlinkWallet(e,t,i){const r={linkSiweUnlinkPostRequest:{walletAddress:e,chaindId:t}};return a.withApiError(async()=>(await this.backendApiClients.siweApi.linkSiweUnlinkPost(r,{headers:i.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"unlinkWallet"})}async linkWallet(e,t,i,r,n,s,o){const h={siweVerifyPostRequest:{signature:e,message:t,walletAddress:n,chainId:s,walletClientType:i,connectorType:r}};return a.withApiError(async()=>(await this.backendApiClients.siweApi.linkSiweVerifyPost(h,{headers:o.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}:{authorization:`Bearer ${o.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"linkWallet"})}async requestEmailOTP(e){const t={emailOtpSendVerificationOtpPostRequest:{email:e,type:"sign-in"}};await a.withApiError(async()=>(await this.backendApiClients.emailOTPApi.emailOtpSendVerificationOtpPost(t,{headers:{"x-project-key":`${this.publishableKey}`}})).data,{context:"requestEmailOTP"})}async loginWithEmailOTP(e,t){return await a.withApiError(async()=>{const i=(await this.backendApiClients.emailOTPApi.signInEmailOtpPost({signInEmailOtpPostRequest:{email:e,otp:t}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginWithEmailOTP"})}async requestPhoneOtp(e){const t={phoneNumberSendOtpPostRequest:{phoneNumber:e}};await a.withApiError(async()=>(await this.backendApiClients.smsOTPApi.phoneNumberSendOtpPost(t,{headers:{"x-project-key":`${this.publishableKey}`}})).data,{context:"requestPhoneOtp"})}async loginWithSMSOTP(e,t){return await a.withApiError(async()=>{const i=(await this.backendApiClients.smsOTPApi.phoneNumberVerifyPost({phoneNumberVerifyPostRequest:{code:t,phoneNumber:e}},{headers:{"x-project-key":`${this.publishableKey}`}})).data;return{token:i.token,user:n(i.user)}},{context:"loginWithSMSOTP"})}async getSessionWithToken(e,t){return await a.withApiError(async()=>(await this.backendApiClients.authenticationV2Api.getSessionGet({disableCookieCache:t},{headers:e.thirdPartyProvider?{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}:{authorization:`Bearer ${e.token}`,"x-project-key":`${this.publishableKey}`}})).data,{context:"getSessionWithToken"})}};
@@ -1 +1 @@
1
- "use strict";var e=require("../../storage/istorage.js"),t=require("../../types/types.js");require("human-id"),require("axios"),require("../errors/sentry.js"),require("eventemitter3"),require("../../wallets/evm/JsonRpcError.js"),require("@ethersproject/keccak256"),require("../../wallets/evm/types.js"),require("../../wallets/evm/provider/eip6963.js"),require("../../wallets/messaging/browserMessenger/backwardCompatibility.js"),require("../../wallets/types.js");class s{constructor(e){this.user=e.user,this.id=e.id,this.chainType=e.chainType,this.address=e.address,this.accountType=e.accountType,this.chainId=e.chainId,this.createdAt=e.createdAt,this.implementationAddress=e.implementationAddress,this.implementationType=e.implementationType,this.factoryAddress=e.factoryAddress,this.recoveryMethod=e.recoveryMethod,this.recoveryMethodDetails=e.recoveryMethodDetails,this.salt=e.salt,this.ownerAddress=e.ownerAddress,this.type=e.type}user;id;chainType;address;accountType;chainId;ownerAddress;factoryAddress;implementationAddress;salt;createdAt;implementationType;recoveryMethod;recoveryMethodDetails;type;save(t){t.save(e.StorageKeys.ACCOUNT,JSON.stringify({user:this.user,id:this.id,chainType:this.chainType,address:this.address,accountType:this.accountType,chainId:this.chainId,ownerAddress:this.ownerAddress,createdAt:this.createdAt,implementationType:this.implementationType,factoryAddress:this.factoryAddress,implementationAddress:this.implementationAddress,salt:this.salt,recoveryMethod:this.recoveryMethod,recoveryMethodDetails:this.recoveryMethodDetails}))}static parseRecoveryMethod=e=>{switch(e){case"user":case t.RecoveryMethod.PASSWORD:return t.RecoveryMethod.PASSWORD;case"project":case t.RecoveryMethod.AUTOMATIC:return t.RecoveryMethod.AUTOMATIC;case"passkey":case t.RecoveryMethod.PASSKEY:return t.RecoveryMethod.PASSKEY;default:return}};static async fromStorage(t){const r=await t.get(e.StorageKeys.ACCOUNT);if(!r)return null;try{const e=JSON.parse(r);return new s(e)}catch{return null}}}exports.Account=s;
1
+ "use strict";var e=require("../../storage/istorage.js"),t=require("../../types/types.js");class s{constructor(e){this.user=e.user,this.id=e.id,this.chainType=e.chainType,this.address=e.address,this.accountType=e.accountType,this.chainId=e.chainId,this.createdAt=e.createdAt,this.implementationAddress=e.implementationAddress,this.implementationType=e.implementationType,this.factoryAddress=e.factoryAddress,this.recoveryMethod=e.recoveryMethod,this.recoveryMethodDetails=e.recoveryMethodDetails,this.salt=e.salt,this.ownerAddress=e.ownerAddress,this.type=e.type}user;id;chainType;address;accountType;chainId;ownerAddress;factoryAddress;implementationAddress;salt;createdAt;implementationType;recoveryMethod;recoveryMethodDetails;type;save(t){t.save(e.StorageKeys.ACCOUNT,JSON.stringify({user:this.user,id:this.id,chainType:this.chainType,address:this.address,accountType:this.accountType,chainId:this.chainId,ownerAddress:this.ownerAddress,createdAt:this.createdAt,implementationType:this.implementationType,factoryAddress:this.factoryAddress,implementationAddress:this.implementationAddress,salt:this.salt,recoveryMethod:this.recoveryMethod,recoveryMethodDetails:this.recoveryMethodDetails}))}static parseRecoveryMethod=e=>{switch(e){case"user":case t.RecoveryMethod.PASSWORD:return t.RecoveryMethod.PASSWORD;case"project":case t.RecoveryMethod.AUTOMATIC:return t.RecoveryMethod.AUTOMATIC;case"passkey":case t.RecoveryMethod.PASSKEY:return t.RecoveryMethod.PASSKEY;default:return}};static async fromStorage(t){const r=await t.get(e.StorageKeys.ACCOUNT);if(!r)return null;try{const e=JSON.parse(r);return new s(e)}catch{return null}}}exports.Account=s;
@@ -1 +1 @@
1
- "use strict";var e=require("axios"),t=require("../../version.js");const r="https://64a03e4967fb4dad3ecb914918c777b6@o4504593015242752.ingest.us.sentry.io/4509292415287296";class s{static sentryInstance;static queuedCalls=[];static baseTags;static set sentry(t){const n=t.getDsn();if(!n)throw new Error("Sentry DSN is not set");if(n.projectId!==r.split("https://")[1].split("/")[1]||n.host!==r.split("@")[1].split("/")[0]||n.publicKey!==r.split("@")[0].split("https://")[1])throw new Error("Sentry DSN is not valid");t.captureAxiosError=(r,n,o,a)=>{if(n instanceof e.AxiosError){if(400===n.response?.status||401===n.response?.status)return;n.name=r,t.captureException(n,{...o,captureContext:{...o?.captureContext,extra:{errorResponseData:n.response?.data,errorStatus:n.response?.status,errorHeaders:n.response?.headers,errorRequest:n.request},tags:{...s.baseTags,method:r}}})}else t.captureException(n,o,a)},t.captureError=(e,r,n,o)=>{const a=r.statusCode;if(400===a||401===a)return;const c=r,i=c.error,u=c.error_description,p=n?.captureContext;t.captureException(r,{...n,captureContext:{...p,extra:{...p?.extra,errorCode:i,errorDescription:u,errorClass:r.constructor.name,...c.statusCode&&{statusCode:c.statusCode},...c.audience&&{audience:c.audience},...c.scope&&{scope:c.scope},...c.accountId&&{accountId:c.accountId},...c.userId&&{userId:c.userId},...c.provider&&{provider:c.provider},...c.recoveryMethod&&{recoveryMethod:c.recoveryMethod}},tags:{...s.baseTags,context:e,errorClass:r.constructor.name}}})},s.sentryInstance=t}static get sentry(){return s.proxy}static async init({sentry:e,configuration:n}){if(e)return void(s.sentry=e);const o=await import("@sentry/browser");s.sentry=new o.BrowserClient({dsn:r,integrations:[],stackParser:o.defaultStackParser,transport:o.makeFetchTransport}),s.baseTags={projectId:n?.baseConfiguration.publishableKey,sdk:t.PACKAGE,sdkVersion:t.VERSION},s.processQueuedCalls()}static proxy=new Proxy({},{get:(e,t)=>s.sentryInstance&&"function"==typeof s.sentryInstance[t]?(...e)=>s.sentryInstance[t](...e):(...e)=>{s.queuedCalls.push({fn:t,args:e})}});static processQueuedCalls(){s.sentryInstance&&(s.queuedCalls.forEach(({fn:e,args:t})=>{"function"==typeof s.sentryInstance[e]&&s.sentryInstance[e](...t)}),s.queuedCalls=[])}}const{sentry:n}=s;exports.InternalSentry=s,exports.sentry=n;
1
+ "use strict";var e=require("axios"),t=require("../../version.js");const r="https://64a03e4967fb4dad3ecb914918c777b6@o4504593015242752.ingest.us.sentry.io/4509292415287296";class s{static sentryInstance;static queuedCalls=[];static baseTags;static set sentry(t){const n=t.getDsn();if(!n)throw new Error("Sentry DSN is not set");if(n.projectId!==r.split("https://")[1].split("/")[1]||n.host!==r.split("@")[1].split("/")[0]||n.publicKey!==r.split("@")[0].split("https://")[1])throw new Error("Sentry DSN is not valid");t.captureAxiosError=(r,n,o,a)=>{if(n instanceof e.AxiosError){if(400===n.response?.status||401===n.response?.status)return;n.name=r,t.captureException(n,{...o,captureContext:{...o?.captureContext,extra:{errorResponseData:n.response?.data,errorStatus:n.response?.status,errorHeaders:n.response?.headers,errorRequest:n.request},tags:{...s.baseTags,method:r}}})}else t.captureException(n,o,a)},t.captureError=(e,r,n,o)=>{const a=r.statusCode;if(400===a||401===a)return;const c=r,i=c.error,u=c.error_description,p=n?.captureContext;t.captureException(r,{...n,captureContext:{...p,extra:{...p?.extra,errorCode:i,errorDescription:u,errorClass:r.constructor.name,...c.statusCode&&{statusCode:c.statusCode},...c.audience&&{audience:c.audience},...c.scope&&{scope:c.scope},...c.accountId&&{accountId:c.accountId},...c.userId&&{userId:c.userId},...c.provider&&{provider:c.provider},...c.recoveryMethod&&{recoveryMethod:c.recoveryMethod}},tags:{...s.baseTags,context:e,errorClass:r.constructor.name}}})},s.sentryInstance=t}static get sentry(){return s.proxy}static async init({sentry:e,configuration:n}){if(e)return void(s.sentry=e);const o=await import("@sentry/browser");s.sentry=new o.BrowserClient({dsn:r,integrations:[],stackParser:o.defaultStackParser,transport:o.makeFetchTransport}),s.baseTags={projectId:n?.baseConfiguration.publishableKey??"",sdk:t.PACKAGE,sdkVersion:t.VERSION},s.processQueuedCalls()}static proxy=new Proxy({},{get:(e,t)=>s.sentryInstance&&"function"==typeof s.sentryInstance[t]?(...e)=>s.sentryInstance[t](...e):(...e)=>{s.queuedCalls.push({fn:t,args:e})}});static processQueuedCalls(){s.sentryInstance&&(s.queuedCalls.forEach(({fn:e,args:t})=>{"function"==typeof s.sentryInstance[e]&&s.sentryInstance[e](...t)}),s.queuedCalls=[])}}const{sentry:n}=s;exports.InternalSentry=s,exports.sentry=n;
@@ -1 +1 @@
1
- "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.js"),t=require("../api/auth.js"),i=require("../api/embeddedWallet.js"),n=require("../api/proxy.js"),a=require("../api/user.js"),r=require("../auth/authManager.js"),s=require("../storage/istorage.js"),o=require("../storage/lazyStorage.js"),h=require("../utils/typedEventEmitter.js"),l=require("./config/config.js"),u=require("./configuration/passkey.js"),c=require("./errors/authErrorCodes.js"),d=require("./errors/openfortError.js"),g=require("./errors/sentry.js"),f=require("./openfortInternal.js");class p{storage;iAuthManager=null;openfortInternal;initPromise;asyncInitPromise=null;authInstance;embeddedWalletInstance;userInstance;proxyInstance;configuration;eventEmitter;iPasskeyHandler;static globalEventEmitter=null;get auth(){if(!this.authInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing auth.");return this.authInstance}get embeddedWallet(){if(!this.embeddedWalletInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing embeddedWallet.");return this.embeddedWalletInstance}get user(){if(!this.userInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing user.");return this.userInstance}get proxy(){if(!this.proxyInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing proxy.");return this.proxyInstance}initializeSynchronously(){try{this.iAuthManager=new r.AuthManager,this.openfortInternal=new f.OpenfortInternal(this.storage,this.authManager,this.eventEmitter),this.authInstance=new t.AuthApi(this.storage,this.authManager,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),this.eventEmitter),this.embeddedWalletInstance=new i.EmbeddedWalletApi(this.storage,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),this.eventEmitter,this.passkeyHandler),this.userInstance=new a.UserApi(this.storage,this.authManager,this.validateAndRefreshToken.bind(this)),this.proxyInstance=new n.ProxyApi(this.storage,this.backendApiClients,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),async()=>{if(!this.embeddedWalletInstance)throw new d.SignerError(c.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"Embedded wallet not initialized");const e=this.embeddedWalletInstance;return t=>e.signMessage(t,{hashMessage:!0,arrayifyMessage:!0})})}catch(e){throw new d.ConfigurationError("Openfort SDK synchronous initialization failed")}}constructor(e){if(this.configuration=new l.SDKConfiguration(e),this.storage=new o.LazyStorage(this.configuration.storage),this.eventEmitter=new h,p.globalEventEmitter){["onAuthInit","onAuthSuccess","onAuthFailure","onLogout","onSwitchAccount","onSignedMessage","onEmbeddedWalletCreated","onEmbeddedWalletRecovered","onAuthFlowOpen","onAuthFlowClose","onAuthFlowCancel"].forEach(e=>{this.eventEmitter.on(e,(...t)=>{p.globalEventEmitter?.emit(e,...t)})})}else p.globalEventEmitter=this.eventEmitter;this.iPasskeyHandler=new u.PasskeyHandler({rpId:this.configuration.passkeyRpId,rpName:this.configuration.passkeyRpName,extractableKey:!0}),g.InternalSentry.init({configuration:this.configuration}),this.initializeSynchronously(),this.initPromise=Promise.resolve()}static getEventEmitter(){return p.globalEventEmitter||(p.globalEventEmitter=new h),p.globalEventEmitter}async waitForInitialization(){await this.initPromise,await this.ensureAsyncInitialized()}async getAccessToken(){return await this.ensureInitialized(),this.openfortInternal.getAccessToken()}async validateAndRefreshToken(e){return await this.ensureInitialized(),await this.openfortInternal.validateAndRefreshToken(e)}get backendApiClients(){return new e.BackendApiClients({basePath:this.configuration.backendUrl,accessToken:this.configuration.baseConfiguration.publishableKey,nativeAppIdentifier:this.configuration.nativeAppIdentifier,storage:this.storage,onLogout:()=>{this.eventEmitter.emit("onLogout")}})}get authManager(){if(!this.iAuthManager)throw new d.RequestError("AuthManager not initialized");return this.iAuthManager}get passkeyHandler(){return this.iPasskeyHandler}static async isStorageAccessible(e){try{const t=s.StorageKeys.TEST,i="openfort_storage_test";e.save(t,i);const n=await e.get(t);return e.remove(t),n===i}catch(e){return!1}}async initializeAsync(){try{if(!await p.isStorageAccessible(this.storage))throw new d.ConfigurationError("Storage is not accessible");this.authManager.setBackendApiClients(this.backendApiClients,this.configuration.baseConfiguration.publishableKey)}catch(e){throw new d.RequestError("Openfort SDK async initialization failed")}}async ensureAsyncInitialized(){this.asyncInitPromise||(this.asyncInitPromise=this.initializeAsync()),await this.asyncInitPromise}async ensureInitialized(){await this.initPromise,await this.ensureAsyncInitialized()}}exports.Openfort=p;
1
+ "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.js"),t=require("../api/auth.js"),i=require("../api/embeddedWallet.js"),n=require("../api/proxy.js"),a=require("../api/user.js"),r=require("../auth/authManager.js"),s=require("../storage/istorage.js"),o=require("../storage/lazyStorage.js"),h=require("../utils/typedEventEmitter.js"),l=require("./config/config.js"),u=require("./configuration/passkey.js"),c=require("./errors/authErrorCodes.js"),d=require("./errors/openfortError.js"),g=require("./errors/sentry.js"),f=require("./openfortInternal.js");class p{storage;iAuthManager=null;openfortInternal;initPromise;asyncInitPromise=null;authInstance;embeddedWalletInstance;userInstance;proxyInstance;configuration;eventEmitter;iPasskeyHandler;static globalEventEmitter=null;get auth(){if(!this.authInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing auth.");return this.authInstance}get embeddedWallet(){if(!this.embeddedWalletInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing embeddedWallet.");return this.embeddedWalletInstance}get user(){if(!this.userInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing user.");return this.userInstance}get proxy(){if(!this.proxyInstance)throw new d.ConfigurationError("Openfort SDK not initialized. Please await waitForInitialization() before accessing proxy.");return this.proxyInstance}initializeSynchronously(){try{this.iAuthManager=new r.AuthManager,this.openfortInternal=new f.OpenfortInternal(this.storage,this.authManager,this.eventEmitter),this.authInstance=new t.AuthApi(this.storage,this.authManager,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),this.eventEmitter),this.embeddedWalletInstance=new i.EmbeddedWalletApi(this.storage,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),this.eventEmitter,this.passkeyHandler),this.userInstance=new a.UserApi(this.storage,this.authManager,this.validateAndRefreshToken.bind(this)),this.proxyInstance=new n.ProxyApi(this.storage,this.backendApiClients,this.validateAndRefreshToken.bind(this),this.ensureInitialized.bind(this),async()=>{if(!this.embeddedWalletInstance)throw new d.SignerError(c.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"Embedded wallet not initialized");const e=this.embeddedWalletInstance;return t=>e.signMessage(t,{hashMessage:!0,arrayifyMessage:!0})})}catch(e){throw new d.ConfigurationError("Openfort SDK synchronous initialization failed")}}constructor(e){if(this.configuration=new l.SDKConfiguration(e),this.storage=new o.LazyStorage(this.configuration.baseConfiguration.publishableKey,this.configuration.storage),this.eventEmitter=new h,p.globalEventEmitter){["onAuthInit","onAuthSuccess","onAuthFailure","onLogout","onSwitchAccount","onSignedMessage","onEmbeddedWalletCreated","onEmbeddedWalletRecovered","onAuthFlowOpen","onAuthFlowClose","onAuthFlowCancel"].forEach(e=>{this.eventEmitter.on(e,(...t)=>{p.globalEventEmitter?.emit(e,...t)})})}else p.globalEventEmitter=this.eventEmitter;this.iPasskeyHandler=new u.PasskeyHandler({rpId:this.configuration.passkeyRpId,rpName:this.configuration.passkeyRpName,extractableKey:!0}),g.InternalSentry.init({configuration:this.configuration}),this.initializeSynchronously(),this.initPromise=Promise.resolve()}static getEventEmitter(){return p.globalEventEmitter||(p.globalEventEmitter=new h),p.globalEventEmitter}async waitForInitialization(){await this.initPromise,await this.ensureAsyncInitialized()}async getAccessToken(){return await this.ensureInitialized(),this.openfortInternal.getAccessToken()}async validateAndRefreshToken(e){return await this.ensureInitialized(),await this.openfortInternal.validateAndRefreshToken(e)}get backendApiClients(){return new e.BackendApiClients({basePath:this.configuration.backendUrl,accessToken:this.configuration.baseConfiguration.publishableKey,nativeAppIdentifier:this.configuration.nativeAppIdentifier,storage:this.storage,onLogout:()=>{this.eventEmitter.emit("onLogout")}})}get authManager(){if(!this.iAuthManager)throw new d.RequestError("AuthManager not initialized");return this.iAuthManager}get passkeyHandler(){return this.iPasskeyHandler}static async isStorageAccessible(e){try{const t=s.StorageKeys.TEST,i="openfort_storage_test";e.save(t,i);const n=await e.get(t);return e.remove(t),n===i}catch(e){return!1}}async initializeAsync(){if(!await p.isStorageAccessible(this.storage))throw new d.OpenfortError("Storage is not accessible",c.OPENFORT_ERROR_CODES.INVALID_CONFIGURATION);this.authManager.setBackendApiClients(this.backendApiClients,this.configuration.baseConfiguration.publishableKey)}async ensureAsyncInitialized(){this.asyncInitPromise||(this.asyncInitPromise=this.initializeAsync()),await this.asyncInitPromise}async ensureInitialized(){await this.initPromise,await this.ensureAsyncInitialized()}}exports.Openfort=p;