@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.cjs
CHANGED
|
@@ -467,7 +467,7 @@ const AccountsApiAxiosParamCreator = function (configuration) {
|
|
|
467
467
|
};
|
|
468
468
|
},
|
|
469
469
|
/**
|
|
470
|
-
* **Custodial Accounts only** - Signs the typed
|
|
470
|
+
* **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.
|
|
471
471
|
* @summary Sign a given payload
|
|
472
472
|
* @param {string} id Specifies the unique account ID (starts with acc_).
|
|
473
473
|
* @param {SignPayloadRequest} signPayloadRequest
|
|
@@ -668,7 +668,7 @@ const AccountsApiFp = function (configuration) {
|
|
|
668
668
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
669
669
|
},
|
|
670
670
|
/**
|
|
671
|
-
* **Custodial Accounts only** - Signs the typed
|
|
671
|
+
* **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.
|
|
672
672
|
* @summary Sign a given payload
|
|
673
673
|
* @param {string} id Specifies the unique account ID (starts with acc_).
|
|
674
674
|
* @param {SignPayloadRequest} signPayloadRequest
|
|
@@ -789,7 +789,7 @@ class AccountsApi extends BaseAPI {
|
|
|
789
789
|
return AccountsApiFp(this.configuration).requestTransferOwnership(requestParameters.id, requestParameters.transferOwnershipRequest, options).then((request) => request(this.axios, this.basePath));
|
|
790
790
|
}
|
|
791
791
|
/**
|
|
792
|
-
* **Custodial Accounts only** - Signs the typed
|
|
792
|
+
* **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.
|
|
793
793
|
* @summary Sign a given payload
|
|
794
794
|
* @param {AccountsApiSignPayloadRequest} requestParameters Request parameters.
|
|
795
795
|
* @param {*} [options] Override http request option.
|
|
@@ -847,6 +847,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
847
847
|
* @summary Authenticate player with oauth token.
|
|
848
848
|
* @param {AuthenticateOAuthRequest} authenticateOAuthRequest
|
|
849
849
|
* @param {*} [options] Override http request option.
|
|
850
|
+
* @deprecated
|
|
850
851
|
* @throws {RequiredError}
|
|
851
852
|
*/
|
|
852
853
|
authenticateOAuth: async (authenticateOAuthRequest, options = {}) => {
|
|
@@ -908,6 +909,38 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
908
909
|
options: localVarRequestOptions,
|
|
909
910
|
};
|
|
910
911
|
},
|
|
912
|
+
/**
|
|
913
|
+
*
|
|
914
|
+
* @param {AuthorizePlayerRequest} authorizePlayerRequest
|
|
915
|
+
* @param {*} [options] Override http request option.
|
|
916
|
+
* @throws {RequiredError}
|
|
917
|
+
*/
|
|
918
|
+
authorize: async (authorizePlayerRequest, options = {}) => {
|
|
919
|
+
// verify required parameter 'authorizePlayerRequest' is not null or undefined
|
|
920
|
+
assertParamExists('authorize', 'authorizePlayerRequest', authorizePlayerRequest);
|
|
921
|
+
const localVarPath = `/iam/v1/authorize`;
|
|
922
|
+
// use dummy base URL string because the URL constructor only accepts absolute URLs.
|
|
923
|
+
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
|
|
924
|
+
let baseOptions;
|
|
925
|
+
if (configuration) {
|
|
926
|
+
baseOptions = configuration.baseOptions;
|
|
927
|
+
}
|
|
928
|
+
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
929
|
+
const localVarHeaderParameter = {};
|
|
930
|
+
const localVarQueryParameter = {};
|
|
931
|
+
// authentication sk required
|
|
932
|
+
// http bearer authentication required
|
|
933
|
+
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
934
|
+
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
935
|
+
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
936
|
+
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
937
|
+
localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
|
|
938
|
+
localVarRequestOptions.data = serializeDataIfNeeded(authorizePlayerRequest, localVarRequestOptions, configuration);
|
|
939
|
+
return {
|
|
940
|
+
url: toPathString(localVarUrlObj),
|
|
941
|
+
options: localVarRequestOptions,
|
|
942
|
+
};
|
|
943
|
+
},
|
|
911
944
|
/**
|
|
912
945
|
* 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.
|
|
913
946
|
* @summary Authorize player with token.
|
|
@@ -982,10 +1015,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
982
1015
|
*
|
|
983
1016
|
* @summary Initialize OAuth.
|
|
984
1017
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1018
|
+
* @param {string} [xGame]
|
|
985
1019
|
* @param {*} [options] Override http request option.
|
|
986
1020
|
* @throws {RequiredError}
|
|
987
1021
|
*/
|
|
988
|
-
initOAuth: async (oAuthInitRequest, options = {}) => {
|
|
1022
|
+
initOAuth: async (oAuthInitRequest, xGame, options = {}) => {
|
|
989
1023
|
// verify required parameter 'oAuthInitRequest' is not null or undefined
|
|
990
1024
|
assertParamExists('initOAuth', 'oAuthInitRequest', oAuthInitRequest);
|
|
991
1025
|
const localVarPath = `/iam/v1/oauth/init`;
|
|
@@ -1001,6 +1035,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1001
1035
|
// authentication pk required
|
|
1002
1036
|
// http bearer authentication required
|
|
1003
1037
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1038
|
+
if (xGame != null) {
|
|
1039
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1040
|
+
}
|
|
1004
1041
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1005
1042
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1006
1043
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1015,10 +1052,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1015
1052
|
* Create a challenge to link external wallet to the player.
|
|
1016
1053
|
* @summary Initialize SIWE.
|
|
1017
1054
|
* @param {SIWERequest} sIWERequest
|
|
1055
|
+
* @param {string} [xGame]
|
|
1018
1056
|
* @param {*} [options] Override http request option.
|
|
1019
1057
|
* @throws {RequiredError}
|
|
1020
1058
|
*/
|
|
1021
|
-
initSIWE: async (sIWERequest, options = {}) => {
|
|
1059
|
+
initSIWE: async (sIWERequest, xGame, options = {}) => {
|
|
1022
1060
|
// verify required parameter 'sIWERequest' is not null or undefined
|
|
1023
1061
|
assertParamExists('initSIWE', 'sIWERequest', sIWERequest);
|
|
1024
1062
|
const localVarPath = `/iam/v1/siwe/init`;
|
|
@@ -1034,6 +1072,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1034
1072
|
// authentication pk required
|
|
1035
1073
|
// http bearer authentication required
|
|
1036
1074
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1075
|
+
if (xGame != null) {
|
|
1076
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1077
|
+
}
|
|
1037
1078
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1038
1079
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1039
1080
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1047,10 +1088,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1047
1088
|
/**
|
|
1048
1089
|
*
|
|
1049
1090
|
* @param {LoginRequest} loginRequest
|
|
1091
|
+
* @param {string} [xGame]
|
|
1050
1092
|
* @param {*} [options] Override http request option.
|
|
1051
1093
|
* @throws {RequiredError}
|
|
1052
1094
|
*/
|
|
1053
|
-
linkEmail: async (loginRequest, options = {}) => {
|
|
1095
|
+
linkEmail: async (loginRequest, xGame, options = {}) => {
|
|
1054
1096
|
// verify required parameter 'loginRequest' is not null or undefined
|
|
1055
1097
|
assertParamExists('linkEmail', 'loginRequest', loginRequest);
|
|
1056
1098
|
const localVarPath = `/iam/v1/password/link`;
|
|
@@ -1063,6 +1105,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1063
1105
|
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
1064
1106
|
const localVarHeaderParameter = {};
|
|
1065
1107
|
const localVarQueryParameter = {};
|
|
1108
|
+
if (xGame != null) {
|
|
1109
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1110
|
+
}
|
|
1066
1111
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1067
1112
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1068
1113
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1077,10 +1122,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1077
1122
|
*
|
|
1078
1123
|
* @summary Initialize Link OAuth.
|
|
1079
1124
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1125
|
+
* @param {string} [xGame]
|
|
1080
1126
|
* @param {*} [options] Override http request option.
|
|
1081
1127
|
* @throws {RequiredError}
|
|
1082
1128
|
*/
|
|
1083
|
-
linkOAuth: async (oAuthInitRequest, options = {}) => {
|
|
1129
|
+
linkOAuth: async (oAuthInitRequest, xGame, options = {}) => {
|
|
1084
1130
|
// verify required parameter 'oAuthInitRequest' is not null or undefined
|
|
1085
1131
|
assertParamExists('linkOAuth', 'oAuthInitRequest', oAuthInitRequest);
|
|
1086
1132
|
const localVarPath = `/iam/v1/oauth/init_link`;
|
|
@@ -1093,6 +1139,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1093
1139
|
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
|
|
1094
1140
|
const localVarHeaderParameter = {};
|
|
1095
1141
|
const localVarQueryParameter = {};
|
|
1142
|
+
if (xGame != null) {
|
|
1143
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1144
|
+
}
|
|
1096
1145
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1097
1146
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1098
1147
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1137,10 +1186,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1137
1186
|
* Authenticate a player based on email and password.
|
|
1138
1187
|
* @summary Email and password login.
|
|
1139
1188
|
* @param {LoginRequest} loginRequest
|
|
1189
|
+
* @param {string} [xGame]
|
|
1140
1190
|
* @param {*} [options] Override http request option.
|
|
1141
1191
|
* @throws {RequiredError}
|
|
1142
1192
|
*/
|
|
1143
|
-
loginEmailPassword: async (loginRequest, options = {}) => {
|
|
1193
|
+
loginEmailPassword: async (loginRequest, xGame, options = {}) => {
|
|
1144
1194
|
// verify required parameter 'loginRequest' is not null or undefined
|
|
1145
1195
|
assertParamExists('loginEmailPassword', 'loginRequest', loginRequest);
|
|
1146
1196
|
const localVarPath = `/iam/v1/password/login`;
|
|
@@ -1156,6 +1206,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1156
1206
|
// authentication pk required
|
|
1157
1207
|
// http bearer authentication required
|
|
1158
1208
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1209
|
+
if (xGame != null) {
|
|
1210
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1211
|
+
}
|
|
1159
1212
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1160
1213
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1161
1214
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1390,10 +1443,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1390
1443
|
* Create and authenticate a player based on email and password.
|
|
1391
1444
|
* @summary Email and password signup.
|
|
1392
1445
|
* @param {SignupRequest} signupRequest
|
|
1446
|
+
* @param {string} [xGame]
|
|
1393
1447
|
* @param {*} [options] Override http request option.
|
|
1394
1448
|
* @throws {RequiredError}
|
|
1395
1449
|
*/
|
|
1396
|
-
signupEmailPassword: async (signupRequest, options = {}) => {
|
|
1450
|
+
signupEmailPassword: async (signupRequest, xGame, options = {}) => {
|
|
1397
1451
|
// verify required parameter 'signupRequest' is not null or undefined
|
|
1398
1452
|
assertParamExists('signupEmailPassword', 'signupRequest', signupRequest);
|
|
1399
1453
|
const localVarPath = `/iam/v1/password/signup`;
|
|
@@ -1409,6 +1463,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1409
1463
|
// authentication pk required
|
|
1410
1464
|
// http bearer authentication required
|
|
1411
1465
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1466
|
+
if (xGame != null) {
|
|
1467
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1468
|
+
}
|
|
1412
1469
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1413
1470
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1414
1471
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1423,10 +1480,11 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1423
1480
|
*
|
|
1424
1481
|
* @summary Verify oauth token of a third party auth provider.
|
|
1425
1482
|
* @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
|
|
1483
|
+
* @param {string} [xGame]
|
|
1426
1484
|
* @param {*} [options] Override http request option.
|
|
1427
1485
|
* @throws {RequiredError}
|
|
1428
1486
|
*/
|
|
1429
|
-
thirdParty: async (thirdPartyOAuthRequest, options = {}) => {
|
|
1487
|
+
thirdParty: async (thirdPartyOAuthRequest, xGame, options = {}) => {
|
|
1430
1488
|
// verify required parameter 'thirdPartyOAuthRequest' is not null or undefined
|
|
1431
1489
|
assertParamExists('thirdParty', 'thirdPartyOAuthRequest', thirdPartyOAuthRequest);
|
|
1432
1490
|
const localVarPath = `/iam/v1/oauth/third_party`;
|
|
@@ -1442,6 +1500,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
|
|
|
1442
1500
|
// authentication pk required
|
|
1443
1501
|
// http bearer authentication required
|
|
1444
1502
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
1503
|
+
if (xGame != null) {
|
|
1504
|
+
localVarHeaderParameter['x-game'] = String(xGame);
|
|
1505
|
+
}
|
|
1445
1506
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
1446
1507
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
1447
1508
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -1659,6 +1720,7 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1659
1720
|
* @summary Authenticate player with oauth token.
|
|
1660
1721
|
* @param {AuthenticateOAuthRequest} authenticateOAuthRequest
|
|
1661
1722
|
* @param {*} [options] Override http request option.
|
|
1723
|
+
* @deprecated
|
|
1662
1724
|
* @throws {RequiredError}
|
|
1663
1725
|
*/
|
|
1664
1726
|
async authenticateOAuth(authenticateOAuthRequest, options) {
|
|
@@ -1676,6 +1738,16 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1676
1738
|
const localVarAxiosArgs = await localVarAxiosParamCreator.authenticateSIWE(sIWEAuthenticateRequest, options);
|
|
1677
1739
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1678
1740
|
},
|
|
1741
|
+
/**
|
|
1742
|
+
*
|
|
1743
|
+
* @param {AuthorizePlayerRequest} authorizePlayerRequest
|
|
1744
|
+
* @param {*} [options] Override http request option.
|
|
1745
|
+
* @throws {RequiredError}
|
|
1746
|
+
*/
|
|
1747
|
+
async authorize(authorizePlayerRequest, options) {
|
|
1748
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.authorize(authorizePlayerRequest, options);
|
|
1749
|
+
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1750
|
+
},
|
|
1679
1751
|
/**
|
|
1680
1752
|
* 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.
|
|
1681
1753
|
* @summary Authorize player with token.
|
|
@@ -1704,43 +1776,47 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1704
1776
|
*
|
|
1705
1777
|
* @summary Initialize OAuth.
|
|
1706
1778
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1779
|
+
* @param {string} [xGame]
|
|
1707
1780
|
* @param {*} [options] Override http request option.
|
|
1708
1781
|
* @throws {RequiredError}
|
|
1709
1782
|
*/
|
|
1710
|
-
async initOAuth(oAuthInitRequest, options) {
|
|
1711
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.initOAuth(oAuthInitRequest, options);
|
|
1783
|
+
async initOAuth(oAuthInitRequest, xGame, options) {
|
|
1784
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.initOAuth(oAuthInitRequest, xGame, options);
|
|
1712
1785
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1713
1786
|
},
|
|
1714
1787
|
/**
|
|
1715
1788
|
* Create a challenge to link external wallet to the player.
|
|
1716
1789
|
* @summary Initialize SIWE.
|
|
1717
1790
|
* @param {SIWERequest} sIWERequest
|
|
1791
|
+
* @param {string} [xGame]
|
|
1718
1792
|
* @param {*} [options] Override http request option.
|
|
1719
1793
|
* @throws {RequiredError}
|
|
1720
1794
|
*/
|
|
1721
|
-
async initSIWE(sIWERequest, options) {
|
|
1722
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, options);
|
|
1795
|
+
async initSIWE(sIWERequest, xGame, options) {
|
|
1796
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, xGame, options);
|
|
1723
1797
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1724
1798
|
},
|
|
1725
1799
|
/**
|
|
1726
1800
|
*
|
|
1727
1801
|
* @param {LoginRequest} loginRequest
|
|
1802
|
+
* @param {string} [xGame]
|
|
1728
1803
|
* @param {*} [options] Override http request option.
|
|
1729
1804
|
* @throws {RequiredError}
|
|
1730
1805
|
*/
|
|
1731
|
-
async linkEmail(loginRequest, options) {
|
|
1732
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.linkEmail(loginRequest, options);
|
|
1806
|
+
async linkEmail(loginRequest, xGame, options) {
|
|
1807
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.linkEmail(loginRequest, xGame, options);
|
|
1733
1808
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1734
1809
|
},
|
|
1735
1810
|
/**
|
|
1736
1811
|
*
|
|
1737
1812
|
* @summary Initialize Link OAuth.
|
|
1738
1813
|
* @param {OAuthInitRequest} oAuthInitRequest
|
|
1814
|
+
* @param {string} [xGame]
|
|
1739
1815
|
* @param {*} [options] Override http request option.
|
|
1740
1816
|
* @throws {RequiredError}
|
|
1741
1817
|
*/
|
|
1742
|
-
async linkOAuth(oAuthInitRequest, options) {
|
|
1743
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.linkOAuth(oAuthInitRequest, options);
|
|
1818
|
+
async linkOAuth(oAuthInitRequest, xGame, options) {
|
|
1819
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.linkOAuth(oAuthInitRequest, xGame, options);
|
|
1744
1820
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1745
1821
|
},
|
|
1746
1822
|
/**
|
|
@@ -1758,11 +1834,12 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1758
1834
|
* Authenticate a player based on email and password.
|
|
1759
1835
|
* @summary Email and password login.
|
|
1760
1836
|
* @param {LoginRequest} loginRequest
|
|
1837
|
+
* @param {string} [xGame]
|
|
1761
1838
|
* @param {*} [options] Override http request option.
|
|
1762
1839
|
* @throws {RequiredError}
|
|
1763
1840
|
*/
|
|
1764
|
-
async loginEmailPassword(loginRequest, options) {
|
|
1765
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.loginEmailPassword(loginRequest, options);
|
|
1841
|
+
async loginEmailPassword(loginRequest, xGame, options) {
|
|
1842
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.loginEmailPassword(loginRequest, xGame, options);
|
|
1766
1843
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1767
1844
|
},
|
|
1768
1845
|
/**
|
|
@@ -1844,22 +1921,24 @@ const AuthenticationApiFp = function (configuration) {
|
|
|
1844
1921
|
* Create and authenticate a player based on email and password.
|
|
1845
1922
|
* @summary Email and password signup.
|
|
1846
1923
|
* @param {SignupRequest} signupRequest
|
|
1924
|
+
* @param {string} [xGame]
|
|
1847
1925
|
* @param {*} [options] Override http request option.
|
|
1848
1926
|
* @throws {RequiredError}
|
|
1849
1927
|
*/
|
|
1850
|
-
async signupEmailPassword(signupRequest, options) {
|
|
1851
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.signupEmailPassword(signupRequest, options);
|
|
1928
|
+
async signupEmailPassword(signupRequest, xGame, options) {
|
|
1929
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.signupEmailPassword(signupRequest, xGame, options);
|
|
1852
1930
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1853
1931
|
},
|
|
1854
1932
|
/**
|
|
1855
1933
|
*
|
|
1856
1934
|
* @summary Verify oauth token of a third party auth provider.
|
|
1857
1935
|
* @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
|
|
1936
|
+
* @param {string} [xGame]
|
|
1858
1937
|
* @param {*} [options] Override http request option.
|
|
1859
1938
|
* @throws {RequiredError}
|
|
1860
1939
|
*/
|
|
1861
|
-
async thirdParty(thirdPartyOAuthRequest, options) {
|
|
1862
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, options);
|
|
1940
|
+
async thirdParty(thirdPartyOAuthRequest, xGame, options) {
|
|
1941
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, xGame, options);
|
|
1863
1942
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
1864
1943
|
},
|
|
1865
1944
|
/**
|
|
@@ -1943,6 +2022,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1943
2022
|
* @summary Authenticate player with oauth token.
|
|
1944
2023
|
* @param {AuthenticationApiAuthenticateOAuthRequest} requestParameters Request parameters.
|
|
1945
2024
|
* @param {*} [options] Override http request option.
|
|
2025
|
+
* @deprecated
|
|
1946
2026
|
* @throws {RequiredError}
|
|
1947
2027
|
* @memberof AuthenticationApi
|
|
1948
2028
|
*/
|
|
@@ -1960,6 +2040,16 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1960
2040
|
authenticateSIWE(requestParameters, options) {
|
|
1961
2041
|
return AuthenticationApiFp(this.configuration).authenticateSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(this.axios, this.basePath));
|
|
1962
2042
|
}
|
|
2043
|
+
/**
|
|
2044
|
+
*
|
|
2045
|
+
* @param {AuthenticationApiAuthorizeRequest} requestParameters Request parameters.
|
|
2046
|
+
* @param {*} [options] Override http request option.
|
|
2047
|
+
* @throws {RequiredError}
|
|
2048
|
+
* @memberof AuthenticationApi
|
|
2049
|
+
*/
|
|
2050
|
+
authorize(requestParameters, options) {
|
|
2051
|
+
return AuthenticationApiFp(this.configuration).authorize(requestParameters.authorizePlayerRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2052
|
+
}
|
|
1963
2053
|
/**
|
|
1964
2054
|
* 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.
|
|
1965
2055
|
* @summary Authorize player with token.
|
|
@@ -1992,7 +2082,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
1992
2082
|
* @memberof AuthenticationApi
|
|
1993
2083
|
*/
|
|
1994
2084
|
initOAuth(requestParameters, options) {
|
|
1995
|
-
return AuthenticationApiFp(this.configuration).initOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2085
|
+
return AuthenticationApiFp(this.configuration).initOAuth(requestParameters.oAuthInitRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
1996
2086
|
}
|
|
1997
2087
|
/**
|
|
1998
2088
|
* Create a challenge to link external wallet to the player.
|
|
@@ -2003,7 +2093,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2003
2093
|
* @memberof AuthenticationApi
|
|
2004
2094
|
*/
|
|
2005
2095
|
initSIWE(requestParameters, options) {
|
|
2006
|
-
return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
|
|
2096
|
+
return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2007
2097
|
}
|
|
2008
2098
|
/**
|
|
2009
2099
|
*
|
|
@@ -2013,7 +2103,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2013
2103
|
* @memberof AuthenticationApi
|
|
2014
2104
|
*/
|
|
2015
2105
|
linkEmail(requestParameters, options) {
|
|
2016
|
-
return AuthenticationApiFp(this.configuration).linkEmail(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2106
|
+
return AuthenticationApiFp(this.configuration).linkEmail(requestParameters.loginRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2017
2107
|
}
|
|
2018
2108
|
/**
|
|
2019
2109
|
*
|
|
@@ -2024,7 +2114,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2024
2114
|
* @memberof AuthenticationApi
|
|
2025
2115
|
*/
|
|
2026
2116
|
linkOAuth(requestParameters, options) {
|
|
2027
|
-
return AuthenticationApiFp(this.configuration).linkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2117
|
+
return AuthenticationApiFp(this.configuration).linkOAuth(requestParameters.oAuthInitRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2028
2118
|
}
|
|
2029
2119
|
/**
|
|
2030
2120
|
*
|
|
@@ -2046,7 +2136,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2046
2136
|
* @memberof AuthenticationApi
|
|
2047
2137
|
*/
|
|
2048
2138
|
loginEmailPassword(requestParameters, options) {
|
|
2049
|
-
return AuthenticationApiFp(this.configuration).loginEmailPassword(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2139
|
+
return AuthenticationApiFp(this.configuration).loginEmailPassword(requestParameters.loginRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2050
2140
|
}
|
|
2051
2141
|
/**
|
|
2052
2142
|
* When using Openfort Auth, the endpoint logs out the player.
|
|
@@ -2132,7 +2222,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2132
2222
|
* @memberof AuthenticationApi
|
|
2133
2223
|
*/
|
|
2134
2224
|
signupEmailPassword(requestParameters, options) {
|
|
2135
|
-
return AuthenticationApiFp(this.configuration).signupEmailPassword(requestParameters.signupRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2225
|
+
return AuthenticationApiFp(this.configuration).signupEmailPassword(requestParameters.signupRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2136
2226
|
}
|
|
2137
2227
|
/**
|
|
2138
2228
|
*
|
|
@@ -2143,7 +2233,7 @@ class AuthenticationApi extends BaseAPI {
|
|
|
2143
2233
|
* @memberof AuthenticationApi
|
|
2144
2234
|
*/
|
|
2145
2235
|
thirdParty(requestParameters, options) {
|
|
2146
|
-
return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2236
|
+
return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, requestParameters.xGame, options).then((request) => request(this.axios, this.basePath));
|
|
2147
2237
|
}
|
|
2148
2238
|
/**
|
|
2149
2239
|
*
|
|
@@ -2583,10 +2673,11 @@ const TransactionIntentsApiAxiosParamCreator = function (configuration) {
|
|
|
2583
2673
|
* 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.
|
|
2584
2674
|
* @summary Create a transaction intent object.
|
|
2585
2675
|
* @param {CreateTransactionIntentRequest} createTransactionIntentRequest
|
|
2676
|
+
* @param {string} [xBehalfOfProject]
|
|
2586
2677
|
* @param {*} [options] Override http request option.
|
|
2587
2678
|
* @throws {RequiredError}
|
|
2588
2679
|
*/
|
|
2589
|
-
createTransactionIntent: async (createTransactionIntentRequest, options = {}) => {
|
|
2680
|
+
createTransactionIntent: async (createTransactionIntentRequest, xBehalfOfProject, options = {}) => {
|
|
2590
2681
|
// verify required parameter 'createTransactionIntentRequest' is not null or undefined
|
|
2591
2682
|
assertParamExists('createTransactionIntent', 'createTransactionIntentRequest', createTransactionIntentRequest);
|
|
2592
2683
|
const localVarPath = `/v1/transaction_intents`;
|
|
@@ -2602,6 +2693,9 @@ const TransactionIntentsApiAxiosParamCreator = function (configuration) {
|
|
|
2602
2693
|
// authentication sk required
|
|
2603
2694
|
// http bearer authentication required
|
|
2604
2695
|
await setBearerAuthToObject(localVarHeaderParameter, configuration);
|
|
2696
|
+
if (xBehalfOfProject != null) {
|
|
2697
|
+
localVarHeaderParameter['X-Behalf-Of-Project'] = String(xBehalfOfProject);
|
|
2698
|
+
}
|
|
2605
2699
|
localVarHeaderParameter['Content-Type'] = 'application/json';
|
|
2606
2700
|
setSearchParams(localVarUrlObj, localVarQueryParameter);
|
|
2607
2701
|
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
|
|
@@ -2798,11 +2892,12 @@ const TransactionIntentsApiFp = function (configuration) {
|
|
|
2798
2892
|
* 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.
|
|
2799
2893
|
* @summary Create a transaction intent object.
|
|
2800
2894
|
* @param {CreateTransactionIntentRequest} createTransactionIntentRequest
|
|
2895
|
+
* @param {string} [xBehalfOfProject]
|
|
2801
2896
|
* @param {*} [options] Override http request option.
|
|
2802
2897
|
* @throws {RequiredError}
|
|
2803
2898
|
*/
|
|
2804
|
-
async createTransactionIntent(createTransactionIntentRequest, options) {
|
|
2805
|
-
const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionIntent(createTransactionIntentRequest, options);
|
|
2899
|
+
async createTransactionIntent(createTransactionIntentRequest, xBehalfOfProject, options) {
|
|
2900
|
+
const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionIntent(createTransactionIntentRequest, xBehalfOfProject, options);
|
|
2806
2901
|
return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
|
|
2807
2902
|
},
|
|
2808
2903
|
/**
|
|
@@ -2877,7 +2972,7 @@ class TransactionIntentsApi extends BaseAPI {
|
|
|
2877
2972
|
* @memberof TransactionIntentsApi
|
|
2878
2973
|
*/
|
|
2879
2974
|
createTransactionIntent(requestParameters, options) {
|
|
2880
|
-
return TransactionIntentsApiFp(this.configuration).createTransactionIntent(requestParameters.createTransactionIntentRequest, options).then((request) => request(this.axios, this.basePath));
|
|
2975
|
+
return TransactionIntentsApiFp(this.configuration).createTransactionIntent(requestParameters.createTransactionIntentRequest, requestParameters.xBehalfOfProject, options).then((request) => request(this.axios, this.basePath));
|
|
2881
2976
|
}
|
|
2882
2977
|
/**
|
|
2883
2978
|
* 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.
|
|
@@ -3100,57 +3195,6 @@ var CodeChallengeMethodEnum;
|
|
|
3100
3195
|
CodeChallengeMethodEnum["S256"] = "S256";
|
|
3101
3196
|
})(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
|
|
3102
3197
|
|
|
3103
|
-
var OpenfortErrorType;
|
|
3104
|
-
(function (OpenfortErrorType) {
|
|
3105
|
-
OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
3106
|
-
OpenfortErrorType["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
|
|
3107
|
-
OpenfortErrorType["NOT_LOGGED_IN_ERROR"] = "NOT_LOGGED_IN_ERROR";
|
|
3108
|
-
OpenfortErrorType["REFRESH_TOKEN_ERROR"] = "REFRESH_TOKEN_ERROR";
|
|
3109
|
-
OpenfortErrorType["USER_REGISTRATION_ERROR"] = "USER_REGISTRATION_ERROR";
|
|
3110
|
-
OpenfortErrorType["LOGOUT_ERROR"] = "LOGOUT_ERROR";
|
|
3111
|
-
OpenfortErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
|
|
3112
|
-
OpenfortErrorType["MISSING_SESSION_SIGNER_ERROR"] = "MISSING_SESSION_SIGNER_ERROR";
|
|
3113
|
-
OpenfortErrorType["MISSING_EMBEDDED_SIGNER_ERROR"] = "MISSING_EMBEDDED_SIGNER_ERROR";
|
|
3114
|
-
OpenfortErrorType["MISSING_SIGNER_ERROR"] = "MISSING_SIGNER_ERROR";
|
|
3115
|
-
})(OpenfortErrorType || (OpenfortErrorType = {}));
|
|
3116
|
-
function isAPIError(error) {
|
|
3117
|
-
return 'type' in error && 'message' in error;
|
|
3118
|
-
}
|
|
3119
|
-
class OpenfortError extends Error {
|
|
3120
|
-
type;
|
|
3121
|
-
constructor(message, type) {
|
|
3122
|
-
super(message);
|
|
3123
|
-
this.type = type;
|
|
3124
|
-
}
|
|
3125
|
-
}
|
|
3126
|
-
const withOpenfortError = async (fn, customErrorType) => {
|
|
3127
|
-
try {
|
|
3128
|
-
return await fn();
|
|
3129
|
-
}
|
|
3130
|
-
catch (error) {
|
|
3131
|
-
let errorMessage;
|
|
3132
|
-
if (globalAxios.isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
|
|
3133
|
-
errorMessage = error.response.data.message;
|
|
3134
|
-
}
|
|
3135
|
-
else {
|
|
3136
|
-
errorMessage = error.message;
|
|
3137
|
-
}
|
|
3138
|
-
throw new OpenfortError(errorMessage, customErrorType);
|
|
3139
|
-
}
|
|
3140
|
-
};
|
|
3141
|
-
|
|
3142
|
-
const validateConfiguration = (configuration, requiredKeys, prefix) => {
|
|
3143
|
-
const missingKeys = requiredKeys
|
|
3144
|
-
.map((key) => !configuration[key] && key)
|
|
3145
|
-
.filter((n) => n)
|
|
3146
|
-
.join(', ');
|
|
3147
|
-
if (missingKeys !== '') {
|
|
3148
|
-
const errorMessage = prefix
|
|
3149
|
-
? `${prefix} - ${missingKeys} cannot be null`
|
|
3150
|
-
: `${missingKeys} cannot be null`;
|
|
3151
|
-
throw new OpenfortError(errorMessage, OpenfortErrorType.INVALID_CONFIGURATION);
|
|
3152
|
-
}
|
|
3153
|
-
};
|
|
3154
3198
|
class OpenfortConfiguration {
|
|
3155
3199
|
publishableKey;
|
|
3156
3200
|
constructor(options) {
|
|
@@ -3178,17 +3222,12 @@ class SDKConfiguration {
|
|
|
3178
3222
|
this.shieldConfiguration = shieldConfiguration;
|
|
3179
3223
|
this.baseConfiguration = baseConfiguration;
|
|
3180
3224
|
if (overrides) {
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
'shieldUrl',
|
|
3185
|
-
], 'overrides');
|
|
3186
|
-
this.backendUrl = overrides.backendUrl;
|
|
3187
|
-
this.iframeUrl = overrides.iframeUrl;
|
|
3188
|
-
this.shieldUrl = overrides.shieldUrl;
|
|
3225
|
+
this.backendUrl = overrides.backendUrl || 'https://api.openfort.xyz';
|
|
3226
|
+
this.iframeUrl = overrides.iframeUrl || 'https://iframe.openfort.xyz';
|
|
3227
|
+
this.shieldUrl = overrides.shieldUrl || 'https://shield.openfort.xyz';
|
|
3189
3228
|
this.openfortAPIConfig = {
|
|
3190
3229
|
backend: createConfig({
|
|
3191
|
-
basePath: overrides.backendUrl,
|
|
3230
|
+
basePath: overrides.backendUrl || 'https://api.openfort.xyz',
|
|
3192
3231
|
accessToken: baseConfiguration.publishableKey,
|
|
3193
3232
|
}),
|
|
3194
3233
|
};
|
|
@@ -4647,6 +4686,69 @@ function announceProvider(detail) {
|
|
|
4647
4686
|
window.addEventListener('eip6963:requestProvider', handler);
|
|
4648
4687
|
}
|
|
4649
4688
|
|
|
4689
|
+
exports.OpenfortErrorType = void 0;
|
|
4690
|
+
(function (OpenfortErrorType) {
|
|
4691
|
+
OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
|
|
4692
|
+
OpenfortErrorType["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
|
|
4693
|
+
OpenfortErrorType["NOT_LOGGED_IN_ERROR"] = "NOT_LOGGED_IN_ERROR";
|
|
4694
|
+
OpenfortErrorType["REFRESH_TOKEN_ERROR"] = "REFRESH_TOKEN_ERROR";
|
|
4695
|
+
OpenfortErrorType["USER_REGISTRATION_ERROR"] = "USER_REGISTRATION_ERROR";
|
|
4696
|
+
OpenfortErrorType["LOGOUT_ERROR"] = "LOGOUT_ERROR";
|
|
4697
|
+
OpenfortErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
|
|
4698
|
+
OpenfortErrorType["MISSING_SESSION_SIGNER_ERROR"] = "MISSING_SESSION_SIGNER_ERROR";
|
|
4699
|
+
OpenfortErrorType["MISSING_EMBEDDED_SIGNER_ERROR"] = "MISSING_EMBEDDED_SIGNER_ERROR";
|
|
4700
|
+
OpenfortErrorType["MISSING_SIGNER_ERROR"] = "MISSING_SIGNER_ERROR";
|
|
4701
|
+
OpenfortErrorType["USER_NOT_AUTHORIZED_ON_ECOSYSTEM"] = "USER_NOT_AUTHORIZED_ON_ECOSYSTEM";
|
|
4702
|
+
})(exports.OpenfortErrorType || (exports.OpenfortErrorType = {}));
|
|
4703
|
+
function isAPIError(error) {
|
|
4704
|
+
return 'type' in error && 'message' in error;
|
|
4705
|
+
}
|
|
4706
|
+
class OpenfortError extends Error {
|
|
4707
|
+
type;
|
|
4708
|
+
data;
|
|
4709
|
+
constructor(message, type, data = {}) {
|
|
4710
|
+
super(message);
|
|
4711
|
+
this.type = type;
|
|
4712
|
+
this.data = data;
|
|
4713
|
+
}
|
|
4714
|
+
}
|
|
4715
|
+
const withOpenfortError = async (fn, customErrorType) => {
|
|
4716
|
+
try {
|
|
4717
|
+
return await fn();
|
|
4718
|
+
}
|
|
4719
|
+
catch (error) {
|
|
4720
|
+
let errorMessage;
|
|
4721
|
+
const data = {};
|
|
4722
|
+
let errorType = customErrorType.default;
|
|
4723
|
+
if (globalAxios.isAxiosError(error)) {
|
|
4724
|
+
const statusCode = error.response?.status;
|
|
4725
|
+
errorType = statusCode ? customErrorType[statusCode] || customErrorType.default : customErrorType.default;
|
|
4726
|
+
if (error.response?.data && error.response.data.error) {
|
|
4727
|
+
const jsonData = JSON.parse(JSON.stringify(error.response.data.error));
|
|
4728
|
+
// eslint-disable-next-line no-restricted-syntax
|
|
4729
|
+
for (const key in jsonData) {
|
|
4730
|
+
if (key !== 'message' && key !== 'type') {
|
|
4731
|
+
data[key] = jsonData[key];
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
if (isAPIError(error.response.data)) {
|
|
4735
|
+
errorMessage = error.response.data.message;
|
|
4736
|
+
}
|
|
4737
|
+
else {
|
|
4738
|
+
errorMessage = error.message;
|
|
4739
|
+
}
|
|
4740
|
+
}
|
|
4741
|
+
else {
|
|
4742
|
+
errorMessage = error.message;
|
|
4743
|
+
}
|
|
4744
|
+
}
|
|
4745
|
+
else {
|
|
4746
|
+
errorMessage = error.message;
|
|
4747
|
+
}
|
|
4748
|
+
throw new OpenfortError(errorMessage, errorType, data);
|
|
4749
|
+
}
|
|
4750
|
+
};
|
|
4751
|
+
|
|
4650
4752
|
var SignerType;
|
|
4651
4753
|
(function (SignerType) {
|
|
4652
4754
|
SignerType["EMBEDDED"] = "embedded";
|
|
@@ -4692,7 +4794,7 @@ class AuthManager {
|
|
|
4692
4794
|
this.backendApiClients = backendApiClients;
|
|
4693
4795
|
this.instanceManager = instanceManager;
|
|
4694
4796
|
}
|
|
4695
|
-
async initOAuth(provider, options) {
|
|
4797
|
+
async initOAuth(provider, options, ecosystemGame) {
|
|
4696
4798
|
const usePooling = options?.usePooling ?? false;
|
|
4697
4799
|
// eslint-disable-next-line no-param-reassign
|
|
4698
4800
|
delete options?.usePooling;
|
|
@@ -4703,7 +4805,7 @@ class AuthManager {
|
|
|
4703
4805
|
usePooling,
|
|
4704
4806
|
},
|
|
4705
4807
|
};
|
|
4706
|
-
const result = await this.backendApiClients.authenticationApi.initOAuth(request);
|
|
4808
|
+
const result = await this.backendApiClients.authenticationApi.initOAuth(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4707
4809
|
if (isBrowser() && options?.skipBrowserRedirect) {
|
|
4708
4810
|
window.location.assign(result.data.url);
|
|
4709
4811
|
}
|
|
@@ -4744,7 +4846,7 @@ class AuthManager {
|
|
|
4744
4846
|
}
|
|
4745
4847
|
throw new Error('Failed to pool OAuth, try again later');
|
|
4746
4848
|
}
|
|
4747
|
-
async authenticateThirdParty(provider, token, tokenType) {
|
|
4849
|
+
async authenticateThirdParty(provider, token, tokenType, ecosystemGame) {
|
|
4748
4850
|
const request = {
|
|
4749
4851
|
thirdPartyOAuthRequest: {
|
|
4750
4852
|
provider,
|
|
@@ -4753,17 +4855,17 @@ class AuthManager {
|
|
|
4753
4855
|
},
|
|
4754
4856
|
};
|
|
4755
4857
|
return withOpenfortError(async () => {
|
|
4756
|
-
const response = await this.backendApiClients.authenticationApi.thirdParty(request);
|
|
4858
|
+
const response = await this.backendApiClients.authenticationApi.thirdParty(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4757
4859
|
return response.data;
|
|
4758
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4860
|
+
}, { default: exports.OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4759
4861
|
}
|
|
4760
|
-
async initSIWE(address) {
|
|
4862
|
+
async initSIWE(address, ecosystemGame) {
|
|
4761
4863
|
const request = {
|
|
4762
4864
|
sIWERequest: {
|
|
4763
4865
|
address,
|
|
4764
4866
|
},
|
|
4765
4867
|
};
|
|
4766
|
-
const result = await this.backendApiClients.authenticationApi.initSIWE(request);
|
|
4868
|
+
const result = await this.backendApiClients.authenticationApi.initSIWE(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4767
4869
|
return {
|
|
4768
4870
|
address: result.data.address,
|
|
4769
4871
|
nonce: result.data.nonce,
|
|
@@ -4782,9 +4884,20 @@ class AuthManager {
|
|
|
4782
4884
|
return withOpenfortError(async () => {
|
|
4783
4885
|
const response = await this.backendApiClients.authenticationApi.authenticateSIWE(request);
|
|
4784
4886
|
return response.data;
|
|
4785
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4887
|
+
}, { default: exports.OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4888
|
+
}
|
|
4889
|
+
static getEcosystemGameOptsOrUndefined(ecosystemGame) {
|
|
4890
|
+
if (ecosystemGame) {
|
|
4891
|
+
return {
|
|
4892
|
+
headers: {
|
|
4893
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4894
|
+
'x-game': ecosystemGame,
|
|
4895
|
+
},
|
|
4896
|
+
};
|
|
4897
|
+
}
|
|
4898
|
+
return undefined;
|
|
4786
4899
|
}
|
|
4787
|
-
async loginEmailPassword(email, password) {
|
|
4900
|
+
async loginEmailPassword(email, password, ecosystemGame) {
|
|
4788
4901
|
const request = {
|
|
4789
4902
|
loginRequest: {
|
|
4790
4903
|
email,
|
|
@@ -4792,9 +4905,10 @@ class AuthManager {
|
|
|
4792
4905
|
},
|
|
4793
4906
|
};
|
|
4794
4907
|
return withOpenfortError(async () => {
|
|
4795
|
-
const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request);
|
|
4908
|
+
const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4796
4909
|
return response.data;
|
|
4797
|
-
|
|
4910
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4911
|
+
}, { default: exports.OpenfortErrorType.AUTHENTICATION_ERROR, 403: exports.OpenfortErrorType.USER_NOT_AUTHORIZED_ON_ECOSYSTEM });
|
|
4798
4912
|
}
|
|
4799
4913
|
async requestResetPassword(email, redirectUrl) {
|
|
4800
4914
|
const verifier = base64URLEncode(crypto__namespace.randomBytes(32));
|
|
@@ -4831,7 +4945,7 @@ class AuthManager {
|
|
|
4831
4945
|
},
|
|
4832
4946
|
};
|
|
4833
4947
|
await this.backendApiClients.authenticationApi.resetPassword(request);
|
|
4834
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4948
|
+
}, { default: exports.OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4835
4949
|
}
|
|
4836
4950
|
async requestEmailVerification(email, redirectUrl) {
|
|
4837
4951
|
const verifier = base64URLEncode(crypto__namespace.randomBytes(32));
|
|
@@ -4867,9 +4981,9 @@ class AuthManager {
|
|
|
4867
4981
|
},
|
|
4868
4982
|
};
|
|
4869
4983
|
await this.backendApiClients.authenticationApi.verifyEmail(request);
|
|
4870
|
-
}, OpenfortErrorType.AUTHENTICATION_ERROR);
|
|
4984
|
+
}, { default: exports.OpenfortErrorType.AUTHENTICATION_ERROR });
|
|
4871
4985
|
}
|
|
4872
|
-
async signupEmailPassword(email, password, name) {
|
|
4986
|
+
async signupEmailPassword(email, password, name, ecosystemGame) {
|
|
4873
4987
|
const request = {
|
|
4874
4988
|
signupRequest: {
|
|
4875
4989
|
email,
|
|
@@ -4878,16 +4992,16 @@ class AuthManager {
|
|
|
4878
4992
|
},
|
|
4879
4993
|
};
|
|
4880
4994
|
return withOpenfortError(async () => {
|
|
4881
|
-
const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request);
|
|
4995
|
+
const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request, AuthManager.getEcosystemGameOptsOrUndefined(ecosystemGame));
|
|
4882
4996
|
return response.data;
|
|
4883
|
-
}, OpenfortErrorType.USER_REGISTRATION_ERROR);
|
|
4997
|
+
}, { default: exports.OpenfortErrorType.USER_REGISTRATION_ERROR });
|
|
4884
4998
|
}
|
|
4885
4999
|
async validateCredentials(forceRefresh) {
|
|
4886
5000
|
const jwk = await this.instanceManager.getJWK();
|
|
4887
5001
|
const accessToken = this.instanceManager.getAccessToken()?.token;
|
|
4888
5002
|
const refreshToken = this.instanceManager.getRefreshToken();
|
|
4889
5003
|
if (!accessToken || !refreshToken || !jwk) {
|
|
4890
|
-
throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
5004
|
+
throw new OpenfortError('Must be logged in to validate and refresh token', exports.OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
4891
5005
|
}
|
|
4892
5006
|
if (forceRefresh) {
|
|
4893
5007
|
return this.refreshTokens(refreshToken, forceRefresh);
|
|
@@ -4927,7 +5041,7 @@ class AuthManager {
|
|
|
4927
5041
|
accessToken: response.data.token,
|
|
4928
5042
|
refreshToken: response.data.refreshToken,
|
|
4929
5043
|
};
|
|
4930
|
-
}, OpenfortErrorType.REFRESH_TOKEN_ERROR);
|
|
5044
|
+
}, { default: exports.OpenfortErrorType.REFRESH_TOKEN_ERROR });
|
|
4931
5045
|
}
|
|
4932
5046
|
async logout(accessToken, refreshToken) {
|
|
4933
5047
|
const request = {
|
|
@@ -4943,7 +5057,7 @@ class AuthManager {
|
|
|
4943
5057
|
'x-player-token': accessToken,
|
|
4944
5058
|
},
|
|
4945
5059
|
});
|
|
4946
|
-
}, OpenfortErrorType.LOGOUT_ERROR);
|
|
5060
|
+
}, { default: exports.OpenfortErrorType.LOGOUT_ERROR });
|
|
4947
5061
|
}
|
|
4948
5062
|
async getUser(accessToken) {
|
|
4949
5063
|
// TODO: Add storage of user info
|
|
@@ -4956,7 +5070,7 @@ class AuthManager {
|
|
|
4956
5070
|
});
|
|
4957
5071
|
return response.data;
|
|
4958
5072
|
}
|
|
4959
|
-
async linkOAuth(provider, playerToken, options) {
|
|
5073
|
+
async linkOAuth(provider, playerToken, options, ecosystemGame) {
|
|
4960
5074
|
const request = {
|
|
4961
5075
|
oAuthInitRequest: {
|
|
4962
5076
|
provider,
|
|
@@ -4969,6 +5083,8 @@ class AuthManager {
|
|
|
4969
5083
|
authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
|
|
4970
5084
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
4971
5085
|
'x-player-token': playerToken,
|
|
5086
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5087
|
+
'x-game': ecosystemGame || undefined,
|
|
4972
5088
|
},
|
|
4973
5089
|
});
|
|
4974
5090
|
if (isBrowser() && !options?.skipBrowserRedirect) {
|
|
@@ -5042,7 +5158,7 @@ class AuthManager {
|
|
|
5042
5158
|
});
|
|
5043
5159
|
return authPlayerResponse.data;
|
|
5044
5160
|
}
|
|
5045
|
-
async linkEmail(email, password, accessToken) {
|
|
5161
|
+
async linkEmail(email, password, accessToken, ecosystemGame) {
|
|
5046
5162
|
const request = {
|
|
5047
5163
|
loginRequest: {
|
|
5048
5164
|
email,
|
|
@@ -5054,6 +5170,8 @@ class AuthManager {
|
|
|
5054
5170
|
authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
|
|
5055
5171
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5056
5172
|
'x-player-token': accessToken,
|
|
5173
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
5174
|
+
'x-game': ecosystemGame || undefined,
|
|
5057
5175
|
},
|
|
5058
5176
|
});
|
|
5059
5177
|
return authPlayerResponse.data;
|
|
@@ -5973,7 +6091,7 @@ class Openfort {
|
|
|
5973
6091
|
*/
|
|
5974
6092
|
getEthereumProvider(options = { announceProvider: true }) {
|
|
5975
6093
|
if (!(this.signer instanceof EmbeddedSigner)) {
|
|
5976
|
-
throw new OpenfortError('Embedded signer must be configured to get Ethereum provider', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6094
|
+
throw new OpenfortError('Embedded signer must be configured to get Ethereum provider', exports.OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
5977
6095
|
}
|
|
5978
6096
|
const address = this.instanceManager.getAccountAddress();
|
|
5979
6097
|
const provider = new EvmProvider({
|
|
@@ -5999,7 +6117,7 @@ class Openfort {
|
|
|
5999
6117
|
*/
|
|
6000
6118
|
configureSessionKey() {
|
|
6001
6119
|
if (this.instanceManager.getSignerType() === SignerType.EMBEDDED) {
|
|
6002
|
-
throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
|
|
6120
|
+
throw new OpenfortError('Session signer must be configured to sign a session', exports.OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
|
|
6003
6121
|
}
|
|
6004
6122
|
const signer = new SessionSigner(this.instanceManager);
|
|
6005
6123
|
this.signer = signer;
|
|
@@ -6036,11 +6154,12 @@ class Openfort {
|
|
|
6036
6154
|
*
|
|
6037
6155
|
* @param email - User's email.
|
|
6038
6156
|
* @param password - User's password.
|
|
6157
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6039
6158
|
* @returns An AuthResponse object containing authentication details.
|
|
6040
6159
|
*/
|
|
6041
|
-
async logInWithEmailPassword({ email, password }) {
|
|
6160
|
+
async logInWithEmailPassword({ email, password, ecosystemGame }) {
|
|
6042
6161
|
this.logout();
|
|
6043
|
-
const result = await this.authManager.loginEmailPassword(email, password);
|
|
6162
|
+
const result = await this.authManager.loginEmailPassword(email, password, ecosystemGame);
|
|
6044
6163
|
this.storeCredentials({
|
|
6045
6164
|
player: result.player.id,
|
|
6046
6165
|
accessToken: result.token,
|
|
@@ -6054,11 +6173,12 @@ class Openfort {
|
|
|
6054
6173
|
* @param email - User's email.
|
|
6055
6174
|
* @param password - User's password.
|
|
6056
6175
|
* @param options - Additional options for the sign-up process.
|
|
6176
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6057
6177
|
* @returns An AuthResponse object containing authentication details.
|
|
6058
6178
|
*/
|
|
6059
|
-
async signUpWithEmailPassword({ email, password, options }) {
|
|
6179
|
+
async signUpWithEmailPassword({ email, password, options, ecosystemGame, }) {
|
|
6060
6180
|
this.logout();
|
|
6061
|
-
const result = await this.authManager.signupEmailPassword(email, password, options?.data.name);
|
|
6181
|
+
const result = await this.authManager.signupEmailPassword(email, password, options?.data.name, ecosystemGame);
|
|
6062
6182
|
this.storeCredentials({
|
|
6063
6183
|
player: result.player.id,
|
|
6064
6184
|
accessToken: result.token,
|
|
@@ -6072,11 +6192,11 @@ class Openfort {
|
|
|
6072
6192
|
* @param email - User's email.
|
|
6073
6193
|
* @param password - User's password.
|
|
6074
6194
|
* @param authToken - Authentication token.
|
|
6195
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6075
6196
|
* @returns An AuthPlayerResponse object.
|
|
6076
6197
|
*/
|
|
6077
|
-
async linkEmailPassword({ email, password, authToken }) {
|
|
6078
|
-
|
|
6079
|
-
return result;
|
|
6198
|
+
async linkEmailPassword({ email, password, authToken, ecosystemGame, }) {
|
|
6199
|
+
return await this.authManager.linkEmail(email, password, authToken, ecosystemGame);
|
|
6080
6200
|
}
|
|
6081
6201
|
/**
|
|
6082
6202
|
* Unlinks an email and password from an existing account using an authentication token.
|
|
@@ -6086,8 +6206,7 @@ class Openfort {
|
|
|
6086
6206
|
* @returns An AuthPlayerResponse object.
|
|
6087
6207
|
*/
|
|
6088
6208
|
async unlinkEmailPassword({ email, authToken }) {
|
|
6089
|
-
|
|
6090
|
-
return result;
|
|
6209
|
+
return await this.authManager.unlinkEmail(email, authToken);
|
|
6091
6210
|
}
|
|
6092
6211
|
/**
|
|
6093
6212
|
* Requests an email verification link.
|
|
@@ -6131,12 +6250,12 @@ class Openfort {
|
|
|
6131
6250
|
*
|
|
6132
6251
|
* @param provider - OAuth provider.
|
|
6133
6252
|
* @param options - Additional options for initialization.
|
|
6253
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6134
6254
|
* @returns An InitAuthResponse object.
|
|
6135
6255
|
*/
|
|
6136
|
-
async initOAuth({ provider, options }) {
|
|
6256
|
+
async initOAuth({ provider, options, ecosystemGame }) {
|
|
6137
6257
|
this.logout();
|
|
6138
|
-
|
|
6139
|
-
return authResponse;
|
|
6258
|
+
return await this.authManager.initOAuth(provider, options, ecosystemGame);
|
|
6140
6259
|
}
|
|
6141
6260
|
/**
|
|
6142
6261
|
* Initializes an OAuth linking process.
|
|
@@ -6144,10 +6263,11 @@ class Openfort {
|
|
|
6144
6263
|
* @param provider - OAuth provider.
|
|
6145
6264
|
* @param authToken - Authentication token.
|
|
6146
6265
|
* @param options - Additional options for initialization.
|
|
6266
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6147
6267
|
* @returns An InitAuthResponse object.
|
|
6148
6268
|
*/
|
|
6149
|
-
async initLinkOAuth({ provider, authToken, options }) {
|
|
6150
|
-
return await this.authManager.linkOAuth(provider, authToken, options);
|
|
6269
|
+
async initLinkOAuth({ provider, authToken, options, ecosystemGame, }) {
|
|
6270
|
+
return await this.authManager.linkOAuth(provider, authToken, options, ecosystemGame);
|
|
6151
6271
|
}
|
|
6152
6272
|
/**
|
|
6153
6273
|
* Unlinks an OAuth provider from the account.
|
|
@@ -6157,8 +6277,7 @@ class Openfort {
|
|
|
6157
6277
|
* @returns An AuthPlayerResponse object.
|
|
6158
6278
|
*/
|
|
6159
6279
|
async unlinkOAuth({ provider, authToken }) {
|
|
6160
|
-
|
|
6161
|
-
return result;
|
|
6280
|
+
return await this.authManager.unlinkOAuth(provider, authToken);
|
|
6162
6281
|
}
|
|
6163
6282
|
/**
|
|
6164
6283
|
* Polls for OAuth authentication completion.
|
|
@@ -6175,10 +6294,11 @@ class Openfort {
|
|
|
6175
6294
|
* @param provider - Third-party OAuth provider.
|
|
6176
6295
|
* @param token - OAuth token.
|
|
6177
6296
|
* @param tokenType - Type of the OAuth token.
|
|
6297
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6178
6298
|
* @returns An AuthPlayerResponse object.
|
|
6179
6299
|
*/
|
|
6180
|
-
async authenticateWithThirdPartyProvider({ provider, token, tokenType }) {
|
|
6181
|
-
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType);
|
|
6300
|
+
async authenticateWithThirdPartyProvider({ provider, token, tokenType, ecosystemGame, }) {
|
|
6301
|
+
const result = await this.authManager.authenticateThirdParty(provider, token, tokenType, ecosystemGame);
|
|
6182
6302
|
this.instanceManager.setAccessToken({
|
|
6183
6303
|
token,
|
|
6184
6304
|
thirdPartyProvider: provider,
|
|
@@ -6194,10 +6314,11 @@ class Openfort {
|
|
|
6194
6314
|
* Initializes Sign-In with Ethereum (SIWE).
|
|
6195
6315
|
*
|
|
6196
6316
|
* @param address - Ethereum address.
|
|
6317
|
+
* @param ecosystemGame - In case of ecosystem, the game that wants to authenticate.
|
|
6197
6318
|
* @returns A SIWEInitResponse object.
|
|
6198
6319
|
*/
|
|
6199
|
-
async initSIWE({ address }) {
|
|
6200
|
-
return await this.authManager.initSIWE(address);
|
|
6320
|
+
async initSIWE({ address, ecosystemGame }) {
|
|
6321
|
+
return await this.authManager.initSIWE(address, ecosystemGame);
|
|
6201
6322
|
}
|
|
6202
6323
|
/**
|
|
6203
6324
|
* Authenticates using Sign-In with Ethereum (SIWE).
|
|
@@ -6231,8 +6352,7 @@ class Openfort {
|
|
|
6231
6352
|
* @returns An AuthPlayerResponse object.
|
|
6232
6353
|
*/
|
|
6233
6354
|
async linkWallet({ signature, message, walletClientType, connectorType, authToken, }) {
|
|
6234
|
-
|
|
6235
|
-
return result;
|
|
6355
|
+
return await this.authManager.linkWallet(signature, message, walletClientType, connectorType, authToken);
|
|
6236
6356
|
}
|
|
6237
6357
|
/**
|
|
6238
6358
|
* Unlinks a wallet.
|
|
@@ -6242,8 +6362,7 @@ class Openfort {
|
|
|
6242
6362
|
* @returns An AuthPlayerResponse object.
|
|
6243
6363
|
*/
|
|
6244
6364
|
async unlinkWallet({ address, authToken }) {
|
|
6245
|
-
|
|
6246
|
-
return result;
|
|
6365
|
+
return await this.authManager.unlinkWallet(address, authToken);
|
|
6247
6366
|
}
|
|
6248
6367
|
/**
|
|
6249
6368
|
* Stores authentication credentials.
|
|
@@ -6274,11 +6393,11 @@ class Openfort {
|
|
|
6274
6393
|
let newSignature = signature;
|
|
6275
6394
|
if (!newSignature) {
|
|
6276
6395
|
if (!userOperationHash) {
|
|
6277
|
-
throw new OpenfortError('No userOperationHash or signature provided', OpenfortErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
6396
|
+
throw new OpenfortError('No userOperationHash or signature provided', exports.OpenfortErrorType.OPERATION_NOT_SUPPORTED_ERROR);
|
|
6278
6397
|
}
|
|
6279
6398
|
await this.recoverSigner();
|
|
6280
6399
|
if (!this.signer) {
|
|
6281
|
-
throw new OpenfortError('In order to sign a transaction intent, a signer must be configured', OpenfortErrorType.MISSING_SIGNER_ERROR);
|
|
6400
|
+
throw new OpenfortError('In order to sign a transaction intent, a signer must be configured', exports.OpenfortErrorType.MISSING_SIGNER_ERROR);
|
|
6282
6401
|
}
|
|
6283
6402
|
if (this.signer.useCredentials()) {
|
|
6284
6403
|
await this.validateAndRefreshToken();
|
|
@@ -6306,7 +6425,7 @@ class Openfort {
|
|
|
6306
6425
|
async signMessage(message, options) {
|
|
6307
6426
|
await this.recoverSigner();
|
|
6308
6427
|
if (!this.signer) {
|
|
6309
|
-
throw new OpenfortError('In order to sign a message, an embedded signer must be configured', OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
|
|
6428
|
+
throw new OpenfortError('In order to sign a message, an embedded signer must be configured', exports.OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
|
|
6310
6429
|
}
|
|
6311
6430
|
if (this.signer.useCredentials()) {
|
|
6312
6431
|
await this.validateAndRefreshToken();
|
|
@@ -6326,7 +6445,7 @@ class Openfort {
|
|
|
6326
6445
|
async signTypedData(domain, types, value) {
|
|
6327
6446
|
await this.recoverSigner();
|
|
6328
6447
|
if (!this.signer) {
|
|
6329
|
-
throw new OpenfortError('In order to sign a message, an embedded signer must be configured', OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
|
|
6448
|
+
throw new OpenfortError('In order to sign a message, an embedded signer must be configured', exports.OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
|
|
6330
6449
|
}
|
|
6331
6450
|
if (this.signer.useCredentials()) {
|
|
6332
6451
|
await this.validateAndRefreshToken();
|
|
@@ -6413,7 +6532,7 @@ class Openfort {
|
|
|
6413
6532
|
await this.validateAndRefreshToken();
|
|
6414
6533
|
const accessToken = this.instanceManager.getAccessToken();
|
|
6415
6534
|
if (!accessToken) {
|
|
6416
|
-
throw new OpenfortError('No accessToken found', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6535
|
+
throw new OpenfortError('No accessToken found', exports.OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6417
6536
|
}
|
|
6418
6537
|
return await this.authManager.getUser(accessToken.token);
|
|
6419
6538
|
}
|
|
@@ -6423,7 +6542,7 @@ class Openfort {
|
|
|
6423
6542
|
async validateAndRefreshToken(forceRefresh) {
|
|
6424
6543
|
const authType = this.credentialsProvided();
|
|
6425
6544
|
if (!authType) {
|
|
6426
|
-
throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6545
|
+
throw new OpenfortError('Must be logged in to validate and refresh token', exports.OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6427
6546
|
}
|
|
6428
6547
|
if (authType === exports.AuthType.OPENFORT) {
|
|
6429
6548
|
const auth = await this.authManager.validateCredentials(forceRefresh);
|
|
@@ -6482,7 +6601,7 @@ class Openfort {
|
|
|
6482
6601
|
}
|
|
6483
6602
|
newEmbeddedSigner(chainId) {
|
|
6484
6603
|
if (!this.credentialsProvided()) {
|
|
6485
|
-
throw new OpenfortError('Must be logged in to configure embedded signer', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6604
|
+
throw new OpenfortError('Must be logged in to configure embedded signer', exports.OpenfortErrorType.NOT_LOGGED_IN_ERROR);
|
|
6486
6605
|
}
|
|
6487
6606
|
let shieldAuthType = this.instanceManager.getShieldAuthType();
|
|
6488
6607
|
if (!shieldAuthType) {
|
|
@@ -6495,7 +6614,7 @@ class Openfort {
|
|
|
6495
6614
|
? this.instanceManager.getAccessToken()?.token
|
|
6496
6615
|
: this.instanceManager.getShieldAuthToken();
|
|
6497
6616
|
if (!token) {
|
|
6498
|
-
throw new OpenfortError('Shield auth token is not set', OpenfortErrorType.INVALID_CONFIGURATION);
|
|
6617
|
+
throw new OpenfortError('Shield auth token is not set', exports.OpenfortErrorType.INVALID_CONFIGURATION);
|
|
6499
6618
|
}
|
|
6500
6619
|
const shieldAuth = {
|
|
6501
6620
|
auth: shieldAuthType,
|