@openfort/openfort-js 0.7.13 → 0.7.15
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/index.cjs +269 -150
- package/dist/index.d.ts +32 -13
- package/dist/index.js +259 -140
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -444,7 +444,7 @@ const AccountsApiAxiosParamCreator = function (configuration) {
|
|
|
444
444
|
};
|
|
445
445
|
},
|
|
446
446
|
/**
|
|
447
|
-
* **Custodial Accounts only** - Signs the typed
|
|
447
|
+
* **Custodial Accounts only** - Signs the typed repositories value with types repositories structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
|
|
448
448
|
* @summary Sign a given payload
|
|
449
449
|
* @param {string} id Specifies the unique account ID (starts with acc_).
|
|
450
450
|
* @param {SignPayloadRequest} signPayloadRequest
|
|
@@ -645,7 +645,7 @@ const AccountsApiFp = function (configuration) {
|
|
|
645
645
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
646
646
|
},
|
|
647
647
|
/**
|
|
648
|
-
* **Custodial Accounts only** - Signs the typed
|
|
648
|
+
* **Custodial Accounts only** - Signs the typed repositories value with types repositories structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
|
|
649
649
|
* @summary Sign a given payload
|
|
650
650
|
* @param {string} id Specifies the unique account ID (starts with acc_).
|
|
651
651
|
* @param {SignPayloadRequest} signPayloadRequest
|
|
@@ -766,7 +766,7 @@ class AccountsApi extends BaseAPI {
|
|
|
766
766
|
return AccountsApiFp(this.configuration).requestTransferOwnership(requestParameters.id, requestParameters.transferOwnershipRequest, options).then((request) => request(this.axios, this.basePath));
|
|
767
767
|
}
|
|
768
768
|
/**
|
|
769
|
-
* **Custodial Accounts only** - Signs the typed
|
|
769
|
+
* **Custodial Accounts only** - Signs the typed repositories value with types repositories structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
|
|
770
770
|
* @summary Sign a given payload
|
|
771
771
|
* @param {AccountsApiSignPayloadRequest} requestParameters Request parameters.
|
|
772
772
|
* @param {*} [options] Override http request option.
|
|
@@ -824,6 +824,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
824
824
|
* @summary Authenticate player with oauth token.
|
|
825
825
|
* @param {AuthenticateOAuthRequest} authenticateOAuthRequest
|
|
826
826
|
* @param {*} [options] Override http request option.
|
|
827
|
+
* @deprecated
|
|
827
828
|
* @throws {RequiredError}
|
|
828
829
|
*/
|
|
829
830
|
authenticateOAuth: async (authenticateOAuthRequest, options = {}) => {
|
|
@@ -885,6 +886,38 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
885
886
|
options: localVarRequestOptions,
|
|
886
887
|
};
|
|
887
888
|
},
|
|
889
|
+
/**
|
|
890
|
+
*
|
|
891
|
+
* @param {AuthorizePlayerRequest} authorizePlayerRequest
|
|
892
|
+
* @param {*} [options] Override http request option.
|
|
893
|
+
* @throws {RequiredError}
|
|
894
|
+
*/
|
|
895
|
+
authorize: async (authorizePlayerRequest, options = {}) => {
|
|
896
|
+
// verify required parameter 'authorizePlayerRequest' is not null or undefined
|
|
897
|
+
assertParamExists('authorize', 'authorizePlayerRequest', authorizePlayerRequest);
|
|
898
|
+
const localVarPath = `/iam/v1/authorize`;
|
|
899
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
900
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
901
|
+
let baseOptions;
|
|
902
|
+
if (configuration) {
|
|
903
|
+
baseOptions = configuration.baseOptions;
|
|
904
|
+
}
|
|
905
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
906
|
+
const localVarHeaderParameter = {};
|
|
907
|
+
const localVarQueryParameter = {};
|
|
908
|
+
// authentication sk required
|
|
909
|
+
// http bearer authentication required
|
|
910
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
911
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
912
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
913
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
914
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
915
|
+
localVarRequestOptions.data = serializeDataIfNeeded(authorizePlayerRequest, localVarRequestOptions, configuration);
|
|
916
|
+
return {
|
|
917
|
+
url: toPathString(localVarUrlObj),
|
|
918
|
+
options: localVarRequestOptions,
|
|
919
|
+
};
|
|
920
|
+
},
|
|
888
921
|
/**
|
|
889
922
|
* The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
|
|
890
923
|
* @summary Authorize player with token.
|
|
@@ -959,10 +992,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
959
992
|
*
|
|
960
993
|
* @summary Initialize OAuth.
|
|
961
994
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
995
|
+
* @param {string} [xGame]
|
|
962
996
|
* @param {*} [options] Override http request option.
|
|
963
997
|
* @throws {RequiredError}
|
|
964
998
|
*/
|
|
965
|
-
initOAuth: async (oAuthInitRequest, options = {}) => {
|
|
999
|
+
initOAuth: async (oAuthInitRequest, xGame, options = {}) => {
|
|
966
1000
|
// verify required parameter 'oAuthInitRequest' is not null or undefined
|
|
967
1001
|
assertParamExists('initOAuth', 'oAuthInitRequest', oAuthInitRequest);
|
|
968
1002
|
const localVarPath = `/iam/v1/oauth/init`;
|
|
@@ -978,6 +1012,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
978
1012
|
// authentication pk required
|
|
979
1013
|
// http bearer authentication required
|
|
980
1014
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1015
|
+
if (xGame != null) {
|
|
1016
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1017
|
+
}
|
|
981
1018
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
982
1019
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
983
1020
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -992,10 +1029,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
992
1029
|
* Create a challenge to link external wallet to the player.
|
|
993
1030
|
* @summary Initialize SIWE.
|
|
994
1031
|
* @param {SIWERequest} sIWERequest
|
|
1032
|
+
* @param {string} [xGame]
|
|
995
1033
|
* @param {*} [options] Override http request option.
|
|
996
1034
|
* @throws {RequiredError}
|
|
997
1035
|
*/
|
|
998
|
-
initSIWE: async (sIWERequest, options = {}) => {
|
|
1036
|
+
initSIWE: async (sIWERequest, xGame, options = {}) => {
|
|
999
1037
|
// verify required parameter 'sIWERequest' is not null or undefined
|
|
1000
1038
|
assertParamExists('initSIWE', 'sIWERequest', sIWERequest);
|
|
1001
1039
|
const localVarPath = `/iam/v1/siwe/init`;
|
|
@@ -1011,6 +1049,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1011
1049
|
// authentication pk required
|
|
1012
1050
|
// http bearer authentication required
|
|
1013
1051
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1052
|
+
if (xGame != null) {
|
|
1053
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1054
|
+
}
|
|
1014
1055
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1015
1056
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1016
1057
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1024,10 +1065,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1024
1065
|
/**
|
|
1025
1066
|
*
|
|
1026
1067
|
* @param {LoginRequest} loginRequest
|
|
1068
|
+
* @param {string} [xGame]
|
|
1027
1069
|
* @param {*} [options] Override http request option.
|
|
1028
1070
|
* @throws {RequiredError}
|
|
1029
1071
|
*/
|
|
1030
|
-
linkEmail: async (loginRequest, options = {}) => {
|
|
1072
|
+
linkEmail: async (loginRequest, xGame, options = {}) => {
|
|
1031
1073
|
// verify required parameter 'loginRequest' is not null or undefined
|
|
1032
1074
|
assertParamExists('linkEmail', 'loginRequest', loginRequest);
|
|
1033
1075
|
const localVarPath = `/iam/v1/password/link`;
|
|
@@ -1040,6 +1082,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1040
1082
|
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
1041
1083
|
const localVarHeaderParameter = {};
|
|
1042
1084
|
const localVarQueryParameter = {};
|
|
1085
|
+
if (xGame != null) {
|
|
1086
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1087
|
+
}
|
|
1043
1088
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1044
1089
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1045
1090
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1054,10 +1099,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1054
1099
|
*
|
|
1055
1100
|
* @summary Initialize Link OAuth.
|
|
1056
1101
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1102
|
+
* @param {string} [xGame]
|
|
1057
1103
|
* @param {*} [options] Override http request option.
|
|
1058
1104
|
* @throws {RequiredError}
|
|
1059
1105
|
*/
|
|
1060
|
-
linkOAuth: async (oAuthInitRequest, options = {}) => {
|
|
1106
|
+
linkOAuth: async (oAuthInitRequest, xGame, options = {}) => {
|
|
1061
1107
|
// verify required parameter 'oAuthInitRequest' is not null or undefined
|
|
1062
1108
|
assertParamExists('linkOAuth', 'oAuthInitRequest', oAuthInitRequest);
|
|
1063
1109
|
const localVarPath = `/iam/v1/oauth/init_link`;
|
|
@@ -1070,6 +1116,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1070
1116
|
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
1071
1117
|
const localVarHeaderParameter = {};
|
|
1072
1118
|
const localVarQueryParameter = {};
|
|
1119
|
+
if (xGame != null) {
|
|
1120
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1121
|
+
}
|
|
1073
1122
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1074
1123
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1075
1124
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1114,10 +1163,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1114
1163
|
* Authenticate a player based on email and password.
|
|
1115
1164
|
* @summary Email and password login.
|
|
1116
1165
|
* @param {LoginRequest} loginRequest
|
|
1166
|
+
* @param {string} [xGame]
|
|
1117
1167
|
* @param {*} [options] Override http request option.
|
|
1118
1168
|
* @throws {RequiredError}
|
|
1119
1169
|
*/
|
|
1120
|
-
loginEmailPassword: async (loginRequest, options = {}) => {
|
|
1170
|
+
loginEmailPassword: async (loginRequest, xGame, options = {}) => {
|
|
1121
1171
|
// verify required parameter 'loginRequest' is not null or undefined
|
|
1122
1172
|
assertParamExists('loginEmailPassword', 'loginRequest', loginRequest);
|
|
1123
1173
|
const localVarPath = `/iam/v1/password/login`;
|
|
@@ -1133,6 +1183,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1133
1183
|
// authentication pk required
|
|
1134
1184
|
// http bearer authentication required
|
|
1135
1185
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1186
|
+
if (xGame != null) {
|
|
1187
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1188
|
+
}
|
|
1136
1189
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1137
1190
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1138
1191
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1367,10 +1420,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1367
1420
|
* Create and authenticate a player based on email and password.
|
|
1368
1421
|
* @summary Email and password signup.
|
|
1369
1422
|
* @param {SignupRequest} signupRequest
|
|
1423
|
+
* @param {string} [xGame]
|
|
1370
1424
|
* @param {*} [options] Override http request option.
|
|
1371
1425
|
* @throws {RequiredError}
|
|
1372
1426
|
*/
|
|
1373
|
-
signupEmailPassword: async (signupRequest, options = {}) => {
|
|
1427
|
+
signupEmailPassword: async (signupRequest, xGame, options = {}) => {
|
|
1374
1428
|
// verify required parameter 'signupRequest' is not null or undefined
|
|
1375
1429
|
assertParamExists('signupEmailPassword', 'signupRequest', signupRequest);
|
|
1376
1430
|
const localVarPath = `/iam/v1/password/signup`;
|
|
@@ -1386,6 +1440,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1386
1440
|
// authentication pk required
|
|
1387
1441
|
// http bearer authentication required
|
|
1388
1442
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1443
|
+
if (xGame != null) {
|
|
1444
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1445
|
+
}
|
|
1389
1446
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1390
1447
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1391
1448
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1400,10 +1457,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1400
1457
|
*
|
|
1401
1458
|
* @summary Verify oauth token of a third party auth provider.
|
|
1402
1459
|
* @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
|
|
1460
|
+
* @param {string} [xGame]
|
|
1403
1461
|
* @param {*} [options] Override http request option.
|
|
1404
1462
|
* @throws {RequiredError}
|
|
1405
1463
|
*/
|
|
1406
|
-
thirdParty: async (thirdPartyOAuthRequest, options = {}) => {
|
|
1464
|
+
thirdParty: async (thirdPartyOAuthRequest, xGame, options = {}) => {
|
|
1407
1465
|
// verify required parameter 'thirdPartyOAuthRequest' is not null or undefined
|
|
1408
1466
|
assertParamExists('thirdParty', 'thirdPartyOAuthRequest', thirdPartyOAuthRequest);
|
|
1409
1467
|
const localVarPath = `/iam/v1/oauth/third_party`;
|
|
@@ -1419,6 +1477,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1419
1477
|
// authentication pk required
|
|
1420
1478
|
// http bearer authentication required
|
|
1421
1479
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1480
|
+
if (xGame != null) {
|
|
1481
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1482
|
+
}
|
|
1422
1483
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1423
1484
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1424
1485
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1636,6 +1697,7 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1636
1697
|
* @summary Authenticate player with oauth token.
|
|
1637
1698
|
* @param {AuthenticateOAuthRequest} authenticateOAuthRequest
|
|
1638
1699
|
* @param {*} [options] Override http request option.
|
|
1700
|
+
* @deprecated
|
|
1639
1701
|
* @throws {RequiredError}
|
|
1640
1702
|
*/
|
|
1641
1703
|
async authenticateOAuth(authenticateOAuthRequest, options) {
|
|
@@ -1653,6 +1715,16 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1653
1715
|
const localVarAxiosArgs = await localVarAxiosParamCreator.authenticateSIWE(sIWEAuthenticateRequest, options);
|
|
1654
1716
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1655
1717
|
},
|
|
1718
|
+
/**
|
|
1719
|
+
*
|
|
1720
|
+
* @param {AuthorizePlayerRequest} authorizePlayerRequest
|
|
1721
|
+
* @param {*} [options] Override http request option.
|
|
1722
|
+
* @throws {RequiredError}
|
|
1723
|
+
*/
|
|
1724
|
+
async authorize(authorizePlayerRequest, options) {
|
|
1725
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.authorize(authorizePlayerRequest, options);
|
|
1726
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1727
|
+
},
|
|
1656
1728
|
/**
|
|
1657
1729
|
* The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
|
|
1658
1730
|
* @summary Authorize player with token.
|
|
@@ -1681,43 +1753,47 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1681
1753
|
*
|
|
1682
1754
|
* @summary Initialize OAuth.
|
|
1683
1755
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1756
|
+
* @param {string} [xGame]
|
|
1684
1757
|
* @param {*} [options] Override http request option.
|
|
1685
1758
|
* @throws {RequiredError}
|
|
1686
1759
|
*/
|
|
1687
|
-
async initOAuth(oAuthInitRequest, options) {
|
|
1688
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.initOAuth(oAuthInitRequest, options);
|
|
1760
|
+
async initOAuth(oAuthInitRequest, xGame, options) {
|
|
1761
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.initOAuth(oAuthInitRequest, xGame, options);
|
|
1689
1762
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1690
1763
|
},
|
|
1691
1764
|
/**
|
|
1692
1765
|
* Create a challenge to link external wallet to the player.
|
|
1693
1766
|
* @summary Initialize SIWE.
|
|
1694
1767
|
* @param {SIWERequest} sIWERequest
|
|
1768
|
+
* @param {string} [xGame]
|
|
1695
1769
|
* @param {*} [options] Override http request option.
|
|
1696
1770
|
* @throws {RequiredError}
|
|
1697
1771
|
*/
|
|
1698
|
-
async initSIWE(sIWERequest, options) {
|
|
1699
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, options);
|
|
1772
|
+
async initSIWE(sIWERequest, xGame, options) {
|
|
1773
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, xGame, options);
|
|
1700
1774
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1701
1775
|
},
|
|
1702
1776
|
/**
|
|
1703
1777
|
*
|
|
1704
1778
|
* @param {LoginRequest} loginRequest
|
|
1779
|
+
* @param {string} [xGame]
|
|
1705
1780
|
* @param {*} [options] Override http request option.
|
|
1706
1781
|
* @throws {RequiredError}
|
|
1707
1782
|
*/
|
|
1708
|
-
async linkEmail(loginRequest, options) {
|
|
1709
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.linkEmail(loginRequest, options);
|
|
1783
|
+
async linkEmail(loginRequest, xGame, options) {
|
|
1784
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.linkEmail(loginRequest, xGame, options);
|
|
1710
1785
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1711
1786
|
},
|
|
1712
1787
|
/**
|
|
1713
1788
|
*
|
|
1714
1789
|
* @summary Initialize Link OAuth.
|
|
1715
1790
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1791
|
+
* @param {string} [xGame]
|
|
1716
1792
|
* @param {*} [options] Override http request option.
|
|
1717
1793
|
* @throws {RequiredError}
|
|
1718
1794
|
*/
|
|
1719
|
-
async linkOAuth(oAuthInitRequest, options) {
|
|
1720
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.linkOAuth(oAuthInitRequest, options);
|
|
1795
|
+
async linkOAuth(oAuthInitRequest, xGame, options) {
|
|
1796
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.linkOAuth(oAuthInitRequest, xGame, options);
|
|
1721
1797
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1722
1798
|
},
|
|
1723
1799
|
/**
|
|
@@ -1735,11 +1811,12 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1735
1811
|
* Authenticate a player based on email and password.
|
|
1736
1812
|
* @summary Email and password login.
|
|
1737
1813
|
* @param {LoginRequest} loginRequest
|
|
1814
|
+
* @param {string} [xGame]
|
|
1738
1815
|
* @param {*} [options] Override http request option.
|
|
1739
1816
|
* @throws {RequiredError}
|
|
1740
1817
|
*/
|
|
1741
|
-
async loginEmailPassword(loginRequest, options) {
|
|
1742
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.loginEmailPassword(loginRequest, options);
|
|
1818
|
+
async loginEmailPassword(loginRequest, xGame, options) {
|
|
1819
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.loginEmailPassword(loginRequest, xGame, options);
|
|
1743
1820
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1744
1821
|
},
|
|
1745
1822
|
/**
|
|
@@ -1821,22 +1898,24 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1821
1898
|
* Create and authenticate a player based on email and password.
|
|
1822
1899
|
* @summary Email and password signup.
|
|
1823
1900
|
* @param {SignupRequest} signupRequest
|
|
1901
|
+
* @param {string} [xGame]
|
|
1824
1902
|
* @param {*} [options] Override http request option.
|
|
1825
1903
|
* @throws {RequiredError}
|
|
1826
1904
|
*/
|
|
1827
|
-
async signupEmailPassword(signupRequest, options) {
|
|
1828
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.signupEmailPassword(signupRequest, options);
|
|
1905
|
+
async signupEmailPassword(signupRequest, xGame, options) {
|
|
1906
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.signupEmailPassword(signupRequest, xGame, options);
|
|
1829
1907
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1830
1908
|
},
|
|
1831
1909
|
/**
|
|
1832
1910
|
*
|
|
1833
1911
|
* @summary Verify oauth token of a third party auth provider.
|
|
1834
1912
|
* @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
|
|
1913
|
+
* @param {string} [xGame]
|
|
1835
1914
|
* @param {*} [options] Override http request option.
|
|
1836
1915
|
* @throws {RequiredError}
|
|
1837
1916
|
*/
|
|
1838
|
-
async thirdParty(thirdPartyOAuthRequest, options) {
|
|
1839
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, options);
|
|
1917
|
+
async thirdParty(thirdPartyOAuthRequest, xGame, options) {
|
|
1918
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, xGame, options);
|
|
1840
1919
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1841
1920
|
},
|
|
1842
1921
|
/**
|
|
@@ -1920,6 +1999,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1920
1999
|
* @summary Authenticate player with oauth token.
|
|
1921
2000
|
* @param {AuthenticationApiAuthenticateOAuthRequest} requestParameters Request parameters.
|
|
1922
2001
|
* @param {*} [options] Override http request option.
|
|
2002
|
+
* @deprecated
|
|
1923
2003
|
* @throws {RequiredError}
|
|
1924
2004
|
* @memberof AuthenticationApi
|
|
1925
2005
|
*/
|
|
@@ -1937,6 +2017,16 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1937
2017
|
authenticateSIWE(requestParameters, options) {
|
|
1938
2018
|
return AuthenticationApiFp(this.configuration).authenticateSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1939
2019
|
}
|
|
2020
|
+
/**
|
|
2021
|
+
*
|
|
2022
|
+
* @param {AuthenticationApiAuthorizeRequest} requestParameters Request parameters.
|
|
2023
|
+
* @param {*} [options] Override http request option.
|
|
2024
|
+
* @throws {RequiredError}
|
|
2025
|
+
* @memberof AuthenticationApi
|
|
2026
|
+
*/
|
|
2027
|
+
authorize(requestParameters, options) {
|
|
2028
|
+
return AuthenticationApiFp(this.configuration).authorize(requestParameters.authorizePlayerRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2029
|
+
}
|
|
1940
2030
|
/**
|
|
1941
2031
|
* The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
|
|
1942
2032
|
* @summary Authorize player with token.
|
|
@@ -1969,7 +2059,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1969
2059
|
* @memberof AuthenticationApi
|
|
1970
2060
|
*/
|
|
1971
2061
|
initOAuth(requestParameters, options) {
|
|
1972
|
-
return AuthenticationApiFp(this.configuration).initOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2062
|
+
return AuthenticationApiFp(this.configuration).initOAuth(requestParameters.oAuthInitRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
1973
2063
|
}
|
|
1974
2064
|
/**
|
|
1975
2065
|
* Create a challenge to link external wallet to the player.
|
|
@@ -1980,7 +2070,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1980
2070
|
* @memberof AuthenticationApi
|
|
1981
2071
|
*/
|
|
1982
2072
|
initSIWE(requestParameters, options) {
|
|
1983
|
-
return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
|
|
2073
|
+
return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
1984
2074
|
}
|
|
1985
2075
|
/**
|
|
1986
2076
|
*
|
|
@@ -1990,7 +2080,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1990
2080
|
* @memberof AuthenticationApi
|
|
1991
2081
|
*/
|
|
1992
2082
|
linkEmail(requestParameters, options) {
|
|
1993
|
-
return AuthenticationApiFp(this.configuration).linkEmail(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2083
|
+
return AuthenticationApiFp(this.configuration).linkEmail(requestParameters.loginRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
1994
2084
|
}
|
|
1995
2085
|
/**
|
|
1996
2086
|
*
|
|
@@ -2001,7 +2091,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2001
2091
|
* @memberof AuthenticationApi
|
|
2002
2092
|
*/
|
|
2003
2093
|
linkOAuth(requestParameters, options) {
|
|
2004
|
-
return AuthenticationApiFp(this.configuration).linkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2094
|
+
return AuthenticationApiFp(this.configuration).linkOAuth(requestParameters.oAuthInitRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2005
2095
|
}
|
|
2006
2096
|
/**
|
|
2007
2097
|
*
|
|
@@ -2023,7 +2113,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2023
2113
|
* @memberof AuthenticationApi
|
|
2024
2114
|
*/
|
|
2025
2115
|
loginEmailPassword(requestParameters, options) {
|
|
2026
|
-
return AuthenticationApiFp(this.configuration).loginEmailPassword(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2116
|
+
return AuthenticationApiFp(this.configuration).loginEmailPassword(requestParameters.loginRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2027
2117
|
}
|
|
2028
2118
|
/**
|
|
2029
2119
|
* When using Openfort Auth, the endpoint logs out the player.
|
|
@@ -2109,7 +2199,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2109
2199
|
* @memberof AuthenticationApi
|
|
2110
2200
|
*/
|
|
2111
2201
|
signupEmailPassword(requestParameters, options) {
|
|
2112
|
-
return AuthenticationApiFp(this.configuration).signupEmailPassword(requestParameters.signupRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2202
|
+
return AuthenticationApiFp(this.configuration).signupEmailPassword(requestParameters.signupRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2113
2203
|
}
|
|
2114
2204
|
/**
|
|
2115
2205
|
*
|
|
@@ -2120,7 +2210,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2120
2210
|
* @memberof AuthenticationApi
|
|
2121
2211
|
*/
|
|
2122
2212
|
thirdParty(requestParameters, options) {
|
|
2123
|
-
return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2213
|
+
return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2124
2214
|
}
|
|
2125
2215
|
/**
|
|
2126
2216
|
*
|
|
@@ -2560,10 +2650,11 @@ const TransactionIntentsApiAxiosParamCreator = function (configuration) {
|
|
|
2560
2650
|
* Creates a TransactionIntent. A pending TransactionIntent has the `response` attribute as undefined. After the TransactionIntent is created and broadcasted to the blockchain, `response` will be populated with the transaction hash and a status (1 success, 0 fail). When using a non-custodial account, a `nextAction` attribute is returned with the `userOperationHash` that must be signed by the owner of the account.
|
|
2561
2651
|
* @summary Create a transaction intent object.
|
|
2562
2652
|
* @param {CreateTransactionIntentRequest} createTransactionIntentRequest
|
|
2653
|
+
* @param {string} [xBehalfOfProject]
|
|
2563
2654
|
* @param {*} [options] Override http request option.
|
|
2564
2655
|
* @throws {RequiredError}
|
|
2565
2656
|
*/
|
|
2566
|
-
createTransactionIntent: async (createTransactionIntentRequest, options = {}) => {
|
|
2657
|
+
createTransactionIntent: async (createTransactionIntentRequest, xBehalfOfProject, options = {}) => {
|
|
2567
2658
|
// verify required parameter 'createTransactionIntentRequest' is not null or undefined
|
|
2568
2659
|
assertParamExists('createTransactionIntent', 'createTransactionIntentRequest', createTransactionIntentRequest);
|
|
2569
2660
|
const localVarPath = `/v1/transaction_intents`;
|
|
@@ -2579,6 +2670,9 @@ const TransactionIntentsApiAxiosParamCreator = function (configuration) {
|
|
|
2579
2670
|
// authentication sk required
|
|
2580
2671
|
// http bearer authentication required
|
|
2581
2672
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
2673
|
+
if (xBehalfOfProject != null) {
|
|
2674
|
+
localVarHeaderParameter['X-Behalf-Of-Project'] = String(xBehalfOfProject);
|
|
2675
|
+
}
|
|
2582
2676
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
2583
2677
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
2584
2678
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -2775,11 +2869,12 @@ const TransactionIntentsApiFp = function (configuration) {
|
|
|
2775
2869
|
* Creates a TransactionIntent. A pending TransactionIntent has the `response` attribute as undefined. After the TransactionIntent is created and broadcasted to the blockchain, `response` will be populated with the transaction hash and a status (1 success, 0 fail). When using a non-custodial account, a `nextAction` attribute is returned with the `userOperationHash` that must be signed by the owner of the account.
|
|
2776
2870
|
* @summary Create a transaction intent object.
|
|
2777
2871
|
* @param {CreateTransactionIntentRequest} createTransactionIntentRequest
|
|
2872
|
+
* @param {string} [xBehalfOfProject]
|
|
2778
2873
|
* @param {*} [options] Override http request option.
|
|
2779
2874
|
* @throws {RequiredError}
|
|
2780
2875
|
*/
|
|
2781
|
-
async createTransactionIntent(createTransactionIntentRequest, options) {
|
|
2782
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionIntent(createTransactionIntentRequest, options);
|
|
2876
|
+
async createTransactionIntent(createTransactionIntentRequest, xBehalfOfProject, options) {
|
|
2877
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionIntent(createTransactionIntentRequest, xBehalfOfProject, options);
|
|
2783
2878
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
2784
2879
|
},
|
|
2785
2880
|
/**
|
|
@@ -2854,7 +2949,7 @@ class TransactionIntentsApi extends BaseAPI {
|
|
|
2854
2949
|
* @memberof TransactionIntentsApi
|
|
2855
2950
|
*/
|
|
2856
2951
|
createTransactionIntent(requestParameters, options) {
|
|
2857
|
-
return TransactionIntentsApiFp(this.configuration).createTransactionIntent(requestParameters.createTransactionIntentRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2952
|
+
return TransactionIntentsApiFp(this.configuration).createTransactionIntent(requestParameters.createTransactionIntentRequest, requestParameters.xBehalfOfProject, options).then((request) => request(this.axios, this.basePath));
|
|
2858
2953
|
}
|
|
2859
2954
|
/**
|
|
2860
2955
|
* Estimate the gas cost of broadcasting a TransactionIntent. This is a simulation, it does not send the transaction on-chain. If a Policy ID is used that includes payment of gas in ERC-20 tokens, an extra field `estimatedTXGasFeeToken` is returned with the estimated amount of tokens that will be used.
|
|
@@ -3077,57 +3172,6 @@ var CodeChallengeMethodEnum;
|
|
|
3077
3172
|
CodeChallengeMethodEnum["S256"] = "S256";
|
|
3078
3173
|
})(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
|
|
3079
3174
|
|
|
3080
|
-
var OpenfortErrorType;
|
|
3081
|
-
(function (OpenfortErrorType) {
|
|
3082
|
-
OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
3083
|
-
OpenfortErrorType["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
|
|
3084
|
-
OpenfortErrorType["NOT_LOGGED_IN_ERROR"] = "NOT_LOGGED_IN_ERROR";
|
|
3085
|
-
OpenfortErrorType["REFRESH_TOKEN_ERROR"] = "REFRESH_TOKEN_ERROR";
|
|
3086
|
-
OpenfortErrorType["USER_REGISTRATION_ERROR"] = "USER_REGISTRATION_ERROR";
|
|
3087
|
-
OpenfortErrorType["LOGOUT_ERROR"] = "LOGOUT_ERROR";
|
|
3088
|
-
OpenfortErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
|
|
3089
|
-
OpenfortErrorType["MISSING_SESSION_SIGNER_ERROR"] = "MISSING_SESSION_SIGNER_ERROR";
|
|
3090
|
-
OpenfortErrorType["MISSING_EMBEDDED_SIGNER_ERROR"] = "MISSING_EMBEDDED_SIGNER_ERROR";
|
|
3091
|
-
OpenfortErrorType["MISSING_SIGNER_ERROR"] = "MISSING_SIGNER_ERROR";
|
|
3092
|
-
})(OpenfortErrorType || (OpenfortErrorType = {}));
|
|
3093
|
-
function isAPIError(error) {
|
|
3094
|
-
return 'type' in error && 'message' in error;
|
|
3095
|
-
}
|
|
3096
|
-
class OpenfortError extends Error {
|
|
3097
|
-
type;
|
|
3098
|
-
constructor(message, type) {
|
|
3099
|
-
super(message);
|
|
3100
|
-
this.type = type;
|
|
3101
|
-
}
|
|
3102
|
-
}
|
|
3103
|
-
const withOpenfortError = async (fn, customErrorType) => {
|
|
3104
|
-
try {
|
|
3105
|
-
return await fn();
|
|
3106
|
-
}
|
|
3107
|
-
catch (error) {
|
|
3108
|
-
let errorMessage;
|
|
3109
|
-
if (isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
|
|
3110
|
-
errorMessage = error.response.data.message;
|
|
3111
|
-
}
|
|
3112
|
-
else {
|
|
3113
|
-
errorMessage = error.message;
|
|
3114
|
-
}
|
|
3115
|
-
throw new OpenfortError(errorMessage, customErrorType);
|
|
3116
|
-
}
|
|
3117
|
-
};
|
|
3118
|
-
|
|
3119
|
-
const validateConfiguration = (configuration, requiredKeys, prefix) => {
|
|
3120
|
-
const missingKeys = requiredKeys
|
|
3121
|
-
.map((key) => !configuration[key] && key)
|
|
3122
|
-
.filter((n) => n)
|
|
3123
|
-
.join(', ');
|
|
3124
|
-
if (missingKeys !== '') {
|
|
3125
|
-
const errorMessage = prefix
|
|
3126
|
-
? `${prefix} - ${missingKeys} cannot be null`
|
|
3127
|
-
: `${missingKeys} cannot be null`;
|
|
3128
|
-
throw new OpenfortError(errorMessage, OpenfortErrorType.INVALID_CONFIGURATION);
|
|
3129
|
-
}
|
|
3130
|
-
};
|
|
3131
3175
|
class OpenfortConfiguration {
|
|
3132
3176
|
publishableKey;
|
|
3133
3177
|
constructor(options) {
|
|
@@ -3155,17 +3199,12 @@ class SDKConfiguration {
|
|
|
3155
3199
|
this.shieldConfiguration = shieldConfiguration;
|
|
3156
3200
|
this.baseConfiguration = baseConfiguration;
|
|
3157
3201
|
if (overrides) {
|
|
3158
|
-
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
|
-
'shieldUrl',
|
|
3162
|
-
], 'overrides');
|
|
3163
|
-
this.backendUrl = overrides.backendUrl;
|
|
3164
|
-
this.iframeUrl = overrides.iframeUrl;
|
|
3165
|
-
this.shieldUrl = overrides.shieldUrl;
|
|
3202
|
+
this.backendUrl = overrides.backendUrl || 'https://api.openfort.xyz';
|
|
3203
|
+
this.iframeUrl = overrides.iframeUrl || 'https://iframe.openfort.xyz';
|
|
3204
|
+
this.shieldUrl = overrides.shieldUrl || 'https://shield.openfort.xyz';
|
|
3166
3205
|
this.openfortAPIConfig = {
|
|
3167
3206
|
backend: createConfig({
|
|
3168
|
-
basePath: overrides.backendUrl,
|
|
3207
|
+
basePath: overrides.backendUrl || 'https://api.openfort.xyz',
|
|
3169
3208
|
accessToken: baseConfiguration.publishableKey,
|
|
3170
3209
|
}),
|
|
3171
3210
|
};
|
|
@@ -4624,6 +4663,69 @@ function announceProvider(detail) {
|
|
|
4624
4663
|
window.addEventListener('eip6963:requestProvider', handler);
|
|
4625
4664
|
}
|
|
4626
4665
|
|
|
4666
|
+
var OpenfortErrorType;
|
|
4667
|
+
(function (OpenfortErrorType) {
|
|
4668
|
+
OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
4669
|
+
OpenfortErrorType["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
|
|
4670
|
+
OpenfortErrorType["NOT_LOGGED_IN_ERROR"] = "NOT_LOGGED_IN_ERROR";
|
|
4671
|
+
OpenfortErrorType["REFRESH_TOKEN_ERROR"] = "REFRESH_TOKEN_ERROR";
|
|
4672
|
+
OpenfortErrorType["USER_REGISTRATION_ERROR"] = "USER_REGISTRATION_ERROR";
|
|
4673
|
+
OpenfortErrorType["LOGOUT_ERROR"] = "LOGOUT_ERROR";
|
|
4674
|
+
OpenfortErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
|
|
4675
|
+
OpenfortErrorType["MISSING_SESSION_SIGNER_ERROR"] = "MISSING_SESSION_SIGNER_ERROR";
|
|
4676
|
+
OpenfortErrorType["MISSING_EMBEDDED_SIGNER_ERROR"] = "MISSING_EMBEDDED_SIGNER_ERROR";
|
|
4677
|
+
OpenfortErrorType["MISSING_SIGNER_ERROR"] = "MISSING_SIGNER_ERROR";
|
|
4678
|
+
OpenfortErrorType["USER_NOT_AUTHORIZED_ON_ECOSYSTEM"] = "USER_NOT_AUTHORIZED_ON_ECOSYSTEM";
|
|
4679
|
+
})(OpenfortErrorType || (OpenfortErrorType = {}));
|
|
4680
|
+
function isAPIError(error) {
|
|
4681
|
+
return 'type' in error && 'message' in error;
|
|
4682
|
+
}
|
|
4683
|
+
class OpenfortError extends Error {
|
|
4684
|
+
type;
|
|
4685
|
+
data;
|
|
4686
|
+
constructor(message, type, data = {}) {
|
|
4687
|
+
super(message);
|
|
4688
|
+
this.type = type;
|
|
4689
|
+
this.data = data;
|
|
4690
|
+
}
|
|
4691
|
+
}
|
|
4692
|
+
const withOpenfortError = async (fn, customErrorType) => {
|
|
4693
|
+
try {
|
|
4694
|
+
return await fn();
|
|
4695
|
+
}
|
|
4696
|
+
catch (error) {
|
|
4697
|
+
let errorMessage;
|
|
4698
|
+
const data = {};
|
|
4699
|
+
let errorType = customErrorType.default;
|
|
4700
|
+
if (isAxiosError(error)) {
|
|
4701
|
+
const statusCode = error.response?.status;
|
|
4702
|
+
errorType = statusCode ? customErrorType[statusCode] || customErrorType.default : customErrorType.default;
|
|
4703
|
+
if (error.response?.data && error.response.data.error) {
|
|
4704
|
+
const jsonData = JSON.parse(JSON.stringify(error.response.data.error));
|
|
4705
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
4706
|
+
for (const key in jsonData) {
|
|
4707
|
+
if (key !== 'message' && key !== 'type') {
|
|
4708
|
+
data[key] = jsonData[key];
|
|
4709
|
+
}
|
|
4710
|
+
}
|
|
4711
|
+
if (isAPIError(error.response.data)) {
|
|
4712
|
+
errorMessage = error.response.data.message;
|
|
4713
|
+
}
|
|
4714
|
+
else {
|
|
4715
|
+
errorMessage = error.message;
|
|
4716
|
+
}
|
|
4717
|
+
}
|
|
4718
|
+
else {
|
|
4719
|
+
errorMessage = error.message;
|
|
4720
|
+
}
|
|
4721
|
+
}
|
|
4722
|
+
else {
|
|
4723
|
+
errorMessage = error.message;
|
|
4724
|
+
}
|
|
4725
|
+
throw new OpenfortError(errorMessage, errorType, data);
|
|
4726
|
+
}
|
|
4727
|
+
};
|
|
4728
|
+
|
|
4627
4729
|
var SignerType;
|
|
4628
4730
|
(function (SignerType) {
|
|
4629
4731
|
SignerType["EMBEDDED"] = "embedded";
|
|
@@ -4669,7 +4771,7 @@ class AuthManager {
|
|
|
4669
4771
|
this.backendApiClients = backendApiClients;
|
|
4670
4772
|
this.instanceManager = instanceManager;
|
|
4671
4773
|
}
|
|
4672
|
-
async initOAuth(provider, options) {
|
|
4774
|
+
async initOAuth(provider, options, ecosystemGame) {
|
|
4673
4775
|
const usePooling = options?.usePooling ?? false;
|
|
4674
4776
|
// eslint-disable-next-line no-param-reassign
|
|
4675
4777
|
delete options?.usePooling;
|
|
@@ -4680,7 +4782,7 @@ class AuthManager {
|
|
|
4680
4782
|
usePooling,
|
|
4681
4783
|
},
|
|
4682
4784
|
};
|
|
4683
|
-
const result = await this.backendApiClients.authenticationApi.initOAuth(request);
|
|
4785
|
+
const result = await this.backendApiClients.authenticationApi.initOAuth(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4684
4786
|
if (isBrowser() && options?.skipBrowserRedirect) {
|
|
4685
4787
|
window.location.assign(result.data.url);
|
|
4686
4788
|
}
|
|
@@ -4721,7 +4823,7 @@ class AuthManager {
|
|
|
4721
4823
|
}
|
|
4722
4824
|
throw new Error('Failed to pool OAuth, try again later');
|
|
4723
4825
|
}
|
|
4724
|
-
async authenticateThirdParty(provider, token, tokenType) {
|
|
4826
|
+
async authenticateThirdParty(provider, token, tokenType, ecosystemGame) {
|
|
4725
4827
|
const request = {
|
|
4726
4828
|
thirdPartyOAuthRequest: {
|
|
4727
4829
|
provider,
|
|
@@ -4730,17 +4832,17 @@ class AuthManager {
|
|
|
4730
4832
|
},
|
|
4731
4833
|
};
|
|
4732
4834
|
return withOpenfortError(async () => {
|
|
4733
|
-
const response = await this.backendApiClients.authenticationApi.thirdParty(request);
|
|
4835
|
+
const response = await this.backendApiClients.authenticationApi.thirdParty(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4734
4836
|
return response.data;
|
|
4735
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4837
|
+
}, { default: OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4736
4838
|
}
|
|
4737
|
-
async initSIWE(address) {
|
|
4839
|
+
async initSIWE(address, ecosystemGame) {
|
|
4738
4840
|
const request = {
|
|
4739
4841
|
sIWERequest: {
|
|
4740
4842
|
address,
|
|
4741
4843
|
},
|
|
4742
4844
|
};
|
|
4743
|
-
const result = await this.backendApiClients.authenticationApi.initSIWE(request);
|
|
4845
|
+
const result = await this.backendApiClients.authenticationApi.initSIWE(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4744
4846
|
return {
|
|
4745
4847
|
address: result.data.address,
|
|
4746
4848
|
nonce: result.data.nonce,
|
|
@@ -4759,9 +4861,20 @@ class AuthManager {
|
|
|
4759
4861
|
return withOpenfortError(async () => {
|
|
4760
4862
|
const response = await this.backendApiClients.authenticationApi.authenticateSIWE(request);
|
|
4761
4863
|
return response.data;
|
|
4762
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4864
|
+
}, { default: OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4865
|
+
}
|
|
4866
|
+
static getEcosystemGameOptsOrUndefined(ecosystemGame) {
|
|
4867
|
+
if (ecosystemGame) {
|
|
4868
|
+
return {
|
|
4869
|
+
headers: {
|
|
4870
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4871
|
+
'x-game': ecosystemGame,
|
|
4872
|
+
},
|
|
4873
|
+
};
|
|
4874
|
+
}
|
|
4875
|
+
return undefined;
|
|
4763
4876
|
}
|
|
4764
|
-
async loginEmailPassword(email, password) {
|
|
4877
|
+
async loginEmailPassword(email, password, ecosystemGame) {
|
|
4765
4878
|
const request = {
|
|
4766
4879
|
loginRequest: {
|
|
4767
4880
|
email,
|
|
@@ -4769,9 +4882,10 @@ class AuthManager {
|
|
|
4769
4882
|
},
|
|
4770
4883
|
};
|
|
4771
4884
|
return withOpenfortError(async () => {
|
|
4772
|
-
const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request);
|
|
4885
|
+
const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4773
4886
|
return response.data;
|
|
4774
|
-
|
|
4887
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4888
|
+
}, { default: OpenfortErrorType.AUTHENTICATION_ERROR, 403: OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM });
|
|
4775
4889
|
}
|
|
4776
4890
|
async requestResetPassword(email, redirectUrl) {
|
|
4777
4891
|
const verifier = base64URLEncode(crypto.randomBytes(32));
|
|
@@ -4808,7 +4922,7 @@ class AuthManager {
|
|
|
4808
4922
|
},
|
|
4809
4923
|
};
|
|
4810
4924
|
await this.backendApiClients.authenticationApi.resetPassword(request);
|
|
4811
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4925
|
+
}, { default: OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4812
4926
|
}
|
|
4813
4927
|
async requestEmailVerification(email, redirectUrl) {
|
|
4814
4928
|
const verifier = base64URLEncode(crypto.randomBytes(32));
|
|
@@ -4844,9 +4958,9 @@ class AuthManager {
|
|
|
4844
4958
|
},
|
|
4845
4959
|
};
|
|
4846
4960
|
await this.backendApiClients.authenticationApi.verifyEmail(request);
|
|
4847
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4961
|
+
}, { default: OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4848
4962
|
}
|
|
4849
|
-
async signupEmailPassword(email, password, name) {
|
|
4963
|
+
async signupEmailPassword(email, password, name, ecosystemGame) {
|
|
4850
4964
|
const request = {
|
|
4851
4965
|
signupRequest: {
|
|
4852
4966
|
email,
|
|
@@ -4855,9 +4969,9 @@ class AuthManager {
|
|
|
4855
4969
|
},
|
|
4856
4970
|
};
|
|
4857
4971
|
return withOpenfortError(async () => {
|
|
4858
|
-
const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request);
|
|
4972
|
+
const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4859
4973
|
return response.data;
|
|
4860
|
-
}, OpenfortErrorType.USER_REGISTRATION_ERROR);
|
|
4974
|
+
}, { default: OpenfortErrorType.USER_REGISTRATION_ERROR });
|
|
4861
4975
|
}
|
|
4862
4976
|
async validateCredentials(forceRefresh) {
|
|
4863
4977
|
const jwk = await this.instanceManager.getJWK();
|
|
@@ -4904,7 +5018,7 @@ class AuthManager {
|
|
|
4904
5018
|
accessToken: response.data.token,
|
|
4905
5019
|
refreshToken: response.data.refreshToken,
|
|
4906
5020
|
};
|
|
4907
|
-
}, OpenfortErrorType.REFRESH_TOKEN_ERROR);
|
|
5021
|
+
}, { default: OpenfortErrorType.REFRESH_TOKEN_ERROR });
|
|
4908
5022
|
}
|
|
4909
5023
|
async logout(accessToken, refreshToken) {
|
|
4910
5024
|
const request = {
|
|
@@ -4920,7 +5034,7 @@ class AuthManager {
|
|
|
4920
5034
|
'x-player-token': accessToken,
|
|
4921
5035
|
},
|
|
4922
5036
|
});
|
|
4923
|
-
}, OpenfortErrorType.LOGOUT_ERROR);
|
|
5037
|
+
}, { default: OpenfortErrorType.LOGOUT_ERROR });
|
|
4924
5038
|
}
|
|
4925
5039
|
async getUser(accessToken) {
|
|
4926
5040
|
// TODO: Add storage of user info
|
|
@@ -4933,7 +5047,7 @@ class AuthManager {
|
|
|
4933
5047
|
});
|
|
4934
5048
|
return response.data;
|
|
4935
5049
|
}
|
|
4936
|
-
async linkOAuth(provider, playerToken, options) {
|
|
5050
|
+
async linkOAuth(provider, playerToken, options, ecosystemGame) {
|
|
4937
5051
|
const request = {
|
|
4938
5052
|
oAuthInitRequest: {
|
|
4939
5053
|
provider,
|
|
@@ -4946,6 +5060,8 @@ class AuthManager {
|
|
|
4946
5060
|
authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
|
|
4947
5061
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4948
5062
|
'x-player-token': playerToken,
|
|
5063
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5064
|
+
'x-game': ecosystemGame || undefined,
|
|
4949
5065
|
},
|
|
4950
5066
|
});
|
|
4951
5067
|
if (isBrowser() && !options?.skipBrowserRedirect) {
|
|
@@ -5019,7 +5135,7 @@ class AuthManager {
|
|
|
5019
5135
|
});
|
|
5020
5136
|
return authPlayerResponse.data;
|
|
5021
5137
|
}
|
|
5022
|
-
async linkEmail(email, password, accessToken) {
|
|
5138
|
+
async linkEmail(email, password, accessToken, ecosystemGame) {
|
|
5023
5139
|
const request = {
|
|
5024
5140
|
loginRequest: {
|
|
5025
5141
|
email,
|
|
@@ -5031,6 +5147,8 @@ class AuthManager {
|
|
|
5031
5147
|
authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
|
|
5032
5148
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5033
5149
|
'x-player-token': accessToken,
|
|
5150
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5151
|
+
'x-game': ecosystemGame || undefined,
|
|
5034
5152
|
},
|
|
5035
5153
|
});
|
|
5036
5154
|
return authPlayerResponse.data;
|
|
@@ -6013,11 +6131,12 @@ class Openfort {
|
|
|
6013
6131
|
*
|
|
6014
6132
|
* @param email - User's email.
|
|
6015
6133
|
* @param password - User's password.
|
|
6134
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6016
6135
|
* @returns An AuthResponse object containing authentication details.
|
|
6017
6136
|
*/
|
|
6018
|
-
async logInWithEmailPassword({ email, password }) {
|
|
6137
|
+
async logInWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6019
6138
|
this.logout();
|
|
6020
|
-
const result = await this.authManager.loginEmailPassword(email, password);
|
|
6139
|
+
const result = await this.authManager.loginEmailPassword(email, password, ecosystemGame);
|
|
6021
6140
|
this.storeCredentials({
|
|
6022
6141
|
player: result.player.id,
|
|
6023
6142
|
accessToken: result.token,
|
|
@@ -6031,11 +6150,12 @@ class Openfort {
|
|
|
6031
6150
|
* @param email - User's email.
|
|
6032
6151
|
* @param password - User's password.
|
|
6033
6152
|
* @param options - Additional options for the sign-up process.
|
|
6153
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6034
6154
|
* @returns An AuthResponse object containing authentication details.
|
|
6035
6155
|
*/
|
|
6036
|
-
async signUpWithEmailPassword({ email, password, options }) {
|
|
6156
|
+
async signUpWithEmailPassword({ email, password, options, ecosystemGame, }) {
|
|
6037
6157
|
this.logout();
|
|
6038
|
-
const result = await this.authManager.signupEmailPassword(email, password, options?.data.name);
|
|
6158
|
+
const result = await this.authManager.signupEmailPassword(email, password, options?.data.name, ecosystemGame);
|
|
6039
6159
|
this.storeCredentials({
|
|
6040
6160
|
player: result.player.id,
|
|
6041
6161
|
accessToken: result.token,
|
|
@@ -6049,11 +6169,11 @@ class Openfort {
|
|
|
6049
6169
|
* @param email - User's email.
|
|
6050
6170
|
* @param password - User's password.
|
|
6051
6171
|
* @param authToken - Authentication token.
|
|
6172
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6052
6173
|
* @returns An AuthPlayerResponse object.
|
|
6053
6174
|
*/
|
|
6054
|
-
async linkEmailPassword({ email, password, authToken }) {
|
|
6055
|
-
|
|
6056
|
-
return result;
|
|
6175
|
+
async linkEmailPassword({ email, password, authToken, ecosystemGame, }) {
|
|
6176
|
+
return await this.authManager.linkEmail(email, password, authToken, ecosystemGame);
|
|
6057
6177
|
}
|
|
6058
6178
|
/**
|
|
6059
6179
|
* Unlinks an email and password from an existing account using an authentication token.
|
|
@@ -6063,8 +6183,7 @@ class Openfort {
|
|
|
6063
6183
|
* @returns An AuthPlayerResponse object.
|
|
6064
6184
|
*/
|
|
6065
6185
|
async unlinkEmailPassword({ email, authToken }) {
|
|
6066
|
-
|
|
6067
|
-
return result;
|
|
6186
|
+
return await this.authManager.unlinkEmail(email, authToken);
|
|
6068
6187
|
}
|
|
6069
6188
|
/**
|
|
6070
6189
|
* Requests an email verification link.
|
|
@@ -6108,12 +6227,12 @@ class Openfort {
|
|
|
6108
6227
|
*
|
|
6109
6228
|
* @param provider - OAuth provider.
|
|
6110
6229
|
* @param options - Additional options for initialization.
|
|
6230
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6111
6231
|
* @returns An InitAuthResponse object.
|
|
6112
6232
|
*/
|
|
6113
|
-
async initOAuth({ provider, options }) {
|
|
6233
|
+
async initOAuth({ provider, options, ecosystemGame }) {
|
|
6114
6234
|
this.logout();
|
|
6115
|
-
|
|
6116
|
-
return authResponse;
|
|
6235
|
+
return await this.authManager.initOAuth(provider, options, ecosystemGame);
|
|
6117
6236
|
}
|
|
6118
6237
|
/**
|
|
6119
6238
|
* Initializes an OAuth linking process.
|
|
@@ -6121,10 +6240,11 @@ class Openfort {
|
|
|
6121
6240
|
* @param provider - OAuth provider.
|
|
6122
6241
|
* @param authToken - Authentication token.
|
|
6123
6242
|
* @param options - Additional options for initialization.
|
|
6243
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6124
6244
|
* @returns An InitAuthResponse object.
|
|
6125
6245
|
*/
|
|
6126
|
-
async initLinkOAuth({ provider, authToken, options }) {
|
|
6127
|
-
return await this.authManager.linkOAuth(provider, authToken, options);
|
|
6246
|
+
async initLinkOAuth({ provider, authToken, options, ecosystemGame, }) {
|
|
6247
|
+
return await this.authManager.linkOAuth(provider, authToken, options, ecosystemGame);
|
|
6128
6248
|
}
|
|
6129
6249
|
/**
|
|
6130
6250
|
* Unlinks an OAuth provider from the account.
|
|
@@ -6134,8 +6254,7 @@ class Openfort {
|
|
|
6134
6254
|
* @returns An AuthPlayerResponse object.
|
|
6135
6255
|
*/
|
|
6136
6256
|
async unlinkOAuth({ provider, authToken }) {
|
|
6137
|
-
|
|
6138
|
-
return result;
|
|
6257
|
+
return await this.authManager.unlinkOAuth(provider, authToken);
|
|
6139
6258
|
}
|
|
6140
6259
|
/**
|
|
6141
6260
|
* Polls for OAuth authentication completion.
|
|
@@ -6152,10 +6271,11 @@ class Openfort {
|
|
|
6152
6271
|
* @param provider - Third-party OAuth provider.
|
|
6153
6272
|
* @param token - OAuth token.
|
|
6154
6273
|
* @param tokenType - Type of the OAuth token.
|
|
6274
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6155
6275
|
* @returns An AuthPlayerResponse object.
|
|
6156
6276
|
*/
|
|
6157
|
-
async authenticateWithThirdPartyProvider({ provider, token, tokenType }) {
|
|
6158
|
-
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType);
|
|
6277
|
+
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6278
|
+
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6159
6279
|
this.instanceManager.setAccessToken({
|
|
6160
6280
|
token,
|
|
6161
6281
|
thirdPartyProvider: provider,
|
|
@@ -6171,10 +6291,11 @@ class Openfort {
|
|
|
6171
6291
|
* Initializes Sign-In with Ethereum (SIWE).
|
|
6172
6292
|
*
|
|
6173
6293
|
* @param address - Ethereum address.
|
|
6294
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6174
6295
|
* @returns A SIWEInitResponse object.
|
|
6175
6296
|
*/
|
|
6176
|
-
async initSIWE({ address }) {
|
|
6177
|
-
return await this.authManager.initSIWE(address);
|
|
6297
|
+
async initSIWE({ address, ecosystemGame }) {
|
|
6298
|
+
return await this.authManager.initSIWE(address, ecosystemGame);
|
|
6178
6299
|
}
|
|
6179
6300
|
/**
|
|
6180
6301
|
* Authenticates using Sign-In with Ethereum (SIWE).
|
|
@@ -6208,8 +6329,7 @@ class Openfort {
|
|
|
6208
6329
|
* @returns An AuthPlayerResponse object.
|
|
6209
6330
|
*/
|
|
6210
6331
|
async linkWallet({ signature, message, walletClientType, connectorType, authToken, }) {
|
|
6211
|
-
|
|
6212
|
-
return result;
|
|
6332
|
+
return await this.authManager.linkWallet(signature, message, walletClientType, connectorType, authToken);
|
|
6213
6333
|
}
|
|
6214
6334
|
/**
|
|
6215
6335
|
* Unlinks a wallet.
|
|
@@ -6219,8 +6339,7 @@ class Openfort {
|
|
|
6219
6339
|
* @returns An AuthPlayerResponse object.
|
|
6220
6340
|
*/
|
|
6221
6341
|
async unlinkWallet({ address, authToken }) {
|
|
6222
|
-
|
|
6223
|
-
return result;
|
|
6342
|
+
return await this.authManager.unlinkWallet(address, authToken);
|
|
6224
6343
|
}
|
|
6225
6344
|
/**
|
|
6226
6345
|
* Stores authentication credentials.
|
|
@@ -6517,4 +6636,4 @@ class Openfort {
|
|
|
6517
6636
|
}
|
|
6518
6637
|
}
|
|
6519
6638
|
|
|
6520
|
-
export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, OpenfortError, SDKConfiguration, ShieldAuthType, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };
|
|
6639
|
+
export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, OpenfortError, OpenfortErrorType, SDKConfiguration, ShieldAuthType, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };
|