@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.js CHANGED
@@ -10,60 +10,6 @@ import { secp256k1 } from '@noble/curves/secp256k1';
10
10
  import { SigningKey } from '@ethersproject/signing-key';
11
11
  import { computeAddress } from '@ethersproject/transactions';
12
12
 
13
- var EmbeddedState;
14
- (function (EmbeddedState) {
15
- EmbeddedState[EmbeddedState["NONE"] = 0] = "NONE";
16
- EmbeddedState[EmbeddedState["UNAUTHENTICATED"] = 1] = "UNAUTHENTICATED";
17
- EmbeddedState[EmbeddedState["EMBEDDED_SIGNER_NOT_CONFIGURED"] = 2] = "EMBEDDED_SIGNER_NOT_CONFIGURED";
18
- EmbeddedState[EmbeddedState["CREATING_ACCOUNT"] = 3] = "CREATING_ACCOUNT";
19
- EmbeddedState[EmbeddedState["READY"] = 4] = "READY";
20
- })(EmbeddedState || (EmbeddedState = {}));
21
- var OpenfortEvents;
22
- (function (OpenfortEvents) {
23
- OpenfortEvents["LOGGED_OUT"] = "loggedOut";
24
- })(OpenfortEvents || (OpenfortEvents = {}));
25
- var AccountType;
26
- (function (AccountType) {
27
- AccountType["UPGRADEABLE_V4"] = "Upgradeable_v04";
28
- AccountType["MANAGED_V4"] = "Managed_v04";
29
- AccountType["ERC6551_V4"] = "ERC6551_v04";
30
- AccountType["ERC6551_V5"] = "ERC6551_v05";
31
- AccountType["RECOVERABLE_V4"] = "Recoverable_v04";
32
- AccountType["MANAGED_V5"] = "Managed_v05";
33
- AccountType["UPGRADEABLE_V5"] = "Upgradeable_v05";
34
- })(AccountType || (AccountType = {}));
35
- var TokenType;
36
- (function (TokenType) {
37
- TokenType["ID_TOKEN"] = "idToken";
38
- TokenType["CUSTOM_TOKEN"] = "customToken";
39
- })(TokenType || (TokenType = {}));
40
- var ThirdPartyOAuthProvider;
41
- (function (ThirdPartyOAuthProvider) {
42
- ThirdPartyOAuthProvider["ACCELBYTE"] = "accelbyte";
43
- ThirdPartyOAuthProvider["FIREBASE"] = "firebase";
44
- ThirdPartyOAuthProvider["LOOTLOCKER"] = "lootlocker";
45
- ThirdPartyOAuthProvider["PLAYFAB"] = "playfab";
46
- ThirdPartyOAuthProvider["SUPABASE"] = "supabase";
47
- ThirdPartyOAuthProvider["CUSTOM"] = "custom";
48
- ThirdPartyOAuthProvider["OIDC"] = "oidc";
49
- })(ThirdPartyOAuthProvider || (ThirdPartyOAuthProvider = {}));
50
- var BasicAuthProvider;
51
- (function (BasicAuthProvider) {
52
- BasicAuthProvider["EMAIL"] = "email";
53
- BasicAuthProvider["WALLET"] = "wallet";
54
- })(BasicAuthProvider || (BasicAuthProvider = {}));
55
- var OAuthProvider;
56
- (function (OAuthProvider) {
57
- OAuthProvider["GOOGLE"] = "google";
58
- OAuthProvider["TWITTER"] = "twitter";
59
- OAuthProvider["FACEBOOK"] = "facebook";
60
- })(OAuthProvider || (OAuthProvider = {}));
61
- var CodeChallengeMethodEnum;
62
- (function (CodeChallengeMethodEnum) {
63
- CodeChallengeMethodEnum["PLAIN"] = "plain";
64
- CodeChallengeMethodEnum["S256"] = "S256";
65
- })(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
66
-
67
13
  /* tslint:disable */
68
14
  /* eslint-disable */
69
15
  /**
@@ -3067,6 +3013,65 @@ const createConfig = ({ basePath, accessToken, }) => {
3067
3013
  return new Configuration(apiConfigOptions);
3068
3014
  };
3069
3015
 
3016
+ var EmbeddedState;
3017
+ (function (EmbeddedState) {
3018
+ EmbeddedState[EmbeddedState["NONE"] = 0] = "NONE";
3019
+ EmbeddedState[EmbeddedState["UNAUTHENTICATED"] = 1] = "UNAUTHENTICATED";
3020
+ EmbeddedState[EmbeddedState["EMBEDDED_SIGNER_NOT_CONFIGURED"] = 2] = "EMBEDDED_SIGNER_NOT_CONFIGURED";
3021
+ EmbeddedState[EmbeddedState["CREATING_ACCOUNT"] = 3] = "CREATING_ACCOUNT";
3022
+ EmbeddedState[EmbeddedState["READY"] = 4] = "READY";
3023
+ })(EmbeddedState || (EmbeddedState = {}));
3024
+ var OpenfortEvents;
3025
+ (function (OpenfortEvents) {
3026
+ OpenfortEvents["LOGGED_OUT"] = "loggedOut";
3027
+ })(OpenfortEvents || (OpenfortEvents = {}));
3028
+ var AccountType;
3029
+ (function (AccountType) {
3030
+ AccountType["UPGRADEABLE_V4"] = "Upgradeable_v04";
3031
+ AccountType["MANAGED_V4"] = "Managed_v04";
3032
+ AccountType["ERC6551_V4"] = "ERC6551_v04";
3033
+ AccountType["ERC6551_V5"] = "ERC6551_v05";
3034
+ AccountType["RECOVERABLE_V4"] = "Recoverable_v04";
3035
+ AccountType["MANAGED_V5"] = "Managed_v05";
3036
+ AccountType["UPGRADEABLE_V5"] = "Upgradeable_v05";
3037
+ })(AccountType || (AccountType = {}));
3038
+ var AuthType;
3039
+ (function (AuthType) {
3040
+ AuthType["OPENFORT"] = "openfort";
3041
+ AuthType["THIRD_PARTY"] = "thirdParty";
3042
+ })(AuthType || (AuthType = {}));
3043
+ var TokenType;
3044
+ (function (TokenType) {
3045
+ TokenType["ID_TOKEN"] = "idToken";
3046
+ TokenType["CUSTOM_TOKEN"] = "customToken";
3047
+ })(TokenType || (TokenType = {}));
3048
+ var ThirdPartyOAuthProvider;
3049
+ (function (ThirdPartyOAuthProvider) {
3050
+ ThirdPartyOAuthProvider["ACCELBYTE"] = "accelbyte";
3051
+ ThirdPartyOAuthProvider["FIREBASE"] = "firebase";
3052
+ ThirdPartyOAuthProvider["LOOTLOCKER"] = "lootlocker";
3053
+ ThirdPartyOAuthProvider["PLAYFAB"] = "playfab";
3054
+ ThirdPartyOAuthProvider["SUPABASE"] = "supabase";
3055
+ ThirdPartyOAuthProvider["CUSTOM"] = "custom";
3056
+ ThirdPartyOAuthProvider["OIDC"] = "oidc";
3057
+ })(ThirdPartyOAuthProvider || (ThirdPartyOAuthProvider = {}));
3058
+ var BasicAuthProvider;
3059
+ (function (BasicAuthProvider) {
3060
+ BasicAuthProvider["EMAIL"] = "email";
3061
+ BasicAuthProvider["WALLET"] = "wallet";
3062
+ })(BasicAuthProvider || (BasicAuthProvider = {}));
3063
+ var OAuthProvider;
3064
+ (function (OAuthProvider) {
3065
+ OAuthProvider["GOOGLE"] = "google";
3066
+ OAuthProvider["TWITTER"] = "twitter";
3067
+ OAuthProvider["FACEBOOK"] = "facebook";
3068
+ })(OAuthProvider || (OAuthProvider = {}));
3069
+ var CodeChallengeMethodEnum;
3070
+ (function (CodeChallengeMethodEnum) {
3071
+ CodeChallengeMethodEnum["PLAIN"] = "plain";
3072
+ CodeChallengeMethodEnum["S256"] = "S256";
3073
+ })(CodeChallengeMethodEnum || (CodeChallengeMethodEnum = {}));
3074
+
3070
3075
  var OpenfortErrorType;
3071
3076
  (function (OpenfortErrorType) {
3072
3077
  OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
@@ -4601,8 +4606,8 @@ class EvmProvider {
4601
4606
  const openfortProviderInfo = {
4602
4607
  // eslint-disable-next-line max-len
4603
4608
  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>',
4604
- name: 'Ecosystem ID',
4605
- rdns: 'com.ecosystem.id',
4609
+ name: 'Openfort',
4610
+ rdns: 'xyz.openfort',
4606
4611
  uuid: v4(),
4607
4612
  };
4608
4613
  function announceProvider(detail) {
@@ -4660,11 +4665,14 @@ class AuthManager {
4660
4665
  this.instanceManager = instanceManager;
4661
4666
  }
4662
4667
  async initOAuth(provider, options) {
4668
+ const usePooling = options?.usePooling ?? false;
4669
+ // eslint-disable-next-line no-param-reassign
4670
+ delete options?.usePooling;
4663
4671
  const request = {
4664
4672
  oAuthInitRequest: {
4665
4673
  provider,
4666
4674
  options,
4667
- usePooling: options?.usePooling || false,
4675
+ usePooling,
4668
4676
  },
4669
4677
  };
4670
4678
  const result = await this.backendApiClients.authenticationApi.initOAuth(request);
@@ -4846,7 +4854,13 @@ class AuthManager {
4846
4854
  return response.data;
4847
4855
  }, OpenfortErrorType.USER_REGISTRATION_ERROR);
4848
4856
  }
4849
- async validateCredentials(accessToken, refreshToken, jwk) {
4857
+ async validateCredentials() {
4858
+ const jwk = await this.instanceManager.getJWK();
4859
+ const accessToken = this.instanceManager.getAccessToken()?.token;
4860
+ const refreshToken = this.instanceManager.getRefreshToken();
4861
+ if (!accessToken || !refreshToken || !jwk) {
4862
+ throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
4863
+ }
4850
4864
  try {
4851
4865
  const key = (await importJWK({
4852
4866
  kty: jwk.kty,
@@ -5022,6 +5036,8 @@ const chainIDStorageKey = 'openfort.chain_id';
5022
5036
  const jwksStorageKey = 'openfort.jwk';
5023
5037
  const deviceIDStorageKey = 'openfort.device_id';
5024
5038
  const accountTypeStorageKey = 'openfort.account_type';
5039
+ const shieldAuthTypeStorageKey = 'openfort.shield_auth_type';
5040
+ const shieldAuthTokenStorageKey = 'openfort.shield_auth_token';
5025
5041
  const accountAddressStorageKey = 'openfort.account_address';
5026
5042
 
5027
5043
  class InstanceManager {
@@ -5031,6 +5047,7 @@ class InstanceManager {
5031
5047
  jwk = null;
5032
5048
  sessionKey = null;
5033
5049
  deviceID = null;
5050
+ shieldAuthType = null;
5034
5051
  chainId = null;
5035
5052
  accountAddress = null;
5036
5053
  accountType = null;
@@ -5162,9 +5179,10 @@ class InstanceManager {
5162
5179
  };
5163
5180
  const response = await this.backendApiClients.authenticationApi.getJwks(request);
5164
5181
  if (response.data.keys.length === 0) {
5165
- throw new Error('No keys found');
5182
+ throw new Error('Internal error: No JWKS keys found');
5166
5183
  }
5167
5184
  const jwtKey = response.data.keys[0];
5185
+ this.setJWK(jwtKey);
5168
5186
  this.jwk = {
5169
5187
  kty: jwtKey.kty,
5170
5188
  crv: jwtKey.crv,
@@ -5249,6 +5267,34 @@ class InstanceManager {
5249
5267
  this.accountType = null;
5250
5268
  this.persistentStorage.remove(accountTypeStorageKey);
5251
5269
  }
5270
+ setShieldAuthType(accountType) {
5271
+ this.accountType = accountType;
5272
+ this.persistentStorage.save(shieldAuthTypeStorageKey, accountType);
5273
+ }
5274
+ getShieldAuthType() {
5275
+ if (!this.accountType) {
5276
+ this.accountType = this.persistentStorage.get(shieldAuthTypeStorageKey);
5277
+ }
5278
+ return this.accountType;
5279
+ }
5280
+ removeShieldAuthType() {
5281
+ this.accountType = null;
5282
+ this.persistentStorage.remove(shieldAuthTypeStorageKey);
5283
+ }
5284
+ setShieldAuthToken(accountType) {
5285
+ this.accountType = accountType;
5286
+ this.persistentStorage.save(shieldAuthTokenStorageKey, accountType);
5287
+ }
5288
+ getShieldAuthToken() {
5289
+ if (!this.accountType) {
5290
+ this.accountType = this.persistentStorage.get(shieldAuthTokenStorageKey);
5291
+ }
5292
+ return this.accountType;
5293
+ }
5294
+ removeShieldAuthToken() {
5295
+ this.accountType = null;
5296
+ this.persistentStorage.remove(shieldAuthTokenStorageKey);
5297
+ }
5252
5298
  }
5253
5299
 
5254
5300
  class LocalStorage {
@@ -5594,11 +5640,11 @@ class UpdateAuthenticationRequest {
5594
5640
  this.recovery = recovery;
5595
5641
  }
5596
5642
  }
5597
- var AuthType;
5598
- (function (AuthType) {
5599
- AuthType["OPENFORT"] = "openfort";
5600
- AuthType["CUSTOM"] = "custom";
5601
- })(AuthType || (AuthType = {}));
5643
+ var ShieldAuthType;
5644
+ (function (ShieldAuthType) {
5645
+ ShieldAuthType["OPENFORT"] = "openfort";
5646
+ ShieldAuthType["CUSTOM"] = "custom";
5647
+ })(ShieldAuthType || (ShieldAuthType = {}));
5602
5648
 
5603
5649
  class MissingRecoveryPasswordError extends Error {
5604
5650
  constructor() {
@@ -5879,6 +5925,8 @@ class Openfort {
5879
5925
  this.instanceManager.removeChainID();
5880
5926
  this.instanceManager.removeDeviceID();
5881
5927
  this.instanceManager.removeJWK();
5928
+ this.instanceManager.removeShieldAuthType();
5929
+ this.instanceManager.removeShieldAuthToken();
5882
5930
  }
5883
5931
  }
5884
5932
  /**
@@ -5915,6 +5963,9 @@ class Openfort {
5915
5963
  * @returns A SessionKey object containing the address and registration status.
5916
5964
  */
5917
5965
  configureSessionKey() {
5966
+ if (this.instanceManager.getSignerType() === SignerType.EMBEDDED) {
5967
+ throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
5968
+ }
5918
5969
  const signer = new SessionSigner(this.instanceManager);
5919
5970
  this.signer = signer;
5920
5971
  const publicKey = signer.loadKeys();
@@ -5933,8 +5984,14 @@ class Openfort {
5933
5984
  * @param recoveryPassword - Recovery password.
5934
5985
  */
5935
5986
  async configureEmbeddedSigner(chainId, shieldAuthentication, recoveryPassword) {
5936
- const signer = this.newEmbeddedSigner(chainId, shieldAuthentication);
5937
5987
  await this.validateAndRefreshToken();
5988
+ if (shieldAuthentication) {
5989
+ this.instanceManager.setShieldAuthType(shieldAuthentication?.auth);
5990
+ if (shieldAuthentication?.auth === ShieldAuthType.CUSTOM) {
5991
+ this.instanceManager.setShieldAuthToken(shieldAuthentication?.token);
5992
+ }
5993
+ }
5994
+ const signer = this.newEmbeddedSigner(chainId);
5938
5995
  await signer.ensureEmbeddedAccount(recoveryPassword);
5939
5996
  this.signer = signer;
5940
5997
  this.instanceManager.setSignerType(SignerType.EMBEDDED);
@@ -5946,10 +6003,8 @@ class Openfort {
5946
6003
  * @param password - User's password.
5947
6004
  * @returns An AuthResponse object containing authentication details.
5948
6005
  */
5949
- async loginWithEmailPassword({ email, password }) {
5950
- this.instanceManager.removeAccessToken();
5951
- this.instanceManager.removeRefreshToken();
5952
- this.instanceManager.removePlayerID();
6006
+ async logInWithEmailPassword({ email, password }) {
6007
+ this.logout();
5953
6008
  const result = await this.authManager.loginEmailPassword(email, password);
5954
6009
  this.storeCredentials({
5955
6010
  player: result.player.id,
@@ -5967,9 +6022,7 @@ class Openfort {
5967
6022
  * @returns An AuthResponse object containing authentication details.
5968
6023
  */
5969
6024
  async signUpWithEmailPassword({ email, password, options }) {
5970
- this.instanceManager.removeAccessToken();
5971
- this.instanceManager.removeRefreshToken();
5972
- this.instanceManager.removePlayerID();
6025
+ this.logout();
5973
6026
  const result = await this.authManager.signupEmailPassword(email, password, options?.data.name);
5974
6027
  this.storeCredentials({
5975
6028
  player: result.player.id,
@@ -6046,6 +6099,7 @@ class Openfort {
6046
6099
  * @returns An InitAuthResponse object.
6047
6100
  */
6048
6101
  async initOAuth({ provider, options }) {
6102
+ this.logout();
6049
6103
  const authResponse = await this.authManager.initOAuth(provider, options);
6050
6104
  return authResponse;
6051
6105
  }
@@ -6168,7 +6222,8 @@ class Openfort {
6168
6222
  thirdPartyTokenType: null,
6169
6223
  });
6170
6224
  this.instanceManager.setRefreshToken(auth.refreshToken);
6171
- this.instanceManager.setPlayerID(auth.player);
6225
+ if (auth.player)
6226
+ this.instanceManager.setPlayerID(auth.player);
6172
6227
  }
6173
6228
  /**
6174
6229
  * Sends a signature transaction intent request.
@@ -6176,10 +6231,11 @@ class Openfort {
6176
6231
  * @param transactionIntentId - Transaction intent ID.
6177
6232
  * @param userOperationHash - User operation hash.
6178
6233
  * @param signature - Transaction signature.
6234
+ * @param optimistic - Whether the request is optimistic.
6179
6235
  * @returns A TransactionIntentResponse object.
6180
6236
  * @throws {OpenfortError} If no userOperationHash or signature is provided.
6181
6237
  */
6182
- async sendSignatureTransactionIntentRequest(transactionIntentId, userOperationHash = null, signature = null) {
6238
+ async sendSignatureTransactionIntentRequest(transactionIntentId, userOperationHash = null, signature = null, optimistic = false) {
6183
6239
  let newSignature = signature;
6184
6240
  if (!newSignature) {
6185
6241
  if (!userOperationHash) {
@@ -6198,6 +6254,7 @@ class Openfort {
6198
6254
  id: transactionIntentId,
6199
6255
  signatureRequest: {
6200
6256
  signature: newSignature,
6257
+ optimistic,
6201
6258
  },
6202
6259
  };
6203
6260
  const result = await this.backendApiClients.transactionIntentsApi.signature(request);
@@ -6271,17 +6328,8 @@ class Openfort {
6271
6328
  * @param signature - Session signature.
6272
6329
  * @param optimistic - Whether the request is optimistic.
6273
6330
  * @returns A SessionResponse object.
6274
- * @throws {OpenfortError} If no signer is configured.
6275
- * @throws {OpenfortError} If the signer is not a SessionSigner.
6276
6331
  */
6277
6332
  async sendRegisterSessionRequest(sessionId, signature, optimistic) {
6278
- await this.recoverSigner();
6279
- if (!this.signer) {
6280
- throw new OpenfortError('No signer configured nor signature provided', OpenfortErrorType.MISSING_SIGNER_ERROR);
6281
- }
6282
- if (this.signer.getSingerType() !== SignerType.SESSION) {
6283
- throw new OpenfortError('Session signer must be configured to sign a session', OpenfortErrorType.MISSING_SESSION_SIGNER_ERROR);
6284
- }
6285
6333
  const request = {
6286
6334
  id: sessionId,
6287
6335
  signatureRequest: {
@@ -6338,28 +6386,31 @@ class Openfort {
6338
6386
  * Validates and refreshes the access token if needed.
6339
6387
  */
6340
6388
  async validateAndRefreshToken() {
6341
- if (!this.credentialsProvided()) {
6342
- return;
6389
+ const authType = this.credentialsProvided();
6390
+ if (!authType) {
6391
+ throw new OpenfortError('Must be logged in to validate and refresh token', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6343
6392
  }
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) {
6393
+ if (authType === AuthType.OPENFORT) {
6394
+ const auth = await this.authManager.validateCredentials();
6352
6395
  this.storeCredentials(auth);
6353
- }
6354
- if (this.signer && this.signer.useCredentials()) {
6355
- await this.signer.updateAuthentication();
6396
+ if (this.signer && this.signer.useCredentials()) {
6397
+ await this.signer.updateAuthentication();
6398
+ }
6356
6399
  }
6357
6400
  }
6358
6401
  credentialsProvided() {
6359
6402
  const token = this.instanceManager.getAccessToken();
6360
6403
  const refreshToken = this.instanceManager.getRefreshToken();
6361
- return token && ((token.token && token.thirdPartyProvider && token.thirdPartyTokenType)
6362
- || (token.token && refreshToken));
6404
+ if (!token) {
6405
+ return null;
6406
+ }
6407
+ if (token.token && token.thirdPartyProvider && token.thirdPartyTokenType) {
6408
+ return AuthType.THIRD_PARTY;
6409
+ }
6410
+ if (token.token && refreshToken) {
6411
+ return AuthType.OPENFORT;
6412
+ }
6413
+ return null;
6363
6414
  }
6364
6415
  async recoverSigner() {
6365
6416
  if (this.signer) {
@@ -6394,16 +6445,33 @@ class Openfort {
6394
6445
  };
6395
6446
  await checkSignerType(0);
6396
6447
  }
6397
- newEmbeddedSigner(chainId, shieldAuthentication) {
6448
+ newEmbeddedSigner(chainId) {
6398
6449
  if (!this.credentialsProvided()) {
6399
6450
  throw new OpenfortError('Must be logged in to configure embedded signer', OpenfortErrorType.NOT_LOGGED_IN_ERROR);
6400
6451
  }
6452
+ let shieldAuthType = this.instanceManager.getShieldAuthType();
6453
+ if (!shieldAuthType) {
6454
+ // TODO: remove, this is for backward compatibility
6455
+ this.instanceManager.setShieldAuthType(ShieldAuthType.OPENFORT);
6456
+ shieldAuthType = ShieldAuthType.OPENFORT;
6457
+ // throw new OpenfortError('Shield auth type is not set', OpenfortErrorType.INVALID_CONFIGURATION);
6458
+ }
6459
+ const token = shieldAuthType === ShieldAuthType.OPENFORT
6460
+ ? this.instanceManager.getAccessToken()?.token
6461
+ : this.instanceManager.getShieldAuthToken();
6462
+ if (!token) {
6463
+ throw new OpenfortError('Shield auth token is not set', OpenfortErrorType.INVALID_CONFIGURATION);
6464
+ }
6465
+ const shieldAuth = {
6466
+ auth: shieldAuthType,
6467
+ token,
6468
+ };
6401
6469
  const iframeConfiguration = {
6402
6470
  accessToken: this.instanceManager.getAccessToken()?.token ?? null,
6403
6471
  thirdPartyProvider: this.instanceManager.getAccessToken()?.thirdPartyProvider ?? null,
6404
6472
  thirdPartyTokenType: this.instanceManager.getAccessToken()?.thirdPartyTokenType ?? null,
6405
6473
  chainId: !chainId ? Number(this.instanceManager.getChainID()) ?? null : chainId,
6406
- recovery: shieldAuthentication ?? null,
6474
+ recovery: shieldAuth,
6407
6475
  };
6408
6476
  return new EmbeddedSigner(this.iframeManager, this.instanceManager, iframeConfiguration);
6409
6477
  }
@@ -6435,4 +6503,4 @@ class Openfort {
6435
6503
  }
6436
6504
  }
6437
6505
 
6438
- export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, OpenfortError, SDKConfiguration, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };
6506
+ export { AuthType, BasicAuthProvider, EmbeddedState, OAuthProvider, OpenfortConfiguration, OpenfortError, SDKConfiguration, ShieldAuthType, ShieldConfiguration, ThirdPartyOAuthProvider, TokenType, Openfort as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/openfort-js",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "author": "Openfort (https://www.openfort.xyz)",
5
5
  "bugs": "https://github.com/openfort-xyz/openfort-js/issues",
6
6
  "repository": "openfort-xyz/openfort-js.git",