@openfort/openfort-js 0.7.6 → 0.7.8

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.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { _TypedDataEncoder, hashMessage } from '@ethersproject/hash';
2
- import globalAxios from 'axios';
2
+ import globalAxios, { isAxiosError } from 'axios';
3
3
  import { StaticJsonRpcProvider } from '@ethersproject/providers';
4
4
  import { hexlify, joinSignature, arrayify } from '@ethersproject/bytes';
5
5
  import { EventEmitter } from 'events';
@@ -1011,15 +1011,15 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1011
1011
  },
1012
1012
  /**
1013
1013
  *
1014
- * @summary Initialize Link OAuth.
1014
+ * @summary Initialize OAuth.
1015
1015
  * @param {OAuthInitRequest} oAuthInitRequest
1016
1016
  * @param {*} [options] Override http request option.
1017
1017
  * @throws {RequiredError}
1018
1018
  */
1019
- initLinkOAuth: async (oAuthInitRequest, options = {}) => {
1019
+ initOAuth: async (oAuthInitRequest, options = {}) => {
1020
1020
  // verify required parameter 'oAuthInitRequest' is not null or undefined
1021
- assertParamExists('initLinkOAuth', 'oAuthInitRequest', oAuthInitRequest);
1022
- const localVarPath = `/iam/v1/oauth/init_link`;
1021
+ assertParamExists('initOAuth', 'oAuthInitRequest', oAuthInitRequest);
1022
+ const localVarPath = `/iam/v1/oauth/init`;
1023
1023
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1024
1024
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1025
1025
  let baseOptions;
@@ -1029,6 +1029,9 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1029
1029
  const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1030
1030
  const localVarHeaderParameter = {};
1031
1031
  const localVarQueryParameter = {};
1032
+ // authentication pk required
1033
+ // http bearer authentication required
1034
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1032
1035
  localVarHeaderParameter['Content-Type'] = 'application/json';
1033
1036
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1034
1037
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
@@ -1040,16 +1043,16 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1040
1043
  };
1041
1044
  },
1042
1045
  /**
1043
- *
1044
- * @summary Initialize OAuth.
1045
- * @param {OAuthInitRequest} oAuthInitRequest
1046
+ * Create a challenge to link external wallet to the player.
1047
+ * @summary Initialize SIWE.
1048
+ * @param {SIWERequest} sIWERequest
1046
1049
  * @param {*} [options] Override http request option.
1047
1050
  * @throws {RequiredError}
1048
1051
  */
1049
- initOAuth: async (oAuthInitRequest, options = {}) => {
1050
- // verify required parameter 'oAuthInitRequest' is not null or undefined
1051
- assertParamExists('initOAuth', 'oAuthInitRequest', oAuthInitRequest);
1052
- const localVarPath = `/iam/v1/oauth/init`;
1052
+ initSIWE: async (sIWERequest, options = {}) => {
1053
+ // verify required parameter 'sIWERequest' is not null or undefined
1054
+ assertParamExists('initSIWE', 'sIWERequest', sIWERequest);
1055
+ const localVarPath = `/iam/v1/siwe/init`;
1053
1056
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1054
1057
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1055
1058
  let baseOptions;
@@ -1066,23 +1069,22 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1066
1069
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1067
1070
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1068
1071
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1069
- localVarRequestOptions.data = serializeDataIfNeeded(oAuthInitRequest, localVarRequestOptions, configuration);
1072
+ localVarRequestOptions.data = serializeDataIfNeeded(sIWERequest, localVarRequestOptions, configuration);
1070
1073
  return {
1071
1074
  url: toPathString(localVarUrlObj),
1072
1075
  options: localVarRequestOptions,
1073
1076
  };
1074
1077
  },
1075
1078
  /**
1076
- * Create a challenge to link external wallet to the player.
1077
- * @summary Initialize SIWE.
1078
- * @param {SIWERequest} sIWERequest
1079
+ *
1080
+ * @param {LoginRequest} loginRequest
1079
1081
  * @param {*} [options] Override http request option.
1080
1082
  * @throws {RequiredError}
1081
1083
  */
1082
- initSIWE: async (sIWERequest, options = {}) => {
1083
- // verify required parameter 'sIWERequest' is not null or undefined
1084
- assertParamExists('initSIWE', 'sIWERequest', sIWERequest);
1085
- const localVarPath = `/iam/v1/siwe/init`;
1084
+ linkEmail: async (loginRequest, options = {}) => {
1085
+ // verify required parameter 'loginRequest' is not null or undefined
1086
+ assertParamExists('linkEmail', 'loginRequest', loginRequest);
1087
+ const localVarPath = `/iam/v1/password/link`;
1086
1088
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1087
1089
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1088
1090
  let baseOptions;
@@ -1092,14 +1094,41 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1092
1094
  const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1093
1095
  const localVarHeaderParameter = {};
1094
1096
  const localVarQueryParameter = {};
1095
- // authentication pk required
1096
- // http bearer authentication required
1097
- await setBearerAuthToObject(localVarHeaderParameter, configuration);
1098
1097
  localVarHeaderParameter['Content-Type'] = 'application/json';
1099
1098
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1100
1099
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1101
1100
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1102
- localVarRequestOptions.data = serializeDataIfNeeded(sIWERequest, localVarRequestOptions, configuration);
1101
+ localVarRequestOptions.data = serializeDataIfNeeded(loginRequest, localVarRequestOptions, configuration);
1102
+ return {
1103
+ url: toPathString(localVarUrlObj),
1104
+ options: localVarRequestOptions,
1105
+ };
1106
+ },
1107
+ /**
1108
+ *
1109
+ * @summary Initialize Link OAuth.
1110
+ * @param {OAuthInitRequest} oAuthInitRequest
1111
+ * @param {*} [options] Override http request option.
1112
+ * @throws {RequiredError}
1113
+ */
1114
+ linkOAuth: async (oAuthInitRequest, options = {}) => {
1115
+ // verify required parameter 'oAuthInitRequest' is not null or undefined
1116
+ assertParamExists('linkOAuth', 'oAuthInitRequest', oAuthInitRequest);
1117
+ const localVarPath = `/iam/v1/oauth/init_link`;
1118
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1119
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1120
+ let baseOptions;
1121
+ if (configuration) {
1122
+ baseOptions = configuration.baseOptions;
1123
+ }
1124
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1125
+ const localVarHeaderParameter = {};
1126
+ const localVarQueryParameter = {};
1127
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1128
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1129
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1130
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1131
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthInitRequest, localVarRequestOptions, configuration);
1103
1132
  return {
1104
1133
  url: toPathString(localVarUrlObj),
1105
1134
  options: localVarRequestOptions,
@@ -1296,7 +1325,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1296
1325
  requestEmailVerification: async (requestVerifyEmailRequest, options = {}) => {
1297
1326
  // verify required parameter 'requestVerifyEmailRequest' is not null or undefined
1298
1327
  assertParamExists('requestEmailVerification', 'requestVerifyEmailRequest', requestVerifyEmailRequest);
1299
- const localVarPath = `/iam/v1/password/email/request_verification`;
1328
+ const localVarPath = `/iam/v1/password/request_email_verification`;
1300
1329
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1301
1330
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1302
1331
  let baseOptions;
@@ -1329,7 +1358,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1329
1358
  requestResetPassword: async (requestResetPasswordRequest, options = {}) => {
1330
1359
  // verify required parameter 'requestResetPasswordRequest' is not null or undefined
1331
1360
  assertParamExists('requestResetPassword', 'requestResetPasswordRequest', requestResetPasswordRequest);
1332
- const localVarPath = `/iam/v1/password/password/request_reset`;
1361
+ const localVarPath = `/iam/v1/password/request_reset`;
1333
1362
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1334
1363
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1335
1364
  let baseOptions;
@@ -1362,7 +1391,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1362
1391
  resetPassword: async (resetPasswordRequest, options = {}) => {
1363
1392
  // verify required parameter 'resetPasswordRequest' is not null or undefined
1364
1393
  assertParamExists('resetPassword', 'resetPasswordRequest', resetPasswordRequest);
1365
- const localVarPath = `/iam/v1/password/password/reset`;
1394
+ const localVarPath = `/iam/v1/password/reset`;
1366
1395
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1367
1396
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1368
1397
  let baseOptions;
@@ -1451,16 +1480,45 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1451
1480
  options: localVarRequestOptions,
1452
1481
  };
1453
1482
  },
1483
+ /**
1484
+ *
1485
+ * @param {UnlinkEmailRequest} unlinkEmailRequest
1486
+ * @param {*} [options] Override http request option.
1487
+ * @throws {RequiredError}
1488
+ */
1489
+ unlinkEmail: async (unlinkEmailRequest, options = {}) => {
1490
+ // verify required parameter 'unlinkEmailRequest' is not null or undefined
1491
+ assertParamExists('unlinkEmail', 'unlinkEmailRequest', unlinkEmailRequest);
1492
+ const localVarPath = `/iam/v1/password/unlink`;
1493
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1494
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1495
+ let baseOptions;
1496
+ if (configuration) {
1497
+ baseOptions = configuration.baseOptions;
1498
+ }
1499
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1500
+ const localVarHeaderParameter = {};
1501
+ const localVarQueryParameter = {};
1502
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1503
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1504
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1505
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1506
+ localVarRequestOptions.data = serializeDataIfNeeded(unlinkEmailRequest, localVarRequestOptions, configuration);
1507
+ return {
1508
+ url: toPathString(localVarUrlObj),
1509
+ options: localVarRequestOptions,
1510
+ };
1511
+ },
1454
1512
  /**
1455
1513
  *
1456
1514
  * @summary Unlink OAuth account
1457
- * @param {UnlinkRequest} unlinkRequest
1515
+ * @param {UnlinkOAuthRequest} unlinkOAuthRequest
1458
1516
  * @param {*} [options] Override http request option.
1459
1517
  * @throws {RequiredError}
1460
1518
  */
1461
- unlinkOAuth: async (unlinkRequest, options = {}) => {
1462
- // verify required parameter 'unlinkRequest' is not null or undefined
1463
- assertParamExists('unlinkOAuth', 'unlinkRequest', unlinkRequest);
1519
+ unlinkOAuth: async (unlinkOAuthRequest, options = {}) => {
1520
+ // verify required parameter 'unlinkOAuthRequest' is not null or undefined
1521
+ assertParamExists('unlinkOAuth', 'unlinkOAuthRequest', unlinkOAuthRequest);
1464
1522
  const localVarPath = `/iam/v1/oauth/unlink`;
1465
1523
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1466
1524
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
@@ -1475,7 +1533,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1475
1533
  setSearchParams(localVarUrlObj, localVarQueryParameter);
1476
1534
  let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1477
1535
  localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1478
- localVarRequestOptions.data = serializeDataIfNeeded(unlinkRequest, localVarRequestOptions, configuration);
1536
+ localVarRequestOptions.data = serializeDataIfNeeded(unlinkOAuthRequest, localVarRequestOptions, configuration);
1479
1537
  return {
1480
1538
  url: toPathString(localVarUrlObj),
1481
1539
  options: localVarRequestOptions,
@@ -1521,7 +1579,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1521
1579
  verifyEmail: async (verifyEmailRequest, options = {}) => {
1522
1580
  // verify required parameter 'verifyEmailRequest' is not null or undefined
1523
1581
  assertParamExists('verifyEmail', 'verifyEmailRequest', verifyEmailRequest);
1524
- const localVarPath = `/iam/v1/password/email/verify`;
1582
+ const localVarPath = `/iam/v1/password/verify_email`;
1525
1583
  // use dummy base URL string because the URL constructor only accepts absolute URLs.
1526
1584
  const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1527
1585
  let baseOptions;
@@ -1670,17 +1728,6 @@ const AuthenticationApiFp = function (configuration) {
1670
1728
  const localVarAxiosArgs = await localVarAxiosParamCreator.getJwks(publishableKey, options);
1671
1729
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1672
1730
  },
1673
- /**
1674
- *
1675
- * @summary Initialize Link OAuth.
1676
- * @param {OAuthInitRequest} oAuthInitRequest
1677
- * @param {*} [options] Override http request option.
1678
- * @throws {RequiredError}
1679
- */
1680
- async initLinkOAuth(oAuthInitRequest, options) {
1681
- const localVarAxiosArgs = await localVarAxiosParamCreator.initLinkOAuth(oAuthInitRequest, options);
1682
- return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1683
- },
1684
1731
  /**
1685
1732
  *
1686
1733
  * @summary Initialize OAuth.
@@ -1703,6 +1750,27 @@ const AuthenticationApiFp = function (configuration) {
1703
1750
  const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, options);
1704
1751
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1705
1752
  },
1753
+ /**
1754
+ *
1755
+ * @param {LoginRequest} loginRequest
1756
+ * @param {*} [options] Override http request option.
1757
+ * @throws {RequiredError}
1758
+ */
1759
+ async linkEmail(loginRequest, options) {
1760
+ const localVarAxiosArgs = await localVarAxiosParamCreator.linkEmail(loginRequest, options);
1761
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1762
+ },
1763
+ /**
1764
+ *
1765
+ * @summary Initialize Link OAuth.
1766
+ * @param {OAuthInitRequest} oAuthInitRequest
1767
+ * @param {*} [options] Override http request option.
1768
+ * @throws {RequiredError}
1769
+ */
1770
+ async linkOAuth(oAuthInitRequest, options) {
1771
+ const localVarAxiosArgs = await localVarAxiosParamCreator.linkOAuth(oAuthInitRequest, options);
1772
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1773
+ },
1706
1774
  /**
1707
1775
  *
1708
1776
  * @summary Link external wallet.
@@ -1822,15 +1890,25 @@ const AuthenticationApiFp = function (configuration) {
1822
1890
  const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, options);
1823
1891
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1824
1892
  },
1893
+ /**
1894
+ *
1895
+ * @param {UnlinkEmailRequest} unlinkEmailRequest
1896
+ * @param {*} [options] Override http request option.
1897
+ * @throws {RequiredError}
1898
+ */
1899
+ async unlinkEmail(unlinkEmailRequest, options) {
1900
+ const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkEmail(unlinkEmailRequest, options);
1901
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1902
+ },
1825
1903
  /**
1826
1904
  *
1827
1905
  * @summary Unlink OAuth account
1828
- * @param {UnlinkRequest} unlinkRequest
1906
+ * @param {UnlinkOAuthRequest} unlinkOAuthRequest
1829
1907
  * @param {*} [options] Override http request option.
1830
1908
  * @throws {RequiredError}
1831
1909
  */
1832
- async unlinkOAuth(unlinkRequest, options) {
1833
- const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkOAuth(unlinkRequest, options);
1910
+ async unlinkOAuth(unlinkOAuthRequest, options) {
1911
+ const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkOAuth(unlinkOAuthRequest, options);
1834
1912
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1835
1913
  },
1836
1914
  /**
@@ -1933,17 +2011,6 @@ class AuthenticationApi extends BaseAPI {
1933
2011
  getJwks(requestParameters, options) {
1934
2012
  return AuthenticationApiFp(this.configuration).getJwks(requestParameters.publishableKey, options).then((request) => request(this.axios, this.basePath));
1935
2013
  }
1936
- /**
1937
- *
1938
- * @summary Initialize Link OAuth.
1939
- * @param {AuthenticationApiInitLinkOAuthRequest} requestParameters Request parameters.
1940
- * @param {*} [options] Override http request option.
1941
- * @throws {RequiredError}
1942
- * @memberof AuthenticationApi
1943
- */
1944
- initLinkOAuth(requestParameters, options) {
1945
- return AuthenticationApiFp(this.configuration).initLinkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
1946
- }
1947
2014
  /**
1948
2015
  *
1949
2016
  * @summary Initialize OAuth.
@@ -1966,6 +2033,27 @@ class AuthenticationApi extends BaseAPI {
1966
2033
  initSIWE(requestParameters, options) {
1967
2034
  return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
1968
2035
  }
2036
+ /**
2037
+ *
2038
+ * @param {AuthenticationApiLinkEmailRequest} requestParameters Request parameters.
2039
+ * @param {*} [options] Override http request option.
2040
+ * @throws {RequiredError}
2041
+ * @memberof AuthenticationApi
2042
+ */
2043
+ linkEmail(requestParameters, options) {
2044
+ return AuthenticationApiFp(this.configuration).linkEmail(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
2045
+ }
2046
+ /**
2047
+ *
2048
+ * @summary Initialize Link OAuth.
2049
+ * @param {AuthenticationApiLinkOAuthRequest} requestParameters Request parameters.
2050
+ * @param {*} [options] Override http request option.
2051
+ * @throws {RequiredError}
2052
+ * @memberof AuthenticationApi
2053
+ */
2054
+ linkOAuth(requestParameters, options) {
2055
+ return AuthenticationApiFp(this.configuration).linkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
2056
+ }
1969
2057
  /**
1970
2058
  *
1971
2059
  * @summary Link external wallet.
@@ -2085,6 +2173,16 @@ class AuthenticationApi extends BaseAPI {
2085
2173
  thirdParty(requestParameters, options) {
2086
2174
  return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, options).then((request) => request(this.axios, this.basePath));
2087
2175
  }
2176
+ /**
2177
+ *
2178
+ * @param {AuthenticationApiUnlinkEmailRequest} requestParameters Request parameters.
2179
+ * @param {*} [options] Override http request option.
2180
+ * @throws {RequiredError}
2181
+ * @memberof AuthenticationApi
2182
+ */
2183
+ unlinkEmail(requestParameters, options) {
2184
+ return AuthenticationApiFp(this.configuration).unlinkEmail(requestParameters.unlinkEmailRequest, options).then((request) => request(this.axios, this.basePath));
2185
+ }
2088
2186
  /**
2089
2187
  *
2090
2188
  * @summary Unlink OAuth account
@@ -2094,7 +2192,7 @@ class AuthenticationApi extends BaseAPI {
2094
2192
  * @memberof AuthenticationApi
2095
2193
  */
2096
2194
  unlinkOAuth(requestParameters, options) {
2097
- return AuthenticationApiFp(this.configuration).unlinkOAuth(requestParameters.unlinkRequest, options).then((request) => request(this.axios, this.basePath));
2195
+ return AuthenticationApiFp(this.configuration).unlinkOAuth(requestParameters.unlinkOAuthRequest, options).then((request) => request(this.axios, this.basePath));
2098
2196
  }
2099
2197
  /**
2100
2198
  *
@@ -2973,16 +3071,18 @@ var OpenfortErrorType;
2973
3071
  (function (OpenfortErrorType) {
2974
3072
  OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
2975
3073
  OpenfortErrorType["INVALID_CONFIGURATION"] = "INVALID_CONFIGURATION";
2976
- OpenfortErrorType["WALLET_CONNECTION_ERROR"] = "WALLET_CONNECTION_ERROR";
2977
3074
  OpenfortErrorType["NOT_LOGGED_IN_ERROR"] = "NOT_LOGGED_IN_ERROR";
2978
- OpenfortErrorType["SILENT_LOGIN_ERROR"] = "SILENT_LOGIN_ERROR";
2979
3075
  OpenfortErrorType["REFRESH_TOKEN_ERROR"] = "REFRESH_TOKEN_ERROR";
2980
3076
  OpenfortErrorType["USER_REGISTRATION_ERROR"] = "USER_REGISTRATION_ERROR";
2981
- OpenfortErrorType["USER_NOT_REGISTERED_ERROR"] = "USER_NOT_REGISTERED_ERROR";
2982
3077
  OpenfortErrorType["LOGOUT_ERROR"] = "LOGOUT_ERROR";
2983
- OpenfortErrorType["TRANSFER_ERROR"] = "TRANSFER_ERROR";
2984
3078
  OpenfortErrorType["OPERATION_NOT_SUPPORTED_ERROR"] = "OPERATION_NOT_SUPPORTED_ERROR";
3079
+ OpenfortErrorType["MISSING_SESSION_SIGNER_ERROR"] = "MISSING_SESSION_SIGNER_ERROR";
3080
+ OpenfortErrorType["MISSING_EMBEDDED_SIGNER_ERROR"] = "MISSING_EMBEDDED_SIGNER_ERROR";
3081
+ OpenfortErrorType["MISSING_SIGNER_ERROR"] = "MISSING_SIGNER_ERROR";
2985
3082
  })(OpenfortErrorType || (OpenfortErrorType = {}));
3083
+ function isAPIError(error) {
3084
+ return 'code' in error && 'message' in error;
3085
+ }
2986
3086
  class OpenfortError extends Error {
2987
3087
  type;
2988
3088
  constructor(message, type) {
@@ -2990,6 +3090,21 @@ class OpenfortError extends Error {
2990
3090
  this.type = type;
2991
3091
  }
2992
3092
  }
3093
+ const withOpenfortError = async (fn, customErrorType) => {
3094
+ try {
3095
+ return await fn();
3096
+ }
3097
+ catch (error) {
3098
+ let errorMessage;
3099
+ if (isAxiosError(error) && error.response?.data && isAPIError(error.response.data)) {
3100
+ errorMessage = error.response.data.message;
3101
+ }
3102
+ else {
3103
+ errorMessage = error.message;
3104
+ }
3105
+ throw new OpenfortError(errorMessage, customErrorType);
3106
+ }
3107
+ };
2993
3108
 
2994
3109
  const validateConfiguration = (configuration, requiredKeys, prefix) => {
2995
3110
  const missingKeys = requiredKeys
@@ -4544,12 +4659,12 @@ class AuthManager {
4544
4659
  this.backendApiClients = backendApiClients;
4545
4660
  this.instanceManager = instanceManager;
4546
4661
  }
4547
- async initOAuth(provider, usePooling, options) {
4662
+ async initOAuth(provider, options) {
4548
4663
  const request = {
4549
4664
  oAuthInitRequest: {
4550
4665
  provider,
4551
4666
  options,
4552
- usePooling: usePooling || false,
4667
+ usePooling: options?.usePooling || false,
4553
4668
  },
4554
4669
  };
4555
4670
  const result = await this.backendApiClients.authenticationApi.initOAuth(request);
@@ -4561,26 +4676,6 @@ class AuthManager {
4561
4676
  key: result.data.key,
4562
4677
  };
4563
4678
  }
4564
- async initLinkOAuth(provider, playerToken, usePooling, options) {
4565
- const request = {
4566
- oAuthInitRequest: {
4567
- provider,
4568
- options,
4569
- usePooling: usePooling || false,
4570
- },
4571
- };
4572
- const result = await this.backendApiClients.authenticationApi.initLinkOAuth(request, {
4573
- // eslint-disable-next-line @typescript-eslint/naming-convention
4574
- headers: { 'x-player-token': playerToken },
4575
- });
4576
- if (isBrowser() && !options?.skipBrowserRedirect) {
4577
- window.location.assign(result.data.url);
4578
- }
4579
- return {
4580
- url: result.data.url,
4581
- key: result.data.key,
4582
- };
4583
- }
4584
4679
  async poolOAuth(key) {
4585
4680
  const request = {
4586
4681
  key,
@@ -4613,18 +4708,6 @@ class AuthManager {
4613
4708
  }
4614
4709
  throw new Error('Failed to pool OAuth, try again later');
4615
4710
  }
4616
- // @deprecated
4617
- async authenticateOAuth(provider, token, tokenType) {
4618
- const request = {
4619
- authenticateOAuthRequest: {
4620
- provider,
4621
- token,
4622
- tokenType,
4623
- },
4624
- };
4625
- const response = await this.backendApiClients.authenticationApi.authenticateOAuth(request);
4626
- return response.data;
4627
- }
4628
4711
  async authenticateThirdParty(provider, token, tokenType) {
4629
4712
  const request = {
4630
4713
  thirdPartyOAuthRequest: {
@@ -4633,8 +4716,10 @@ class AuthManager {
4633
4716
  tokenType,
4634
4717
  },
4635
4718
  };
4636
- const response = await this.backendApiClients.authenticationApi.thirdParty(request);
4637
- return response.data;
4719
+ return withOpenfortError(async () => {
4720
+ const response = await this.backendApiClients.authenticationApi.thirdParty(request);
4721
+ return response.data;
4722
+ }, OpenfortErrorType.AUTHENTICATION_ERROR);
4638
4723
  }
4639
4724
  async initSIWE(address) {
4640
4725
  const request = {
@@ -4658,8 +4743,10 @@ class AuthManager {
4658
4743
  connectorType,
4659
4744
  },
4660
4745
  };
4661
- const response = await this.backendApiClients.authenticationApi.authenticateSIWE(request);
4662
- return response.data;
4746
+ return withOpenfortError(async () => {
4747
+ const response = await this.backendApiClients.authenticationApi.authenticateSIWE(request);
4748
+ return response.data;
4749
+ }, OpenfortErrorType.AUTHENTICATION_ERROR);
4663
4750
  }
4664
4751
  async loginEmailPassword(email, password) {
4665
4752
  const request = {
@@ -4668,8 +4755,10 @@ class AuthManager {
4668
4755
  password,
4669
4756
  },
4670
4757
  };
4671
- const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request);
4672
- return response.data;
4758
+ return withOpenfortError(async () => {
4759
+ const response = await this.backendApiClients.authenticationApi.loginEmailPassword(request);
4760
+ return response.data;
4761
+ }, OpenfortErrorType.AUTHENTICATION_ERROR);
4673
4762
  }
4674
4763
  async requestResetPassword(email, redirectUrl) {
4675
4764
  const verifier = base64URLEncode(crypto.randomBytes(32));
@@ -4690,25 +4779,23 @@ class AuthManager {
4690
4779
  await this.backendApiClients.authenticationApi.requestResetPassword(request);
4691
4780
  }
4692
4781
  async resetPassword(email, password, state) {
4693
- const pkceData = this.deviceCredentialsManager.getPKCEData();
4694
- if (!pkceData) {
4695
- throw new Error('No code verifier or state for PKCE');
4696
- }
4697
- if (state !== pkceData.state) {
4698
- throw new Error('Provided state does not match stored state');
4699
- }
4700
- const request = {
4701
- resetPasswordRequest: {
4702
- email,
4703
- password,
4704
- state,
4705
- challenge: {
4706
- codeVerifier: pkceData.verifier,
4707
- method: CodeChallengeMethodEnum.S256,
4782
+ return withOpenfortError(async () => {
4783
+ const pkceData = this.deviceCredentialsManager.getPKCEData();
4784
+ if (!pkceData) {
4785
+ throw new Error('No code verifier or state for PKCE');
4786
+ }
4787
+ const request = {
4788
+ resetPasswordRequest: {
4789
+ email,
4790
+ password,
4791
+ state,
4792
+ challenge: {
4793
+ codeVerifier: pkceData.verifier,
4794
+ },
4708
4795
  },
4709
- },
4710
- };
4711
- await this.backendApiClients.authenticationApi.resetPassword(request);
4796
+ };
4797
+ await this.backendApiClients.authenticationApi.resetPassword(request);
4798
+ }, OpenfortErrorType.AUTHENTICATION_ERROR);
4712
4799
  }
4713
4800
  async requestEmailVerification(email, redirectUrl) {
4714
4801
  const verifier = base64URLEncode(crypto.randomBytes(32));
@@ -4729,24 +4816,22 @@ class AuthManager {
4729
4816
  await this.backendApiClients.authenticationApi.requestEmailVerification(request);
4730
4817
  }
4731
4818
  async verifyEmail(email, state) {
4732
- const pkceData = this.deviceCredentialsManager.getPKCEData();
4733
- if (!pkceData) {
4734
- throw new Error('No code verifier or state for PKCE');
4735
- }
4736
- if (state !== pkceData.state) {
4737
- throw new Error('Provided state does not match stored state');
4738
- }
4739
- const request = {
4740
- verifyEmailRequest: {
4741
- email,
4742
- token: state,
4743
- challenge: {
4744
- codeVerifier: pkceData.verifier,
4745
- method: CodeChallengeMethodEnum.S256,
4819
+ return withOpenfortError(async () => {
4820
+ const pkceData = this.deviceCredentialsManager.getPKCEData();
4821
+ if (!pkceData) {
4822
+ throw new Error('No code verifier or state for PKCE');
4823
+ }
4824
+ const request = {
4825
+ verifyEmailRequest: {
4826
+ email,
4827
+ token: state,
4828
+ challenge: {
4829
+ codeVerifier: pkceData.verifier,
4830
+ },
4746
4831
  },
4747
- },
4748
- };
4749
- await this.backendApiClients.authenticationApi.verifyEmail(request);
4832
+ };
4833
+ await this.backendApiClients.authenticationApi.verifyEmail(request);
4834
+ }, OpenfortErrorType.AUTHENTICATION_ERROR);
4750
4835
  }
4751
4836
  async signupEmailPassword(email, password, name) {
4752
4837
  const request = {
@@ -4756,8 +4841,10 @@ class AuthManager {
4756
4841
  name,
4757
4842
  },
4758
4843
  };
4759
- const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request);
4760
- return response.data;
4844
+ return withOpenfortError(async () => {
4845
+ const response = await this.backendApiClients.authenticationApi.signupEmailPassword(request);
4846
+ return response.data;
4847
+ }, OpenfortErrorType.USER_REGISTRATION_ERROR);
4761
4848
  }
4762
4849
  async validateCredentials(accessToken, refreshToken, jwk) {
4763
4850
  try {
@@ -4781,12 +4868,14 @@ class AuthManager {
4781
4868
  refreshToken,
4782
4869
  },
4783
4870
  };
4784
- const newToken = await this.backendApiClients.authenticationApi.refresh(request);
4785
- return {
4786
- player: newToken.data.player.id,
4787
- accessToken: newToken.data.token,
4788
- refreshToken: newToken.data.refreshToken,
4789
- };
4871
+ return withOpenfortError(async () => {
4872
+ const newToken = await this.backendApiClients.authenticationApi.refresh(request);
4873
+ return {
4874
+ player: newToken.data.player.id,
4875
+ accessToken: newToken.data.token,
4876
+ refreshToken: newToken.data.refreshToken,
4877
+ };
4878
+ }, OpenfortErrorType.REFRESH_TOKEN_ERROR);
4790
4879
  }
4791
4880
  throw error;
4792
4881
  }
@@ -4797,57 +4886,172 @@ class AuthManager {
4797
4886
  refreshToken,
4798
4887
  },
4799
4888
  };
4800
- await this.backendApiClients.authenticationApi.logout(request, {
4889
+ withOpenfortError(async () => {
4890
+ await this.backendApiClients.authenticationApi.logout(request, {
4891
+ headers: {
4892
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4893
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4894
+ 'x-player-token': accessToken,
4895
+ },
4896
+ });
4897
+ }, OpenfortErrorType.LOGOUT_ERROR);
4898
+ }
4899
+ async getUser(accessToken) {
4900
+ // TODO: Add storage of user info
4901
+ const response = await this.backendApiClients.authenticationApi.me({
4801
4902
  headers: {
4802
4903
  authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4803
4904
  // eslint-disable-next-line @typescript-eslint/naming-convention
4804
4905
  'x-player-token': accessToken,
4805
4906
  },
4806
4907
  });
4908
+ return response.data;
4909
+ }
4910
+ async linkOAuth(provider, playerToken, options) {
4911
+ const request = {
4912
+ oAuthInitRequest: {
4913
+ provider,
4914
+ options,
4915
+ usePooling: options?.usePooling || false,
4916
+ },
4917
+ };
4918
+ const result = await this.backendApiClients.authenticationApi.linkOAuth(request, {
4919
+ headers: {
4920
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4921
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4922
+ 'x-player-token': playerToken,
4923
+ },
4924
+ });
4925
+ if (isBrowser() && !options?.skipBrowserRedirect) {
4926
+ window.location.assign(result.data.url);
4927
+ }
4928
+ return {
4929
+ url: result.data.url,
4930
+ key: result.data.key,
4931
+ };
4932
+ }
4933
+ async unlinkOAuth(provider, accessToken) {
4934
+ const request = {
4935
+ unlinkOAuthRequest: {
4936
+ provider,
4937
+ },
4938
+ };
4939
+ const authPlayerResponse = await this.backendApiClients.authenticationApi.unlinkOAuth(request, {
4940
+ headers: {
4941
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4942
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4943
+ 'x-player-token': accessToken,
4944
+ },
4945
+ });
4946
+ return authPlayerResponse.data;
4947
+ }
4948
+ async unlinkWallet(address, accessToken) {
4949
+ const request = {
4950
+ sIWERequest: {
4951
+ address,
4952
+ },
4953
+ };
4954
+ const authPlayerResponse = await this.backendApiClients.authenticationApi.unlinkSIWE(request, {
4955
+ headers: {
4956
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4957
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4958
+ 'x-player-token': accessToken,
4959
+ },
4960
+ });
4961
+ return authPlayerResponse.data;
4962
+ }
4963
+ async linkWallet(signature, message, walletClientType, connectorType, accessToken) {
4964
+ const request = {
4965
+ sIWEAuthenticateRequest: {
4966
+ signature,
4967
+ message,
4968
+ walletClientType,
4969
+ connectorType,
4970
+ },
4971
+ };
4972
+ const authPlayerResponse = await this.backendApiClients.authenticationApi.linkSIWE(request, {
4973
+ headers: {
4974
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4975
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4976
+ 'x-player-token': accessToken,
4977
+ },
4978
+ });
4979
+ return authPlayerResponse.data;
4980
+ }
4981
+ async unlinkEmail(email, accessToken) {
4982
+ const request = {
4983
+ unlinkEmailRequest: {
4984
+ email,
4985
+ },
4986
+ };
4987
+ const authPlayerResponse = await this.backendApiClients.authenticationApi.unlinkEmail(request, {
4988
+ headers: {
4989
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
4990
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4991
+ 'x-player-token': accessToken,
4992
+ },
4993
+ });
4994
+ return authPlayerResponse.data;
4995
+ }
4996
+ async linkEmail(email, password, accessToken) {
4997
+ const request = {
4998
+ loginRequest: {
4999
+ email,
5000
+ password,
5001
+ },
5002
+ };
5003
+ const authPlayerResponse = await this.backendApiClients.authenticationApi.linkEmail(request, {
5004
+ headers: {
5005
+ authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
5006
+ // eslint-disable-next-line @typescript-eslint/naming-convention
5007
+ 'x-player-token': accessToken,
5008
+ },
5009
+ });
5010
+ return authPlayerResponse.data;
5011
+ }
5012
+ }
5013
+
5014
+ const authTokenStorageKey = 'openfort.auth_token';
5015
+ const thirdPartyProviderStorageKey = 'openfort.third_party_provider';
5016
+ const thirdPartyProviderTokenTypeStorageKey = 'openfort.third_party_provider_token_type';
5017
+ const refreshTokenStorageKey = 'openfort.refresh_token';
5018
+ const playerIDStorageKey = 'openfort.player_id';
5019
+ const sessionKeyStorageKey = 'openfort.session_key';
5020
+ const signerTypeStorageKey = 'openfort.signer_type';
5021
+ const chainIDStorageKey = 'openfort.chain_id';
5022
+ const jwksStorageKey = 'openfort.jwk';
5023
+ const deviceIDStorageKey = 'openfort.device_id';
5024
+ const accountTypeStorageKey = 'openfort.account_type';
5025
+ const accountAddressStorageKey = 'openfort.account_address';
5026
+
5027
+ class InstanceManager {
5028
+ authToken = null;
5029
+ refreshToken = null;
5030
+ signerType = null;
5031
+ jwk = null;
5032
+ sessionKey = null;
5033
+ deviceID = null;
5034
+ chainId = null;
5035
+ accountAddress = null;
5036
+ accountType = null;
5037
+ temporalStorage;
5038
+ persistentStorage;
5039
+ secureStorage;
5040
+ config;
5041
+ backendApiClients;
5042
+ playerId = null;
5043
+ constructor(temporalStorage, persistentStorage, secureStorage, config, backendApiClients) {
5044
+ this.temporalStorage = temporalStorage;
5045
+ this.persistentStorage = persistentStorage;
5046
+ this.secureStorage = secureStorage;
5047
+ this.config = config;
5048
+ this.backendApiClients = backendApiClients;
4807
5049
  }
4808
- }
4809
-
4810
- const authTokenStorageKey = 'openfort.auth_token';
4811
- const thirdPartyProviderStorageKey = 'openfort.third_party_provider';
4812
- const thirdPartyProviderTokenTypeStorageKey = 'openfort.third_party_provider_token_type';
4813
- const refreshTokenStorageKey = 'openfort.refresh_token';
4814
- const playerIDStorageKey = 'openfort.player_id';
4815
- const sessionKeyStorageKey = 'openfort.session_key';
4816
- const signerTypeStorageKey = 'openfort.signer_type';
4817
- const chainIDStorageKey = 'openfort.chain_id';
4818
- const jwksStorageKey = 'openfort.jwk';
4819
- const deviceIDStorageKey = 'openfort.device_id';
4820
- const accountTypeStorageKey = 'openfort.account_type';
4821
- const accountAddressStorageKey = 'openfort.account_address';
4822
-
4823
- class InstanceManager {
4824
- authToken = null;
4825
- refreshToken = null;
4826
- signerType = null;
4827
- jwk = null;
4828
- sessionKey = null;
4829
- deviceID = null;
4830
- chainId = null;
4831
- accountAddress = null;
4832
- accountType = null;
4833
- temporalStorage;
4834
- persistentStorage;
4835
- secureStorage;
4836
- config;
4837
- backendApiClients;
4838
- playerId = null;
4839
- constructor(temporalStorage, persistentStorage, secureStorage, config, backendApiClients) {
4840
- this.temporalStorage = temporalStorage;
4841
- this.persistentStorage = persistentStorage;
4842
- this.secureStorage = secureStorage;
4843
- this.config = config;
4844
- this.backendApiClients = backendApiClients;
4845
- }
4846
5050
  getAccessToken() {
4847
5051
  if (!this.authToken) {
4848
5052
  const token = this.secureStorage.get(authTokenStorageKey);
4849
5053
  if (token === null)
4850
- return null; // Early exit if no token is found
5054
+ return null;
4851
5055
  this.authToken = {
4852
5056
  token,
4853
5057
  thirdPartyProvider: this.secureStorage.get(thirdPartyProviderStorageKey),
@@ -5629,34 +5833,6 @@ class IframeManager {
5629
5833
  }
5630
5834
  }
5631
5835
 
5632
- class NotLoggedIn extends Error {
5633
- constructor(message) {
5634
- super(message);
5635
- this.name = 'NotLoggedIn';
5636
- Object.setPrototypeOf(this, NotLoggedIn.prototype);
5637
- }
5638
- }
5639
- class EmbeddedNotConfigured extends Error {
5640
- constructor(message) {
5641
- super(message);
5642
- this.name = 'EmbeddedNotConfigured';
5643
- Object.setPrototypeOf(this, EmbeddedNotConfigured.prototype);
5644
- }
5645
- }
5646
- class NoSignerConfigured extends Error {
5647
- constructor(message) {
5648
- super(message);
5649
- this.name = 'NoSignerConfigured';
5650
- Object.setPrototypeOf(this, NoSignerConfigured.prototype);
5651
- }
5652
- }
5653
- class NothingToSign extends Error {
5654
- constructor(message) {
5655
- super(message);
5656
- this.name = 'NothingToSign';
5657
- Object.setPrototypeOf(this, NothingToSign.prototype);
5658
- }
5659
- }
5660
5836
  class Openfort {
5661
5837
  signer;
5662
5838
  authManager;
@@ -5673,6 +5849,9 @@ class Openfort {
5673
5849
  this.openfortEventEmitter = new TypedEventEmitter();
5674
5850
  this.iframeManager = new IframeManager(this.config);
5675
5851
  }
5852
+ /**
5853
+ * Logs the user out by flushing the signer and removing credentials.
5854
+ */
5676
5855
  async logout() {
5677
5856
  await this.flushSigner();
5678
5857
  if (this.credentialsProvided()) {
@@ -5702,11 +5881,16 @@ class Openfort {
5702
5881
  this.instanceManager.removeJWK();
5703
5882
  }
5704
5883
  }
5705
- getEthereumProvider(options = {
5706
- announceProvider: true,
5707
- }) {
5884
+ /**
5885
+ * Returns an Ethereum provider using the configured signer.
5886
+ *
5887
+ * @param options - Configuration options for the Ethereum provider.
5888
+ * @returns A Provider instance.
5889
+ * @throws {OpenfortError} If the signer is not an EmbeddedSigner.
5890
+ */
5891
+ getEthereumProvider(options = { announceProvider: true }) {
5708
5892
  if (!(this.signer instanceof EmbeddedSigner)) {
5709
- throw new EmbeddedNotConfigured('Embedded signer must be configured to get Ethereum provider');
5893
+ throw new OpenfortError('Embedded signer must be configured to get Ethereum provider', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
5710
5894
  }
5711
5895
  const address = this.instanceManager.getAccountAddress();
5712
5896
  const provider = new EvmProvider({
@@ -5725,32 +5909,11 @@ class Openfort {
5725
5909
  }
5726
5910
  return provider;
5727
5911
  }
5728
- async flushSigner() {
5729
- if (this.signer) {
5730
- await this.signer.logout();
5731
- this.instanceManager.removeSignerType();
5732
- return;
5733
- }
5734
- const signerType = this.instanceManager.getSignerType();
5735
- switch (signerType) {
5736
- case SignerType.EMBEDDED: {
5737
- const iframeConfiguration = {
5738
- accessToken: this.instanceManager.getAccessToken()?.token ?? null,
5739
- thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
5740
- thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
5741
- chainId: null,
5742
- recovery: null,
5743
- };
5744
- const embeddedSigner = new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
5745
- await embeddedSigner.logout();
5746
- break;
5747
- }
5748
- case SignerType.SESSION:
5749
- this.configureSessionKey();
5750
- break;
5751
- }
5752
- this.instanceManager.removeSignerType();
5753
- }
5912
+ /**
5913
+ * Configures a session key and returns the session key details.
5914
+ *
5915
+ * @returns A SessionKey object containing the address and registration status.
5916
+ */
5754
5917
  configureSessionKey() {
5755
5918
  const signer = new SessionSigner(this.instanceManager);
5756
5919
  this.signer = signer;
@@ -5762,6 +5925,13 @@ class Openfort {
5762
5925
  this.instanceManager.setSignerType(SignerType.SESSION);
5763
5926
  return { address: publicKey, isRegistered: true };
5764
5927
  }
5928
+ /**
5929
+ * Configures an embedded signer.
5930
+ *
5931
+ * @param chainId - The chain ID for the embedded signer.
5932
+ * @param shieldAuthentication - Shield authentication details.
5933
+ * @param recoveryPassword - Recovery password.
5934
+ */
5765
5935
  async configureEmbeddedSigner(chainId, shieldAuthentication, recoveryPassword) {
5766
5936
  const signer = this.newEmbeddedSigner(chainId, shieldAuthentication);
5767
5937
  await this.validateAndRefreshToken();
@@ -5769,20 +5939,14 @@ class Openfort {
5769
5939
  this.signer = signer;
5770
5940
  this.instanceManager.setSignerType(SignerType.EMBEDDED);
5771
5941
  }
5772
- newEmbeddedSigner(chainId, shieldAuthentication) {
5773
- if (!this.credentialsProvided()) {
5774
- throw new NotLoggedIn('Must be logged in to configure embedded signer');
5775
- }
5776
- const iframeConfiguration = {
5777
- accessToken: this.instanceManager.getAccessToken()?.token ?? null,
5778
- thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
5779
- thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
5780
- chainId: chainId ?? null,
5781
- recovery: shieldAuthentication ?? null,
5782
- };
5783
- return new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
5784
- }
5785
- async loginWithEmailPassword(email, password) {
5942
+ /**
5943
+ * Logs in a user with email and password.
5944
+ *
5945
+ * @param email - User's email.
5946
+ * @param password - User's password.
5947
+ * @returns An AuthResponse object containing authentication details.
5948
+ */
5949
+ async loginWithEmailPassword({ email, password }) {
5786
5950
  this.instanceManager.removeAccessToken();
5787
5951
  this.instanceManager.removeRefreshToken();
5788
5952
  this.instanceManager.removePlayerID();
@@ -5794,11 +5958,19 @@ class Openfort {
5794
5958
  });
5795
5959
  return result;
5796
5960
  }
5797
- async signUpWithEmailPassword(email, password, name) {
5961
+ /**
5962
+ * Signs up a new user with email and password.
5963
+ *
5964
+ * @param email - User's email.
5965
+ * @param password - User's password.
5966
+ * @param options - Additional options for the sign-up process.
5967
+ * @returns An AuthResponse object containing authentication details.
5968
+ */
5969
+ async signUpWithEmailPassword({ email, password, options }) {
5798
5970
  this.instanceManager.removeAccessToken();
5799
5971
  this.instanceManager.removeRefreshToken();
5800
5972
  this.instanceManager.removePlayerID();
5801
- const result = await this.authManager.signupEmailPassword(email, password, name);
5973
+ const result = await this.authManager.signupEmailPassword(email, password, options?.data.name);
5802
5974
  this.storeCredentials({
5803
5975
  player: result.player.id,
5804
5976
  accessToken: result.token,
@@ -5806,45 +5978,117 @@ class Openfort {
5806
5978
  });
5807
5979
  return result;
5808
5980
  }
5809
- async requestEmailVerification(email, redirectUrl) {
5981
+ /**
5982
+ * Links an email and password to an existing account using an authentication token.
5983
+ *
5984
+ * @param email - User's email.
5985
+ * @param password - User's password.
5986
+ * @param authToken - Authentication token.
5987
+ * @returns An AuthPlayerResponse object.
5988
+ */
5989
+ async linkEmailPassword({ email, password, authToken }) {
5990
+ const result = await this.authManager.linkEmail(email, password, authToken);
5991
+ return result;
5992
+ }
5993
+ /**
5994
+ * Unlinks an email and password from an existing account using an authentication token.
5995
+ *
5996
+ * @param email - User's email.
5997
+ * @param authToken - Authentication token.
5998
+ * @returns An AuthPlayerResponse object.
5999
+ */
6000
+ async unlinkEmailPassword({ email, authToken }) {
6001
+ const result = await this.authManager.unlinkEmail(email, authToken);
6002
+ return result;
6003
+ }
6004
+ /**
6005
+ * Requests an email verification link.
6006
+ *
6007
+ * @param email - User's email.
6008
+ * @param redirectUrl - Redirect URL after verification.
6009
+ */
6010
+ async requestEmailVerification({ email, redirectUrl }) {
5810
6011
  await this.authManager.requestEmailVerification(email, redirectUrl);
5811
6012
  }
5812
- async resetPassword(email, password, state) {
6013
+ /**
6014
+ * Resets the user's password.
6015
+ *
6016
+ * @param email - User's email.
6017
+ * @param password - New password.
6018
+ * @param state - Verification state.
6019
+ */
6020
+ async resetPassword({ email, password, state }) {
5813
6021
  await this.authManager.resetPassword(email, password, state);
5814
6022
  }
5815
- async requestResetPassword(email, redirectUrl) {
6023
+ /**
6024
+ * Requests a password reset link.
6025
+ *
6026
+ * @param email - User's email.
6027
+ * @param redirectUrl - Redirect URL after resetting password.
6028
+ */
6029
+ async requestResetPassword({ email, redirectUrl }) {
5816
6030
  await this.authManager.requestResetPassword(email, redirectUrl);
5817
6031
  }
5818
- async verifyEmail(email, state) {
6032
+ /**
6033
+ * Verifies the user's email.
6034
+ *
6035
+ * @param email - User's email.
6036
+ * @param state - Verification state.
6037
+ */
6038
+ async verifyEmail({ email, state }) {
5819
6039
  await this.authManager.verifyEmail(email, state);
5820
6040
  }
5821
- async initOAuth(provider, usePooling, options) {
5822
- const authResponse = await this.authManager.initOAuth(provider, usePooling, options);
6041
+ /**
6042
+ * Initializes an OAuth authentication process.
6043
+ *
6044
+ * @param provider - OAuth provider.
6045
+ * @param options - Additional options for initialization.
6046
+ * @returns An InitAuthResponse object.
6047
+ */
6048
+ async initOAuth({ provider, options }) {
6049
+ const authResponse = await this.authManager.initOAuth(provider, options);
5823
6050
  return authResponse;
5824
6051
  }
5825
- async initLinkOAuth(provider, playerToken, usePooling, options) {
5826
- return await this.authManager.initLinkOAuth(provider, playerToken, usePooling, options);
5827
- }
5828
- async poolOAuth(key) {
5829
- return await this.authManager.poolOAuth(key);
6052
+ /**
6053
+ * Initializes an OAuth linking process.
6054
+ *
6055
+ * @param provider - OAuth provider.
6056
+ * @param authToken - Authentication token.
6057
+ * @param options - Additional options for initialization.
6058
+ * @returns An InitAuthResponse object.
6059
+ */
6060
+ async initLinkOAuth({ provider, authToken, options }) {
6061
+ return await this.authManager.linkOAuth(provider, authToken, options);
5830
6062
  }
5831
- // @deprecated
5832
- async authenticateWithOAuth(provider, token, tokenType) {
5833
- this.instanceManager.removeAccessToken();
5834
- this.instanceManager.removeRefreshToken();
5835
- this.instanceManager.removePlayerID();
5836
- const result = await this.authManager.authenticateOAuth(provider, token, tokenType);
5837
- this.storeCredentials({
5838
- player: result.player.id,
5839
- accessToken: result.token,
5840
- refreshToken: result.refreshToken,
5841
- });
6063
+ /**
6064
+ * Unlinks an OAuth provider from the account.
6065
+ *
6066
+ * @param provider - OAuth provider.
6067
+ * @param authToken - Authentication token.
6068
+ * @returns An AuthPlayerResponse object.
6069
+ */
6070
+ async unlinkOAuth({ provider, authToken }) {
6071
+ const result = await this.authManager.unlinkOAuth(provider, authToken);
5842
6072
  return result;
5843
6073
  }
5844
- async initSIWE(address) {
5845
- return await this.authManager.initSIWE(address);
6074
+ /**
6075
+ * Polls for OAuth authentication completion.
6076
+ *
6077
+ * @param key - OAuth polling key.
6078
+ * @returns An AuthResponse object.
6079
+ */
6080
+ async poolOAuth(key) {
6081
+ return await this.authManager.poolOAuth(key);
5846
6082
  }
5847
- async authenticateWithThirdPartyProvider(provider, token, tokenType) {
6083
+ /**
6084
+ * Authenticates using a third-party OAuth provider.
6085
+ *
6086
+ * @param provider - Third-party OAuth provider.
6087
+ * @param token - OAuth token.
6088
+ * @param tokenType - Type of the OAuth token.
6089
+ * @returns An AuthPlayerResponse object.
6090
+ */
6091
+ async authenticateWithThirdPartyProvider({ provider, token, tokenType }) {
5848
6092
  const result = await this.authManager.authenticateThirdParty(provider, token, tokenType);
5849
6093
  this.instanceManager.setAccessToken({
5850
6094
  token,
@@ -5857,7 +6101,25 @@ class Openfort {
5857
6101
  }
5858
6102
  return result;
5859
6103
  }
5860
- async authenticateWithSIWE(signature, message, walletClientType, connectorType) {
6104
+ /**
6105
+ * Initializes Sign-In with Ethereum (SIWE).
6106
+ *
6107
+ * @param address - Ethereum address.
6108
+ * @returns A SIWEInitResponse object.
6109
+ */
6110
+ async initSIWE({ address }) {
6111
+ return await this.authManager.initSIWE(address);
6112
+ }
6113
+ /**
6114
+ * Authenticates using Sign-In with Ethereum (SIWE).
6115
+ *
6116
+ * @param signature - SIWE signature.
6117
+ * @param message - SIWE message.
6118
+ * @param walletClientType - Wallet client type.
6119
+ * @param connectorType - Connector type.
6120
+ * @returns An AuthResponse object.
6121
+ */
6122
+ async authenticateWithSIWE({ signature, message, walletClientType, connectorType, }) {
5861
6123
  this.instanceManager.removeAccessToken();
5862
6124
  this.instanceManager.removeRefreshToken();
5863
6125
  this.instanceManager.removePlayerID();
@@ -5869,6 +6131,36 @@ class Openfort {
5869
6131
  });
5870
6132
  return result;
5871
6133
  }
6134
+ /**
6135
+ * Links a wallet using SIWE.
6136
+ *
6137
+ * @param signature - SIWE signature.
6138
+ * @param message - SIWE message.
6139
+ * @param walletClientType - Wallet client type.
6140
+ * @param connectorType - Connector type.
6141
+ * @param authToken - Authentication token.
6142
+ * @returns An AuthPlayerResponse object.
6143
+ */
6144
+ async linkWallet({ signature, message, walletClientType, connectorType, authToken, }) {
6145
+ const result = await this.authManager.linkWallet(signature, message, walletClientType, connectorType, authToken);
6146
+ return result;
6147
+ }
6148
+ /**
6149
+ * Unlinks a wallet.
6150
+ *
6151
+ * @param address - Wallet address.
6152
+ * @param authToken - Authentication token.
6153
+ * @returns An AuthPlayerResponse object.
6154
+ */
6155
+ async unlinkWallet({ address, authToken }) {
6156
+ const result = await this.authManager.unlinkWallet(address, authToken);
6157
+ return result;
6158
+ }
6159
+ /**
6160
+ * Stores authentication credentials.
6161
+ *
6162
+ * @param auth - Authentication details.
6163
+ */
5872
6164
  storeCredentials(auth) {
5873
6165
  this.instanceManager.setAccessToken({
5874
6166
  token: auth.accessToken,
@@ -5878,15 +6170,24 @@ class Openfort {
5878
6170
  this.instanceManager.setRefreshToken(auth.refreshToken);
5879
6171
  this.instanceManager.setPlayerID(auth.player);
5880
6172
  }
6173
+ /**
6174
+ * Sends a signature transaction intent request.
6175
+ *
6176
+ * @param transactionIntentId - Transaction intent ID.
6177
+ * @param userOperationHash - User operation hash.
6178
+ * @param signature - Transaction signature.
6179
+ * @returns A TransactionIntentResponse object.
6180
+ * @throws {OpenfortError} If no userOperationHash or signature is provided.
6181
+ */
5881
6182
  async sendSignatureTransactionIntentRequest(transactionIntentId, userOperationHash = null, signature = null) {
5882
6183
  let newSignature = signature;
5883
6184
  if (!newSignature) {
5884
6185
  if (!userOperationHash) {
5885
- throw new NothingToSign('No userOperationHash or signature provided');
6186
+ throw new OpenfortError('No userOperationHash or signature provided', OpenfortErrorType.OPERATION_NOT_SUPPORTED_ERROR);
5886
6187
  }
5887
6188
  await this.recoverSigner();
5888
6189
  if (!this.signer) {
5889
- throw new NoSignerConfigured('In order to sign a transaction intent, a signer must be configured');
6190
+ throw new OpenfortError('In order to sign a transaction intent, a signer must be configured', OpenfortErrorType.MISSING_SIGNER_ERROR);
5890
6191
  }
5891
6192
  if (this.signer.useCredentials()) {
5892
6193
  await this.validateAndRefreshToken();
@@ -5902,10 +6203,18 @@ class Openfort {
5902
6203
  const result = await this.backendApiClients.transactionIntentsApi.signature(request);
5903
6204
  return result.data;
5904
6205
  }
6206
+ /**
6207
+ * Signs a message.
6208
+ *
6209
+ * @param message - Message to sign.
6210
+ * @param options - Additional options for signing.
6211
+ * @returns The signature.
6212
+ * @throws {OpenfortError} If no signer is configured.
6213
+ */
5905
6214
  async signMessage(message, options) {
5906
6215
  await this.recoverSigner();
5907
6216
  if (!this.signer) {
5908
- throw new NoSignerConfigured('No signer configured');
6217
+ throw new OpenfortError('In order to sign a message, an embedded signer must be configured', OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
5909
6218
  }
5910
6219
  if (this.signer.useCredentials()) {
5911
6220
  await this.validateAndRefreshToken();
@@ -5913,10 +6222,19 @@ class Openfort {
5913
6222
  const { hashMessage = true, arrayifyMessage = false } = options || {};
5914
6223
  return await this.signer.sign(message, arrayifyMessage, hashMessage);
5915
6224
  }
6225
+ /**
6226
+ * Signs typed data.
6227
+ *
6228
+ * @param domain - EIP-712 domain.
6229
+ * @param types - Typed data types.
6230
+ * @param value - Typed data value.
6231
+ * @returns The signature.
6232
+ * @throws {OpenfortError} If no signer is configured.
6233
+ */
5916
6234
  async signTypedData(domain, types, value) {
5917
6235
  await this.recoverSigner();
5918
6236
  if (!this.signer) {
5919
- throw new NoSignerConfigured('No signer configured');
6237
+ throw new OpenfortError('In order to sign a message, an embedded signer must be configured', OpenfortErrorType.MISSING_EMBEDDED_SIGNER_ERROR);
5920
6238
  }
5921
6239
  if (this.signer.useCredentials()) {
5922
6240
  await this.validateAndRefreshToken();
@@ -5946,13 +6264,23 @@ class Openfort {
5946
6264
  }
5947
6265
  return await this.signer.sign(hash, false, false);
5948
6266
  }
6267
+ /**
6268
+ * Sends a session registration request.
6269
+ *
6270
+ * @param sessionId - Session ID.
6271
+ * @param signature - Session signature.
6272
+ * @param optimistic - Whether the request is optimistic.
6273
+ * @returns A SessionResponse object.
6274
+ * @throws {OpenfortError} If no signer is configured.
6275
+ * @throws {OpenfortError} If the signer is not a SessionSigner.
6276
+ */
5949
6277
  async sendRegisterSessionRequest(sessionId, signature, optimistic) {
5950
6278
  await this.recoverSigner();
5951
6279
  if (!this.signer) {
5952
- throw new NoSignerConfigured('No signer configured nor signature provided');
6280
+ throw new OpenfortError('No signer configured nor signature provided', OpenfortErrorType.MISSING_SIGNER_ERROR);
5953
6281
  }
5954
6282
  if (this.signer.getSingerType() !== SignerType.SESSION) {
5955
- throw new NoSignerConfigured('Session signer must be configured to sign a session');
6283
+ throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
5956
6284
  }
5957
6285
  const request = {
5958
6286
  id: sessionId,
@@ -5964,6 +6292,75 @@ class Openfort {
5964
6292
  const result = await this.backendApiClients.sessionsApi.signatureSession(request);
5965
6293
  return result.data;
5966
6294
  }
6295
+ /**
6296
+ * Gets the embedded state of the current session.
6297
+ *
6298
+ * @returns The embedded state.
6299
+ */
6300
+ getEmbeddedState() {
6301
+ if (!this.credentialsProvided()) {
6302
+ return EmbeddedState.UNAUTHENTICATED;
6303
+ }
6304
+ if (this.instanceManager.getSignerType() !== SignerType.EMBEDDED) {
6305
+ return EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED;
6306
+ }
6307
+ if (!this.signer) {
6308
+ this.signer = this.newEmbeddedSigner();
6309
+ }
6310
+ if (!this.instanceManager.getDeviceID()) {
6311
+ return EmbeddedState.CREATING_ACCOUNT;
6312
+ }
6313
+ return EmbeddedState.READY;
6314
+ }
6315
+ /**
6316
+ * Gets the current access token.
6317
+ *
6318
+ * @returns The access token, or null if not available.
6319
+ */
6320
+ getAccessToken() {
6321
+ return this.instanceManager.getAccessToken()?.token ?? null;
6322
+ }
6323
+ /**
6324
+ * Retrieves the user details.
6325
+ *
6326
+ * @returns An AuthPlayerResponse object.
6327
+ * @throws {OpenfortError} If no access token is found.
6328
+ */
6329
+ async getUser() {
6330
+ await this.validateAndRefreshToken();
6331
+ const accessToken = this.instanceManager.getAccessToken();
6332
+ if (!accessToken) {
6333
+ throw new OpenfortError('No accessToken found', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6334
+ }
6335
+ return await this.authManager.getUser(accessToken.token);
6336
+ }
6337
+ /**
6338
+ * Validates and refreshes the access token if needed.
6339
+ */
6340
+ async validateAndRefreshToken() {
6341
+ if (!this.credentialsProvided()) {
6342
+ return;
6343
+ }
6344
+ const accessToken = this.instanceManager.getAccessToken();
6345
+ const refreshToken = this.instanceManager.getRefreshToken();
6346
+ const jwk = await this.instanceManager.getJWK();
6347
+ if (!accessToken || !refreshToken || !jwk) {
6348
+ return;
6349
+ }
6350
+ const auth = await this.authManager.validateCredentials(accessToken.token, refreshToken, jwk);
6351
+ if (auth.accessToken !== accessToken.token) {
6352
+ this.storeCredentials(auth);
6353
+ }
6354
+ if (this.signer && this.signer.useCredentials()) {
6355
+ await this.signer.updateAuthentication();
6356
+ }
6357
+ }
6358
+ credentialsProvided() {
6359
+ const token = this.instanceManager.getAccessToken();
6360
+ const refreshToken = this.instanceManager.getRefreshToken();
6361
+ return token && ((token.token && token.thirdPartyProvider && token.thirdPartyTokenType)
6362
+ || (token.token && refreshToken));
6363
+ }
5967
6364
  async recoverSigner() {
5968
6365
  if (this.signer) {
5969
6366
  return;
@@ -5997,75 +6394,45 @@ class Openfort {
5997
6394
  };
5998
6395
  await checkSignerType(0);
5999
6396
  }
6000
- getEmbeddedState() {
6001
- if (!this.credentialsProvided()) {
6002
- return EmbeddedState.UNAUTHENTICATED;
6003
- }
6004
- if (this.instanceManager.getSignerType() !== SignerType.EMBEDDED) {
6005
- return EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED;
6006
- }
6007
- if (!this.signer) {
6008
- this.signer = this.newEmbeddedSigner();
6009
- }
6010
- if (!this.instanceManager.getDeviceID()) {
6011
- return EmbeddedState.CREATING_ACCOUNT;
6012
- }
6013
- return EmbeddedState.READY;
6014
- }
6015
- credentialsProvided() {
6016
- const token = this.instanceManager.getAccessToken();
6017
- const refreshToken = this.instanceManager.getRefreshToken();
6018
- return (token
6019
- && ((token.token && token.thirdPartyProvider && token.thirdPartyTokenType)
6020
- || (token.token && refreshToken)));
6021
- }
6022
- async isAuthenticated() {
6397
+ newEmbeddedSigner(chainId, shieldAuthentication) {
6023
6398
  if (!this.credentialsProvided()) {
6024
- return false;
6399
+ throw new OpenfortError('Must be logged in to configure embedded signer', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6025
6400
  }
6026
- if (!this.signer) {
6027
- const signerType = this.instanceManager.getSignerType();
6028
- if (signerType !== SignerType.EMBEDDED) {
6029
- return false;
6030
- }
6031
- const signer = this.newEmbeddedSigner();
6032
- return await signer.isLoaded();
6033
- }
6034
- if (this.signer.getSingerType() !== SignerType.EMBEDDED) {
6035
- return false;
6036
- }
6037
- return await this.signer.isLoaded();
6038
- }
6039
- getAccessToken() {
6040
- return this.instanceManager.getAccessToken()?.token ?? null;
6041
- }
6042
- isLoaded() {
6043
- if (!this.instanceManager.getJWK()) {
6044
- return false;
6045
- }
6046
- if (this.signer && this.signer.getSingerType() === SignerType.EMBEDDED) {
6047
- return this.signer.iFrameLoaded();
6048
- }
6049
- return true;
6401
+ const iframeConfiguration = {
6402
+ accessToken: this.instanceManager.getAccessToken()?.token ?? null,
6403
+ thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
6404
+ thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
6405
+ chainId: !chainId ? Number(this.instanceManager.getChainID()) ?? null : chainId,
6406
+ recovery: shieldAuthentication ?? null,
6407
+ };
6408
+ return new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
6050
6409
  }
6051
- async validateAndRefreshToken() {
6052
- if (!this.credentialsProvided()) {
6053
- return;
6054
- }
6055
- const accessToken = this.instanceManager.getAccessToken();
6056
- const refreshToken = this.instanceManager.getRefreshToken();
6057
- const jwk = await this.instanceManager.getJWK();
6058
- if (!accessToken || !refreshToken || !jwk) {
6410
+ async flushSigner() {
6411
+ if (this.signer) {
6412
+ await this.signer.logout();
6413
+ this.instanceManager.removeSignerType();
6059
6414
  return;
6060
6415
  }
6061
- const auth = await this.authManager.validateCredentials(accessToken.token, refreshToken, jwk);
6062
- if (auth.accessToken !== accessToken.token) {
6063
- this.storeCredentials(auth);
6064
- }
6065
- if (this.signer && this.signer.useCredentials()) {
6066
- await this.signer.updateAuthentication();
6416
+ const signerType = this.instanceManager.getSignerType();
6417
+ switch (signerType) {
6418
+ case SignerType.EMBEDDED: {
6419
+ const iframeConfiguration = {
6420
+ accessToken: this.instanceManager.getAccessToken()?.token ?? null,
6421
+ thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
6422
+ thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
6423
+ chainId: null,
6424
+ recovery: null,
6425
+ };
6426
+ const embeddedSigner = new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
6427
+ await embeddedSigner.logout();
6428
+ break;
6429
+ }
6430
+ case SignerType.SESSION:
6431
+ this.configureSessionKey();
6432
+ break;
6067
6433
  }
6434
+ this.instanceManager.removeSignerType();
6068
6435
  }
6069
6436
  }
6070
6437
 
6071
- export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, SDKConfiguration, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };
6438
+ export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, OpenfortError, SDKConfiguration, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };