@openfort/openfort-js 0.7.8 → 0.7.9

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 CHANGED
@@ -33,60 +33,6 @@ function _interopNamespaceDefault(e) {
33
33
 
34
34
  var crypto__namespace = /*#__PURE__*/_interopNamespaceDefault(crypto);
35
35
 
36
- exports.EmbeddedState = void 0;
37
- (function (EmbeddedState) {
38
- EmbeddedState[EmbeddedState["NONE"] = 0] = "NONE";
39
- EmbeddedState[EmbeddedState["UNAUTHENTICATED"] = 1] = "UNAUTHENTICATED";
40
- EmbeddedState[EmbeddedState["EMBEDDED_SIGNER_NOT_CONFIGURED"] = 2] = "EMBEDDED_SIGNER_NOT_CONFIGURED";
41
- EmbeddedState[EmbeddedState["CREATING_ACCOUNT"] = 3] = "CREATING_ACCOUNT";
42
- EmbeddedState[EmbeddedState["READY"] = 4] = "READY";
43
- })(exports.EmbeddedState || (exports.EmbeddedState = {}));
44
- var OpenfortEvents;
45
- (function (OpenfortEvents) {
46
- OpenfortEvents["LOGGED_OUT"] = "loggedOut";
47
- })(OpenfortEvents || (OpenfortEvents = {}));
48
- var AccountType;
49
- (function (AccountType) {
50
- AccountType["UPGRADEABLE_V4"] = "Upgradeable_v04";
51
- AccountType["MANAGED_V4"] = "Managed_v04";
52
- AccountType["ERC6551_V4"] = "ERC6551_v04";
53
- AccountType["ERC6551_V5"] = "ERC6551_v05";
54
- AccountType["RECOVERABLE_V4"] = "Recoverable_v04";
55
- AccountType["MANAGED_V5"] = "Managed_v05";
56
- AccountType["UPGRADEABLE_V5"] = "Upgradeable_v05";
57
- })(AccountType || (AccountType = {}));
58
- exports.TokenType = void 0;
59
- (function (TokenType) {
60
- TokenType["ID_TOKEN"] = "idToken";
61
- TokenType["CUSTOM_TOKEN"] = "customToken";
62
- })(exports.TokenType || (exports.TokenType = {}));
63
- exports.ThirdPartyOAuthProvider = void 0;
64
- (function (ThirdPartyOAuthProvider) {
65
- ThirdPartyOAuthProvider["ACCELBYTE"] = "accelbyte";
66
- ThirdPartyOAuthProvider["FIREBASE"] = "firebase";
67
- ThirdPartyOAuthProvider["LOOTLOCKER"] = "lootlocker";
68
- ThirdPartyOAuthProvider["PLAYFAB"] = "playfab";
69
- ThirdPartyOAuthProvider["SUPABASE"] = "supabase";
70
- ThirdPartyOAuthProvider["CUSTOM"] = "custom";
71
- ThirdPartyOAuthProvider["OIDC"] = "oidc";
72
- })(exports.ThirdPartyOAuthProvider || (exports.ThirdPartyOAuthProvider = {}));
73
- exports.BasicAuthProvider = void 0;
74
- (function (BasicAuthProvider) {
75
- BasicAuthProvider["EMAIL"] = "email";
76
- BasicAuthProvider["WALLET"] = "wallet";
77
- })(exports.BasicAuthProvider || (exports.BasicAuthProvider = {}));
78
- exports.OAuthProvider = void 0;
79
- (function (OAuthProvider) {
80
- OAuthProvider["GOOGLE"] = "google";
81
- OAuthProvider["TWITTER"] = "twitter";
82
- OAuthProvider["FACEBOOK"] = "facebook";
83
- })(exports.OAuthProvider || (exports.OAuthProvider = {}));
84
- var CodeChallengeMethodEnum;
85
- (function (CodeChallengeMethodEnum) {
86
- CodeChallengeMethodEnum["PLAIN"] = "plain";
87
- CodeChallengeMethodEnum["S256"] = "S256";
88
- })(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
89
-
90
36
  /* tslint:disable */
91
37
  /* eslint-disable */
92
38
  /**
@@ -3090,6 +3036,65 @@ const createConfig = ({ basePath, accessToken, }) => {
3090
3036
  return new Configuration(apiConfigOptions);
3091
3037
  };
3092
3038
 
3039
+ exports.EmbeddedState = void 0;
3040
+ (function (EmbeddedState) {
3041
+ EmbeddedState[EmbeddedState["NONE"] = 0] = "NONE";
3042
+ EmbeddedState[EmbeddedState["UNAUTHENTICATED"] = 1] = "UNAUTHENTICATED";
3043
+ EmbeddedState[EmbeddedState["EMBEDDED_SIGNER_NOT_CONFIGURED"] = 2] = "EMBEDDED_SIGNER_NOT_CONFIGURED";
3044
+ EmbeddedState[EmbeddedState["CREATING_ACCOUNT"] = 3] = "CREATING_ACCOUNT";
3045
+ EmbeddedState[EmbeddedState["READY"] = 4] = "READY";
3046
+ })(exports.EmbeddedState || (exports.EmbeddedState = {}));
3047
+ var OpenfortEvents;
3048
+ (function (OpenfortEvents) {
3049
+ OpenfortEvents["LOGGED_OUT"] = "loggedOut";
3050
+ })(OpenfortEvents || (OpenfortEvents = {}));
3051
+ var AccountType;
3052
+ (function (AccountType) {
3053
+ AccountType["UPGRADEABLE_V4"] = "Upgradeable_v04";
3054
+ AccountType["MANAGED_V4"] = "Managed_v04";
3055
+ AccountType["ERC6551_V4"] = "ERC6551_v04";
3056
+ AccountType["ERC6551_V5"] = "ERC6551_v05";
3057
+ AccountType["RECOVERABLE_V4"] = "Recoverable_v04";
3058
+ AccountType["MANAGED_V5"] = "Managed_v05";
3059
+ AccountType["UPGRADEABLE_V5"] = "Upgradeable_v05";
3060
+ })(AccountType || (AccountType = {}));
3061
+ exports.AuthType = void 0;
3062
+ (function (AuthType) {
3063
+ AuthType["OPENFORT"] = "openfort";
3064
+ AuthType["THIRD_PARTY"] = "thirdParty";
3065
+ })(exports.AuthType || (exports.AuthType = {}));
3066
+ exports.TokenType = void 0;
3067
+ (function (TokenType) {
3068
+ TokenType["ID_TOKEN"] = "idToken";
3069
+ TokenType["CUSTOM_TOKEN"] = "customToken";
3070
+ })(exports.TokenType || (exports.TokenType = {}));
3071
+ exports.ThirdPartyOAuthProvider = void 0;
3072
+ (function (ThirdPartyOAuthProvider) {
3073
+ ThirdPartyOAuthProvider["ACCELBYTE"] = "accelbyte";
3074
+ ThirdPartyOAuthProvider["FIREBASE"] = "firebase";
3075
+ ThirdPartyOAuthProvider["LOOTLOCKER"] = "lootlocker";
3076
+ ThirdPartyOAuthProvider["PLAYFAB"] = "playfab";
3077
+ ThirdPartyOAuthProvider["SUPABASE"] = "supabase";
3078
+ ThirdPartyOAuthProvider["CUSTOM"] = "custom";
3079
+ ThirdPartyOAuthProvider["OIDC"] = "oidc";
3080
+ })(exports.ThirdPartyOAuthProvider || (exports.ThirdPartyOAuthProvider = {}));
3081
+ exports.BasicAuthProvider = void 0;
3082
+ (function (BasicAuthProvider) {
3083
+ BasicAuthProvider["EMAIL"] = "email";
3084
+ BasicAuthProvider["WALLET"] = "wallet";
3085
+ })(exports.BasicAuthProvider || (exports.BasicAuthProvider = {}));
3086
+ exports.OAuthProvider = void 0;
3087
+ (function (OAuthProvider) {
3088
+ OAuthProvider["GOOGLE"] = "google";
3089
+ OAuthProvider["TWITTER"] = "twitter";
3090
+ OAuthProvider["FACEBOOK"] = "facebook";
3091
+ })(exports.OAuthProvider || (exports.OAuthProvider = {}));
3092
+ var CodeChallengeMethodEnum;
3093
+ (function (CodeChallengeMethodEnum) {
3094
+ CodeChallengeMethodEnum["PLAIN"] = "plain";
3095
+ CodeChallengeMethodEnum["S256"] = "S256";
3096
+ })(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
3097
+
3093
3098
  var OpenfortErrorType;
3094
3099
  (function (OpenfortErrorType) {
3095
3100
  OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
@@ -4624,8 +4629,8 @@ class EvmProvider {
4624
4629
  const openfortProviderInfo = {
4625
4630
  // eslint-disable-next-line max-len
4626
4631
  icon: 'data:image/svg+xml,<svg aria-hidden="true" viewBox="597.32 331.34 171.36 105.32" ><g><rect x="673.9" y="404.26" width="18.2" height="32.4" /><polygon points="768.68,331.36 768.68,331.36 768.68,331.34 610.78,331.34 610.78,331.36 597.32,331.36 597.32,436.64 615.52,436.64 615.52,349.54 750.48,349.54 750.48,436.64 768.68,436.64 " /><polygon points="732.16,367.79 633.83,367.79 633.83,370.19 633.79,370.19 633.79,436.64 651.99,436.64 651.99,385.99 713.9,385.99 713.9,436.64 732.09,436.64 732.09,385.99 732.16,385.99 " /></g></svg>',
4627
- name: 'Ecosystem ID',
4628
- rdns: 'com.ecosystem.id',
4632
+ name: 'Openfort',
4633
+ rdns: 'xyz.openfort',
4629
4634
  uuid: uuid.v4(),
4630
4635
  };
4631
4636
  function announceProvider(detail) {
@@ -4683,11 +4688,14 @@ class AuthManager {
4683
4688
  this.instanceManager = instanceManager;
4684
4689
  }
4685
4690
  async initOAuth(provider, options) {
4691
+ const usePooling = options?.usePooling ?? false;
4692
+ // eslint-disable-next-line no-param-reassign
4693
+ delete options?.usePooling;
4686
4694
  const request = {
4687
4695
  oAuthInitRequest: {
4688
4696
  provider,
4689
4697
  options,
4690
- usePooling: options?.usePooling || false,
4698
+ usePooling,
4691
4699
  },
4692
4700
  };
4693
4701
  const result = await this.backendApiClients.authenticationApi.initOAuth(request);
@@ -4869,7 +4877,13 @@ class AuthManager {
4869
4877
  return response.data;
4870
4878
  }, OpenfortErrorType.USER_REGISTRATION_ERROR);
4871
4879
  }
4872
- async validateCredentials(accessToken, refreshToken, jwk) {
4880
+ async validateCredentials() {
4881
+ const jwk = await this.instanceManager.getJWK();
4882
+ const accessToken = this.instanceManager.getAccessToken()?.token;
4883
+ const refreshToken = this.instanceManager.getRefreshToken();
4884
+ if (!accessToken || !refreshToken || !jwk) {
4885
+ throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
4886
+ }
4873
4887
  try {
4874
4888
  const key = (await jose.importJWK({
4875
4889
  kty: jwk.kty,
@@ -5045,6 +5059,8 @@ const chainIDStorageKey = 'openfort.chain_id';
5045
5059
  const jwksStorageKey = 'openfort.jwk';
5046
5060
  const deviceIDStorageKey = 'openfort.device_id';
5047
5061
  const accountTypeStorageKey = 'openfort.account_type';
5062
+ const shieldAuthTypeStorageKey = 'openfort.shield_auth_type';
5063
+ const shieldAuthTokenStorageKey = 'openfort.shield_auth_token';
5048
5064
  const accountAddressStorageKey = 'openfort.account_address';
5049
5065
 
5050
5066
  class InstanceManager {
@@ -5054,6 +5070,7 @@ class InstanceManager {
5054
5070
  jwk = null;
5055
5071
  sessionKey = null;
5056
5072
  deviceID = null;
5073
+ shieldAuthType = null;
5057
5074
  chainId = null;
5058
5075
  accountAddress = null;
5059
5076
  accountType = null;
@@ -5185,9 +5202,10 @@ class InstanceManager {
5185
5202
  };
5186
5203
  const response = await this.backendApiClients.authenticationApi.getJwks(request);
5187
5204
  if (response.data.keys.length === 0) {
5188
- throw new Error('No keys found');
5205
+ throw new Error('Internal error: No JWKS keys found');
5189
5206
  }
5190
5207
  const jwtKey = response.data.keys[0];
5208
+ this.setJWK(jwtKey);
5191
5209
  this.jwk = {
5192
5210
  kty: jwtKey.kty,
5193
5211
  crv: jwtKey.crv,
@@ -5272,6 +5290,34 @@ class InstanceManager {
5272
5290
  this.accountType = null;
5273
5291
  this.persistentStorage.remove(accountTypeStorageKey);
5274
5292
  }
5293
+ setShieldAuthType(accountType) {
5294
+ this.accountType = accountType;
5295
+ this.persistentStorage.save(shieldAuthTypeStorageKey, accountType);
5296
+ }
5297
+ getShieldAuthType() {
5298
+ if (!this.accountType) {
5299
+ this.accountType = this.persistentStorage.get(shieldAuthTypeStorageKey);
5300
+ }
5301
+ return this.accountType;
5302
+ }
5303
+ removeShieldAuthType() {
5304
+ this.accountType = null;
5305
+ this.persistentStorage.remove(shieldAuthTypeStorageKey);
5306
+ }
5307
+ setShieldAuthToken(accountType) {
5308
+ this.accountType = accountType;
5309
+ this.persistentStorage.save(shieldAuthTokenStorageKey, accountType);
5310
+ }
5311
+ getShieldAuthToken() {
5312
+ if (!this.accountType) {
5313
+ this.accountType = this.persistentStorage.get(shieldAuthTokenStorageKey);
5314
+ }
5315
+ return this.accountType;
5316
+ }
5317
+ removeShieldAuthToken() {
5318
+ this.accountType = null;
5319
+ this.persistentStorage.remove(shieldAuthTokenStorageKey);
5320
+ }
5275
5321
  }
5276
5322
 
5277
5323
  class LocalStorage {
@@ -5617,11 +5663,11 @@ class UpdateAuthenticationRequest {
5617
5663
  this.recovery = recovery;
5618
5664
  }
5619
5665
  }
5620
- exports.AuthType = void 0;
5621
- (function (AuthType) {
5622
- AuthType["OPENFORT"] = "openfort";
5623
- AuthType["CUSTOM"] = "custom";
5624
- })(exports.AuthType || (exports.AuthType = {}));
5666
+ exports.ShieldAuthType = void 0;
5667
+ (function (ShieldAuthType) {
5668
+ ShieldAuthType["OPENFORT"] = "openfort";
5669
+ ShieldAuthType["CUSTOM"] = "custom";
5670
+ })(exports.ShieldAuthType || (exports.ShieldAuthType = {}));
5625
5671
 
5626
5672
  class MissingRecoveryPasswordError extends Error {
5627
5673
  constructor() {
@@ -5902,6 +5948,8 @@ class Openfort {
5902
5948
  this.instanceManager.removeChainID();
5903
5949
  this.instanceManager.removeDeviceID();
5904
5950
  this.instanceManager.removeJWK();
5951
+ this.instanceManager.removeShieldAuthType();
5952
+ this.instanceManager.removeShieldAuthToken();
5905
5953
  }
5906
5954
  }
5907
5955
  /**
@@ -5938,6 +5986,9 @@ class Openfort {
5938
5986
  * @returns A SessionKey object containing the address and registration status.
5939
5987
  */
5940
5988
  configureSessionKey() {
5989
+ if (this.instanceManager.getSignerType() === SignerType.EMBEDDED) {
5990
+ throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
5991
+ }
5941
5992
  const signer = new SessionSigner(this.instanceManager);
5942
5993
  this.signer = signer;
5943
5994
  const publicKey = signer.loadKeys();
@@ -5956,8 +6007,14 @@ class Openfort {
5956
6007
  * @param recoveryPassword - Recovery password.
5957
6008
  */
5958
6009
  async configureEmbeddedSigner(chainId, shieldAuthentication, recoveryPassword) {
5959
- const signer = this.newEmbeddedSigner(chainId, shieldAuthentication);
5960
6010
  await this.validateAndRefreshToken();
6011
+ if (shieldAuthentication) {
6012
+ this.instanceManager.setShieldAuthType(shieldAuthentication?.auth);
6013
+ if (shieldAuthentication?.auth === exports.ShieldAuthType.CUSTOM) {
6014
+ this.instanceManager.setShieldAuthToken(shieldAuthentication?.token);
6015
+ }
6016
+ }
6017
+ const signer = this.newEmbeddedSigner(chainId);
5961
6018
  await signer.ensureEmbeddedAccount(recoveryPassword);
5962
6019
  this.signer = signer;
5963
6020
  this.instanceManager.setSignerType(SignerType.EMBEDDED);
@@ -5969,10 +6026,8 @@ class Openfort {
5969
6026
  * @param password - User's password.
5970
6027
  * @returns An AuthResponse object containing authentication details.
5971
6028
  */
5972
- async loginWithEmailPassword({ email, password }) {
5973
- this.instanceManager.removeAccessToken();
5974
- this.instanceManager.removeRefreshToken();
5975
- this.instanceManager.removePlayerID();
6029
+ async logInWithEmailPassword({ email, password }) {
6030
+ this.logout();
5976
6031
  const result = await this.authManager.loginEmailPassword(email, password);
5977
6032
  this.storeCredentials({
5978
6033
  player: result.player.id,
@@ -5990,9 +6045,7 @@ class Openfort {
5990
6045
  * @returns An AuthResponse object containing authentication details.
5991
6046
  */
5992
6047
  async signUpWithEmailPassword({ email, password, options }) {
5993
- this.instanceManager.removeAccessToken();
5994
- this.instanceManager.removeRefreshToken();
5995
- this.instanceManager.removePlayerID();
6048
+ this.logout();
5996
6049
  const result = await this.authManager.signupEmailPassword(email, password, options?.data.name);
5997
6050
  this.storeCredentials({
5998
6051
  player: result.player.id,
@@ -6069,6 +6122,7 @@ class Openfort {
6069
6122
  * @returns An InitAuthResponse object.
6070
6123
  */
6071
6124
  async initOAuth({ provider, options }) {
6125
+ this.logout();
6072
6126
  const authResponse = await this.authManager.initOAuth(provider, options);
6073
6127
  return authResponse;
6074
6128
  }
@@ -6191,7 +6245,8 @@ class Openfort {
6191
6245
  thirdPartyTokenType: null,
6192
6246
  });
6193
6247
  this.instanceManager.setRefreshToken(auth.refreshToken);
6194
- this.instanceManager.setPlayerID(auth.player);
6248
+ if (auth.player)
6249
+ this.instanceManager.setPlayerID(auth.player);
6195
6250
  }
6196
6251
  /**
6197
6252
  * Sends a signature transaction intent request.
@@ -6199,10 +6254,11 @@ class Openfort {
6199
6254
  * @param transactionIntentId - Transaction intent ID.
6200
6255
  * @param userOperationHash - User operation hash.
6201
6256
  * @param signature - Transaction signature.
6257
+ * @param optimistic - Whether the request is optimistic.
6202
6258
  * @returns A TransactionIntentResponse object.
6203
6259
  * @throws {OpenfortError} If no userOperationHash or signature is provided.
6204
6260
  */
6205
- async sendSignatureTransactionIntentRequest(transactionIntentId, userOperationHash = null, signature = null) {
6261
+ async sendSignatureTransactionIntentRequest(transactionIntentId, userOperationHash = null, signature = null, optimistic = false) {
6206
6262
  let newSignature = signature;
6207
6263
  if (!newSignature) {
6208
6264
  if (!userOperationHash) {
@@ -6221,6 +6277,7 @@ class Openfort {
6221
6277
  id: transactionIntentId,
6222
6278
  signatureRequest: {
6223
6279
  signature: newSignature,
6280
+ optimistic,
6224
6281
  },
6225
6282
  };
6226
6283
  const result = await this.backendApiClients.transactionIntentsApi.signature(request);
@@ -6294,17 +6351,8 @@ class Openfort {
6294
6351
  * @param signature - Session signature.
6295
6352
  * @param optimistic - Whether the request is optimistic.
6296
6353
  * @returns A SessionResponse object.
6297
- * @throws {OpenfortError} If no signer is configured.
6298
- * @throws {OpenfortError} If the signer is not a SessionSigner.
6299
6354
  */
6300
6355
  async sendRegisterSessionRequest(sessionId, signature, optimistic) {
6301
- await this.recoverSigner();
6302
- if (!this.signer) {
6303
- throw new OpenfortError('No signer configured nor signature provided', OpenfortErrorType.MISSING_SIGNER_ERROR);
6304
- }
6305
- if (this.signer.getSingerType() !== SignerType.SESSION) {
6306
- throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
6307
- }
6308
6356
  const request = {
6309
6357
  id: sessionId,
6310
6358
  signatureRequest: {
@@ -6361,28 +6409,31 @@ class Openfort {
6361
6409
  * Validates and refreshes the access token if needed.
6362
6410
  */
6363
6411
  async validateAndRefreshToken() {
6364
- if (!this.credentialsProvided()) {
6365
- return;
6412
+ const authType = this.credentialsProvided();
6413
+ if (!authType) {
6414
+ throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6366
6415
  }
6367
- const accessToken = this.instanceManager.getAccessToken();
6368
- const refreshToken = this.instanceManager.getRefreshToken();
6369
- const jwk = await this.instanceManager.getJWK();
6370
- if (!accessToken || !refreshToken || !jwk) {
6371
- return;
6372
- }
6373
- const auth = await this.authManager.validateCredentials(accessToken.token, refreshToken, jwk);
6374
- if (auth.accessToken !== accessToken.token) {
6416
+ if (authType === exports.AuthType.OPENFORT) {
6417
+ const auth = await this.authManager.validateCredentials();
6375
6418
  this.storeCredentials(auth);
6376
- }
6377
- if (this.signer && this.signer.useCredentials()) {
6378
- await this.signer.updateAuthentication();
6419
+ if (this.signer && this.signer.useCredentials()) {
6420
+ await this.signer.updateAuthentication();
6421
+ }
6379
6422
  }
6380
6423
  }
6381
6424
  credentialsProvided() {
6382
6425
  const token = this.instanceManager.getAccessToken();
6383
6426
  const refreshToken = this.instanceManager.getRefreshToken();
6384
- return token && ((token.token && token.thirdPartyProvider && token.thirdPartyTokenType)
6385
- || (token.token && refreshToken));
6427
+ if (!token) {
6428
+ return null;
6429
+ }
6430
+ if (token.token && token.thirdPartyProvider && token.thirdPartyTokenType) {
6431
+ return exports.AuthType.THIRD_PARTY;
6432
+ }
6433
+ if (token.token && refreshToken) {
6434
+ return exports.AuthType.OPENFORT;
6435
+ }
6436
+ return null;
6386
6437
  }
6387
6438
  async recoverSigner() {
6388
6439
  if (this.signer) {
@@ -6417,16 +6468,33 @@ class Openfort {
6417
6468
  };
6418
6469
  await checkSignerType(0);
6419
6470
  }
6420
- newEmbeddedSigner(chainId, shieldAuthentication) {
6471
+ newEmbeddedSigner(chainId) {
6421
6472
  if (!this.credentialsProvided()) {
6422
6473
  throw new OpenfortError('Must be logged in to configure embedded signer', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6423
6474
  }
6475
+ let shieldAuthType = this.instanceManager.getShieldAuthType();
6476
+ if (!shieldAuthType) {
6477
+ // TODO: remove, this is for backward compatibility
6478
+ this.instanceManager.setShieldAuthType(exports.ShieldAuthType.OPENFORT);
6479
+ shieldAuthType = exports.ShieldAuthType.OPENFORT;
6480
+ // throw new OpenfortError('Shield auth type is not set', OpenfortErrorType.INVALID_CONFIGURATION);
6481
+ }
6482
+ const token = shieldAuthType === exports.ShieldAuthType.OPENFORT
6483
+ ? this.instanceManager.getAccessToken()?.token
6484
+ : this.instanceManager.getShieldAuthToken();
6485
+ if (!token) {
6486
+ throw new OpenfortError('Shield auth token is not set', OpenfortErrorType.INVALID_CONFIGURATION);
6487
+ }
6488
+ const shieldAuth = {
6489
+ auth: shieldAuthType,
6490
+ token,
6491
+ };
6424
6492
  const iframeConfiguration = {
6425
6493
  accessToken: this.instanceManager.getAccessToken()?.token ?? null,
6426
6494
  thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
6427
6495
  thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
6428
6496
  chainId: !chainId ? Number(this.instanceManager.getChainID()) ?? null : chainId,
6429
- recovery: shieldAuthentication ?? null,
6497
+ recovery: shieldAuth,
6430
6498
  };
6431
6499
  return new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
6432
6500
  }