@openfort/openfort-js 0.8.37 → 0.8.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/packages/internal/openapi-clients/dist/index.js +1 -1
- package/dist/cjs/sdk/src/authManager.js +1 -1
- package/dist/cjs/sdk/src/chains/index.js +1 -1
- package/dist/cjs/sdk/src/openfort.js +1 -1
- package/dist/cjs/sdk/src/types.js +1 -1
- package/dist/cjs/sdk/src/version.js +1 -1
- package/dist/index.d.ts +14 -5
- package/dist/packages/internal/openapi-clients/dist/index.js +1 -1
- package/dist/sdk/src/authManager.js +1 -1
- package/dist/sdk/src/chains/index.js +1 -1
- package/dist/sdk/src/openfort.js +1 -1
- package/dist/sdk/src/types.js +1 -1
- package/dist/sdk/src/version.js +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("axios");const t="https://api.openfort.xyz".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(n,s=t,a=e){this.basePath=s,this.axios=a,n&&(this.configuration=n,this.basePath=n.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const a="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},o=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function r(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>r(e,t,n))):Object.keys(t).forEach((s=>r(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);r(n,t),e.search=n.toString()},h=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},u=function(e){return e.pathname+e.search+e.hash},d=function(e,t,n,s){return(a=t,i=n)=>{const o={...e.options,url:(s?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},l=function(n){const s=function(e){return{cancelTransferOwnership:async(t,n,s={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",n);const r="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},completeRecovery:async(t,n,s={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",n);const r="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},createAccount:async(t,n={})=>{i("createAccount","createAccountRequest",t);const s=new URL("/v1/accounts",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},createAccountV2:async(t,n={})=>{i("createAccountV2","accountCreateRequest",t);const s=new URL("/v2/accounts",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},deployAccount:async(t,n,s={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",n);const r="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},disableAccount:async(t,n={})=>{i("disableAccount","id",t);const s="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}},getAccount:async(t,n,s={})=>{i("getAccount","id",t);const r="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},getAccountV2:async(t,n={})=>{i("getAccountV2","accountId",t);const s="/v2/accounts/{accountId}".replace("{accountId}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},getAccounts:async(t,n,s,i,r,h,d={})=>{const l=new URL("/v1/accounts",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},w={},g={};await o(w,e),void 0!==t&&(g.limit=t),void 0!==n&&(g.skip=n),void 0!==s&&(g.order=s),void 0!==i&&(g.player=i),void 0!==r&&(g.address=r),h&&(g.expand=h),c(l,g);let m=p&&p.headers?p.headers:{};return y.headers={...w,...m,...d.headers},{url:u(l),options:y}},listAccountsV2:async(t,n,s,i,o={})=>{const r=new URL("/v2/accounts",a);let h;e&&(h=e.baseOptions);const d={method:"GET",...h,...o},l={};void 0!==t&&(l.limit=t),void 0!==n&&(l.skip=n),void 0!==s&&(l.order=s),void 0!==i&&(l.accountType=i),c(r,l);let p=h&&h.headers?h.headers:{};return d.headers={...p,...o.headers},{url:u(r),options:d}},requestTransferOwnership:async(t,n,s={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",n);const r="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},signPayload:async(t,n,s={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",n);const r="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},startRecovery:async(t,n,s={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",n);const r="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},syncAccount:async(t,n={})=>{i("syncAccount","id",t);const s="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}}}}(n);return{async cancelTransferOwnership(a,i,o){const r=await s.cancelTransferOwnership(a,i,o);return d(r,e,t,n)},async completeRecovery(a,i,o){const r=await s.completeRecovery(a,i,o);return d(r,e,t,n)},async createAccount(a,i){const o=await s.createAccount(a,i);return d(o,e,t,n)},async createAccountV2(a,i){const o=await s.createAccountV2(a,i);return d(o,e,t,n)},async deployAccount(a,i,o){const r=await s.deployAccount(a,i,o);return d(r,e,t,n)},async disableAccount(a,i){const o=await s.disableAccount(a,i);return d(o,e,t,n)},async getAccount(a,i,o){const r=await s.getAccount(a,i,o);return d(r,e,t,n)},async getAccountV2(a,i){const o=await s.getAccountV2(a,i);return d(o,e,t,n)},async getAccounts(a,i,o,r,c,h,u){const l=await s.getAccounts(a,i,o,r,c,h,u);return d(l,e,t,n)},async listAccountsV2(a,i,o,r,c){const h=await s.listAccountsV2(a,i,o,r,c);return d(h,e,t,n)},async requestTransferOwnership(a,i,o){const r=await s.requestTransferOwnership(a,i,o);return d(r,e,t,n)},async signPayload(a,i,o){const r=await s.signPayload(a,i,o);return d(r,e,t,n)},async startRecovery(a,i,o){const r=await s.startRecovery(a,i,o);return d(r,e,t,n)},async syncAccount(a,i){const o=await s.syncAccount(a,i);return d(o,e,t,n)}}};class p extends n{cancelTransferOwnership(e,t){return l(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}completeRecovery(e,t){return l(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}createAccount(e,t){return l(this.configuration).createAccount(e.createAccountRequest,t).then((e=>e(this.axios,this.basePath)))}createAccountV2(e,t){return l(this.configuration).createAccountV2(e.accountCreateRequest,t).then((e=>e(this.axios,this.basePath)))}deployAccount(e,t){return l(this.configuration).deployAccount(e.id,e.deployRequest,t).then((e=>e(this.axios,this.basePath)))}disableAccount(e,t){return l(this.configuration).disableAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}getAccount(e,t){return l(this.configuration).getAccount(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getAccountV2(e,t){return l(this.configuration).getAccountV2(e.accountId,t).then((e=>e(this.axios,this.basePath)))}getAccounts(e={},t){return l(this.configuration).getAccounts(e.limit,e.skip,e.order,e.player,e.address,e.expand,t).then((e=>e(this.axios,this.basePath)))}listAccountsV2(e={},t){return l(this.configuration).listAccountsV2(e.limit,e.skip,e.order,e.accountType,t).then((e=>e(this.axios,this.basePath)))}requestTransferOwnership(e,t){return l(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}signPayload(e,t){return l(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then((e=>e(this.axios,this.basePath)))}startRecovery(e,t){return l(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}syncAccount(e,t){return l(this.configuration).syncAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}}const y=function(n){const s=function(e){return{authenticateOAuth:async(t,n={})=>{i("authenticateOAuth","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},authenticateSIWE:async(t,n={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},authorizeWithOAuthToken:async(t,n,s={})=>{i("authorizeWithOAuthToken","provider",t),i("authorizeWithOAuthToken","oAuthRequest",n);const r="/iam/v1/oauth/{provider}/authorize".replace("{provider}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},getJwks:async(t,n={})=>{i("getJwks","publishableKey",t);const s="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},initOAuth:async(t,n,s={})=>{i("initOAuth","oAuthInitRequest",t);const r=new URL("/iam/v1/oauth/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},initSIWE:async(t,n,s={})=>{i("initSIWE","sIWERequest",t);const r=new URL("/iam/v1/siwe/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},linkEmail:async(t,n,s={})=>{i("linkEmail","loginRequest",t);const o=new URL("/iam/v1/password/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkOAuth:async(t,n,s={})=>{i("linkOAuth","oAuthInitRequest",t);const o=new URL("/iam/v1/oauth/init_link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkSIWE:async(t,n={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/link",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},linkThirdParty:async(t,n,s={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const o=new URL("/iam/v1/oauth/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},loginEmailPassword:async(t,n,s={})=>{i("loginEmailPassword","loginRequest",t);const r=new URL("/iam/v1/password/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginOIDC:async(t,n,s={})=>{i("loginOIDC","loginOIDCRequest",t);const r=new URL("/iam/v1/oidc/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},logout:async(t,n={})=>{i("logout","logoutRequest",t);const s=new URL("/iam/v1/sessions/logout",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},me:async(t={})=>{const n=new URL("/iam/v1/me",a);let s;e&&(s=e.baseOptions);const i={method:"GET",...s,...t};c(n,{});let o=s&&s.headers?s.headers:{};return i.headers={...o,...t.headers},{url:u(n),options:i}},poolOAuth:async(t,n={})=>{i("poolOAuth","key",t);const s=new URL("/iam/v1/oauth/pool",a);let r;e&&(r=e.baseOptions);const h={method:"POST",...r,...n},d={},l={};await o(d,e),void 0!==t&&(l.key=t),c(s,l);let p=r&&r.headers?r.headers:{};return h.headers={...d,...p,...n.headers},{url:u(s),options:h}},refresh:async(t,n={})=>{i("refresh","refreshTokenRequest",t);const s=new URL("/iam/v1/sessions",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},registerGuest:async(t,n={})=>{const s=new URL("/iam/v1/guest",a);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...n},h={};await o(h,e),null!=t&&(h["x-game"]=String(t)),c(s,{});let d=i&&i.headers?i.headers:{};return r.headers={...h,...d,...n.headers},{url:u(s),options:r}},requestEmailVerification:async(t,n={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const s=new URL("/iam/v1/password/request_email_verification",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},requestResetPassword:async(t,n={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const s=new URL("/iam/v1/password/request_reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},resetPassword:async(t,n={})=>{i("resetPassword","resetPasswordRequest",t);const s=new URL("/iam/v1/password/reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},signupEmailPassword:async(t,n,s={})=>{i("signupEmailPassword","signupRequest",t);const r=new URL("/iam/v1/password/signup",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},thirdParty:async(t,n,s={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const r=new URL("/iam/v1/oauth/third_party",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},unlinkEmail:async(t,n={})=>{i("unlinkEmail","unlinkEmailRequest",t);const s=new URL("/iam/v1/password/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkOAuth:async(t,n={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const s=new URL("/iam/v1/oauth/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkSIWE:async(t,n={})=>{i("unlinkSIWE","sIWERequest",t);const s=new URL("/iam/v1/siwe/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},verifyEmail:async(t,n={})=>{i("verifyEmail","verifyEmailRequest",t);const s=new URL("/iam/v1/password/verify_email",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},verifyOAuth:async(t,n,s={})=>{i("verifyOAuth","provider",t),i("verifyOAuth","oAuthRequest",n);const r="/iam/v1/oauth/{provider}/verify".replace("{provider}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},verifyOAuthToken:async(t,n={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/verify",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}}}}(n);return{async authenticateOAuth(a,i){const o=await s.authenticateOAuth(a,i);return d(o,e,t,n)},async authenticateSIWE(a,i){const o=await s.authenticateSIWE(a,i);return d(o,e,t,n)},async authorizeWithOAuthToken(a,i,o){const r=await s.authorizeWithOAuthToken(a,i,o);return d(r,e,t,n)},async getJwks(a,i){const o=await s.getJwks(a,i);return d(o,e,t,n)},async initOAuth(a,i,o){const r=await s.initOAuth(a,i,o);return d(r,e,t,n)},async initSIWE(a,i,o){const r=await s.initSIWE(a,i,o);return d(r,e,t,n)},async linkEmail(a,i,o){const r=await s.linkEmail(a,i,o);return d(r,e,t,n)},async linkOAuth(a,i,o){const r=await s.linkOAuth(a,i,o);return d(r,e,t,n)},async linkSIWE(a,i){const o=await s.linkSIWE(a,i);return d(o,e,t,n)},async linkThirdParty(a,i,o){const r=await s.linkThirdParty(a,i,o);return d(r,e,t,n)},async loginEmailPassword(a,i,o){const r=await s.loginEmailPassword(a,i,o);return d(r,e,t,n)},async loginOIDC(a,i,o){const r=await s.loginOIDC(a,i,o);return d(r,e,t,n)},async logout(a,i){const o=await s.logout(a,i);return d(o,e,t,n)},async me(a){const i=await s.me(a);return d(i,e,t,n)},async poolOAuth(a,i){const o=await s.poolOAuth(a,i);return d(o,e,t,n)},async refresh(a,i){const o=await s.refresh(a,i);return d(o,e,t,n)},async registerGuest(a,i){const o=await s.registerGuest(a,i);return d(o,e,t,n)},async requestEmailVerification(a,i){const o=await s.requestEmailVerification(a,i);return d(o,e,t,n)},async requestResetPassword(a,i){const o=await s.requestResetPassword(a,i);return d(o,e,t,n)},async resetPassword(a,i){const o=await s.resetPassword(a,i);return d(o,e,t,n)},async signupEmailPassword(a,i,o){const r=await s.signupEmailPassword(a,i,o);return d(r,e,t,n)},async thirdParty(a,i,o){const r=await s.thirdParty(a,i,o);return d(r,e,t,n)},async unlinkEmail(a,i){const o=await s.unlinkEmail(a,i);return d(o,e,t,n)},async unlinkOAuth(a,i){const o=await s.unlinkOAuth(a,i);return d(o,e,t,n)},async unlinkSIWE(a,i){const o=await s.unlinkSIWE(a,i);return d(o,e,t,n)},async verifyEmail(a,i){const o=await s.verifyEmail(a,i);return d(o,e,t,n)},async verifyOAuth(a,i,o){const r=await s.verifyOAuth(a,i,o);return d(r,e,t,n)},async verifyOAuthToken(a,i){const o=await s.verifyOAuthToken(a,i);return d(o,e,t,n)}}};class w extends n{authenticateOAuth(e,t){return y(this.configuration).authenticateOAuth(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}authenticateSIWE(e,t){return y(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}authorizeWithOAuthToken(e,t){return y(this.configuration).authorizeWithOAuthToken(e.provider,e.oAuthRequest,t).then((e=>e(this.axios,this.basePath)))}getJwks(e,t){return y(this.configuration).getJwks(e.publishableKey,t).then((e=>e(this.axios,this.basePath)))}initOAuth(e,t){return y(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}initSIWE(e,t){return y(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkEmail(e,t){return y(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkOAuth(e,t){return y(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkSIWE(e,t){return y(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}linkThirdParty(e,t){return y(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginEmailPassword(e,t){return y(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginOIDC(e,t){return y(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}logout(e,t){return y(this.configuration).logout(e.logoutRequest,t).then((e=>e(this.axios,this.basePath)))}me(e){return y(this.configuration).me(e).then((e=>e(this.axios,this.basePath)))}poolOAuth(e,t){return y(this.configuration).poolOAuth(e.key,t).then((e=>e(this.axios,this.basePath)))}refresh(e,t){return y(this.configuration).refresh(e.refreshTokenRequest,t).then((e=>e(this.axios,this.basePath)))}registerGuest(e={},t){return y(this.configuration).registerGuest(e.xGame,t).then((e=>e(this.axios,this.basePath)))}requestEmailVerification(e,t){return y(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}requestResetPassword(e,t){return y(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}resetPassword(e,t){return y(this.configuration).resetPassword(e.resetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}signupEmailPassword(e,t){return y(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}thirdParty(e,t){return y(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}unlinkEmail(e,t){return y(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkOAuth(e,t){return y(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkSIWE(e,t){return y(this.configuration).unlinkSIWE(e.sIWERequest,t).then((e=>e(this.axios,this.basePath)))}verifyEmail(e,t){return y(this.configuration).verifyEmail(e.verifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuth(e,t){return y(this.configuration).verifyOAuth(e.provider,e.oAuthRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuthToken(e,t){return y(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}}const g=function(n){const s=function(e){return{createSession:async(t,n,s={})=>{i("createSession","createSessionRequest",t);const r=new URL("/v1/sessions",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},getPlayerSessions:async(t,n,s,r,h,d={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},w={},g={};await o(w,e),void 0!==n&&(g.limit=n),void 0!==s&&(g.skip=s),void 0!==r&&(g.order=r),void 0!==t&&(g.player=t),h&&(g.expand=h),c(l,g);let m=p&&p.headers?p.headers:{};return y.headers={...w,...m,...d.headers},{url:u(l),options:y}},getSession:async(t,n,s={})=>{i("getSession","id",t);const r="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},revokeSession:async(t,n,s={})=>{i("revokeSession","revokeSessionRequest",t);const r=new URL("/v1/sessions/revoke",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},signatureSession:async(t,n,s={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",n);const r="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createSession(a,i,o){const r=await s.createSession(a,i,o);return d(r,e,t,n)},async getPlayerSessions(a,i,o,r,c,h){const u=await s.getPlayerSessions(a,i,o,r,c,h);return d(u,e,t,n)},async getSession(a,i,o){const r=await s.getSession(a,i,o);return d(r,e,t,n)},async revokeSession(a,i,o){const r=await s.revokeSession(a,i,o);return d(r,e,t,n)},async signatureSession(a,i,o){const r=await s.signatureSession(a,i,o);return d(r,e,t,n)}}};class m extends n{createSession(e,t){return g(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}getPlayerSessions(e,t){return g(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 g(this.configuration).getSession(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}revokeSession(e,t){return g(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}signatureSession(e,t){return g(this.configuration).signatureSession(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}const O=function(n){const s=function(e){return{createTransactionIntent:async(t,n,s={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const r=new URL("/v1/transaction_intents",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},estimateTransactionIntentCost:async(t,n={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const s=new URL("/v1/transaction_intents/estimate_gas_cost",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getTransactionIntent:async(t,n,s={})=>{i("getTransactionIntent","id",t);const r="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},getTransactionIntents:async(t,n,s,i,r,h,d,l,p,y={})=>{const w=new URL("/v1/transaction_intents",a);let g;e&&(g=e.baseOptions);const m={method:"GET",...g,...y},O={},R={};await o(O,e),void 0!==t&&(R.limit=t),void 0!==n&&(R.skip=n),void 0!==s&&(R.order=s),i&&(R.expand=i),void 0!==r&&(R.chainId=r),h&&(R.account=h),d&&(R.player=d),void 0!==l&&(R.status=l),p&&(R.policy=p),c(w,R);let P=g&&g.headers?g.headers:{};return m.headers={...O,...P,...y.headers},{url:u(w),options:m}},signature:async(t,n,s={})=>{i("signature","id",t),i("signature","signatureRequest",n);const r="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createTransactionIntent(a,i,o){const r=await s.createTransactionIntent(a,i,o);return d(r,e,t,n)},async estimateTransactionIntentCost(a,i){const o=await s.estimateTransactionIntentCost(a,i);return d(o,e,t,n)},async getTransactionIntent(a,i,o){const r=await s.getTransactionIntent(a,i,o);return d(r,e,t,n)},async getTransactionIntents(a,i,o,r,c,h,u,l,p,y){const w=await s.getTransactionIntents(a,i,o,r,c,h,u,l,p,y);return d(w,e,t,n)},async signature(a,i,o){const r=await s.signature(a,i,o);return d(r,e,t,n)}}};class R extends n{createTransactionIntent(e,t){return O(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}estimateTransactionIntentCost(e,t){return O(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntent(e,t){return O(this.configuration).getTransactionIntent(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntents(e={},t){return O(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 O(this.configuration).signature(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}class P{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())}}exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;sessionsApi;authenticationApi;constructor(t){const n=e.default?e.default:e;this.config=t,this.transactionIntentsApi=new R(t.backend,void 0,n),this.accountsApi=new p(t.backend,void 0,n),this.sessionsApi=new m(t.backend,void 0,n),this.authenticationApi=new w(t.backend,void 0,n)}},exports.createConfig=({basePath:e,accessToken:t})=>{if(!e.trim())throw Error("basePath can not be empty");return new P({basePath:e,accessToken:t})};
|
|
1
|
+
"use strict";var e=require("axios");const t="https://api.openfort.xyz".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(n,s=t,a=e){this.basePath=s,this.axios=a,n&&(this.configuration=n,this.basePath=n.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const a="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},o=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function r(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>r(e,t,n))):Object.keys(t).forEach((s=>r(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);r(n,t),e.search=n.toString()},h=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},u=function(e){return e.pathname+e.search+e.hash},d=function(e,t,n,s){return(a=t,i=n)=>{const o={...e.options,url:(s?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},l=function(n){const s=function(e){return{cancelTransferOwnership:async(t,n,s={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",n);const r="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},completeRecovery:async(t,n,s={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",n);const r="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},createAccount:async(t,n={})=>{i("createAccount","createAccountRequest",t);const s=new URL("/v1/accounts",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},createAccountV2:async(t,n={})=>{i("createAccountV2","accountCreateRequest",t);const s=new URL("/v2/accounts",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},deployAccount:async(t,n,s={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",n);const r="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},disableAccount:async(t,n={})=>{i("disableAccount","id",t);const s="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}},getAccount:async(t,n,s={})=>{i("getAccount","id",t);const r="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},getAccountV2:async(t,n={})=>{i("getAccountV2","accountId",t);const s="/v2/accounts/{accountId}".replace("{accountId}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},getAccounts:async(t,n,s,i,r,h,d={})=>{const l=new URL("/v1/accounts",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},g={},w={};await o(g,e),void 0!==t&&(w.limit=t),void 0!==n&&(w.skip=n),void 0!==s&&(w.order=s),void 0!==i&&(w.player=i),void 0!==r&&(w.address=r),h&&(w.expand=h),c(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...d.headers},{url:u(l),options:y}},listAccountsV2:async(t,n,s,i,o={})=>{const r=new URL("/v2/accounts",a);let h;e&&(h=e.baseOptions);const d={method:"GET",...h,...o},l={};void 0!==t&&(l.limit=t),void 0!==n&&(l.skip=n),void 0!==s&&(l.order=s),void 0!==i&&(l.accountType=i),c(r,l);let p=h&&h.headers?h.headers:{};return d.headers={...p,...o.headers},{url:u(r),options:d}},requestTransferOwnership:async(t,n,s={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",n);const r="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},signPayload:async(t,n,s={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",n);const r="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},startRecovery:async(t,n,s={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",n);const r="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},syncAccount:async(t,n={})=>{i("syncAccount","id",t);const s="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}}}}(n);return{async cancelTransferOwnership(a,i,o){const r=await s.cancelTransferOwnership(a,i,o);return d(r,e,t,n)},async completeRecovery(a,i,o){const r=await s.completeRecovery(a,i,o);return d(r,e,t,n)},async createAccount(a,i){const o=await s.createAccount(a,i);return d(o,e,t,n)},async createAccountV2(a,i){const o=await s.createAccountV2(a,i);return d(o,e,t,n)},async deployAccount(a,i,o){const r=await s.deployAccount(a,i,o);return d(r,e,t,n)},async disableAccount(a,i){const o=await s.disableAccount(a,i);return d(o,e,t,n)},async getAccount(a,i,o){const r=await s.getAccount(a,i,o);return d(r,e,t,n)},async getAccountV2(a,i){const o=await s.getAccountV2(a,i);return d(o,e,t,n)},async getAccounts(a,i,o,r,c,h,u){const l=await s.getAccounts(a,i,o,r,c,h,u);return d(l,e,t,n)},async listAccountsV2(a,i,o,r,c){const h=await s.listAccountsV2(a,i,o,r,c);return d(h,e,t,n)},async requestTransferOwnership(a,i,o){const r=await s.requestTransferOwnership(a,i,o);return d(r,e,t,n)},async signPayload(a,i,o){const r=await s.signPayload(a,i,o);return d(r,e,t,n)},async startRecovery(a,i,o){const r=await s.startRecovery(a,i,o);return d(r,e,t,n)},async syncAccount(a,i){const o=await s.syncAccount(a,i);return d(o,e,t,n)}}};class p extends n{cancelTransferOwnership(e,t){return l(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}completeRecovery(e,t){return l(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}createAccount(e,t){return l(this.configuration).createAccount(e.createAccountRequest,t).then((e=>e(this.axios,this.basePath)))}createAccountV2(e,t){return l(this.configuration).createAccountV2(e.accountCreateRequest,t).then((e=>e(this.axios,this.basePath)))}deployAccount(e,t){return l(this.configuration).deployAccount(e.id,e.deployRequest,t).then((e=>e(this.axios,this.basePath)))}disableAccount(e,t){return l(this.configuration).disableAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}getAccount(e,t){return l(this.configuration).getAccount(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getAccountV2(e,t){return l(this.configuration).getAccountV2(e.accountId,t).then((e=>e(this.axios,this.basePath)))}getAccounts(e={},t){return l(this.configuration).getAccounts(e.limit,e.skip,e.order,e.player,e.address,e.expand,t).then((e=>e(this.axios,this.basePath)))}listAccountsV2(e={},t){return l(this.configuration).listAccountsV2(e.limit,e.skip,e.order,e.accountType,t).then((e=>e(this.axios,this.basePath)))}requestTransferOwnership(e,t){return l(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}signPayload(e,t){return l(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then((e=>e(this.axios,this.basePath)))}startRecovery(e,t){return l(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}syncAccount(e,t){return l(this.configuration).syncAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}}const y=function(n){const s=function(e){return{authenticateSIWE:async(t,n={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getJwks:async(t,n={})=>{i("getJwks","publishableKey",t);const s="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},initOAuth:async(t,n,s={})=>{i("initOAuth","oAuthInitRequest",t);const r=new URL("/iam/v1/oauth/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},initSIWE:async(t,n,s={})=>{i("initSIWE","sIWERequest",t);const r=new URL("/iam/v1/siwe/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},linkEmail:async(t,n,s={})=>{i("linkEmail","loginRequest",t);const o=new URL("/iam/v1/password/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkOAuth:async(t,n,s={})=>{i("linkOAuth","oAuthInitRequest",t);const o=new URL("/iam/v1/oauth/init_link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkSIWE:async(t,n={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/link",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},linkThirdParty:async(t,n,s={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const o=new URL("/iam/v1/oauth/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},loginEmailPassword:async(t,n,s={})=>{i("loginEmailPassword","loginRequest",t);const r=new URL("/iam/v1/password/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginOIDC:async(t,n,s={})=>{i("loginOIDC","loginOIDCRequest",t);const r=new URL("/iam/v1/oidc/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginWithIdToken:async(t,n={})=>{i("loginWithIdToken","loginWithIdTokenRequest",t);const s=new URL("/iam/v1/oauth/login_id_token",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},logout:async(t,n={})=>{i("logout","logoutRequest",t);const s=new URL("/iam/v1/sessions/logout",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},me:async(t={})=>{const n=new URL("/iam/v1/me",a);let s;e&&(s=e.baseOptions);const i={method:"GET",...s,...t};c(n,{});let o=s&&s.headers?s.headers:{};return i.headers={...o,...t.headers},{url:u(n),options:i}},poolOAuth:async(t,n={})=>{i("poolOAuth","key",t);const s=new URL("/iam/v1/oauth/pool",a);let r;e&&(r=e.baseOptions);const h={method:"POST",...r,...n},d={},l={};await o(d,e),void 0!==t&&(l.key=t),c(s,l);let p=r&&r.headers?r.headers:{};return h.headers={...d,...p,...n.headers},{url:u(s),options:h}},refresh:async(t,n={})=>{i("refresh","refreshTokenRequest",t);const s=new URL("/iam/v1/sessions",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},registerGuest:async(t,n={})=>{const s=new URL("/iam/v1/guest",a);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...n},h={};await o(h,e),null!=t&&(h["x-game"]=String(t)),c(s,{});let d=i&&i.headers?i.headers:{};return r.headers={...h,...d,...n.headers},{url:u(s),options:r}},requestEmailVerification:async(t,n={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const s=new URL("/iam/v1/password/request_email_verification",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},requestResetPassword:async(t,n={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const s=new URL("/iam/v1/password/request_reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},resetPassword:async(t,n={})=>{i("resetPassword","resetPasswordRequest",t);const s=new URL("/iam/v1/password/reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},signupEmailPassword:async(t,n,s={})=>{i("signupEmailPassword","signupRequest",t);const r=new URL("/iam/v1/password/signup",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},thirdParty:async(t,n,s={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const r=new URL("/iam/v1/oauth/third_party",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},unlinkEmail:async(t,n={})=>{i("unlinkEmail","unlinkEmailRequest",t);const s=new URL("/iam/v1/password/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkOAuth:async(t,n={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const s=new URL("/iam/v1/oauth/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkSIWE:async(t,n={})=>{i("unlinkSIWE","sIWERequest",t);const s=new URL("/iam/v1/siwe/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},verifyEmail:async(t,n={})=>{i("verifyEmail","verifyEmailRequest",t);const s=new URL("/iam/v1/password/verify_email",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},verifyOAuthToken:async(t,n={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/verify",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}}}}(n);return{async authenticateSIWE(a,i){const o=await s.authenticateSIWE(a,i);return d(o,e,t,n)},async getJwks(a,i){const o=await s.getJwks(a,i);return d(o,e,t,n)},async initOAuth(a,i,o){const r=await s.initOAuth(a,i,o);return d(r,e,t,n)},async initSIWE(a,i,o){const r=await s.initSIWE(a,i,o);return d(r,e,t,n)},async linkEmail(a,i,o){const r=await s.linkEmail(a,i,o);return d(r,e,t,n)},async linkOAuth(a,i,o){const r=await s.linkOAuth(a,i,o);return d(r,e,t,n)},async linkSIWE(a,i){const o=await s.linkSIWE(a,i);return d(o,e,t,n)},async linkThirdParty(a,i,o){const r=await s.linkThirdParty(a,i,o);return d(r,e,t,n)},async loginEmailPassword(a,i,o){const r=await s.loginEmailPassword(a,i,o);return d(r,e,t,n)},async loginOIDC(a,i,o){const r=await s.loginOIDC(a,i,o);return d(r,e,t,n)},async loginWithIdToken(a,i){const o=await s.loginWithIdToken(a,i);return d(o,e,t,n)},async logout(a,i){const o=await s.logout(a,i);return d(o,e,t,n)},async me(a){const i=await s.me(a);return d(i,e,t,n)},async poolOAuth(a,i){const o=await s.poolOAuth(a,i);return d(o,e,t,n)},async refresh(a,i){const o=await s.refresh(a,i);return d(o,e,t,n)},async registerGuest(a,i){const o=await s.registerGuest(a,i);return d(o,e,t,n)},async requestEmailVerification(a,i){const o=await s.requestEmailVerification(a,i);return d(o,e,t,n)},async requestResetPassword(a,i){const o=await s.requestResetPassword(a,i);return d(o,e,t,n)},async resetPassword(a,i){const o=await s.resetPassword(a,i);return d(o,e,t,n)},async signupEmailPassword(a,i,o){const r=await s.signupEmailPassword(a,i,o);return d(r,e,t,n)},async thirdParty(a,i,o){const r=await s.thirdParty(a,i,o);return d(r,e,t,n)},async unlinkEmail(a,i){const o=await s.unlinkEmail(a,i);return d(o,e,t,n)},async unlinkOAuth(a,i){const o=await s.unlinkOAuth(a,i);return d(o,e,t,n)},async unlinkSIWE(a,i){const o=await s.unlinkSIWE(a,i);return d(o,e,t,n)},async verifyEmail(a,i){const o=await s.verifyEmail(a,i);return d(o,e,t,n)},async verifyOAuthToken(a,i){const o=await s.verifyOAuthToken(a,i);return d(o,e,t,n)}}};class g extends n{authenticateSIWE(e,t){return y(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}getJwks(e,t){return y(this.configuration).getJwks(e.publishableKey,t).then((e=>e(this.axios,this.basePath)))}initOAuth(e,t){return y(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}initSIWE(e,t){return y(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkEmail(e,t){return y(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkOAuth(e,t){return y(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkSIWE(e,t){return y(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}linkThirdParty(e,t){return y(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginEmailPassword(e,t){return y(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginOIDC(e,t){return y(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginWithIdToken(e,t){return y(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then((e=>e(this.axios,this.basePath)))}logout(e,t){return y(this.configuration).logout(e.logoutRequest,t).then((e=>e(this.axios,this.basePath)))}me(e){return y(this.configuration).me(e).then((e=>e(this.axios,this.basePath)))}poolOAuth(e,t){return y(this.configuration).poolOAuth(e.key,t).then((e=>e(this.axios,this.basePath)))}refresh(e,t){return y(this.configuration).refresh(e.refreshTokenRequest,t).then((e=>e(this.axios,this.basePath)))}registerGuest(e={},t){return y(this.configuration).registerGuest(e.xGame,t).then((e=>e(this.axios,this.basePath)))}requestEmailVerification(e,t){return y(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}requestResetPassword(e,t){return y(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}resetPassword(e,t){return y(this.configuration).resetPassword(e.resetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}signupEmailPassword(e,t){return y(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}thirdParty(e,t){return y(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}unlinkEmail(e,t){return y(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkOAuth(e,t){return y(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkSIWE(e,t){return y(this.configuration).unlinkSIWE(e.sIWERequest,t).then((e=>e(this.axios,this.basePath)))}verifyEmail(e,t){return y(this.configuration).verifyEmail(e.verifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuthToken(e,t){return y(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}}const w=function(n){const s=function(e){return{createSession:async(t,n,s={})=>{i("createSession","createSessionRequest",t);const r=new URL("/v1/sessions",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},getPlayerSessions:async(t,n,s,r,h,d={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},g={},w={};await o(g,e),void 0!==n&&(w.limit=n),void 0!==s&&(w.skip=s),void 0!==r&&(w.order=r),void 0!==t&&(w.player=t),h&&(w.expand=h),c(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...d.headers},{url:u(l),options:y}},getSession:async(t,n,s={})=>{i("getSession","id",t);const r="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},revokeSession:async(t,n,s={})=>{i("revokeSession","revokeSessionRequest",t);const r=new URL("/v1/sessions/revoke",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},signatureSession:async(t,n,s={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",n);const r="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createSession(a,i,o){const r=await s.createSession(a,i,o);return d(r,e,t,n)},async getPlayerSessions(a,i,o,r,c,h){const u=await s.getPlayerSessions(a,i,o,r,c,h);return d(u,e,t,n)},async getSession(a,i,o){const r=await s.getSession(a,i,o);return d(r,e,t,n)},async revokeSession(a,i,o){const r=await s.revokeSession(a,i,o);return d(r,e,t,n)},async signatureSession(a,i,o){const r=await s.signatureSession(a,i,o);return d(r,e,t,n)}}};class m extends n{createSession(e,t){return w(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}getPlayerSessions(e,t){return w(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 w(this.configuration).getSession(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}revokeSession(e,t){return w(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}signatureSession(e,t){return w(this.configuration).signatureSession(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}const P=function(n){const s=function(e){return{createTransactionIntent:async(t,n,s={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const r=new URL("/v1/transaction_intents",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},estimateTransactionIntentCost:async(t,n={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const s=new URL("/v1/transaction_intents/estimate_gas_cost",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getTransactionIntent:async(t,n,s={})=>{i("getTransactionIntent","id",t);const r="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},getTransactionIntents:async(t,n,s,i,r,h,d,l,p,y={})=>{const g=new URL("/v1/transaction_intents",a);let w;e&&(w=e.baseOptions);const m={method:"GET",...w,...y},P={},R={};await o(P,e),void 0!==t&&(R.limit=t),void 0!==n&&(R.skip=n),void 0!==s&&(R.order=s),i&&(R.expand=i),void 0!==r&&(R.chainId=r),h&&(R.account=h),d&&(R.player=d),void 0!==l&&(R.status=l),p&&(R.policy=p),c(g,R);let O=w&&w.headers?w.headers:{};return m.headers={...P,...O,...y.headers},{url:u(g),options:m}},signature:async(t,n,s={})=>{i("signature","id",t),i("signature","signatureRequest",n);const r="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createTransactionIntent(a,i,o){const r=await s.createTransactionIntent(a,i,o);return d(r,e,t,n)},async estimateTransactionIntentCost(a,i){const o=await s.estimateTransactionIntentCost(a,i);return d(o,e,t,n)},async getTransactionIntent(a,i,o){const r=await s.getTransactionIntent(a,i,o);return d(r,e,t,n)},async getTransactionIntents(a,i,o,r,c,h,u,l,p,y){const g=await s.getTransactionIntents(a,i,o,r,c,h,u,l,p,y);return d(g,e,t,n)},async signature(a,i,o){const r=await s.signature(a,i,o);return d(r,e,t,n)}}};class R extends n{createTransactionIntent(e,t){return P(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}estimateTransactionIntentCost(e,t){return P(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntent(e,t){return P(this.configuration).getTransactionIntent(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntents(e={},t){return P(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 P(this.configuration).signature(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}class O{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())}}exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;sessionsApi;authenticationApi;constructor(t){const n=e.default?e.default:e;this.config=t,this.transactionIntentsApi=new R(t.backend,void 0,n),this.accountsApi=new p(t.backend,void 0,n),this.sessionsApi=new m(t.backend,void 0,n),this.authenticationApi=new g(t.backend,void 0,n)}},exports.createConfig=({basePath:e,accessToken:t})=>{if(!e.trim())throw Error("basePath can not be empty");return new O({basePath:e,accessToken:t})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../packages/internal/openapi-clients/dist/index.js"),t=require("crypto"),r=require("./errors/openfortError.js"),a=require("./types.js"),i=require("./utils/deviceCredentialsManager.js"),n=require("./utils/helpers.js");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=s(t);function l(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function c(e){return o.createHash("sha256").update(e).digest()}class h{publishableKey;deviceCredentialsManager;backendApiClients;constructor(t,r){this.publishableKey=t,this.deviceCredentialsManager=new i,this.backendApiClients=new e.BackendApiClients({backend:e.createConfig({basePath:r,accessToken:t})})}async initOAuth(e,t,r){const a=t?.usePooling??!1;delete t?.usePooling;const i={oAuthInitRequest:{provider:e,options:t,usePooling:a}},s=await this.backendApiClients.authenticationApi.initOAuth(i,h.getEcosystemGameOptsOrUndefined(r));return n.isBrowser()&&t?.skipBrowserRedirect&&window.location.assign(s.data.url),{url:s.data.url,key:s.data.key}}async registerGuest(){return(await this.backendApiClients.authenticationApi.registerGuest({})).data}async poolOAuth(e){const t={key:e};for(let e=0;e<600;e++)try{const e=await this.backendApiClients.authenticationApi.poolOAuth(t);if(200===e.status)return e.data}catch(e){if(e.response&&404===e.response.status){await new Promise((e=>{setTimeout(e,500)}));continue}throw e}throw new Error("Failed to pool OAuth, try again later")}async authenticateThirdParty(e,t,a,i){const n={thirdPartyOAuthRequest:{provider:e,token:t,tokenType:a}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.thirdParty(n,h.getEcosystemGameOptsOrUndefined(i))).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async initSIWE(e,t){const r={sIWERequest:{address:e}},a=await this.backendApiClients.authenticationApi.initSIWE(r,h.getEcosystemGameOptsOrUndefined(t));return{address:a.data.address,nonce:a.data.nonce,expiresAt:a.data.expiresAt}}async authenticateSIWE(e,t,a,i){const n={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:i}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.authenticateSIWE(n)).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}static getEcosystemGameOptsOrUndefined(e){if(e)return{headers:{"x-game":e}}}async loginEmailPassword(e,t,a){const i={loginRequest:{email:e,password:t}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.loginEmailPassword(i,h.getEcosystemGameOptsOrUndefined(a))).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async requestResetPassword(e,t){const r=l(o.randomBytes(32)),i=l(c(r)),n=l(o.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:n,verifier:r});const s={requestResetPasswordRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:i,method:a.CodeChallengeMethodEnum.S256}}};await this.backendApiClients.authenticationApi.requestResetPassword(s)}async resetPassword(e,t,a){return r.withOpenfortError((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");const i={resetPasswordRequest:{email:e,password:t,state:a,challenge:{codeVerifier:r.verifier}}};await this.backendApiClients.authenticationApi.resetPassword(i)}),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})}async requestEmailVerification(e,t){const r=l(o.randomBytes(32)),i=l(c(r)),n=l(o.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:n,verifier:r});const s={requestVerifyEmailRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:i,method:a.CodeChallengeMethodEnum.S256}}};await this.backendApiClients.authenticationApi.requestEmailVerification(s)}async verifyEmail(e,t){return r.withOpenfortError((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");const a={verifyEmailRequest:{email:e,token:t,challenge:{codeVerifier:r.verifier}}};await this.backendApiClients.authenticationApi.verifyEmail(a)}),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})}async signupEmailPassword(e,t,a,i){const n={signupRequest:{email:e,password:t,name:a}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.signupEmailPassword(n,h.getEcosystemGameOptsOrUndefined(i))).data),{default:r.OpenfortErrorType.USER_REGISTRATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async validateCredentialsWithoutCrypto(e,t){if(!t.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);if(!JWK_UTILS)throw new r.OpenfortError("JWK_UTILS not available",r.OpenfortErrorType.INTERNAL_ERROR);const a=JWK_UTILS.getKey({kty:e.kty,crv:e.crv,x:e.x,y:e.y}),i=JWK_UTILS.parse(t.token);if(!JWK_UTILS.verifyJWT(t.token,a,{alg:[e.alg]}))throw new r.OpenfortError("Invalid token signature",r.OpenfortErrorType.AUTHENTICATION_ERROR);const n=JSON.parse(i.payloadPP);if(!n.exp)return this.refreshTokens(t.refreshToken);const s=JWK_UTILS.getNow();return n.exp<s?this.refreshTokens(t.refreshToken):{player:n.sub,accessToken:t.token,refreshToken:t.refreshToken}}async validateCredentialsWithCrypto(e,t){if(!t.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);const{errors:a,importJWK:i,jwtVerify:n}=await import("jose");try{const r=await i({kty:e.kty,crv:e.crv,x:e.x,y:e.y},e.alg);return{player:(await n(t.token,r)).payload.sub,accessToken:t.token,refreshToken:t.refreshToken}}catch(e){if(e instanceof a.JWTExpired)return this.refreshTokens(t.refreshToken);throw e}}async validateCredentials(e,t){const a=await this.getJWK();if(!e.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);if(t)return this.refreshTokens(e.refreshToken,t);const i=h.getWebCrypto();return i?.subtle?this.validateCredentialsWithCrypto(a,e):this.validateCredentialsWithoutCrypto(a,e)}jwksStorageKey="openfort.jwk";stringToJWK(e){const t=JSON.parse(e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y,alg:t.alg}}async getJWK(){const e=sessionStorage.getItem(this.jwksStorageKey);if(e)return this.stringToJWK(e);const t={publishableKey:this.publishableKey},a=await this.backendApiClients.authenticationApi.getJwks(t);if(0===a.data.keys.length)throw new r.OpenfortError("No JWKS keys found",r.OpenfortErrorType.INTERNAL_ERROR);const i=a.data.keys[0];return sessionStorage.setItem(this.jwksStorageKey,JSON.stringify(i)),{kty:i.kty,crv:i.crv,x:i.x,y:i.y,alg:i.alg}}async refreshTokens(e,t){const a={refreshTokenRequest:{refreshToken:e,forceRefresh:t}};return r.withOpenfortError((async()=>{const e=await this.backendApiClients.authenticationApi.refresh(a);return{player:e.data.player.id,accessToken:e.data.token,refreshToken:e.data.refreshToken}}),{default:r.OpenfortErrorType.REFRESH_TOKEN_ERROR})}async logout(e,t){const a={logoutRequest:{refreshToken:t}};r.withOpenfortError((async()=>{await this.backendApiClients.authenticationApi.logout(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e}})}),{default:r.OpenfortErrorType.LOGOUT_ERROR})}async getUser(e){return(await this.backendApiClients.authenticationApi.me({headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}})).data}async linkThirdParty(e,t,r,a,i){const n={thirdPartyLinkRequest:{provider:t,token:r,tokenType:a}};return(await this.backendApiClients.authenticationApi.linkThirdParty(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":i||void 0}})).data}async linkOAuth(e,t,r,a){const i={oAuthInitRequest:{provider:t,options:r,usePooling:r?.usePooling||!1}},s=await this.backendApiClients.authenticationApi.linkOAuth(i,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":a||void 0}});return n.isBrowser()&&!r?.skipBrowserRedirect&&window.location.assign(s.data.url),{url:s.data.url,key:s.data.key}}async unlinkOAuth(e,t){const r={unlinkOAuthRequest:{provider:e}};return(await this.backendApiClients.authenticationApi.unlinkOAuth(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async unlinkWallet(e,t){const r={sIWERequest:{address:e}};return(await this.backendApiClients.authenticationApi.unlinkSIWE(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async linkWallet(e,t,r,a,i){const n={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:r,connectorType:a}};return(await this.backendApiClients.authenticationApi.linkSIWE(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":i}})).data}async unlinkEmail(e,t){const r={unlinkEmailRequest:{email:e}};return(await this.backendApiClients.authenticationApi.unlinkEmail(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}static getWebCrypto(){return n.isBrowser()?window.crypto:"undefined"!=typeof global&&global.crypto?global.crypto:null}async linkEmail(e,t,r,a){const i={loginRequest:{email:e,password:t}};return(await this.backendApiClients.authenticationApi.linkEmail(i,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":r,"x-game":a||void 0}})).data}}exports.AuthManager=h;
|
|
1
|
+
"use strict";var e=require("../../packages/internal/openapi-clients/dist/index.js"),t=require("crypto"),r=require("./errors/openfortError.js"),a=require("./types.js"),i=require("./utils/deviceCredentialsManager.js"),n=require("./utils/helpers.js");function s(e){var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var a=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,a.get?a:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}var o=s(t);function l(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function c(e){return o.createHash("sha256").update(e).digest()}class p{publishableKey;deviceCredentialsManager;backendApiClients;constructor(t,r){this.publishableKey=t,this.deviceCredentialsManager=new i,this.backendApiClients=new e.BackendApiClients({backend:e.createConfig({basePath:r,accessToken:t})})}async initOAuth(e,t,r){const a=t?.usePooling??!1;delete t?.usePooling;const i={oAuthInitRequest:{provider:e,options:t,usePooling:a}},s=await this.backendApiClients.authenticationApi.initOAuth(i,p.getEcosystemGameOptsOrUndefined(r));return n.isBrowser()&&t?.skipBrowserRedirect&&window.location.assign(s.data.url),{url:s.data.url,key:s.data.key}}async registerGuest(){return(await this.backendApiClients.authenticationApi.registerGuest({})).data}async poolOAuth(e){const t={key:e};for(let e=0;e<600;e++)try{const e=await this.backendApiClients.authenticationApi.poolOAuth(t);if(200===e.status)return e.data}catch(e){if(e.response&&404===e.response.status){await new Promise((e=>{setTimeout(e,500)}));continue}throw e}throw new Error("Failed to pool OAuth, try again later")}async loginWithIdToken(e,t,a){const i={loginWithIdTokenRequest:{provider:e,token:t}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.loginWithIdToken(i,p.getEcosystemGameOptsOrUndefined(a))).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async authenticateThirdParty(e,t,a,i){const n={thirdPartyOAuthRequest:{provider:e,token:t,tokenType:a}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.thirdParty(n,p.getEcosystemGameOptsOrUndefined(i))).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async initSIWE(e,t){const r={sIWERequest:{address:e}},a=await this.backendApiClients.authenticationApi.initSIWE(r,p.getEcosystemGameOptsOrUndefined(t));return{address:a.data.address,nonce:a.data.nonce,expiresAt:a.data.expiresAt}}async authenticateSIWE(e,t,a,i){const n={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:i}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.authenticateSIWE(n)).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}static getEcosystemGameOptsOrUndefined(e){if(e)return{headers:{"x-game":e}}}async loginEmailPassword(e,t,a){const i={loginRequest:{email:e,password:t}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.loginEmailPassword(i,p.getEcosystemGameOptsOrUndefined(a))).data),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async requestResetPassword(e,t){const r=l(o.randomBytes(32)),i=l(c(r)),n=l(o.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:n,verifier:r});const s={requestResetPasswordRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:i,method:a.CodeChallengeMethodEnum.S256}}};await this.backendApiClients.authenticationApi.requestResetPassword(s)}async resetPassword(e,t,a){return r.withOpenfortError((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");const i={resetPasswordRequest:{email:e,password:t,state:a,challenge:{codeVerifier:r.verifier}}};await this.backendApiClients.authenticationApi.resetPassword(i)}),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})}async requestEmailVerification(e,t){const r=l(o.randomBytes(32)),i=l(c(r)),n=l(o.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:n,verifier:r});const s={requestVerifyEmailRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:i,method:a.CodeChallengeMethodEnum.S256}}};await this.backendApiClients.authenticationApi.requestEmailVerification(s)}async verifyEmail(e,t){return r.withOpenfortError((async()=>{const r=this.deviceCredentialsManager.getPKCEData();if(!r)throw new Error("No code verifier or state for PKCE");const a={verifyEmailRequest:{email:e,token:t,challenge:{codeVerifier:r.verifier}}};await this.backendApiClients.authenticationApi.verifyEmail(a)}),{default:r.OpenfortErrorType.AUTHENTICATION_ERROR})}async signupEmailPassword(e,t,a,i){const n={signupRequest:{email:e,password:t,name:a}};return r.withOpenfortError((async()=>(await this.backendApiClients.authenticationApi.signupEmailPassword(n,p.getEcosystemGameOptsOrUndefined(i))).data),{default:r.OpenfortErrorType.USER_REGISTRATION_ERROR,403:r.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async validateCredentialsWithoutCrypto(e,t){if(!t.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);if(!JWK_UTILS)throw new r.OpenfortError("JWK_UTILS not available",r.OpenfortErrorType.INTERNAL_ERROR);const a=JWK_UTILS.getKey({kty:e.kty,crv:e.crv,x:e.x,y:e.y}),i=JWK_UTILS.parse(t.token);if(!JWK_UTILS.verifyJWT(t.token,a,{alg:[e.alg]}))throw new r.OpenfortError("Invalid token signature",r.OpenfortErrorType.AUTHENTICATION_ERROR);const n=JSON.parse(i.payloadPP);if(!n.exp)return this.refreshTokens(t.refreshToken);const s=JWK_UTILS.getNow();return n.exp<s?this.refreshTokens(t.refreshToken):{player:n.sub,accessToken:t.token,refreshToken:t.refreshToken}}async validateCredentialsWithCrypto(e,t){if(!t.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);const{errors:a,importJWK:i,jwtVerify:n}=await import("jose");try{const r=await i({kty:e.kty,crv:e.crv,x:e.x,y:e.y},e.alg);return{player:(await n(t.token,r)).payload.sub,accessToken:t.token,refreshToken:t.refreshToken}}catch(e){if(e instanceof a.JWTExpired)return this.refreshTokens(t.refreshToken);throw e}}async validateCredentials(e,t){const a=await this.getJWK();if(!e.refreshToken)throw new r.OpenfortError("No refresh token provided",r.OpenfortErrorType.AUTHENTICATION_ERROR);if(t)return this.refreshTokens(e.refreshToken,t);const i=p.getWebCrypto();return i?.subtle?this.validateCredentialsWithCrypto(a,e):this.validateCredentialsWithoutCrypto(a,e)}jwksStorageKey="openfort.jwk";stringToJWK(e){const t=JSON.parse(e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y,alg:t.alg}}async getJWK(){const e=sessionStorage.getItem(this.jwksStorageKey);if(e)return this.stringToJWK(e);const t={publishableKey:this.publishableKey},a=await this.backendApiClients.authenticationApi.getJwks(t);if(0===a.data.keys.length)throw new r.OpenfortError("No JWKS keys found",r.OpenfortErrorType.INTERNAL_ERROR);const i=a.data.keys[0];return sessionStorage.setItem(this.jwksStorageKey,JSON.stringify(i)),{kty:i.kty,crv:i.crv,x:i.x,y:i.y,alg:i.alg}}async refreshTokens(e,t){const a={refreshTokenRequest:{refreshToken:e,forceRefresh:t}};return r.withOpenfortError((async()=>{const e=await this.backendApiClients.authenticationApi.refresh(a);return{player:e.data.player.id,accessToken:e.data.token,refreshToken:e.data.refreshToken}}),{default:r.OpenfortErrorType.REFRESH_TOKEN_ERROR})}async logout(e,t){const a={logoutRequest:{refreshToken:t}};r.withOpenfortError((async()=>{await this.backendApiClients.authenticationApi.logout(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e}})}),{default:r.OpenfortErrorType.LOGOUT_ERROR})}async getUser(e){return(await this.backendApiClients.authenticationApi.me({headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}})).data}async linkThirdParty(e,t,r,a,i){const n={thirdPartyLinkRequest:{provider:t,token:r,tokenType:a}};return(await this.backendApiClients.authenticationApi.linkThirdParty(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":i||void 0}})).data}async linkOAuth(e,t,r,a){const i={oAuthInitRequest:{provider:t,options:r,usePooling:r?.usePooling||!1}},s=await this.backendApiClients.authenticationApi.linkOAuth(i,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":a||void 0}});return n.isBrowser()&&!r?.skipBrowserRedirect&&window.location.assign(s.data.url),{url:s.data.url,key:s.data.key}}async unlinkOAuth(e,t){const r={unlinkOAuthRequest:{provider:e}};return(await this.backendApiClients.authenticationApi.unlinkOAuth(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async unlinkWallet(e,t){const r={sIWERequest:{address:e}};return(await this.backendApiClients.authenticationApi.unlinkSIWE(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async linkWallet(e,t,r,a,i){const n={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:r,connectorType:a}};return(await this.backendApiClients.authenticationApi.linkSIWE(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":i}})).data}async unlinkEmail(e,t){const r={unlinkEmailRequest:{email:e}};return(await this.backendApiClients.authenticationApi.unlinkEmail(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}static getWebCrypto(){return n.isBrowser()?window.crypto:"undefined"!=typeof global&&global.crypto?global.crypto:null}async linkEmail(e,t,r,a){const i={loginRequest:{email:e,password:t}};return(await this.backendApiClients.authenticationApi.linkEmail(i,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":r,"x-game":a||void 0}})).data}}exports.AuthManager=p;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.chainRpcs={1:"https://cloudflare-eth.com",10:"https://optimism-rpc.publicnode.com",56:"https://bsc.publicnode.com",97:"https://bsc-testnet.publicnode.com",137:"https://polygon-rpc.com",204:"https://opbnb-mainnet-rpc.bnbchain.org",255:"https://api.kroma.network",300:"https://sepolia.era.zksync.dev",324:"https://mainnet.era.zksync.io",1946:"https://rpc.minato.soneium.org",2358:"https://api.sepolia.kroma.network",2741:"https://api.mainnet.abs.xyz",3939:"https://test.doschain.com",4337:"https://build.onbeam.com/rpc",5611:"https://opbnb-testnet-rpc.bnbchain.org",7979:"https://main.doschain.com",8453:"https://mainnet.base.org",11124:"https://api.testnet.abs.xyz",13337:"https://build.onbeam.com/rpc/testnet",13473:"https://rpc.testnet.immutable.com",42161:"https://arb1.arbitrum.io/rpc",42170:"https://nova.arbitrum.io/rpc",43113:"https://api.avax-test.network/ext/bc/C/rpc",43114:"https://api.avax.network/ext/bc/C/rpc",50104:"https://rpc.sophon.xyz",80002:"https://rpc-amoy.polygon.technology",84532:"https://sepolia.base.org",247253:"https://rpc-testnet.saakuru.network",421614:"https://sepolia-rollup.arbitrum.io/rpc",7225878:"https://rpc.saakuru.network",7777777:"https://rpc.zora.energy/",11155111:"https://ethereum-sepolia-rpc.publicnode.com",11155420:"https://optimism-sepolia-rpc.publicnode.com",28122024:"https://rpcv2-testnet.ancient8.gg",531050104:"https://rpc.testnet.sophon.xyz",666666666:"https://rpc.degen.tips",888888888:"https://rpc.ancient8.gg",999999999:"https://sepolia.rpc.zora.energy",85011:"https://subnets.avax.network/criminalsa/testnet/rpc"};
|
|
1
|
+
"use strict";exports.chainRpcs={1:"https://cloudflare-eth.com",10:"https://optimism-rpc.publicnode.com",56:"https://bsc.publicnode.com",97:"https://bsc-testnet.publicnode.com",137:"https://polygon-rpc.com",204:"https://opbnb-mainnet-rpc.bnbchain.org",255:"https://api.kroma.network",300:"https://sepolia.era.zksync.dev",324:"https://mainnet.era.zksync.io",1946:"https://rpc.minato.soneium.org",2358:"https://api.sepolia.kroma.network",2741:"https://api.mainnet.abs.xyz",3939:"https://test.doschain.com",4337:"https://build.onbeam.com/rpc",5611:"https://opbnb-testnet-rpc.bnbchain.org",7979:"https://main.doschain.com",8453:"https://mainnet.base.org",11124:"https://api.testnet.abs.xyz",13337:"https://build.onbeam.com/rpc/testnet",13473:"https://rpc.testnet.immutable.com",42161:"https://arb1.arbitrum.io/rpc",42170:"https://nova.arbitrum.io/rpc",43113:"https://api.avax-test.network/ext/bc/C/rpc",43114:"https://api.avax.network/ext/bc/C/rpc",50104:"https://rpc.sophon.xyz",80002:"https://rpc-amoy.polygon.technology",84532:"https://sepolia.base.org",247253:"https://rpc-testnet.saakuru.network",421614:"https://sepolia-rollup.arbitrum.io/rpc",7225878:"https://rpc.saakuru.network",7777777:"https://rpc.zora.energy/",11155111:"https://ethereum-sepolia-rpc.publicnode.com",11155420:"https://optimism-sepolia-rpc.publicnode.com",28122024:"https://rpcv2-testnet.ancient8.gg",531050104:"https://rpc.testnet.sophon.xyz",666666666:"https://rpc.degen.tips",888888888:"https://rpc.ancient8.gg",999999999:"https://sepolia.rpc.zora.energy",85011:"https://subnets.avax.network/criminalsa/testnet/rpc",84358:"https://subnets.avax.network/titan/mainnet/rpc",10143:"https://testnet-rpc.monad.xyz"};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("../../packages/internal/openapi-clients/dist/index.js"),r=require("./evm/walletHelpers.js"),t=require("./storage/istorage.js"),a=require("./storage/localStorage.js"),n=require("./manager/signer.js"),o=require("./errors/openfortError.js"),i=require("./types.js"),s=require("./configuration/configuration.js"),u=require("./configuration/account.js"),h=require("./configuration/authentication.js"),g=require("./iframe/iframeManager.js"),d=require("./authManager.js"),c=require("./evm/evmProvider.js");require("./evm/types.js");var l=require("./utils/typedEventEmitter.js"),p=require("./evm/provider/eip6963.js");exports.Openfort=class{storage;provider=null;iAuthManager=null;constructor(e){this.storage=new a.LocalStorage;new s.Configuration(e.baseConfiguration.publishableKey,e.overrides?.backendUrl||"https://api.openfort.xyz",e.shieldConfiguration?.shieldPublishableKey||"",e.shieldConfiguration?.shieldEncryptionKey||"",e.overrides?.shieldUrl||"https://shield.openfort.xyz",e.overrides?.iframeUrl||"https://embedded.openfort.xyz",e.shieldConfiguration?.debug||!1).save()}async logout(){const e=n.SignerManager.fromStorage();this.storage.remove(t.StorageKeys.AUTHENTICATION),this.storage.remove(t.StorageKeys.SIGNER),this.storage.remove(t.StorageKeys.ACCOUNT),e&&await e.logout()}getEthereumProvider(e){const r={announceProvider:!0,...e},t=h.Authentication.fromStorage(this.storage),a=n.SignerManager.fromStorage(),o=u.Account.fromStorage(this.storage);return this.provider?this.provider&&r.policy&&this.provider.updatePolicy(r.policy):(this.provider=new c.EvmProvider({storage:this.storage,openfortEventEmitter:new l,signer:a||void 0,account:o||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,policyId:r.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this)}),r.announceProvider&&p.announceProvider({info:{...p.openfortProviderInfo,...r.providerInfo},provider:this.provider})),this.provider}async configureEmbeddedSigner(e=null,r=null,t=null){await this.validateAndRefreshToken();const a=s.Configuration.fromStorage();let o=null;(t||r?.encryptionSession)&&(o={encryptionSession:r?.encryptionSession||null,recoveryPassword:t||null,encryptionPart:a?.shieldEncryptionKey||null});let i=null,u=null;r&&(i="openfort"===r.auth?"openfort":"custom",u=r.token),await n.SignerManager.embedded(e,o,i,u)}async signMessage(e,r){await this.validateAndRefreshToken();const t=n.SignerManager.fromStorage();if(!t)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);const{hashMessage:a=!0,arrayifyMessage:i=!1}=r||{};return await t.sign(e,i,a)}async signTypedData(e,t,a){await this.validateAndRefreshToken();const i=n.SignerManager.fromStorage(),s=u.Account.fromStorage(this.storage);if(!i||!s)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return await r.getSignedTypedData({domain:e,types:t,message:a},s.type,Number(s.chainId),i,s.address)}async exportPrivateKey(){await this.validateAndRefreshToken();const e=n.SignerManager.fromStorage();if(!e)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return await e.export()}async setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:r,encryptionSession:t}){await this.validateAndRefreshToken();const a=n.SignerManager.fromStorage();if(!a)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);if("embedded"!==a.type())throw new o.OpenfortError("Signer must be embedded",o.OpenfortErrorType.INVALID_CONFIGURATION);if("password"===e&&!r)throw new o.OpenfortError("Recovery password is required",o.OpenfortErrorType.INVALID_CONFIGURATION);await a.setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:r,encryptionSession:t})}async logInWithEmailPassword({email:e,password:r,ecosystemGame:t}){const a=h.Authentication.fromStorage(this.storage),n=await this.authManager.loginEmailPassword(e,r,t);return a&&a.player!==n.player.id&&this.logout(),new h.Authentication("jwt",n.token,n.player.id,n.refreshToken).save(this.storage),n}async signUpGuest(){const e=h.Authentication.fromStorage(this.storage),r=await this.authManager.registerGuest();return e&&e.player!==r.player.id&&this.logout(),new h.Authentication("jwt",r.token,r.player.id,r.refreshToken).save(this.storage),r}async signUpWithEmailPassword({email:e,password:r,options:t,ecosystemGame:a}){const n=h.Authentication.fromStorage(this.storage),o=await this.authManager.signupEmailPassword(e,r,t?.data.name,a);return n&&n.player!==o.player.id&&this.logout(),new h.Authentication("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async linkEmailPassword({email:e,password:r,authToken:t,ecosystemGame:a}){return await this.authManager.linkEmail(e,r,t,a)}async unlinkEmailPassword({email:e,authToken:r}){return await this.authManager.unlinkEmail(e,r)}async requestEmailVerification({email:e,redirectUrl:r}){await this.authManager.requestEmailVerification(e,r)}async resetPassword({email:e,password:r,state:t}){await this.authManager.resetPassword(e,r,t)}async requestResetPassword({email:e,redirectUrl:r}){await this.authManager.requestResetPassword(e,r)}async verifyEmail({email:e,state:r}){await this.authManager.verifyEmail(e,r)}async initOAuth({provider:e,options:r,ecosystemGame:a}){return this.storage.remove(t.StorageKeys.AUTHENTICATION),await this.authManager.initOAuth(e,r,a)}async initLinkOAuth({provider:e,options:r,ecosystemGame:t}){const a=h.Authentication.fromStorage(this.storage);if(!a)throw new o.OpenfortError("No authentication found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.linkOAuth(a,e,r,t)}async linkThirdPartyProvider({provider:e,token:r,tokenType:t}){const a=h.Authentication.fromStorage(this.storage);if(!a)throw new o.OpenfortError("No authentication found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.linkThirdParty(a,e,r,t)}async unlinkOAuth({provider:e,authToken:r}){return await this.authManager.unlinkOAuth(e,r)}async poolOAuth(e){const r=h.Authentication.fromStorage(this.storage),t=await this.authManager.poolOAuth(e);return r&&r.player!==t.player.id&&this.logout(),new h.Authentication("jwt",t.token,t.player.id,t.refreshToken).save(this.storage),t}async authenticateWithThirdPartyProvider({provider:e,token:r,tokenType:t,ecosystemGame:a}){const o=h.Authentication.fromStorage(this.storage),i=await this.authManager.authenticateThirdParty(e,r,t,a);let s=!1;if(o&&o.player!==i.id&&(this.logout(),s=!0),new h.Authentication("third_party",r,i.id,null,e,t).save(this.storage),s)return i;const u=n.SignerManager.fromStorage();try{await(u?.updateAuthentication())}catch(e){throw(e instanceof g.MissingRecoveryPasswordError||e instanceof g.MissingProjectEntropyError)&&await(u?.logout()),e}return i}async initSIWE({address:e,ecosystemGame:r}){return await this.authManager.initSIWE(e,r)}async authenticateWithSIWE({signature:e,message:r,walletClientType:t,connectorType:a}){const n=h.Authentication.fromStorage(this.storage),o=await this.authManager.authenticateSIWE(e,r,t,a);return n&&n.player!==o.player.id&&this.logout(),new h.Authentication("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async linkWallet({signature:e,message:r,walletClientType:t,connectorType:a,authToken:n}){return await this.authManager.linkWallet(e,r,t,a,n)}async unlinkWallet({address:e,authToken:r}){return await this.authManager.unlinkWallet(e,r)}storeCredentials(e){if(this.storage.remove(t.StorageKeys.AUTHENTICATION),!e.player)throw new o.OpenfortError("Player ID is required to store credentials",o.OpenfortErrorType.INVALID_CONFIGURATION);new h.Authentication("jwt",e.accessToken,e.player,e.refreshToken).save(this.storage)}async sendSignatureTransactionIntentRequest(e,r=null,t=null,a=!1){if(!s.Configuration.fromStorage())throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);await this.validateAndRefreshToken();let i=t;if(!i){if(!r)throw new o.OpenfortError("No signableHash or signature provided",o.OpenfortErrorType.OPERATION_NOT_SUPPORTED_ERROR);const e=n.SignerManager.fromStorage();if(!e)throw new o.OpenfortError("In order to sign a transaction intent, a signer must be configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);i=await e.sign(r)}const u={id:e,signatureRequest:{signature:i,optimistic:a}};return(await this.backendApiClients.transactionIntentsApi.signature(u)).data}async getAccount(){const e=u.Account.fromStorage(this.storage);if(!e)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return{chainId:e.chainId,address:e.address,ownerAddress:e.ownerAddress,accountType:e.type}}get backendApiClients(){const r=s.Configuration.fromStorage();if(!r)throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);return new e.BackendApiClients({backend:e.createConfig({basePath:r.openfortURL,accessToken:r.publishableKey})})}async sendSignatureSessionRequest(e,r,t){const a={id:e,signatureRequest:{signature:r,optimistic:t}};return(await this.backendApiClients.sessionsApi.signatureSession(a)).data}getEmbeddedState(){if(!h.Authentication.fromStorage(this.storage))return i.EmbeddedState.UNAUTHENTICATED;const e=n.SignerManager.fromStorage();if(!e||"embedded"!==e.type())return i.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED;return u.Account.fromStorage(this.storage)?i.EmbeddedState.READY:i.EmbeddedState.CREATING_ACCOUNT}getAccessToken(){return h.Authentication.fromStorage(this.storage)?.token??null}get authManager(){if(!this.iAuthManager){const e=s.Configuration.fromStorage();if(!e)throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);this.iAuthManager=new d.AuthManager(e.publishableKey,e.openfortURL)}return this.iAuthManager}async getUser(){await this.validateAndRefreshToken();const e=h.Authentication.fromStorage(this.storage);if(!e)throw new o.OpenfortError("No access token found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.getUser(e)}async validateAndRefreshToken(e){const r=h.Authentication.fromStorage(this.storage);if(!r)throw new o.OpenfortError("Must be logged in to validate and refresh token",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);if("jwt"!==r.type)return;const t=await this.authManager.validateCredentials(r,e);if(!t.player)throw new o.OpenfortError("No player found in credentials",o.OpenfortErrorType.INTERNAL_ERROR);if(t.accessToken===r.token)return;new h.Authentication("jwt",t.accessToken,t.player,t.refreshToken).save(this.storage);const a=n.SignerManager.fromStorage();try{await(a?.updateAuthentication())}catch(e){throw(e instanceof g.MissingRecoveryPasswordError||e instanceof g.MissingProjectEntropyError)&&await(a?.logout()),e}}};
|
|
1
|
+
"use strict";var e=require("../../packages/internal/openapi-clients/dist/index.js"),t=require("./evm/walletHelpers.js"),r=require("./storage/istorage.js"),a=require("./storage/localStorage.js"),n=require("./manager/signer.js"),o=require("./errors/openfortError.js"),i=require("./types.js"),s=require("./configuration/configuration.js"),u=require("./configuration/account.js"),h=require("./configuration/authentication.js"),g=require("./iframe/iframeManager.js"),d=require("./authManager.js"),c=require("./evm/evmProvider.js");require("./evm/types.js");var l=require("./utils/typedEventEmitter.js"),p=require("./evm/provider/eip6963.js");exports.Openfort=class{storage;provider=null;iAuthManager=null;constructor(e){this.storage=new a.LocalStorage;new s.Configuration(e.baseConfiguration.publishableKey,e.overrides?.backendUrl||"https://api.openfort.xyz",e.shieldConfiguration?.shieldPublishableKey||"",e.shieldConfiguration?.shieldEncryptionKey||"",e.overrides?.shieldUrl||"https://shield.openfort.xyz",e.overrides?.iframeUrl||"https://embedded.openfort.xyz",e.shieldConfiguration?.debug||!1).save()}async logout(){const e=n.SignerManager.fromStorage();this.storage.remove(r.StorageKeys.AUTHENTICATION),this.storage.remove(r.StorageKeys.SIGNER),this.storage.remove(r.StorageKeys.ACCOUNT),e&&await e.logout()}getEthereumProvider(e){const t={announceProvider:!0,...e},r=h.Authentication.fromStorage(this.storage),a=n.SignerManager.fromStorage(),o=u.Account.fromStorage(this.storage);return this.provider?this.provider&&t.policy&&this.provider.updatePolicy(t.policy):(this.provider=new c.EvmProvider({storage:this.storage,openfortEventEmitter:new l,signer:a||void 0,account:o||void 0,authentication:r||void 0,backendApiClients:this.backendApiClients,policyId:t.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this)}),t.announceProvider&&p.announceProvider({info:{...p.openfortProviderInfo,...t.providerInfo},provider:this.provider})),this.provider}async configureEmbeddedSigner(e=null,t=null,r=null){await this.validateAndRefreshToken();const a=s.Configuration.fromStorage();let o=null;(r||t?.encryptionSession)&&(o={encryptionSession:t?.encryptionSession||null,recoveryPassword:r||null,encryptionPart:a?.shieldEncryptionKey||null});let i=null,u=null;t&&(i="openfort"===t.auth?"openfort":"custom",u=t.token),await n.SignerManager.embedded(e,o,i,u)}async signMessage(e,t){await this.validateAndRefreshToken();const r=n.SignerManager.fromStorage();if(!r)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);const{hashMessage:a=!0,arrayifyMessage:i=!1}=t||{};return await r.sign(e,i,a)}async signTypedData(e,r,a){await this.validateAndRefreshToken();const i=n.SignerManager.fromStorage(),s=u.Account.fromStorage(this.storage);if(!i||!s)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return await t.getSignedTypedData({domain:e,types:r,message:a},s.type,Number(s.chainId),i,s.address)}async exportPrivateKey(){await this.validateAndRefreshToken();const e=n.SignerManager.fromStorage();if(!e)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return await e.export()}async setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:t,encryptionSession:r}){await this.validateAndRefreshToken();const a=n.SignerManager.fromStorage();if(!a)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);if("embedded"!==a.type())throw new o.OpenfortError("Signer must be embedded",o.OpenfortErrorType.INVALID_CONFIGURATION);if("password"===e&&!t)throw new o.OpenfortError("Recovery password is required",o.OpenfortErrorType.INVALID_CONFIGURATION);await a.setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:t,encryptionSession:r})}async logInWithEmailPassword({email:e,password:t,ecosystemGame:r}){const a=h.Authentication.fromStorage(this.storage),n=await this.authManager.loginEmailPassword(e,t,r);return a&&a.player!==n.player.id&&this.logout(),new h.Authentication("jwt",n.token,n.player.id,n.refreshToken).save(this.storage),n}async signUpGuest(){const e=h.Authentication.fromStorage(this.storage),t=await this.authManager.registerGuest();return e&&e.player!==t.player.id&&this.logout(),new h.Authentication("jwt",t.token,t.player.id,t.refreshToken).save(this.storage),t}async signUpWithEmailPassword({email:e,password:t,options:r,ecosystemGame:a}){const n=h.Authentication.fromStorage(this.storage),o=await this.authManager.signupEmailPassword(e,t,r?.data.name,a);return n&&n.player!==o.player.id&&this.logout(),new h.Authentication("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async linkEmailPassword({email:e,password:t,authToken:r,ecosystemGame:a}){return await this.authManager.linkEmail(e,t,r,a)}async unlinkEmailPassword({email:e,authToken:t}){return await this.authManager.unlinkEmail(e,t)}async requestEmailVerification({email:e,redirectUrl:t}){await this.authManager.requestEmailVerification(e,t)}async resetPassword({email:e,password:t,state:r}){await this.authManager.resetPassword(e,t,r)}async requestResetPassword({email:e,redirectUrl:t}){await this.authManager.requestResetPassword(e,t)}async verifyEmail({email:e,state:t}){await this.authManager.verifyEmail(e,t)}async initOAuth({provider:e,options:t,ecosystemGame:a}){return this.storage.remove(r.StorageKeys.AUTHENTICATION),await this.authManager.initOAuth(e,t,a)}async initLinkOAuth({provider:e,options:t,ecosystemGame:r}){const a=h.Authentication.fromStorage(this.storage);if(!a)throw new o.OpenfortError("No authentication found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.linkOAuth(a,e,t,r)}async linkThirdPartyProvider({provider:e,token:t,tokenType:r}){const a=h.Authentication.fromStorage(this.storage);if(!a)throw new o.OpenfortError("No authentication found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.linkThirdParty(a,e,t,r)}async unlinkOAuth({provider:e,authToken:t}){return await this.authManager.unlinkOAuth(e,t)}async poolOAuth(e){const t=h.Authentication.fromStorage(this.storage),r=await this.authManager.poolOAuth(e);return t&&t.player!==r.player.id&&this.logout(),new h.Authentication("jwt",r.token,r.player.id,r.refreshToken).save(this.storage),r}async authenticateWithThirdPartyProvider({provider:e,token:t,tokenType:r,ecosystemGame:a}){const o=h.Authentication.fromStorage(this.storage),i=await this.authManager.authenticateThirdParty(e,t,r,a);let s=!1;if(o&&o.player!==i.id&&(this.logout(),s=!0),new h.Authentication("third_party",t,i.id,null,e,r).save(this.storage),s)return i;const u=n.SignerManager.fromStorage();try{await(u?.updateAuthentication())}catch(e){throw(e instanceof g.MissingRecoveryPasswordError||e instanceof g.MissingProjectEntropyError)&&await(u?.logout()),e}return i}async loginWithIdToken({provider:e,token:t,ecosystemGame:r}){const a=h.Authentication.fromStorage(this.storage),n=await this.authManager.loginWithIdToken(e,t,r);return a&&a.player!==n.player.id&&this.logout(),new h.Authentication("jwt",n.token,n.player.id,n.refreshToken).save(this.storage),n}async initSIWE({address:e,ecosystemGame:t}){return await this.authManager.initSIWE(e,t)}async authenticateWithSIWE({signature:e,message:t,walletClientType:r,connectorType:a}){const n=h.Authentication.fromStorage(this.storage),o=await this.authManager.authenticateSIWE(e,t,r,a);return n&&n.player!==o.player.id&&this.logout(),new h.Authentication("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async linkWallet({signature:e,message:t,walletClientType:r,connectorType:a,authToken:n}){return await this.authManager.linkWallet(e,t,r,a,n)}async unlinkWallet({address:e,authToken:t}){return await this.authManager.unlinkWallet(e,t)}storeCredentials(e){if(this.storage.remove(r.StorageKeys.AUTHENTICATION),!e.player)throw new o.OpenfortError("Player ID is required to store credentials",o.OpenfortErrorType.INVALID_CONFIGURATION);new h.Authentication("jwt",e.accessToken,e.player,e.refreshToken).save(this.storage)}async sendSignatureTransactionIntentRequest(e,t=null,r=null,a=!1){if(!s.Configuration.fromStorage())throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);await this.validateAndRefreshToken();let i=r;if(!i){if(!t)throw new o.OpenfortError("No signableHash or signature provided",o.OpenfortErrorType.OPERATION_NOT_SUPPORTED_ERROR);const e=n.SignerManager.fromStorage();if(!e)throw new o.OpenfortError("In order to sign a transaction intent, a signer must be configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);i=await e.sign(t)}const u={id:e,signatureRequest:{signature:i,optimistic:a}};return(await this.backendApiClients.transactionIntentsApi.signature(u)).data}async getAccount(){const e=u.Account.fromStorage(this.storage);if(!e)throw new o.OpenfortError("No signer configured",o.OpenfortErrorType.MISSING_SIGNER_ERROR);return{chainId:e.chainId,address:e.address,ownerAddress:e.ownerAddress,accountType:e.type}}get backendApiClients(){const t=s.Configuration.fromStorage();if(!t)throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);return new e.BackendApiClients({backend:e.createConfig({basePath:t.openfortURL,accessToken:t.publishableKey})})}async sendSignatureSessionRequest(e,t,r){const a={id:e,signatureRequest:{signature:t,optimistic:r}};return(await this.backendApiClients.sessionsApi.signatureSession(a)).data}getEmbeddedState(){if(!h.Authentication.fromStorage(this.storage))return i.EmbeddedState.UNAUTHENTICATED;const e=n.SignerManager.fromStorage();if(!e||"embedded"!==e.type())return i.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED;return u.Account.fromStorage(this.storage)?i.EmbeddedState.READY:i.EmbeddedState.CREATING_ACCOUNT}getAccessToken(){return h.Authentication.fromStorage(this.storage)?.token??null}get authManager(){if(!this.iAuthManager){const e=s.Configuration.fromStorage();if(!e)throw new o.OpenfortError("Configuration not found",o.OpenfortErrorType.INVALID_CONFIGURATION);this.iAuthManager=new d.AuthManager(e.publishableKey,e.openfortURL)}return this.iAuthManager}async getUser(){await this.validateAndRefreshToken();const e=h.Authentication.fromStorage(this.storage);if(!e)throw new o.OpenfortError("No access token found",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);return await this.authManager.getUser(e)}async validateAndRefreshToken(e){const t=h.Authentication.fromStorage(this.storage);if(!t)throw new o.OpenfortError("Must be logged in to validate and refresh token",o.OpenfortErrorType.NOT_LOGGED_IN_ERROR);if("jwt"!==t.type)return;const r=await this.authManager.validateCredentials(t,e);if(!r.player)throw new o.OpenfortError("No player found in credentials",o.OpenfortErrorType.INTERNAL_ERROR);if(r.accessToken===t.token)return;new h.Authentication("jwt",r.accessToken,r.player,r.refreshToken).save(this.storage);const a=n.SignerManager.fromStorage();try{await(a?.updateAuthentication())}catch(e){throw(e instanceof g.MissingRecoveryPasswordError||e instanceof g.MissingProjectEntropyError)&&await(a?.logout()),e}}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e,o,t,r,E,A,p,d,s;exports.EmbeddedState=void 0,(e=exports.EmbeddedState||(exports.EmbeddedState={}))[e.NONE=0]="NONE",e[e.UNAUTHENTICATED=1]="UNAUTHENTICATED",e[e.EMBEDDED_SIGNER_NOT_CONFIGURED=2]="EMBEDDED_SIGNER_NOT_CONFIGURED",e[e.CREATING_ACCOUNT=3]="CREATING_ACCOUNT",e[e.READY=4]="READY",exports.OpenfortEvents=void 0,(exports.OpenfortEvents||(exports.OpenfortEvents={})).LOGGED_OUT="loggedOut",exports.RecoveryMethod=void 0,(o=exports.RecoveryMethod||(exports.RecoveryMethod={})).PASSWORD="password",o.AUTOMATIC="automatic",exports.AccountType=void 0,(t=exports.AccountType||(exports.AccountType={})).UPGRADEABLE_V4="Upgradeable_v04",t.MANAGED_V4="Managed_v04",t.ERC6551_V4="ERC6551_v04",t.ERC6551_V5="ERC6551_v05",t.RECOVERABLE_V4="Recoverable_v04",t.MANAGED_V5="Managed_v05",t.UPGRADEABLE_V5="Upgradeable_v05",t.UPGRADEABLE_V6="Upgradeable_v06",t.ZKSYNC_UPGRADEABLE_V1="zksync_upgradeable_v1",t.ZKSYNC_UPGRADEABLE_V2="zksync_upgradeable_v2",exports.AuthType=void 0,(r=exports.AuthType||(exports.AuthType={})).OPENFORT="openfort",r.THIRD_PARTY="thirdParty",exports.TokenType=void 0,(E=exports.TokenType||(exports.TokenType={})).ID_TOKEN="idToken",E.CUSTOM_TOKEN="customToken",exports.ThirdPartyOAuthProvider=void 0,(A=exports.ThirdPartyOAuthProvider||(exports.ThirdPartyOAuthProvider={})).ACCELBYTE="accelbyte",A.FIREBASE="firebase",A.LOOTLOCKER="lootlocker",A.PLAYFAB="playfab",A.SUPABASE="supabase",A.CUSTOM="custom",A.OIDC="oidc",
|
|
1
|
+
"use strict";var e,o,t,r,E,A,p,d,s;exports.EmbeddedState=void 0,(e=exports.EmbeddedState||(exports.EmbeddedState={}))[e.NONE=0]="NONE",e[e.UNAUTHENTICATED=1]="UNAUTHENTICATED",e[e.EMBEDDED_SIGNER_NOT_CONFIGURED=2]="EMBEDDED_SIGNER_NOT_CONFIGURED",e[e.CREATING_ACCOUNT=3]="CREATING_ACCOUNT",e[e.READY=4]="READY",exports.OpenfortEvents=void 0,(exports.OpenfortEvents||(exports.OpenfortEvents={})).LOGGED_OUT="loggedOut",exports.RecoveryMethod=void 0,(o=exports.RecoveryMethod||(exports.RecoveryMethod={})).PASSWORD="password",o.AUTOMATIC="automatic",exports.AccountType=void 0,(t=exports.AccountType||(exports.AccountType={})).UPGRADEABLE_V4="Upgradeable_v04",t.MANAGED_V4="Managed_v04",t.ERC6551_V4="ERC6551_v04",t.ERC6551_V5="ERC6551_v05",t.RECOVERABLE_V4="Recoverable_v04",t.MANAGED_V5="Managed_v05",t.UPGRADEABLE_V5="Upgradeable_v05",t.UPGRADEABLE_V6="Upgradeable_v06",t.ZKSYNC_UPGRADEABLE_V1="zksync_upgradeable_v1",t.ZKSYNC_UPGRADEABLE_V2="zksync_upgradeable_v2",exports.AuthType=void 0,(r=exports.AuthType||(exports.AuthType={})).OPENFORT="openfort",r.THIRD_PARTY="thirdParty",exports.TokenType=void 0,(E=exports.TokenType||(exports.TokenType={})).ID_TOKEN="idToken",E.CUSTOM_TOKEN="customToken",exports.ThirdPartyOAuthProvider=void 0,(A=exports.ThirdPartyOAuthProvider||(exports.ThirdPartyOAuthProvider={})).ACCELBYTE="accelbyte",A.FIREBASE="firebase",A.LOOTLOCKER="lootlocker",A.PLAYFAB="playfab",A.SUPABASE="supabase",A.CUSTOM="custom",A.OIDC="oidc",exports.BasicAuthProvider=void 0,(p=exports.BasicAuthProvider||(exports.BasicAuthProvider={})).EMAIL="email",p.WALLET="wallet",exports.OAuthProvider=void 0,(d=exports.OAuthProvider||(exports.OAuthProvider={})).GOOGLE="google",d.TWITTER="twitter",d.APPLE="apple",d.FACEBOOK="facebook",d.DISCORD="discord",d.EPIC_GAMES="epic_games",d.LINE="line",exports.CodeChallengeMethodEnum=void 0,(s=exports.CodeChallengeMethodEnum||(exports.CodeChallengeMethodEnum={})).PLAIN="plain",s.S256="S256";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.VERSION="0.8.
|
|
1
|
+
"use strict";exports.VERSION="0.8.39";
|
package/dist/index.d.ts
CHANGED
|
@@ -86,9 +86,7 @@ declare enum ThirdPartyOAuthProvider {
|
|
|
86
86
|
PLAYFAB = "playfab",
|
|
87
87
|
SUPABASE = "supabase",
|
|
88
88
|
CUSTOM = "custom",
|
|
89
|
-
OIDC = "oidc"
|
|
90
|
-
APPLE_NATIVE = "apple_native",
|
|
91
|
-
GOOGLE_NATIVE = "google_native"
|
|
89
|
+
OIDC = "oidc"
|
|
92
90
|
}
|
|
93
91
|
declare enum BasicAuthProvider {
|
|
94
92
|
EMAIL = "email",
|
|
@@ -97,8 +95,6 @@ declare enum BasicAuthProvider {
|
|
|
97
95
|
declare const AUTH_PROVIDER: {
|
|
98
96
|
readonly email: "email";
|
|
99
97
|
readonly wallet: "wallet";
|
|
100
|
-
readonly apple_native: "apple_native";
|
|
101
|
-
readonly google_native: "google_native";
|
|
102
98
|
readonly apple: "apple";
|
|
103
99
|
readonly google: "google";
|
|
104
100
|
readonly twitter: "twitter";
|
|
@@ -749,6 +745,19 @@ declare class Openfort {
|
|
|
749
745
|
tokenType: TokenType;
|
|
750
746
|
ecosystemGame?: string;
|
|
751
747
|
}): Promise<AuthPlayerResponse>;
|
|
748
|
+
/**
|
|
749
|
+
* Login with idToken of OAuth provider.
|
|
750
|
+
*
|
|
751
|
+
* @param provider - OAuth provider.
|
|
752
|
+
* @param token - OAuth token.
|
|
753
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
754
|
+
* @returns An AuthResponse object.
|
|
755
|
+
*/
|
|
756
|
+
loginWithIdToken({ provider, token, ecosystemGame, }: {
|
|
757
|
+
provider: OAuthProvider;
|
|
758
|
+
token: string;
|
|
759
|
+
ecosystemGame?: string;
|
|
760
|
+
}): Promise<AuthResponse>;
|
|
752
761
|
/**
|
|
753
762
|
* Initializes Sign-In with Ethereum (SIWE).
|
|
754
763
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";const t="https://api.openfort.xyz".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(n,s=t,a=e){this.basePath=s,this.axios=a,n&&(this.configuration=n,this.basePath=n.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const a="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},o=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function r(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>r(e,t,n))):Object.keys(t).forEach((s=>r(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);r(n,t),e.search=n.toString()},h=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},u=function(e){return e.pathname+e.search+e.hash},d=function(e,t,n,s){return(a=t,i=n)=>{const o={...e.options,url:(s?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},l=function(n){const s=function(e){return{cancelTransferOwnership:async(t,n,s={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",n);const r="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},completeRecovery:async(t,n,s={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",n);const r="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},createAccount:async(t,n={})=>{i("createAccount","createAccountRequest",t);const s=new URL("/v1/accounts",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},createAccountV2:async(t,n={})=>{i("createAccountV2","accountCreateRequest",t);const s=new URL("/v2/accounts",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},deployAccount:async(t,n,s={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",n);const r="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},disableAccount:async(t,n={})=>{i("disableAccount","id",t);const s="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}},getAccount:async(t,n,s={})=>{i("getAccount","id",t);const r="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},getAccountV2:async(t,n={})=>{i("getAccountV2","accountId",t);const s="/v2/accounts/{accountId}".replace("{accountId}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},getAccounts:async(t,n,s,i,r,h,d={})=>{const l=new URL("/v1/accounts",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},w={},g={};await o(w,e),void 0!==t&&(g.limit=t),void 0!==n&&(g.skip=n),void 0!==s&&(g.order=s),void 0!==i&&(g.player=i),void 0!==r&&(g.address=r),h&&(g.expand=h),c(l,g);let m=p&&p.headers?p.headers:{};return y.headers={...w,...m,...d.headers},{url:u(l),options:y}},listAccountsV2:async(t,n,s,i,o={})=>{const r=new URL("/v2/accounts",a);let h;e&&(h=e.baseOptions);const d={method:"GET",...h,...o},l={};void 0!==t&&(l.limit=t),void 0!==n&&(l.skip=n),void 0!==s&&(l.order=s),void 0!==i&&(l.accountType=i),c(r,l);let p=h&&h.headers?h.headers:{};return d.headers={...p,...o.headers},{url:u(r),options:d}},requestTransferOwnership:async(t,n,s={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",n);const r="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},signPayload:async(t,n,s={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",n);const r="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},startRecovery:async(t,n,s={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",n);const r="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},syncAccount:async(t,n={})=>{i("syncAccount","id",t);const s="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}}}}(n);return{async cancelTransferOwnership(a,i,o){const r=await s.cancelTransferOwnership(a,i,o);return d(r,e,t,n)},async completeRecovery(a,i,o){const r=await s.completeRecovery(a,i,o);return d(r,e,t,n)},async createAccount(a,i){const o=await s.createAccount(a,i);return d(o,e,t,n)},async createAccountV2(a,i){const o=await s.createAccountV2(a,i);return d(o,e,t,n)},async deployAccount(a,i,o){const r=await s.deployAccount(a,i,o);return d(r,e,t,n)},async disableAccount(a,i){const o=await s.disableAccount(a,i);return d(o,e,t,n)},async getAccount(a,i,o){const r=await s.getAccount(a,i,o);return d(r,e,t,n)},async getAccountV2(a,i){const o=await s.getAccountV2(a,i);return d(o,e,t,n)},async getAccounts(a,i,o,r,c,h,u){const l=await s.getAccounts(a,i,o,r,c,h,u);return d(l,e,t,n)},async listAccountsV2(a,i,o,r,c){const h=await s.listAccountsV2(a,i,o,r,c);return d(h,e,t,n)},async requestTransferOwnership(a,i,o){const r=await s.requestTransferOwnership(a,i,o);return d(r,e,t,n)},async signPayload(a,i,o){const r=await s.signPayload(a,i,o);return d(r,e,t,n)},async startRecovery(a,i,o){const r=await s.startRecovery(a,i,o);return d(r,e,t,n)},async syncAccount(a,i){const o=await s.syncAccount(a,i);return d(o,e,t,n)}}};class p extends n{cancelTransferOwnership(e,t){return l(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}completeRecovery(e,t){return l(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}createAccount(e,t){return l(this.configuration).createAccount(e.createAccountRequest,t).then((e=>e(this.axios,this.basePath)))}createAccountV2(e,t){return l(this.configuration).createAccountV2(e.accountCreateRequest,t).then((e=>e(this.axios,this.basePath)))}deployAccount(e,t){return l(this.configuration).deployAccount(e.id,e.deployRequest,t).then((e=>e(this.axios,this.basePath)))}disableAccount(e,t){return l(this.configuration).disableAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}getAccount(e,t){return l(this.configuration).getAccount(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getAccountV2(e,t){return l(this.configuration).getAccountV2(e.accountId,t).then((e=>e(this.axios,this.basePath)))}getAccounts(e={},t){return l(this.configuration).getAccounts(e.limit,e.skip,e.order,e.player,e.address,e.expand,t).then((e=>e(this.axios,this.basePath)))}listAccountsV2(e={},t){return l(this.configuration).listAccountsV2(e.limit,e.skip,e.order,e.accountType,t).then((e=>e(this.axios,this.basePath)))}requestTransferOwnership(e,t){return l(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}signPayload(e,t){return l(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then((e=>e(this.axios,this.basePath)))}startRecovery(e,t){return l(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}syncAccount(e,t){return l(this.configuration).syncAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}}const y=function(n){const s=function(e){return{authenticateOAuth:async(t,n={})=>{i("authenticateOAuth","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},authenticateSIWE:async(t,n={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},authorizeWithOAuthToken:async(t,n,s={})=>{i("authorizeWithOAuthToken","provider",t),i("authorizeWithOAuthToken","oAuthRequest",n);const r="/iam/v1/oauth/{provider}/authorize".replace("{provider}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},getJwks:async(t,n={})=>{i("getJwks","publishableKey",t);const s="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},initOAuth:async(t,n,s={})=>{i("initOAuth","oAuthInitRequest",t);const r=new URL("/iam/v1/oauth/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},initSIWE:async(t,n,s={})=>{i("initSIWE","sIWERequest",t);const r=new URL("/iam/v1/siwe/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},linkEmail:async(t,n,s={})=>{i("linkEmail","loginRequest",t);const o=new URL("/iam/v1/password/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkOAuth:async(t,n,s={})=>{i("linkOAuth","oAuthInitRequest",t);const o=new URL("/iam/v1/oauth/init_link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkSIWE:async(t,n={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/link",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},linkThirdParty:async(t,n,s={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const o=new URL("/iam/v1/oauth/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},loginEmailPassword:async(t,n,s={})=>{i("loginEmailPassword","loginRequest",t);const r=new URL("/iam/v1/password/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginOIDC:async(t,n,s={})=>{i("loginOIDC","loginOIDCRequest",t);const r=new URL("/iam/v1/oidc/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},logout:async(t,n={})=>{i("logout","logoutRequest",t);const s=new URL("/iam/v1/sessions/logout",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},me:async(t={})=>{const n=new URL("/iam/v1/me",a);let s;e&&(s=e.baseOptions);const i={method:"GET",...s,...t};c(n,{});let o=s&&s.headers?s.headers:{};return i.headers={...o,...t.headers},{url:u(n),options:i}},poolOAuth:async(t,n={})=>{i("poolOAuth","key",t);const s=new URL("/iam/v1/oauth/pool",a);let r;e&&(r=e.baseOptions);const h={method:"POST",...r,...n},d={},l={};await o(d,e),void 0!==t&&(l.key=t),c(s,l);let p=r&&r.headers?r.headers:{};return h.headers={...d,...p,...n.headers},{url:u(s),options:h}},refresh:async(t,n={})=>{i("refresh","refreshTokenRequest",t);const s=new URL("/iam/v1/sessions",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},registerGuest:async(t,n={})=>{const s=new URL("/iam/v1/guest",a);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...n},h={};await o(h,e),null!=t&&(h["x-game"]=String(t)),c(s,{});let d=i&&i.headers?i.headers:{};return r.headers={...h,...d,...n.headers},{url:u(s),options:r}},requestEmailVerification:async(t,n={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const s=new URL("/iam/v1/password/request_email_verification",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},requestResetPassword:async(t,n={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const s=new URL("/iam/v1/password/request_reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},resetPassword:async(t,n={})=>{i("resetPassword","resetPasswordRequest",t);const s=new URL("/iam/v1/password/reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},signupEmailPassword:async(t,n,s={})=>{i("signupEmailPassword","signupRequest",t);const r=new URL("/iam/v1/password/signup",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},thirdParty:async(t,n,s={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const r=new URL("/iam/v1/oauth/third_party",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},unlinkEmail:async(t,n={})=>{i("unlinkEmail","unlinkEmailRequest",t);const s=new URL("/iam/v1/password/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkOAuth:async(t,n={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const s=new URL("/iam/v1/oauth/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkSIWE:async(t,n={})=>{i("unlinkSIWE","sIWERequest",t);const s=new URL("/iam/v1/siwe/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},verifyEmail:async(t,n={})=>{i("verifyEmail","verifyEmailRequest",t);const s=new URL("/iam/v1/password/verify_email",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},verifyOAuth:async(t,n,s={})=>{i("verifyOAuth","provider",t),i("verifyOAuth","oAuthRequest",n);const r="/iam/v1/oauth/{provider}/verify".replace("{provider}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},verifyOAuthToken:async(t,n={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/verify",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}}}}(n);return{async authenticateOAuth(a,i){const o=await s.authenticateOAuth(a,i);return d(o,e,t,n)},async authenticateSIWE(a,i){const o=await s.authenticateSIWE(a,i);return d(o,e,t,n)},async authorizeWithOAuthToken(a,i,o){const r=await s.authorizeWithOAuthToken(a,i,o);return d(r,e,t,n)},async getJwks(a,i){const o=await s.getJwks(a,i);return d(o,e,t,n)},async initOAuth(a,i,o){const r=await s.initOAuth(a,i,o);return d(r,e,t,n)},async initSIWE(a,i,o){const r=await s.initSIWE(a,i,o);return d(r,e,t,n)},async linkEmail(a,i,o){const r=await s.linkEmail(a,i,o);return d(r,e,t,n)},async linkOAuth(a,i,o){const r=await s.linkOAuth(a,i,o);return d(r,e,t,n)},async linkSIWE(a,i){const o=await s.linkSIWE(a,i);return d(o,e,t,n)},async linkThirdParty(a,i,o){const r=await s.linkThirdParty(a,i,o);return d(r,e,t,n)},async loginEmailPassword(a,i,o){const r=await s.loginEmailPassword(a,i,o);return d(r,e,t,n)},async loginOIDC(a,i,o){const r=await s.loginOIDC(a,i,o);return d(r,e,t,n)},async logout(a,i){const o=await s.logout(a,i);return d(o,e,t,n)},async me(a){const i=await s.me(a);return d(i,e,t,n)},async poolOAuth(a,i){const o=await s.poolOAuth(a,i);return d(o,e,t,n)},async refresh(a,i){const o=await s.refresh(a,i);return d(o,e,t,n)},async registerGuest(a,i){const o=await s.registerGuest(a,i);return d(o,e,t,n)},async requestEmailVerification(a,i){const o=await s.requestEmailVerification(a,i);return d(o,e,t,n)},async requestResetPassword(a,i){const o=await s.requestResetPassword(a,i);return d(o,e,t,n)},async resetPassword(a,i){const o=await s.resetPassword(a,i);return d(o,e,t,n)},async signupEmailPassword(a,i,o){const r=await s.signupEmailPassword(a,i,o);return d(r,e,t,n)},async thirdParty(a,i,o){const r=await s.thirdParty(a,i,o);return d(r,e,t,n)},async unlinkEmail(a,i){const o=await s.unlinkEmail(a,i);return d(o,e,t,n)},async unlinkOAuth(a,i){const o=await s.unlinkOAuth(a,i);return d(o,e,t,n)},async unlinkSIWE(a,i){const o=await s.unlinkSIWE(a,i);return d(o,e,t,n)},async verifyEmail(a,i){const o=await s.verifyEmail(a,i);return d(o,e,t,n)},async verifyOAuth(a,i,o){const r=await s.verifyOAuth(a,i,o);return d(r,e,t,n)},async verifyOAuthToken(a,i){const o=await s.verifyOAuthToken(a,i);return d(o,e,t,n)}}};class w extends n{authenticateOAuth(e,t){return y(this.configuration).authenticateOAuth(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}authenticateSIWE(e,t){return y(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}authorizeWithOAuthToken(e,t){return y(this.configuration).authorizeWithOAuthToken(e.provider,e.oAuthRequest,t).then((e=>e(this.axios,this.basePath)))}getJwks(e,t){return y(this.configuration).getJwks(e.publishableKey,t).then((e=>e(this.axios,this.basePath)))}initOAuth(e,t){return y(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}initSIWE(e,t){return y(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkEmail(e,t){return y(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkOAuth(e,t){return y(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkSIWE(e,t){return y(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}linkThirdParty(e,t){return y(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginEmailPassword(e,t){return y(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginOIDC(e,t){return y(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}logout(e,t){return y(this.configuration).logout(e.logoutRequest,t).then((e=>e(this.axios,this.basePath)))}me(e){return y(this.configuration).me(e).then((e=>e(this.axios,this.basePath)))}poolOAuth(e,t){return y(this.configuration).poolOAuth(e.key,t).then((e=>e(this.axios,this.basePath)))}refresh(e,t){return y(this.configuration).refresh(e.refreshTokenRequest,t).then((e=>e(this.axios,this.basePath)))}registerGuest(e={},t){return y(this.configuration).registerGuest(e.xGame,t).then((e=>e(this.axios,this.basePath)))}requestEmailVerification(e,t){return y(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}requestResetPassword(e,t){return y(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}resetPassword(e,t){return y(this.configuration).resetPassword(e.resetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}signupEmailPassword(e,t){return y(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}thirdParty(e,t){return y(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}unlinkEmail(e,t){return y(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkOAuth(e,t){return y(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkSIWE(e,t){return y(this.configuration).unlinkSIWE(e.sIWERequest,t).then((e=>e(this.axios,this.basePath)))}verifyEmail(e,t){return y(this.configuration).verifyEmail(e.verifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuth(e,t){return y(this.configuration).verifyOAuth(e.provider,e.oAuthRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuthToken(e,t){return y(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}}const g=function(n){const s=function(e){return{createSession:async(t,n,s={})=>{i("createSession","createSessionRequest",t);const r=new URL("/v1/sessions",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},getPlayerSessions:async(t,n,s,r,h,d={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},w={},g={};await o(w,e),void 0!==n&&(g.limit=n),void 0!==s&&(g.skip=s),void 0!==r&&(g.order=r),void 0!==t&&(g.player=t),h&&(g.expand=h),c(l,g);let m=p&&p.headers?p.headers:{};return y.headers={...w,...m,...d.headers},{url:u(l),options:y}},getSession:async(t,n,s={})=>{i("getSession","id",t);const r="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},revokeSession:async(t,n,s={})=>{i("revokeSession","revokeSessionRequest",t);const r=new URL("/v1/sessions/revoke",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},signatureSession:async(t,n,s={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",n);const r="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createSession(a,i,o){const r=await s.createSession(a,i,o);return d(r,e,t,n)},async getPlayerSessions(a,i,o,r,c,h){const u=await s.getPlayerSessions(a,i,o,r,c,h);return d(u,e,t,n)},async getSession(a,i,o){const r=await s.getSession(a,i,o);return d(r,e,t,n)},async revokeSession(a,i,o){const r=await s.revokeSession(a,i,o);return d(r,e,t,n)},async signatureSession(a,i,o){const r=await s.signatureSession(a,i,o);return d(r,e,t,n)}}};class m extends n{createSession(e,t){return g(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}getPlayerSessions(e,t){return g(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 g(this.configuration).getSession(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}revokeSession(e,t){return g(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}signatureSession(e,t){return g(this.configuration).signatureSession(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}const O=function(n){const s=function(e){return{createTransactionIntent:async(t,n,s={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const r=new URL("/v1/transaction_intents",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},estimateTransactionIntentCost:async(t,n={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const s=new URL("/v1/transaction_intents/estimate_gas_cost",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getTransactionIntent:async(t,n,s={})=>{i("getTransactionIntent","id",t);const r="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let w=d&&d.headers?d.headers:{};return l.headers={...p,...w,...s.headers},{url:u(h),options:l}},getTransactionIntents:async(t,n,s,i,r,h,d,l,p,y={})=>{const w=new URL("/v1/transaction_intents",a);let g;e&&(g=e.baseOptions);const m={method:"GET",...g,...y},O={},R={};await o(O,e),void 0!==t&&(R.limit=t),void 0!==n&&(R.skip=n),void 0!==s&&(R.order=s),i&&(R.expand=i),void 0!==r&&(R.chainId=r),h&&(R.account=h),d&&(R.player=d),void 0!==l&&(R.status=l),p&&(R.policy=p),c(w,R);let P=g&&g.headers?g.headers:{};return m.headers={...O,...P,...y.headers},{url:u(w),options:m}},signature:async(t,n,s={})=>{i("signature","id",t),i("signature","signatureRequest",n);const r="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let w=l&&l.headers?l.headers:{};return p.headers={...y,...w,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createTransactionIntent(a,i,o){const r=await s.createTransactionIntent(a,i,o);return d(r,e,t,n)},async estimateTransactionIntentCost(a,i){const o=await s.estimateTransactionIntentCost(a,i);return d(o,e,t,n)},async getTransactionIntent(a,i,o){const r=await s.getTransactionIntent(a,i,o);return d(r,e,t,n)},async getTransactionIntents(a,i,o,r,c,h,u,l,p,y){const w=await s.getTransactionIntents(a,i,o,r,c,h,u,l,p,y);return d(w,e,t,n)},async signature(a,i,o){const r=await s.signature(a,i,o);return d(r,e,t,n)}}};class R extends n{createTransactionIntent(e,t){return O(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}estimateTransactionIntentCost(e,t){return O(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntent(e,t){return O(this.configuration).getTransactionIntent(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntents(e={},t){return O(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 O(this.configuration).signature(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}class P{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())}}class T{config;transactionIntentsApi;accountsApi;sessionsApi;authenticationApi;constructor(t){const n=e.default?e.default:e;this.config=t,this.transactionIntentsApi=new R(t.backend,void 0,n),this.accountsApi=new p(t.backend,void 0,n),this.sessionsApi=new m(t.backend,void 0,n),this.authenticationApi=new w(t.backend,void 0,n)}}const f=({basePath:e,accessToken:t})=>{if(!e.trim())throw Error("basePath can not be empty");return new P({basePath:e,accessToken:t})};export{T as BackendApiClients,f as createConfig};
|
|
1
|
+
import e from"axios";const t="https://api.openfort.xyz".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(n,s=t,a=e){this.basePath=s,this.axios=a,n&&(this.configuration=n,this.basePath=n.basePath||this.basePath)}}class s extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const a="https://example.com",i=function(e,t,n){if(null==n)throw new s(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},o=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function r(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach((t=>r(e,t,n))):Object.keys(t).forEach((s=>r(e,t[s],`${n}${""!==n?".":""}${s}`))):e.has(n)?e.append(n,t):e.set(n,t))}const c=function(e,...t){const n=new URLSearchParams(e.search);r(n,t),e.search=n.toString()},h=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},u=function(e){return e.pathname+e.search+e.hash},d=function(e,t,n,s){return(a=t,i=n)=>{const o={...e.options,url:(s?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},l=function(n){const s=function(e){return{cancelTransferOwnership:async(t,n,s={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",n);const r="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},completeRecovery:async(t,n,s={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",n);const r="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},createAccount:async(t,n={})=>{i("createAccount","createAccountRequest",t);const s=new URL("/v1/accounts",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},createAccountV2:async(t,n={})=>{i("createAccountV2","accountCreateRequest",t);const s=new URL("/v2/accounts",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},deployAccount:async(t,n,s={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",n);const r="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},disableAccount:async(t,n={})=>{i("disableAccount","id",t);const s="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}},getAccount:async(t,n,s={})=>{i("getAccount","id",t);const r="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},getAccountV2:async(t,n={})=>{i("getAccountV2","accountId",t);const s="/v2/accounts/{accountId}".replace("{accountId}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},getAccounts:async(t,n,s,i,r,h,d={})=>{const l=new URL("/v1/accounts",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},g={},w={};await o(g,e),void 0!==t&&(w.limit=t),void 0!==n&&(w.skip=n),void 0!==s&&(w.order=s),void 0!==i&&(w.player=i),void 0!==r&&(w.address=r),h&&(w.expand=h),c(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...d.headers},{url:u(l),options:y}},listAccountsV2:async(t,n,s,i,o={})=>{const r=new URL("/v2/accounts",a);let h;e&&(h=e.baseOptions);const d={method:"GET",...h,...o},l={};void 0!==t&&(l.limit=t),void 0!==n&&(l.skip=n),void 0!==s&&(l.order=s),void 0!==i&&(l.accountType=i),c(r,l);let p=h&&h.headers?h.headers:{};return d.headers={...p,...o.headers},{url:u(r),options:d}},requestTransferOwnership:async(t,n,s={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",n);const r="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},signPayload:async(t,n,s={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",n);const r="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},startRecovery:async(t,n,s={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",n);const r="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}},syncAccount:async(t,n={})=>{i("syncAccount","id",t);const s="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),r=new URL(s,a);let h;e&&(h=e.baseOptions);const d={method:"POST",...h,...n},l={};await o(l,e),c(r,{});let p=h&&h.headers?h.headers:{};return d.headers={...l,...p,...n.headers},{url:u(r),options:d}}}}(n);return{async cancelTransferOwnership(a,i,o){const r=await s.cancelTransferOwnership(a,i,o);return d(r,e,t,n)},async completeRecovery(a,i,o){const r=await s.completeRecovery(a,i,o);return d(r,e,t,n)},async createAccount(a,i){const o=await s.createAccount(a,i);return d(o,e,t,n)},async createAccountV2(a,i){const o=await s.createAccountV2(a,i);return d(o,e,t,n)},async deployAccount(a,i,o){const r=await s.deployAccount(a,i,o);return d(r,e,t,n)},async disableAccount(a,i){const o=await s.disableAccount(a,i);return d(o,e,t,n)},async getAccount(a,i,o){const r=await s.getAccount(a,i,o);return d(r,e,t,n)},async getAccountV2(a,i){const o=await s.getAccountV2(a,i);return d(o,e,t,n)},async getAccounts(a,i,o,r,c,h,u){const l=await s.getAccounts(a,i,o,r,c,h,u);return d(l,e,t,n)},async listAccountsV2(a,i,o,r,c){const h=await s.listAccountsV2(a,i,o,r,c);return d(h,e,t,n)},async requestTransferOwnership(a,i,o){const r=await s.requestTransferOwnership(a,i,o);return d(r,e,t,n)},async signPayload(a,i,o){const r=await s.signPayload(a,i,o);return d(r,e,t,n)},async startRecovery(a,i,o){const r=await s.startRecovery(a,i,o);return d(r,e,t,n)},async syncAccount(a,i){const o=await s.syncAccount(a,i);return d(o,e,t,n)}}};class p extends n{cancelTransferOwnership(e,t){return l(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}completeRecovery(e,t){return l(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}createAccount(e,t){return l(this.configuration).createAccount(e.createAccountRequest,t).then((e=>e(this.axios,this.basePath)))}createAccountV2(e,t){return l(this.configuration).createAccountV2(e.accountCreateRequest,t).then((e=>e(this.axios,this.basePath)))}deployAccount(e,t){return l(this.configuration).deployAccount(e.id,e.deployRequest,t).then((e=>e(this.axios,this.basePath)))}disableAccount(e,t){return l(this.configuration).disableAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}getAccount(e,t){return l(this.configuration).getAccount(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getAccountV2(e,t){return l(this.configuration).getAccountV2(e.accountId,t).then((e=>e(this.axios,this.basePath)))}getAccounts(e={},t){return l(this.configuration).getAccounts(e.limit,e.skip,e.order,e.player,e.address,e.expand,t).then((e=>e(this.axios,this.basePath)))}listAccountsV2(e={},t){return l(this.configuration).listAccountsV2(e.limit,e.skip,e.order,e.accountType,t).then((e=>e(this.axios,this.basePath)))}requestTransferOwnership(e,t){return l(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then((e=>e(this.axios,this.basePath)))}signPayload(e,t){return l(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then((e=>e(this.axios,this.basePath)))}startRecovery(e,t){return l(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then((e=>e(this.axios,this.basePath)))}syncAccount(e,t){return l(this.configuration).syncAccount(e.id,t).then((e=>e(this.axios,this.basePath)))}}const y=function(n){const s=function(e){return{authenticateSIWE:async(t,n={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/authenticate",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getJwks:async(t,n={})=>{i("getJwks","publishableKey",t);const s="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),o=new URL(s,a);let r;e&&(r=e.baseOptions);const h={method:"GET",...r,...n};c(o,{});let d=r&&r.headers?r.headers:{};return h.headers={...d,...n.headers},{url:u(o),options:h}},initOAuth:async(t,n,s={})=>{i("initOAuth","oAuthInitRequest",t);const r=new URL("/iam/v1/oauth/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},initSIWE:async(t,n,s={})=>{i("initSIWE","sIWERequest",t);const r=new URL("/iam/v1/siwe/init",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},linkEmail:async(t,n,s={})=>{i("linkEmail","loginRequest",t);const o=new URL("/iam/v1/password/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkOAuth:async(t,n,s={})=>{i("linkOAuth","oAuthInitRequest",t);const o=new URL("/iam/v1/oauth/init_link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},linkSIWE:async(t,n={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/link",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},linkThirdParty:async(t,n,s={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const o=new URL("/iam/v1/oauth/link",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",c(o,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...s.headers},d.data=h(t,d,e),{url:u(o),options:d}},loginEmailPassword:async(t,n,s={})=>{i("loginEmailPassword","loginRequest",t);const r=new URL("/iam/v1/password/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginOIDC:async(t,n,s={})=>{i("loginOIDC","loginOIDCRequest",t);const r=new URL("/iam/v1/oidc/login",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},loginWithIdToken:async(t,n={})=>{i("loginWithIdToken","loginWithIdTokenRequest",t);const s=new URL("/iam/v1/oauth/login_id_token",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},logout:async(t,n={})=>{i("logout","logoutRequest",t);const s=new URL("/iam/v1/sessions/logout",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},me:async(t={})=>{const n=new URL("/iam/v1/me",a);let s;e&&(s=e.baseOptions);const i={method:"GET",...s,...t};c(n,{});let o=s&&s.headers?s.headers:{};return i.headers={...o,...t.headers},{url:u(n),options:i}},poolOAuth:async(t,n={})=>{i("poolOAuth","key",t);const s=new URL("/iam/v1/oauth/pool",a);let r;e&&(r=e.baseOptions);const h={method:"POST",...r,...n},d={},l={};await o(d,e),void 0!==t&&(l.key=t),c(s,l);let p=r&&r.headers?r.headers:{};return h.headers={...d,...p,...n.headers},{url:u(s),options:h}},refresh:async(t,n={})=>{i("refresh","refreshTokenRequest",t);const s=new URL("/iam/v1/sessions",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},registerGuest:async(t,n={})=>{const s=new URL("/iam/v1/guest",a);let i;e&&(i=e.baseOptions);const r={method:"POST",...i,...n},h={};await o(h,e),null!=t&&(h["x-game"]=String(t)),c(s,{});let d=i&&i.headers?i.headers:{};return r.headers={...h,...d,...n.headers},{url:u(s),options:r}},requestEmailVerification:async(t,n={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const s=new URL("/iam/v1/password/request_email_verification",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},requestResetPassword:async(t,n={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const s=new URL("/iam/v1/password/request_reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},resetPassword:async(t,n={})=>{i("resetPassword","resetPasswordRequest",t);const s=new URL("/iam/v1/password/reset",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},signupEmailPassword:async(t,n,s={})=>{i("signupEmailPassword","signupRequest",t);const r=new URL("/iam/v1/password/signup",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},thirdParty:async(t,n,s={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const r=new URL("/iam/v1/oauth/third_party",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},unlinkEmail:async(t,n={})=>{i("unlinkEmail","unlinkEmailRequest",t);const s=new URL("/iam/v1/password/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkOAuth:async(t,n={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const s=new URL("/iam/v1/oauth/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},unlinkSIWE:async(t,n={})=>{i("unlinkSIWE","sIWERequest",t);const s=new URL("/iam/v1/siwe/unlink",a);let o;e&&(o=e.baseOptions);const r={method:"POST",...o,...n},d={"Content-Type":"application/json"};c(s,{});let l=o&&o.headers?o.headers:{};return r.headers={...d,...l,...n.headers},r.data=h(t,r,e),{url:u(s),options:r}},verifyEmail:async(t,n={})=>{i("verifyEmail","verifyEmailRequest",t);const s=new URL("/iam/v1/password/verify_email",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},verifyOAuthToken:async(t,n={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/verify",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}}}}(n);return{async authenticateSIWE(a,i){const o=await s.authenticateSIWE(a,i);return d(o,e,t,n)},async getJwks(a,i){const o=await s.getJwks(a,i);return d(o,e,t,n)},async initOAuth(a,i,o){const r=await s.initOAuth(a,i,o);return d(r,e,t,n)},async initSIWE(a,i,o){const r=await s.initSIWE(a,i,o);return d(r,e,t,n)},async linkEmail(a,i,o){const r=await s.linkEmail(a,i,o);return d(r,e,t,n)},async linkOAuth(a,i,o){const r=await s.linkOAuth(a,i,o);return d(r,e,t,n)},async linkSIWE(a,i){const o=await s.linkSIWE(a,i);return d(o,e,t,n)},async linkThirdParty(a,i,o){const r=await s.linkThirdParty(a,i,o);return d(r,e,t,n)},async loginEmailPassword(a,i,o){const r=await s.loginEmailPassword(a,i,o);return d(r,e,t,n)},async loginOIDC(a,i,o){const r=await s.loginOIDC(a,i,o);return d(r,e,t,n)},async loginWithIdToken(a,i){const o=await s.loginWithIdToken(a,i);return d(o,e,t,n)},async logout(a,i){const o=await s.logout(a,i);return d(o,e,t,n)},async me(a){const i=await s.me(a);return d(i,e,t,n)},async poolOAuth(a,i){const o=await s.poolOAuth(a,i);return d(o,e,t,n)},async refresh(a,i){const o=await s.refresh(a,i);return d(o,e,t,n)},async registerGuest(a,i){const o=await s.registerGuest(a,i);return d(o,e,t,n)},async requestEmailVerification(a,i){const o=await s.requestEmailVerification(a,i);return d(o,e,t,n)},async requestResetPassword(a,i){const o=await s.requestResetPassword(a,i);return d(o,e,t,n)},async resetPassword(a,i){const o=await s.resetPassword(a,i);return d(o,e,t,n)},async signupEmailPassword(a,i,o){const r=await s.signupEmailPassword(a,i,o);return d(r,e,t,n)},async thirdParty(a,i,o){const r=await s.thirdParty(a,i,o);return d(r,e,t,n)},async unlinkEmail(a,i){const o=await s.unlinkEmail(a,i);return d(o,e,t,n)},async unlinkOAuth(a,i){const o=await s.unlinkOAuth(a,i);return d(o,e,t,n)},async unlinkSIWE(a,i){const o=await s.unlinkSIWE(a,i);return d(o,e,t,n)},async verifyEmail(a,i){const o=await s.verifyEmail(a,i);return d(o,e,t,n)},async verifyOAuthToken(a,i){const o=await s.verifyOAuthToken(a,i);return d(o,e,t,n)}}};class g extends n{authenticateSIWE(e,t){return y(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}getJwks(e,t){return y(this.configuration).getJwks(e.publishableKey,t).then((e=>e(this.axios,this.basePath)))}initOAuth(e,t){return y(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}initSIWE(e,t){return y(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkEmail(e,t){return y(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkOAuth(e,t){return y(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}linkSIWE(e,t){return y(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then((e=>e(this.axios,this.basePath)))}linkThirdParty(e,t){return y(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginEmailPassword(e,t){return y(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginOIDC(e,t){return y(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}loginWithIdToken(e,t){return y(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then((e=>e(this.axios,this.basePath)))}logout(e,t){return y(this.configuration).logout(e.logoutRequest,t).then((e=>e(this.axios,this.basePath)))}me(e){return y(this.configuration).me(e).then((e=>e(this.axios,this.basePath)))}poolOAuth(e,t){return y(this.configuration).poolOAuth(e.key,t).then((e=>e(this.axios,this.basePath)))}refresh(e,t){return y(this.configuration).refresh(e.refreshTokenRequest,t).then((e=>e(this.axios,this.basePath)))}registerGuest(e={},t){return y(this.configuration).registerGuest(e.xGame,t).then((e=>e(this.axios,this.basePath)))}requestEmailVerification(e,t){return y(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}requestResetPassword(e,t){return y(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}resetPassword(e,t){return y(this.configuration).resetPassword(e.resetPasswordRequest,t).then((e=>e(this.axios,this.basePath)))}signupEmailPassword(e,t){return y(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}thirdParty(e,t){return y(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then((e=>e(this.axios,this.basePath)))}unlinkEmail(e,t){return y(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkOAuth(e,t){return y(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}unlinkSIWE(e,t){return y(this.configuration).unlinkSIWE(e.sIWERequest,t).then((e=>e(this.axios,this.basePath)))}verifyEmail(e,t){return y(this.configuration).verifyEmail(e.verifyEmailRequest,t).then((e=>e(this.axios,this.basePath)))}verifyOAuthToken(e,t){return y(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then((e=>e(this.axios,this.basePath)))}}const w=function(n){const s=function(e){return{createSession:async(t,n,s={})=>{i("createSession","createSessionRequest",t);const r=new URL("/v1/sessions",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},getPlayerSessions:async(t,n,s,r,h,d={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",a);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...d},g={},w={};await o(g,e),void 0!==n&&(w.limit=n),void 0!==s&&(w.skip=s),void 0!==r&&(w.order=r),void 0!==t&&(w.player=t),h&&(w.expand=h),c(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...d.headers},{url:u(l),options:y}},getSession:async(t,n,s={})=>{i("getSession","id",t);const r="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},revokeSession:async(t,n,s={})=>{i("revokeSession","revokeSessionRequest",t);const r=new URL("/v1/sessions/revoke",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},signatureSession:async(t,n,s={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",n);const r="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createSession(a,i,o){const r=await s.createSession(a,i,o);return d(r,e,t,n)},async getPlayerSessions(a,i,o,r,c,h){const u=await s.getPlayerSessions(a,i,o,r,c,h);return d(u,e,t,n)},async getSession(a,i,o){const r=await s.getSession(a,i,o);return d(r,e,t,n)},async revokeSession(a,i,o){const r=await s.revokeSession(a,i,o);return d(r,e,t,n)},async signatureSession(a,i,o){const r=await s.signatureSession(a,i,o);return d(r,e,t,n)}}};class m extends n{createSession(e,t){return w(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}getPlayerSessions(e,t){return w(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 w(this.configuration).getSession(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}revokeSession(e,t){return w(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}signatureSession(e,t){return w(this.configuration).signatureSession(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}const P=function(n){const s=function(e){return{createTransactionIntent:async(t,n,s={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const r=new URL("/v1/transaction_intents",a);let d;e&&(d=e.baseOptions);const l={method:"POST",...d,...s},p={};await o(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",c(r,{});let y=d&&d.headers?d.headers:{};return l.headers={...p,...y,...s.headers},l.data=h(t,l,e),{url:u(r),options:l}},estimateTransactionIntentCost:async(t,n={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const s=new URL("/v1/transaction_intents/estimate_gas_cost",a);let r;e&&(r=e.baseOptions);const d={method:"POST",...r,...n},l={};await o(l,e),l["Content-Type"]="application/json",c(s,{});let p=r&&r.headers?r.headers:{};return d.headers={...l,...p,...n.headers},d.data=h(t,d,e),{url:u(s),options:d}},getTransactionIntent:async(t,n,s={})=>{i("getTransactionIntent","id",t);const r="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(r,a);let d;e&&(d=e.baseOptions);const l={method:"GET",...d,...s},p={},y={};await o(p,e),n&&(y.expand=n),c(h,y);let g=d&&d.headers?d.headers:{};return l.headers={...p,...g,...s.headers},{url:u(h),options:l}},getTransactionIntents:async(t,n,s,i,r,h,d,l,p,y={})=>{const g=new URL("/v1/transaction_intents",a);let w;e&&(w=e.baseOptions);const m={method:"GET",...w,...y},P={},R={};await o(P,e),void 0!==t&&(R.limit=t),void 0!==n&&(R.skip=n),void 0!==s&&(R.order=s),i&&(R.expand=i),void 0!==r&&(R.chainId=r),h&&(R.account=h),d&&(R.player=d),void 0!==l&&(R.status=l),p&&(R.policy=p),c(g,R);let O=w&&w.headers?w.headers:{};return m.headers={...P,...O,...y.headers},{url:u(g),options:m}},signature:async(t,n,s={})=>{i("signature","id",t),i("signature","signatureRequest",n);const r="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),d=new URL(r,a);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await o(y,e),await o(y,e),y["Content-Type"]="application/json",c(d,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=h(n,p,e),{url:u(d),options:p}}}}(n);return{async createTransactionIntent(a,i,o){const r=await s.createTransactionIntent(a,i,o);return d(r,e,t,n)},async estimateTransactionIntentCost(a,i){const o=await s.estimateTransactionIntentCost(a,i);return d(o,e,t,n)},async getTransactionIntent(a,i,o){const r=await s.getTransactionIntent(a,i,o);return d(r,e,t,n)},async getTransactionIntents(a,i,o,r,c,h,u,l,p,y){const g=await s.getTransactionIntents(a,i,o,r,c,h,u,l,p,y);return d(g,e,t,n)},async signature(a,i,o){const r=await s.signature(a,i,o);return d(r,e,t,n)}}};class R extends n{createTransactionIntent(e,t){return P(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then((e=>e(this.axios,this.basePath)))}estimateTransactionIntentCost(e,t){return P(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntent(e,t){return P(this.configuration).getTransactionIntent(e.id,e.expand,t).then((e=>e(this.axios,this.basePath)))}getTransactionIntents(e={},t){return P(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 P(this.configuration).signature(e.id,e.signatureRequest,t).then((e=>e(this.axios,this.basePath)))}}class O{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())}}class T{config;transactionIntentsApi;accountsApi;sessionsApi;authenticationApi;constructor(t){const n=e.default?e.default:e;this.config=t,this.transactionIntentsApi=new R(t.backend,void 0,n),this.accountsApi=new p(t.backend,void 0,n),this.sessionsApi=new m(t.backend,void 0,n),this.authenticationApi=new g(t.backend,void 0,n)}}const f=({basePath:e,accessToken:t})=>{if(!e.trim())throw Error("basePath can not be empty");return new O({basePath:e,accessToken:t})};export{T as BackendApiClients,f as createConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BackendApiClients as e,createConfig as t}from"../../packages/internal/openapi-clients/dist/index.js";import*as a from"crypto";import{withOpenfortError as i,OpenfortErrorType as n,OpenfortError as r}from"./errors/openfortError.js";import{CodeChallengeMethodEnum as s}from"./types.js";import o from"./utils/deviceCredentialsManager.js";import{isBrowser as l}from"./utils/helpers.js";function c(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function d(e){return a.createHash("sha256").update(e).digest()}class h{publishableKey;deviceCredentialsManager;backendApiClients;constructor(a,i){this.publishableKey=a,this.deviceCredentialsManager=new o,this.backendApiClients=new e({backend:t({basePath:i,accessToken:a})})}async initOAuth(e,t,a){const i=t?.usePooling??!1;delete t?.usePooling;const n={oAuthInitRequest:{provider:e,options:t,usePooling:i}},r=await this.backendApiClients.authenticationApi.initOAuth(n,h.getEcosystemGameOptsOrUndefined(a));return l()&&t?.skipBrowserRedirect&&window.location.assign(r.data.url),{url:r.data.url,key:r.data.key}}async registerGuest(){return(await this.backendApiClients.authenticationApi.registerGuest({})).data}async poolOAuth(e){const t={key:e};for(let e=0;e<600;e++)try{const e=await this.backendApiClients.authenticationApi.poolOAuth(t);if(200===e.status)return e.data}catch(e){if(e.response&&404===e.response.status){await new Promise((e=>{setTimeout(e,500)}));continue}throw e}throw new Error("Failed to pool OAuth, try again later")}async authenticateThirdParty(e,t,a,r){const s={thirdPartyOAuthRequest:{provider:e,token:t,tokenType:a}};return i((async()=>(await this.backendApiClients.authenticationApi.thirdParty(s,h.getEcosystemGameOptsOrUndefined(r))).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async initSIWE(e,t){const a={sIWERequest:{address:e}},i=await this.backendApiClients.authenticationApi.initSIWE(a,h.getEcosystemGameOptsOrUndefined(t));return{address:i.data.address,nonce:i.data.nonce,expiresAt:i.data.expiresAt}}async authenticateSIWE(e,t,a,r){const s={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:r}};return i((async()=>(await this.backendApiClients.authenticationApi.authenticateSIWE(s)).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}static getEcosystemGameOptsOrUndefined(e){if(e)return{headers:{"x-game":e}}}async loginEmailPassword(e,t,a){const r={loginRequest:{email:e,password:t}};return i((async()=>(await this.backendApiClients.authenticationApi.loginEmailPassword(r,h.getEcosystemGameOptsOrUndefined(a))).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async requestResetPassword(e,t){const i=c(a.randomBytes(32)),n=c(d(i)),r=c(a.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:r,verifier:i});const o={requestResetPasswordRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:n,method:s.S256}}};await this.backendApiClients.authenticationApi.requestResetPassword(o)}async resetPassword(e,t,a){return i((async()=>{const i=this.deviceCredentialsManager.getPKCEData();if(!i)throw new Error("No code verifier or state for PKCE");const n={resetPasswordRequest:{email:e,password:t,state:a,challenge:{codeVerifier:i.verifier}}};await this.backendApiClients.authenticationApi.resetPassword(n)}),{default:n.AUTHENTICATION_ERROR})}async requestEmailVerification(e,t){const i=c(a.randomBytes(32)),n=c(d(i)),r=c(a.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:r,verifier:i});const o={requestVerifyEmailRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:n,method:s.S256}}};await this.backendApiClients.authenticationApi.requestEmailVerification(o)}async verifyEmail(e,t){return i((async()=>{const a=this.deviceCredentialsManager.getPKCEData();if(!a)throw new Error("No code verifier or state for PKCE");const i={verifyEmailRequest:{email:e,token:t,challenge:{codeVerifier:a.verifier}}};await this.backendApiClients.authenticationApi.verifyEmail(i)}),{default:n.AUTHENTICATION_ERROR})}async signupEmailPassword(e,t,a,r){const s={signupRequest:{email:e,password:t,name:a}};return i((async()=>(await this.backendApiClients.authenticationApi.signupEmailPassword(s,h.getEcosystemGameOptsOrUndefined(r))).data),{default:n.USER_REGISTRATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async validateCredentialsWithoutCrypto(e,t){if(!t.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);if(!JWK_UTILS)throw new r("JWK_UTILS not available",n.INTERNAL_ERROR);const a=JWK_UTILS.getKey({kty:e.kty,crv:e.crv,x:e.x,y:e.y}),i=JWK_UTILS.parse(t.token);if(!JWK_UTILS.verifyJWT(t.token,a,{alg:[e.alg]}))throw new r("Invalid token signature",n.AUTHENTICATION_ERROR);const s=JSON.parse(i.payloadPP);if(!s.exp)return this.refreshTokens(t.refreshToken);const o=JWK_UTILS.getNow();return s.exp<o?this.refreshTokens(t.refreshToken):{player:s.sub,accessToken:t.token,refreshToken:t.refreshToken}}async validateCredentialsWithCrypto(e,t){if(!t.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);const{errors:a,importJWK:i,jwtVerify:s}=await import("jose");try{const a=await i({kty:e.kty,crv:e.crv,x:e.x,y:e.y},e.alg);return{player:(await s(t.token,a)).payload.sub,accessToken:t.token,refreshToken:t.refreshToken}}catch(e){if(e instanceof a.JWTExpired)return this.refreshTokens(t.refreshToken);throw e}}async validateCredentials(e,t){const a=await this.getJWK();if(!e.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);if(t)return this.refreshTokens(e.refreshToken,t);const i=h.getWebCrypto();return i?.subtle?this.validateCredentialsWithCrypto(a,e):this.validateCredentialsWithoutCrypto(a,e)}jwksStorageKey="openfort.jwk";stringToJWK(e){const t=JSON.parse(e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y,alg:t.alg}}async getJWK(){const e=sessionStorage.getItem(this.jwksStorageKey);if(e)return this.stringToJWK(e);const t={publishableKey:this.publishableKey},a=await this.backendApiClients.authenticationApi.getJwks(t);if(0===a.data.keys.length)throw new r("No JWKS keys found",n.INTERNAL_ERROR);const i=a.data.keys[0];return sessionStorage.setItem(this.jwksStorageKey,JSON.stringify(i)),{kty:i.kty,crv:i.crv,x:i.x,y:i.y,alg:i.alg}}async refreshTokens(e,t){const a={refreshTokenRequest:{refreshToken:e,forceRefresh:t}};return i((async()=>{const e=await this.backendApiClients.authenticationApi.refresh(a);return{player:e.data.player.id,accessToken:e.data.token,refreshToken:e.data.refreshToken}}),{default:n.REFRESH_TOKEN_ERROR})}async logout(e,t){const a={logoutRequest:{refreshToken:t}};i((async()=>{await this.backendApiClients.authenticationApi.logout(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e}})}),{default:n.LOGOUT_ERROR})}async getUser(e){return(await this.backendApiClients.authenticationApi.me({headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}})).data}async linkThirdParty(e,t,a,i,n){const r={thirdPartyLinkRequest:{provider:t,token:a,tokenType:i}};return(await this.backendApiClients.authenticationApi.linkThirdParty(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":n||void 0}})).data}async linkOAuth(e,t,a,i){const n={oAuthInitRequest:{provider:t,options:a,usePooling:a?.usePooling||!1}},r=await this.backendApiClients.authenticationApi.linkOAuth(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":i||void 0}});return l()&&!a?.skipBrowserRedirect&&window.location.assign(r.data.url),{url:r.data.url,key:r.data.key}}async unlinkOAuth(e,t){const a={unlinkOAuthRequest:{provider:e}};return(await this.backendApiClients.authenticationApi.unlinkOAuth(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async unlinkWallet(e,t){const a={sIWERequest:{address:e}};return(await this.backendApiClients.authenticationApi.unlinkSIWE(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async linkWallet(e,t,a,i,n){const r={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:i}};return(await this.backendApiClients.authenticationApi.linkSIWE(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":n}})).data}async unlinkEmail(e,t){const a={unlinkEmailRequest:{email:e}};return(await this.backendApiClients.authenticationApi.unlinkEmail(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}static getWebCrypto(){return l()?window.crypto:"undefined"!=typeof global&&global.crypto?global.crypto:null}async linkEmail(e,t,a,i){const n={loginRequest:{email:e,password:t}};return(await this.backendApiClients.authenticationApi.linkEmail(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":a,"x-game":i||void 0}})).data}}export{h as AuthManager};
|
|
1
|
+
import{BackendApiClients as e,createConfig as t}from"../../packages/internal/openapi-clients/dist/index.js";import*as a from"crypto";import{withOpenfortError as i,OpenfortErrorType as n,OpenfortError as r}from"./errors/openfortError.js";import{CodeChallengeMethodEnum as s}from"./types.js";import o from"./utils/deviceCredentialsManager.js";import{isBrowser as l}from"./utils/helpers.js";function c(e){return e.toString("base64").replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function d(e){return a.createHash("sha256").update(e).digest()}class h{publishableKey;deviceCredentialsManager;backendApiClients;constructor(a,i){this.publishableKey=a,this.deviceCredentialsManager=new o,this.backendApiClients=new e({backend:t({basePath:i,accessToken:a})})}async initOAuth(e,t,a){const i=t?.usePooling??!1;delete t?.usePooling;const n={oAuthInitRequest:{provider:e,options:t,usePooling:i}},r=await this.backendApiClients.authenticationApi.initOAuth(n,h.getEcosystemGameOptsOrUndefined(a));return l()&&t?.skipBrowserRedirect&&window.location.assign(r.data.url),{url:r.data.url,key:r.data.key}}async registerGuest(){return(await this.backendApiClients.authenticationApi.registerGuest({})).data}async poolOAuth(e){const t={key:e};for(let e=0;e<600;e++)try{const e=await this.backendApiClients.authenticationApi.poolOAuth(t);if(200===e.status)return e.data}catch(e){if(e.response&&404===e.response.status){await new Promise((e=>{setTimeout(e,500)}));continue}throw e}throw new Error("Failed to pool OAuth, try again later")}async loginWithIdToken(e,t,a){const r={loginWithIdTokenRequest:{provider:e,token:t}};return i((async()=>(await this.backendApiClients.authenticationApi.loginWithIdToken(r,h.getEcosystemGameOptsOrUndefined(a))).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async authenticateThirdParty(e,t,a,r){const s={thirdPartyOAuthRequest:{provider:e,token:t,tokenType:a}};return i((async()=>(await this.backendApiClients.authenticationApi.thirdParty(s,h.getEcosystemGameOptsOrUndefined(r))).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async initSIWE(e,t){const a={sIWERequest:{address:e}},i=await this.backendApiClients.authenticationApi.initSIWE(a,h.getEcosystemGameOptsOrUndefined(t));return{address:i.data.address,nonce:i.data.nonce,expiresAt:i.data.expiresAt}}async authenticateSIWE(e,t,a,r){const s={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:r}};return i((async()=>(await this.backendApiClients.authenticationApi.authenticateSIWE(s)).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}static getEcosystemGameOptsOrUndefined(e){if(e)return{headers:{"x-game":e}}}async loginEmailPassword(e,t,a){const r={loginRequest:{email:e,password:t}};return i((async()=>(await this.backendApiClients.authenticationApi.loginEmailPassword(r,h.getEcosystemGameOptsOrUndefined(a))).data),{default:n.AUTHENTICATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async requestResetPassword(e,t){const i=c(a.randomBytes(32)),n=c(d(i)),r=c(a.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:r,verifier:i});const o={requestResetPasswordRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:n,method:s.S256}}};await this.backendApiClients.authenticationApi.requestResetPassword(o)}async resetPassword(e,t,a){return i((async()=>{const i=this.deviceCredentialsManager.getPKCEData();if(!i)throw new Error("No code verifier or state for PKCE");const n={resetPasswordRequest:{email:e,password:t,state:a,challenge:{codeVerifier:i.verifier}}};await this.backendApiClients.authenticationApi.resetPassword(n)}),{default:n.AUTHENTICATION_ERROR})}async requestEmailVerification(e,t){const i=c(a.randomBytes(32)),n=c(d(i)),r=c(a.randomBytes(32));this.deviceCredentialsManager.savePKCEData({state:r,verifier:i});const o={requestVerifyEmailRequest:{email:e,redirectUrl:t,challenge:{codeChallenge:n,method:s.S256}}};await this.backendApiClients.authenticationApi.requestEmailVerification(o)}async verifyEmail(e,t){return i((async()=>{const a=this.deviceCredentialsManager.getPKCEData();if(!a)throw new Error("No code verifier or state for PKCE");const i={verifyEmailRequest:{email:e,token:t,challenge:{codeVerifier:a.verifier}}};await this.backendApiClients.authenticationApi.verifyEmail(i)}),{default:n.AUTHENTICATION_ERROR})}async signupEmailPassword(e,t,a,r){const s={signupRequest:{email:e,password:t,name:a}};return i((async()=>(await this.backendApiClients.authenticationApi.signupEmailPassword(s,h.getEcosystemGameOptsOrUndefined(r))).data),{default:n.USER_REGISTRATION_ERROR,403:n.USER_NOT_AUTHORIZED_ON_ECOSYSTEM})}async validateCredentialsWithoutCrypto(e,t){if(!t.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);if(!JWK_UTILS)throw new r("JWK_UTILS not available",n.INTERNAL_ERROR);const a=JWK_UTILS.getKey({kty:e.kty,crv:e.crv,x:e.x,y:e.y}),i=JWK_UTILS.parse(t.token);if(!JWK_UTILS.verifyJWT(t.token,a,{alg:[e.alg]}))throw new r("Invalid token signature",n.AUTHENTICATION_ERROR);const s=JSON.parse(i.payloadPP);if(!s.exp)return this.refreshTokens(t.refreshToken);const o=JWK_UTILS.getNow();return s.exp<o?this.refreshTokens(t.refreshToken):{player:s.sub,accessToken:t.token,refreshToken:t.refreshToken}}async validateCredentialsWithCrypto(e,t){if(!t.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);const{errors:a,importJWK:i,jwtVerify:s}=await import("jose");try{const a=await i({kty:e.kty,crv:e.crv,x:e.x,y:e.y},e.alg);return{player:(await s(t.token,a)).payload.sub,accessToken:t.token,refreshToken:t.refreshToken}}catch(e){if(e instanceof a.JWTExpired)return this.refreshTokens(t.refreshToken);throw e}}async validateCredentials(e,t){const a=await this.getJWK();if(!e.refreshToken)throw new r("No refresh token provided",n.AUTHENTICATION_ERROR);if(t)return this.refreshTokens(e.refreshToken,t);const i=h.getWebCrypto();return i?.subtle?this.validateCredentialsWithCrypto(a,e):this.validateCredentialsWithoutCrypto(a,e)}jwksStorageKey="openfort.jwk";stringToJWK(e){const t=JSON.parse(e);return{kty:t.kty,crv:t.crv,x:t.x,y:t.y,alg:t.alg}}async getJWK(){const e=sessionStorage.getItem(this.jwksStorageKey);if(e)return this.stringToJWK(e);const t={publishableKey:this.publishableKey},a=await this.backendApiClients.authenticationApi.getJwks(t);if(0===a.data.keys.length)throw new r("No JWKS keys found",n.INTERNAL_ERROR);const i=a.data.keys[0];return sessionStorage.setItem(this.jwksStorageKey,JSON.stringify(i)),{kty:i.kty,crv:i.crv,x:i.x,y:i.y,alg:i.alg}}async refreshTokens(e,t){const a={refreshTokenRequest:{refreshToken:e,forceRefresh:t}};return i((async()=>{const e=await this.backendApiClients.authenticationApi.refresh(a);return{player:e.data.player.id,accessToken:e.data.token,refreshToken:e.data.refreshToken}}),{default:n.REFRESH_TOKEN_ERROR})}async logout(e,t){const a={logoutRequest:{refreshToken:t}};i((async()=>{await this.backendApiClients.authenticationApi.logout(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e}})}),{default:n.LOGOUT_ERROR})}async getUser(e){return(await this.backendApiClients.authenticationApi.me({headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider,"x-token-type":e.thirdPartyTokenType}})).data}async linkThirdParty(e,t,a,i,n){const r={thirdPartyLinkRequest:{provider:t,token:a,tokenType:i}};return(await this.backendApiClients.authenticationApi.linkThirdParty(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":n||void 0}})).data}async linkOAuth(e,t,a,i){const n={oAuthInitRequest:{provider:t,options:a,usePooling:a?.usePooling||!1}},r=await this.backendApiClients.authenticationApi.linkOAuth(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":e.token,"x-auth-provider":e.thirdPartyProvider||void 0,"x-token-type":e.thirdPartyTokenType||void 0,"x-game":i||void 0}});return l()&&!a?.skipBrowserRedirect&&window.location.assign(r.data.url),{url:r.data.url,key:r.data.key}}async unlinkOAuth(e,t){const a={unlinkOAuthRequest:{provider:e}};return(await this.backendApiClients.authenticationApi.unlinkOAuth(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async unlinkWallet(e,t){const a={sIWERequest:{address:e}};return(await this.backendApiClients.authenticationApi.unlinkSIWE(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}async linkWallet(e,t,a,i,n){const r={sIWEAuthenticateRequest:{signature:e,message:t,walletClientType:a,connectorType:i}};return(await this.backendApiClients.authenticationApi.linkSIWE(r,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":n}})).data}async unlinkEmail(e,t){const a={unlinkEmailRequest:{email:e}};return(await this.backendApiClients.authenticationApi.unlinkEmail(a,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":t}})).data}static getWebCrypto(){return l()?window.crypto:"undefined"!=typeof global&&global.crypto?global.crypto:null}async linkEmail(e,t,a,i){const n={loginRequest:{email:e,password:t}};return(await this.backendApiClients.authenticationApi.linkEmail(n,{headers:{authorization:`Bearer ${this.publishableKey}`,"x-player-token":a,"x-game":i||void 0}})).data}}export{h as AuthManager};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={1:"https://cloudflare-eth.com",10:"https://optimism-rpc.publicnode.com",56:"https://bsc.publicnode.com",97:"https://bsc-testnet.publicnode.com",137:"https://polygon-rpc.com",204:"https://opbnb-mainnet-rpc.bnbchain.org",255:"https://api.kroma.network",300:"https://sepolia.era.zksync.dev",324:"https://mainnet.era.zksync.io",1946:"https://rpc.minato.soneium.org",2358:"https://api.sepolia.kroma.network",2741:"https://api.mainnet.abs.xyz",3939:"https://test.doschain.com",4337:"https://build.onbeam.com/rpc",5611:"https://opbnb-testnet-rpc.bnbchain.org",7979:"https://main.doschain.com",8453:"https://mainnet.base.org",11124:"https://api.testnet.abs.xyz",13337:"https://build.onbeam.com/rpc/testnet",13473:"https://rpc.testnet.immutable.com",42161:"https://arb1.arbitrum.io/rpc",42170:"https://nova.arbitrum.io/rpc",43113:"https://api.avax-test.network/ext/bc/C/rpc",43114:"https://api.avax.network/ext/bc/C/rpc",50104:"https://rpc.sophon.xyz",80002:"https://rpc-amoy.polygon.technology",84532:"https://sepolia.base.org",247253:"https://rpc-testnet.saakuru.network",421614:"https://sepolia-rollup.arbitrum.io/rpc",7225878:"https://rpc.saakuru.network",7777777:"https://rpc.zora.energy/",11155111:"https://ethereum-sepolia-rpc.publicnode.com",11155420:"https://optimism-sepolia-rpc.publicnode.com",28122024:"https://rpcv2-testnet.ancient8.gg",531050104:"https://rpc.testnet.sophon.xyz",666666666:"https://rpc.degen.tips",888888888:"https://rpc.ancient8.gg",999999999:"https://sepolia.rpc.zora.energy",85011:"https://subnets.avax.network/criminalsa/testnet/rpc"};export{t as chainRpcs};
|
|
1
|
+
const t={1:"https://cloudflare-eth.com",10:"https://optimism-rpc.publicnode.com",56:"https://bsc.publicnode.com",97:"https://bsc-testnet.publicnode.com",137:"https://polygon-rpc.com",204:"https://opbnb-mainnet-rpc.bnbchain.org",255:"https://api.kroma.network",300:"https://sepolia.era.zksync.dev",324:"https://mainnet.era.zksync.io",1946:"https://rpc.minato.soneium.org",2358:"https://api.sepolia.kroma.network",2741:"https://api.mainnet.abs.xyz",3939:"https://test.doschain.com",4337:"https://build.onbeam.com/rpc",5611:"https://opbnb-testnet-rpc.bnbchain.org",7979:"https://main.doschain.com",8453:"https://mainnet.base.org",11124:"https://api.testnet.abs.xyz",13337:"https://build.onbeam.com/rpc/testnet",13473:"https://rpc.testnet.immutable.com",42161:"https://arb1.arbitrum.io/rpc",42170:"https://nova.arbitrum.io/rpc",43113:"https://api.avax-test.network/ext/bc/C/rpc",43114:"https://api.avax.network/ext/bc/C/rpc",50104:"https://rpc.sophon.xyz",80002:"https://rpc-amoy.polygon.technology",84532:"https://sepolia.base.org",247253:"https://rpc-testnet.saakuru.network",421614:"https://sepolia-rollup.arbitrum.io/rpc",7225878:"https://rpc.saakuru.network",7777777:"https://rpc.zora.energy/",11155111:"https://ethereum-sepolia-rpc.publicnode.com",11155420:"https://optimism-sepolia-rpc.publicnode.com",28122024:"https://rpcv2-testnet.ancient8.gg",531050104:"https://rpc.testnet.sophon.xyz",666666666:"https://rpc.degen.tips",888888888:"https://rpc.ancient8.gg",999999999:"https://sepolia.rpc.zora.energy",85011:"https://subnets.avax.network/criminalsa/testnet/rpc",84358:"https://subnets.avax.network/titan/mainnet/rpc",10143:"https://testnet-rpc.monad.xyz"};export{t as chainRpcs};
|
package/dist/sdk/src/openfort.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BackendApiClients as e,createConfig as t}from"../../packages/internal/openapi-clients/dist/index.js";import{getSignedTypedData as r}from"./evm/walletHelpers.js";import{StorageKeys as a}from"./storage/istorage.js";import{LocalStorage as o}from"./storage/localStorage.js";import{SignerManager as i}from"./manager/signer.js";import{OpenfortError as n,OpenfortErrorType as s}from"./errors/openfortError.js";import{EmbeddedState as h}from"./types.js";import{Configuration as d}from"./configuration/configuration.js";import{Account as u}from"./configuration/account.js";import{Authentication as g}from"./configuration/authentication.js";import{MissingRecoveryPasswordError as l,MissingProjectEntropyError as c}from"./iframe/iframeManager.js";import{AuthManager as f}from"./authManager.js";import{EvmProvider as
|
|
1
|
+
import{BackendApiClients as e,createConfig as t}from"../../packages/internal/openapi-clients/dist/index.js";import{getSignedTypedData as r}from"./evm/walletHelpers.js";import{StorageKeys as a}from"./storage/istorage.js";import{LocalStorage as o}from"./storage/localStorage.js";import{SignerManager as i}from"./manager/signer.js";import{OpenfortError as n,OpenfortErrorType as s}from"./errors/openfortError.js";import{EmbeddedState as h}from"./types.js";import{Configuration as d}from"./configuration/configuration.js";import{Account as u}from"./configuration/account.js";import{Authentication as g}from"./configuration/authentication.js";import{MissingRecoveryPasswordError as l,MissingProjectEntropyError as c}from"./iframe/iframeManager.js";import{AuthManager as f}from"./authManager.js";import{EvmProvider as p}from"./evm/evmProvider.js";import"./evm/types.js";import m from"./utils/typedEventEmitter.js";import{announceProvider as w,openfortProviderInfo as y}from"./evm/provider/eip6963.js";class R{storage;provider=null;iAuthManager=null;constructor(e){this.storage=new o;new d(e.baseConfiguration.publishableKey,e.overrides?.backendUrl||"https://api.openfort.xyz",e.shieldConfiguration?.shieldPublishableKey||"",e.shieldConfiguration?.shieldEncryptionKey||"",e.overrides?.shieldUrl||"https://shield.openfort.xyz",e.overrides?.iframeUrl||"https://embedded.openfort.xyz",e.shieldConfiguration?.debug||!1).save()}async logout(){const e=i.fromStorage();this.storage.remove(a.AUTHENTICATION),this.storage.remove(a.SIGNER),this.storage.remove(a.ACCOUNT),e&&await e.logout()}getEthereumProvider(e){const t={announceProvider:!0,...e},r=g.fromStorage(this.storage),a=i.fromStorage(),o=u.fromStorage(this.storage);return this.provider?this.provider&&t.policy&&this.provider.updatePolicy(t.policy):(this.provider=new p({storage:this.storage,openfortEventEmitter:new m,signer:a||void 0,account:o||void 0,authentication:r||void 0,backendApiClients:this.backendApiClients,policyId:t.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this)}),t.announceProvider&&w({info:{...y,...t.providerInfo},provider:this.provider})),this.provider}async configureEmbeddedSigner(e=null,t=null,r=null){await this.validateAndRefreshToken();const a=d.fromStorage();let o=null;(r||t?.encryptionSession)&&(o={encryptionSession:t?.encryptionSession||null,recoveryPassword:r||null,encryptionPart:a?.shieldEncryptionKey||null});let n=null,s=null;t&&(n="openfort"===t.auth?"openfort":"custom",s=t.token),await i.embedded(e,o,n,s)}async signMessage(e,t){await this.validateAndRefreshToken();const r=i.fromStorage();if(!r)throw new n("No signer configured",s.MISSING_SIGNER_ERROR);const{hashMessage:a=!0,arrayifyMessage:o=!1}=t||{};return await r.sign(e,o,a)}async signTypedData(e,t,a){await this.validateAndRefreshToken();const o=i.fromStorage(),h=u.fromStorage(this.storage);if(!o||!h)throw new n("No signer configured",s.MISSING_SIGNER_ERROR);return await r({domain:e,types:t,message:a},h.type,Number(h.chainId),o,h.address)}async exportPrivateKey(){await this.validateAndRefreshToken();const e=i.fromStorage();if(!e)throw new n("No signer configured",s.MISSING_SIGNER_ERROR);return await e.export()}async setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:t,encryptionSession:r}){await this.validateAndRefreshToken();const a=i.fromStorage();if(!a)throw new n("No signer configured",s.MISSING_SIGNER_ERROR);if("embedded"!==a.type())throw new n("Signer must be embedded",s.INVALID_CONFIGURATION);if("password"===e&&!t)throw new n("Recovery password is required",s.INVALID_CONFIGURATION);await a.setEmbeddedRecovery({recoveryMethod:e,recoveryPassword:t,encryptionSession:r})}async logInWithEmailPassword({email:e,password:t,ecosystemGame:r}){const a=g.fromStorage(this.storage),o=await this.authManager.loginEmailPassword(e,t,r);return a&&a.player!==o.player.id&&this.logout(),new g("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async signUpGuest(){const e=g.fromStorage(this.storage),t=await this.authManager.registerGuest();return e&&e.player!==t.player.id&&this.logout(),new g("jwt",t.token,t.player.id,t.refreshToken).save(this.storage),t}async signUpWithEmailPassword({email:e,password:t,options:r,ecosystemGame:a}){const o=g.fromStorage(this.storage),i=await this.authManager.signupEmailPassword(e,t,r?.data.name,a);return o&&o.player!==i.player.id&&this.logout(),new g("jwt",i.token,i.player.id,i.refreshToken).save(this.storage),i}async linkEmailPassword({email:e,password:t,authToken:r,ecosystemGame:a}){return await this.authManager.linkEmail(e,t,r,a)}async unlinkEmailPassword({email:e,authToken:t}){return await this.authManager.unlinkEmail(e,t)}async requestEmailVerification({email:e,redirectUrl:t}){await this.authManager.requestEmailVerification(e,t)}async resetPassword({email:e,password:t,state:r}){await this.authManager.resetPassword(e,t,r)}async requestResetPassword({email:e,redirectUrl:t}){await this.authManager.requestResetPassword(e,t)}async verifyEmail({email:e,state:t}){await this.authManager.verifyEmail(e,t)}async initOAuth({provider:e,options:t,ecosystemGame:r}){return this.storage.remove(a.AUTHENTICATION),await this.authManager.initOAuth(e,t,r)}async initLinkOAuth({provider:e,options:t,ecosystemGame:r}){const a=g.fromStorage(this.storage);if(!a)throw new n("No authentication found",s.NOT_LOGGED_IN_ERROR);return await this.authManager.linkOAuth(a,e,t,r)}async linkThirdPartyProvider({provider:e,token:t,tokenType:r}){const a=g.fromStorage(this.storage);if(!a)throw new n("No authentication found",s.NOT_LOGGED_IN_ERROR);return await this.authManager.linkThirdParty(a,e,t,r)}async unlinkOAuth({provider:e,authToken:t}){return await this.authManager.unlinkOAuth(e,t)}async poolOAuth(e){const t=g.fromStorage(this.storage),r=await this.authManager.poolOAuth(e);return t&&t.player!==r.player.id&&this.logout(),new g("jwt",r.token,r.player.id,r.refreshToken).save(this.storage),r}async authenticateWithThirdPartyProvider({provider:e,token:t,tokenType:r,ecosystemGame:a}){const o=g.fromStorage(this.storage),n=await this.authManager.authenticateThirdParty(e,t,r,a);let s=!1;if(o&&o.player!==n.id&&(this.logout(),s=!0),new g("third_party",t,n.id,null,e,r).save(this.storage),s)return n;const h=i.fromStorage();try{await(h?.updateAuthentication())}catch(e){throw(e instanceof l||e instanceof c)&&await(h?.logout()),e}return n}async loginWithIdToken({provider:e,token:t,ecosystemGame:r}){const a=g.fromStorage(this.storage),o=await this.authManager.loginWithIdToken(e,t,r);return a&&a.player!==o.player.id&&this.logout(),new g("jwt",o.token,o.player.id,o.refreshToken).save(this.storage),o}async initSIWE({address:e,ecosystemGame:t}){return await this.authManager.initSIWE(e,t)}async authenticateWithSIWE({signature:e,message:t,walletClientType:r,connectorType:a}){const o=g.fromStorage(this.storage),i=await this.authManager.authenticateSIWE(e,t,r,a);return o&&o.player!==i.player.id&&this.logout(),new g("jwt",i.token,i.player.id,i.refreshToken).save(this.storage),i}async linkWallet({signature:e,message:t,walletClientType:r,connectorType:a,authToken:o}){return await this.authManager.linkWallet(e,t,r,a,o)}async unlinkWallet({address:e,authToken:t}){return await this.authManager.unlinkWallet(e,t)}storeCredentials(e){if(this.storage.remove(a.AUTHENTICATION),!e.player)throw new n("Player ID is required to store credentials",s.INVALID_CONFIGURATION);new g("jwt",e.accessToken,e.player,e.refreshToken).save(this.storage)}async sendSignatureTransactionIntentRequest(e,t=null,r=null,a=!1){if(!d.fromStorage())throw new n("Configuration not found",s.INVALID_CONFIGURATION);await this.validateAndRefreshToken();let o=r;if(!o){if(!t)throw new n("No signableHash or signature provided",s.OPERATION_NOT_SUPPORTED_ERROR);const e=i.fromStorage();if(!e)throw new n("In order to sign a transaction intent, a signer must be configured",s.MISSING_SIGNER_ERROR);o=await e.sign(t)}const h={id:e,signatureRequest:{signature:o,optimistic:a}};return(await this.backendApiClients.transactionIntentsApi.signature(h)).data}async getAccount(){const e=u.fromStorage(this.storage);if(!e)throw new n("No signer configured",s.MISSING_SIGNER_ERROR);return{chainId:e.chainId,address:e.address,ownerAddress:e.ownerAddress,accountType:e.type}}get backendApiClients(){const r=d.fromStorage();if(!r)throw new n("Configuration not found",s.INVALID_CONFIGURATION);return new e({backend:t({basePath:r.openfortURL,accessToken:r.publishableKey})})}async sendSignatureSessionRequest(e,t,r){const a={id:e,signatureRequest:{signature:t,optimistic:r}};return(await this.backendApiClients.sessionsApi.signatureSession(a)).data}getEmbeddedState(){if(!g.fromStorage(this.storage))return h.UNAUTHENTICATED;const e=i.fromStorage();if(!e||"embedded"!==e.type())return h.EMBEDDED_SIGNER_NOT_CONFIGURED;return u.fromStorage(this.storage)?h.READY:h.CREATING_ACCOUNT}getAccessToken(){return g.fromStorage(this.storage)?.token??null}get authManager(){if(!this.iAuthManager){const e=d.fromStorage();if(!e)throw new n("Configuration not found",s.INVALID_CONFIGURATION);this.iAuthManager=new f(e.publishableKey,e.openfortURL)}return this.iAuthManager}async getUser(){await this.validateAndRefreshToken();const e=g.fromStorage(this.storage);if(!e)throw new n("No access token found",s.NOT_LOGGED_IN_ERROR);return await this.authManager.getUser(e)}async validateAndRefreshToken(e){const t=g.fromStorage(this.storage);if(!t)throw new n("Must be logged in to validate and refresh token",s.NOT_LOGGED_IN_ERROR);if("jwt"!==t.type)return;const r=await this.authManager.validateCredentials(t,e);if(!r.player)throw new n("No player found in credentials",s.INTERNAL_ERROR);if(r.accessToken===t.token)return;new g("jwt",r.accessToken,r.player,r.refreshToken).save(this.storage);const a=i.fromStorage();try{await(a?.updateAuthentication())}catch(e){throw(e instanceof l||e instanceof c)&&await(a?.logout()),e}}}export{R as Openfort};
|
package/dist/sdk/src/types.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
var E,A,_,e,a,o,T,n,O,
|
|
1
|
+
var E,A,_,e,a,o,T,n,O,R;!function(E){E[E.NONE=0]="NONE",E[E.UNAUTHENTICATED=1]="UNAUTHENTICATED",E[E.EMBEDDED_SIGNER_NOT_CONFIGURED=2]="EMBEDDED_SIGNER_NOT_CONFIGURED",E[E.CREATING_ACCOUNT=3]="CREATING_ACCOUNT",E[E.READY=4]="READY"}(E||(E={})),function(E){E.LOGGED_OUT="loggedOut"}(A||(A={})),function(E){E.PASSWORD="password",E.AUTOMATIC="automatic"}(_||(_={})),function(E){E.UPGRADEABLE_V4="Upgradeable_v04",E.MANAGED_V4="Managed_v04",E.ERC6551_V4="ERC6551_v04",E.ERC6551_V5="ERC6551_v05",E.RECOVERABLE_V4="Recoverable_v04",E.MANAGED_V5="Managed_v05",E.UPGRADEABLE_V5="Upgradeable_v05",E.UPGRADEABLE_V6="Upgradeable_v06",E.ZKSYNC_UPGRADEABLE_V1="zksync_upgradeable_v1",E.ZKSYNC_UPGRADEABLE_V2="zksync_upgradeable_v2"}(e||(e={})),function(E){E.OPENFORT="openfort",E.THIRD_PARTY="thirdParty"}(a||(a={})),function(E){E.ID_TOKEN="idToken",E.CUSTOM_TOKEN="customToken"}(o||(o={})),function(E){E.ACCELBYTE="accelbyte",E.FIREBASE="firebase",E.LOOTLOCKER="lootlocker",E.PLAYFAB="playfab",E.SUPABASE="supabase",E.CUSTOM="custom",E.OIDC="oidc"}(T||(T={})),function(E){E.EMAIL="email",E.WALLET="wallet"}(n||(n={})),function(E){E.GOOGLE="google",E.TWITTER="twitter",E.APPLE="apple",E.FACEBOOK="facebook",E.DISCORD="discord",E.EPIC_GAMES="epic_games",E.LINE="line"}(O||(O={})),function(E){E.PLAIN="plain",E.S256="S256"}(R||(R={}));export{e as AccountType,a as AuthType,n as BasicAuthProvider,R as CodeChallengeMethodEnum,E as EmbeddedState,O as OAuthProvider,A as OpenfortEvents,_ as RecoveryMethod,T as ThirdPartyOAuthProvider,o as TokenType};
|
package/dist/sdk/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.8.
|
|
1
|
+
const o="0.8.39";export{o as VERSION};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfort/openfort-js",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.39",
|
|
4
4
|
"author": "Openfort (https://www.openfort.io)",
|
|
5
5
|
"bugs": "https://github.com/openfort-xyz/openfort-js/issues",
|
|
6
6
|
"repository": "openfort-xyz/openfort-js.git",
|
|
@@ -24,6 +24,7 @@
|
|
|
24
24
|
"test:watch": "jest --watch",
|
|
25
25
|
"packageList": "./scripts/generate-package-list.sh",
|
|
26
26
|
"typecheck": "tsc --noEmit --jsx preserve",
|
|
27
|
+
"dev": "NODE_ENV=development yarn rollup --config rollup.config.js --watch",
|
|
27
28
|
"lint": "eslint 'src/**/*.ts' --fix",
|
|
28
29
|
"clean": "rimraf dist",
|
|
29
30
|
"build": "yarn packageList && yarn clean && NODE_ENV=production yarn rollup --config rollup.config.js && rm -rf dist/types",
|