@dynamic-labs/utils 4.25.9 → 4.26.0

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/CHANGELOG.md CHANGED
@@ -1,4 +1,37 @@
1
1
 
2
+ ## [4.26.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.10...v4.26.0) (2025-08-14)
3
+
4
+
5
+ ### Features
6
+
7
+ * add forceRefresh to useTokenBalances ([#9320](https://github.com/dynamic-labs/dynamic-auth/issues/9320)) ([22c4035](https://github.com/dynamic-labs/dynamic-auth/commit/22c403546496ffb6b1ed846510a079efc65c5d57))
8
+ * add signMessageWithContext to support user operations with WaaS ([#9287](https://github.com/dynamic-labs/dynamic-auth/issues/9287)) ([744c158](https://github.com/dynamic-labs/dynamic-auth/commit/744c158a890346c624a101ba8b20911eefbdd1ef))
9
+ * add sui support to react native ([#9236](https://github.com/dynamic-labs/dynamic-auth/issues/9236)) ([301d821](https://github.com/dynamic-labs/dynamic-auth/commit/301d821b16eb1bc112609882ed0ae5e9f2477ace))
10
+ * add whitelistedContracts to token balance hooks ([#9324](https://github.com/dynamic-labs/dynamic-auth/issues/9324)) ([86596dd](https://github.com/dynamic-labs/dynamic-auth/commit/86596dd692152f82a2553b9824ce21781024dac1))
11
+ * pass policy context to sign authorization ([#9327](https://github.com/dynamic-labs/dynamic-auth/issues/9327)) ([3e6d009](https://github.com/dynamic-labs/dynamic-auth/commit/3e6d009ca3d50e01a665550fa803d07bd3038eb1))
12
+
13
+
14
+ ### Bug Fixes
15
+
16
+ * don't prompt passkeys twice when component renders ([#9340](https://github.com/dynamic-labs/dynamic-auth/issues/9340)) ([8fbdd28](https://github.com/dynamic-labs/dynamic-auth/commit/8fbdd287d1dd67fee4720f16a3d506f75d9dafe7))
17
+ * onAuthSuccess with primaryWallet null when signing up with embedded wallets v3 ([#9345](https://github.com/dynamic-labs/dynamic-auth/issues/9345)) ([14e54a0](https://github.com/dynamic-labs/dynamic-auth/commit/14e54a093395a46cb32282aebc172b26c243d42f))
18
+ * rename passkey not automatically updating UI ([#9339](https://github.com/dynamic-labs/dynamic-auth/issues/9339)) ([b9ef253](https://github.com/dynamic-labs/dynamic-auth/commit/b9ef2532152a228feebb1fb9811937d7a14d81b1))
19
+ * wallet kit being initiated internally multiple times ([#9344](https://github.com/dynamic-labs/dynamic-auth/issues/9344)) ([49a3664](https://github.com/dynamic-labs/dynamic-auth/commit/49a3664c5995b0104693ec87b41b8540dd19bdca))
20
+
21
+ ### [4.25.10](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.9...v4.25.10) (2025-08-07)
22
+
23
+
24
+ ### Features
25
+
26
+ * trigger event for social account changes ([#9291](https://github.com/dynamic-labs/dynamic-auth/issues/9291)) ([6766754](https://github.com/dynamic-labs/dynamic-auth/commit/6766754dd6858628003781fab6cca42c1898dd2d))
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * allow using the custom transport config in EthereumWallet walletClient creation ([#9310](https://github.com/dynamic-labs/dynamic-auth/issues/9310)) ([e1db68a](https://github.com/dynamic-labs/dynamic-auth/commit/e1db68a16d51d4db3317b707f27ff35b64056829))
32
+ * incorrect modal showing up when linking MetaMask SOL in headless mode ([#9317](https://github.com/dynamic-labs/dynamic-auth/issues/9317)) ([c7f9644](https://github.com/dynamic-labs/dynamic-auth/commit/c7f9644abe51d537100997db47d8a6d1b78cf8e7))
33
+ * prevent logged-in users from trying to signing in again with social ([#9315](https://github.com/dynamic-labs/dynamic-auth/issues/9315)) ([365c65c](https://github.com/dynamic-labs/dynamic-auth/commit/365c65c0c7bb22c47e77ca58727a473b60887e24))
34
+
2
35
  ### [4.25.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.25.8...v4.25.9) (2025-08-01)
3
36
 
4
37
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.25.9";
6
+ var version = "4.26.0";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.25.9";
2
+ var version = "4.26.0";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/utils",
3
- "version": "4.25.9",
3
+ "version": "4.26.0",
4
4
  "description": "A React SDK for implementing wallet web3 authentication and authorization to your website.",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
- "@dynamic-labs/sdk-api-core": "0.0.728",
21
+ "@dynamic-labs/sdk-api-core": "0.0.749",
22
22
  "tldts": "6.0.16",
23
- "@dynamic-labs/assert-package-version": "4.25.9",
24
- "@dynamic-labs/logger": "4.25.9",
25
- "@dynamic-labs/types": "4.25.9",
23
+ "@dynamic-labs/assert-package-version": "4.26.0",
24
+ "@dynamic-labs/logger": "4.26.0",
25
+ "@dynamic-labs/types": "4.26.0",
26
26
  "buffer": "6.0.3",
27
27
  "eventemitter3": "5.0.1"
28
28
  },
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var _tslib = require('../../../_virtual/_tslib.cjs');
7
+ var DecryptionError = require('../../errors/DecryptionError.cjs');
7
8
 
8
9
  /**
9
10
  * Decrypts an encrypted message using AES-GCM encryption with a shared secret key.
@@ -16,20 +17,32 @@ var _tslib = require('../../../_virtual/_tslib.cjs');
16
17
  */
17
18
  const decryptMessage = (sharedSecret, message, iv, additionalData) => _tslib.__awaiter(void 0, void 0, void 0, function* () {
18
19
  var _a, _b;
19
- const decoder = new TextDecoder();
20
- const sharedSecretByteArray = new Uint8Array((_b = (_a = decodeURIComponent(sharedSecret)
21
- .match(/.{1,2}/g)) === null || _a === void 0 ? void 0 : _a.map((byte) => parseInt(byte, 16))) !== null && _b !== void 0 ? _b : []);
22
- // Import the ArrayBuffer as a CryptoKey
23
- const sharedSecretCryptoKey = yield crypto.subtle.importKey('raw', sharedSecretByteArray.buffer, 'AES-GCM', true, ['encrypt', 'decrypt']);
24
- const decryptParams = {
25
- iv: hexToUint8Array(decodeURIComponent(iv)),
26
- name: 'AES-GCM',
27
- };
28
- if (additionalData) {
29
- decryptParams.additionalData = additionalData;
20
+ try {
21
+ const decoder = new TextDecoder();
22
+ const sharedSecretByteArray = new Uint8Array((_b = (_a = decodeURIComponent(sharedSecret)
23
+ .match(/.{1,2}/g)) === null || _a === void 0 ? void 0 : _a.map((byte) => parseInt(byte, 16))) !== null && _b !== void 0 ? _b : []);
24
+ // Import the ArrayBuffer as a CryptoKey
25
+ const sharedSecretCryptoKey = yield crypto.subtle.importKey('raw', sharedSecretByteArray.buffer, 'AES-GCM', true, ['encrypt', 'decrypt']);
26
+ const decryptParams = {
27
+ iv: hexToUint8Array(decodeURIComponent(iv)),
28
+ name: 'AES-GCM',
29
+ };
30
+ if (additionalData) {
31
+ decryptParams.additionalData = additionalData;
32
+ }
33
+ const decryptedData = yield crypto.subtle.decrypt(decryptParams, sharedSecretCryptoKey, base64ToArrayBuffer(decodeURIComponent(message)));
34
+ return decoder.decode(new Uint8Array(decryptedData));
35
+ }
36
+ catch (error) {
37
+ // Failed to decrypt the message
38
+ if (error &&
39
+ typeof error === 'object' &&
40
+ 'name' in error &&
41
+ typeof error.name === 'string') {
42
+ throw new DecryptionError.DecryptionError(error.name);
43
+ }
44
+ throw error;
30
45
  }
31
- const decryptedData = yield crypto.subtle.decrypt(decryptParams, sharedSecretCryptoKey, base64ToArrayBuffer(decodeURIComponent(message)));
32
- return decoder.decode(new Uint8Array(decryptedData));
33
46
  });
34
47
  const hexToUint8Array = (hex) => {
35
48
  if (hex.length % 2 !== 0) {
@@ -1,5 +1,6 @@
1
1
  'use client'
2
2
  import { __awaiter } from '../../../_virtual/_tslib.js';
3
+ import { DecryptionError } from '../../errors/DecryptionError.js';
3
4
 
4
5
  /**
5
6
  * Decrypts an encrypted message using AES-GCM encryption with a shared secret key.
@@ -12,20 +13,32 @@ import { __awaiter } from '../../../_virtual/_tslib.js';
12
13
  */
13
14
  const decryptMessage = (sharedSecret, message, iv, additionalData) => __awaiter(void 0, void 0, void 0, function* () {
14
15
  var _a, _b;
15
- const decoder = new TextDecoder();
16
- const sharedSecretByteArray = new Uint8Array((_b = (_a = decodeURIComponent(sharedSecret)
17
- .match(/.{1,2}/g)) === null || _a === void 0 ? void 0 : _a.map((byte) => parseInt(byte, 16))) !== null && _b !== void 0 ? _b : []);
18
- // Import the ArrayBuffer as a CryptoKey
19
- const sharedSecretCryptoKey = yield crypto.subtle.importKey('raw', sharedSecretByteArray.buffer, 'AES-GCM', true, ['encrypt', 'decrypt']);
20
- const decryptParams = {
21
- iv: hexToUint8Array(decodeURIComponent(iv)),
22
- name: 'AES-GCM',
23
- };
24
- if (additionalData) {
25
- decryptParams.additionalData = additionalData;
16
+ try {
17
+ const decoder = new TextDecoder();
18
+ const sharedSecretByteArray = new Uint8Array((_b = (_a = decodeURIComponent(sharedSecret)
19
+ .match(/.{1,2}/g)) === null || _a === void 0 ? void 0 : _a.map((byte) => parseInt(byte, 16))) !== null && _b !== void 0 ? _b : []);
20
+ // Import the ArrayBuffer as a CryptoKey
21
+ const sharedSecretCryptoKey = yield crypto.subtle.importKey('raw', sharedSecretByteArray.buffer, 'AES-GCM', true, ['encrypt', 'decrypt']);
22
+ const decryptParams = {
23
+ iv: hexToUint8Array(decodeURIComponent(iv)),
24
+ name: 'AES-GCM',
25
+ };
26
+ if (additionalData) {
27
+ decryptParams.additionalData = additionalData;
28
+ }
29
+ const decryptedData = yield crypto.subtle.decrypt(decryptParams, sharedSecretCryptoKey, base64ToArrayBuffer(decodeURIComponent(message)));
30
+ return decoder.decode(new Uint8Array(decryptedData));
31
+ }
32
+ catch (error) {
33
+ // Failed to decrypt the message
34
+ if (error &&
35
+ typeof error === 'object' &&
36
+ 'name' in error &&
37
+ typeof error.name === 'string') {
38
+ throw new DecryptionError(error.name);
39
+ }
40
+ throw error;
26
41
  }
27
- const decryptedData = yield crypto.subtle.decrypt(decryptParams, sharedSecretCryptoKey, base64ToArrayBuffer(decodeURIComponent(message)));
28
- return decoder.decode(new Uint8Array(decryptedData));
29
42
  });
30
43
  const hexToUint8Array = (hex) => {
31
44
  if (hex.length % 2 !== 0) {
@@ -0,0 +1,12 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ class DecryptionError extends Error {
7
+ constructor(errorName) {
8
+ super(`Failed to decrypt the message: ${errorName}`);
9
+ }
10
+ }
11
+
12
+ exports.DecryptionError = DecryptionError;
@@ -0,0 +1,3 @@
1
+ export declare class DecryptionError extends Error {
2
+ constructor(errorName: string);
3
+ }
@@ -0,0 +1,8 @@
1
+ 'use client'
2
+ class DecryptionError extends Error {
3
+ constructor(errorName) {
4
+ super(`Failed to decrypt the message: ${errorName}`);
5
+ }
6
+ }
7
+
8
+ export { DecryptionError };
@@ -4,6 +4,7 @@ export * from './ChainalysisError';
4
4
  export * from './CookieInvalidError';
5
5
  export * from './CustomError';
6
6
  export * from './CustomFieldNotUniqueError';
7
+ export * from './DecryptionError';
7
8
  export * from './DynamicError';
8
9
  export * from './EmailAlreadyExistsError';
9
10
  export * from './EmailProviderError';
package/src/index.cjs CHANGED
@@ -16,6 +16,7 @@ var ChainalysisError = require('./errors/ChainalysisError.cjs');
16
16
  var CookieInvalidError = require('./errors/CookieInvalidError.cjs');
17
17
  var CustomError = require('./errors/CustomError.cjs');
18
18
  var CustomFieldNotUniqueError = require('./errors/CustomFieldNotUniqueError.cjs');
19
+ var DecryptionError = require('./errors/DecryptionError.cjs');
19
20
  var DynamicError = require('./errors/DynamicError.cjs');
20
21
  var EmailAlreadyExistsError = require('./errors/EmailAlreadyExistsError.cjs');
21
22
  var EmailProviderError = require('./errors/EmailProviderError.cjs');
@@ -123,6 +124,7 @@ exports.ChainalysisError = ChainalysisError.ChainalysisError;
123
124
  exports.CookieInvalidError = CookieInvalidError.CookieInvalidError;
124
125
  exports.CustomError = CustomError.CustomError;
125
126
  exports.CustomFieldNotUniqueError = CustomFieldNotUniqueError.CustomFieldNotUniqueError;
127
+ exports.DecryptionError = DecryptionError.DecryptionError;
126
128
  exports.DynamicError = DynamicError.DynamicError;
127
129
  exports.EmailAlreadyExistsError = EmailAlreadyExistsError.EmailAlreadyExistsError;
128
130
  exports.EmailProviderError = EmailProviderError.EmailProviderError;
package/src/index.js CHANGED
@@ -12,6 +12,7 @@ export { ChainalysisError } from './errors/ChainalysisError.js';
12
12
  export { CookieInvalidError } from './errors/CookieInvalidError.js';
13
13
  export { CustomError } from './errors/CustomError.js';
14
14
  export { CustomFieldNotUniqueError } from './errors/CustomFieldNotUniqueError.js';
15
+ export { DecryptionError } from './errors/DecryptionError.js';
15
16
  export { DynamicError } from './errors/DynamicError.js';
16
17
  export { EmailAlreadyExistsError } from './errors/EmailAlreadyExistsError.js';
17
18
  export { EmailProviderError } from './errors/EmailProviderError.js';