@openfort/openfort-js 0.8.15 → 0.8.16

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
@@ -3339,7 +3339,7 @@ class KeyPair extends signingKey.SigningKey {
3339
3339
  }
3340
3340
  }
3341
3341
 
3342
- const VERSION = '0.8.15';
3342
+ const VERSION = '0.8.16';
3343
3343
 
3344
3344
  var Event;
3345
3345
  (function (Event) {
@@ -4636,7 +4636,8 @@ class AuthManager {
4636
4636
  if (forceRefresh) {
4637
4637
  return this.refreshTokens(authentication.refreshToken, forceRefresh);
4638
4638
  }
4639
- if (crypto__namespace.subtle) {
4639
+ const webCrypto = AuthManager.getWebCrypto();
4640
+ if (webCrypto?.subtle) {
4640
4641
  return this.validateCredentialsWithCrypto(jwk, authentication);
4641
4642
  }
4642
4643
  return this.validateCredentialsWithoutCrypto(jwk, authentication);
@@ -4837,6 +4838,16 @@ class AuthManager {
4837
4838
  });
4838
4839
  return authPlayerResponse.data;
4839
4840
  }
4841
+ static getWebCrypto() {
4842
+ if (isBrowser()) {
4843
+ return window.crypto;
4844
+ }
4845
+ // Node.js environment
4846
+ if (typeof global !== 'undefined' && global.crypto) {
4847
+ return global.crypto;
4848
+ }
4849
+ return null;
4850
+ }
4840
4851
  async linkEmail(email, password, accessToken, ecosystemGame) {
4841
4852
  const request = {
4842
4853
  loginRequest: {
package/dist/index.js CHANGED
@@ -3316,7 +3316,7 @@ class KeyPair extends SigningKey {
3316
3316
  }
3317
3317
  }
3318
3318
 
3319
- const VERSION = '0.8.15';
3319
+ const VERSION = '0.8.16';
3320
3320
 
3321
3321
  var Event;
3322
3322
  (function (Event) {
@@ -4613,7 +4613,8 @@ class AuthManager {
4613
4613
  if (forceRefresh) {
4614
4614
  return this.refreshTokens(authentication.refreshToken, forceRefresh);
4615
4615
  }
4616
- if (crypto.subtle) {
4616
+ const webCrypto = AuthManager.getWebCrypto();
4617
+ if (webCrypto?.subtle) {
4617
4618
  return this.validateCredentialsWithCrypto(jwk, authentication);
4618
4619
  }
4619
4620
  return this.validateCredentialsWithoutCrypto(jwk, authentication);
@@ -4814,6 +4815,16 @@ class AuthManager {
4814
4815
  });
4815
4816
  return authPlayerResponse.data;
4816
4817
  }
4818
+ static getWebCrypto() {
4819
+ if (isBrowser()) {
4820
+ return window.crypto;
4821
+ }
4822
+ // Node.js environment
4823
+ if (typeof global !== 'undefined' && global.crypto) {
4824
+ return global.crypto;
4825
+ }
4826
+ return null;
4827
+ }
4817
4828
  async linkEmail(email, password, accessToken, ecosystemGame) {
4818
4829
  const request = {
4819
4830
  loginRequest: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openfort/openfort-js",
3
- "version": "0.8.15",
3
+ "version": "0.8.16",
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",