@dynamic-labs/client 4.20.8 → 4.20.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/CHANGELOG.md CHANGED
@@ -1,4 +1,19 @@
1
1
 
2
+ ### [4.20.9](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.8...v4.20.9) (2025-06-24)
3
+
4
+
5
+ ### Features
6
+
7
+ * add MFA to react-native ([#8987](https://github.com/dynamic-labs/dynamic-auth/issues/8987)) ([ecfa72d](https://github.com/dynamic-labs/dynamic-auth/commit/ecfa72dac1b2155166baa423a00e8460587074c2))
8
+
9
+
10
+ ### Bug Fixes
11
+
12
+ * add recovery flow for react-native ([#9007](https://github.com/dynamic-labs/dynamic-auth/issues/9007)) ([04ffa45](https://github.com/dynamic-labs/dynamic-auth/commit/04ffa45fc30e02b6ef8924a5d338cb8bebbb1aea))
13
+ * always get user and set primary wallet id ([#9013](https://github.com/dynamic-labs/dynamic-auth/issues/9013)) ([6685612](https://github.com/dynamic-labs/dynamic-auth/commit/66856125918bc903922fdbc4d2e151b4249308e3))
14
+ * cannot use recovery codes to delete mfa method ([#9003](https://github.com/dynamic-labs/dynamic-auth/issues/9003)) ([f3b6cb0](https://github.com/dynamic-labs/dynamic-auth/commit/f3b6cb03b1c76248a78f611249a6fb92cffcd32e))
15
+ * upgrade pbkdf2 ([#9008](https://github.com/dynamic-labs/dynamic-auth/issues/9008)) ([a0b8869](https://github.com/dynamic-labs/dynamic-auth/commit/a0b8869027b8e012d08ec7a6ded555e3ef89ca43))
16
+
2
17
  ### [4.20.8](https://github.com/dynamic-labs/dynamic-auth/compare/v4.20.7...v4.20.8) (2025-06-23)
3
18
 
4
19
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.20.8";
6
+ var version = "4.20.9";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.20.8";
2
+ var version = "4.20.9";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/client",
3
- "version": "4.20.8",
3
+ "version": "4.20.9",
4
4
  "description": "Core package for utilizing Dynamic's sdk",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -19,10 +19,11 @@
19
19
  "homepage": "https://www.dynamic.xyz/",
20
20
  "dependencies": {
21
21
  "@vue/reactivity": "^3.4.21",
22
- "@dynamic-labs/assert-package-version": "4.20.8",
23
- "@dynamic-labs/logger": "4.20.8",
24
- "@dynamic-labs/message-transport": "4.20.8",
25
- "@dynamic-labs/types": "4.20.8",
22
+ "@dynamic-labs/sdk-api-core": "0.0.688",
23
+ "@dynamic-labs/assert-package-version": "4.20.9",
24
+ "@dynamic-labs/logger": "4.20.9",
25
+ "@dynamic-labs/message-transport": "4.20.9",
26
+ "@dynamic-labs/types": "4.20.9",
26
27
  "eventemitter3": "5.0.1"
27
28
  },
28
29
  "peerDependencies": {}
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
6
  var authModule = require('../modules/authModule/authModule.cjs');
7
7
  var instrumentationModule = require('../modules/instrumentationModule/instrumentationModule.cjs');
8
+ var mfaModule = require('../modules/mfaModule/mfaModule.cjs');
8
9
  var networksModule = require('../modules/networksModule/networksModule.cjs');
9
10
  var sdkModule = require('../modules/sdkModule/sdkModule.cjs');
10
11
  var userInterfaceModule = require('../modules/userInterfaceModule/userInterfaceModule.cjs');
@@ -39,6 +40,8 @@ const createClient = (props) => {
39
40
  return {
40
41
  /** Module that gives access over authentication state, such as the auth token and user */
41
42
  auth: authModule.createAuthModule(core$1),
43
+ /** Module that provides access to MFA features */
44
+ mfa: mfaModule.createMfaModule(core$1),
42
45
  /** Module that provides all the networks configured */
43
46
  networks: networksModule.createNetworksModule(core$1),
44
47
  /** Module that gives insight over the state of the SDK */
@@ -1,3 +1,4 @@
1
+ import { LogLevel } from '@dynamic-labs/logger';
1
2
  import { Extendable } from '../utils/Extendable';
2
3
  export declare const baseClientExtensionName = "base";
3
4
  export type BaseClient = ReturnType<typeof createClient>;
@@ -10,6 +11,7 @@ export type ClientProps = {
10
11
  debug?: {
11
12
  webview?: boolean;
12
13
  messageTransport?: boolean;
14
+ loggerLevel?: LogLevel;
13
15
  };
14
16
  };
15
17
  /**
@@ -22,6 +24,8 @@ export type ClientProps = {
22
24
  export declare const createClient: (props: ClientProps) => {
23
25
  /** Module that gives access over authentication state, such as the auth token and user */
24
26
  auth: import("../modules/authModule").AuthModule;
27
+ /** Module that provides access to MFA features */
28
+ mfa: import("../modules/mfaModule").MfaModule;
25
29
  /** Module that provides all the networks configured */
26
30
  networks: import("dist/packages/message-transport/src").StoreStateGetters<import("dist/packages/message-transport/src").NetworksModuleState> & import("dist/packages/message-transport/src").PickedEventListeners<import("dist/packages/message-transport/src").StoreStateEvents<import("dist/packages/message-transport/src").NetworksModuleState>>;
27
31
  /** Module that gives insight over the state of the SDK */
@@ -1,6 +1,7 @@
1
1
  'use client'
2
2
  import { createAuthModule } from '../modules/authModule/authModule.js';
3
3
  import { setupInstrumentationModule } from '../modules/instrumentationModule/instrumentationModule.js';
4
+ import { createMfaModule } from '../modules/mfaModule/mfaModule.js';
4
5
  import { createNetworksModule } from '../modules/networksModule/networksModule.js';
5
6
  import { createSdkModule } from '../modules/sdkModule/sdkModule.js';
6
7
  import { createUserInterfaceModule } from '../modules/userInterfaceModule/userInterfaceModule.js';
@@ -35,6 +36,8 @@ const createClient = (props) => {
35
36
  return {
36
37
  /** Module that gives access over authentication state, such as the auth token and user */
37
38
  auth: createAuthModule(core),
39
+ /** Module that provides access to MFA features */
40
+ mfa: createMfaModule(core),
38
41
  /** Module that provides all the networks configured */
39
42
  networks: createNetworksModule(core),
40
43
  /** Module that gives insight over the state of the SDK */
@@ -33,6 +33,10 @@ const createCore = (props) => {
33
33
  * checks this list and throws an error if it doesn't find "viem" there.
34
34
  */
35
35
  declaredExtensionNames: reactivity.reactive([]),
36
+ /**
37
+ * The environment ID of the client
38
+ */
39
+ environmentId: props.environmentId,
36
40
  /**
37
41
  * SDK initialization module handles the initialization error
38
42
  */
@@ -13,6 +13,10 @@ export declare const createCore: (props: ClientProps) => {
13
13
  * checks this list and throws an error if it doesn't find "viem" there.
14
14
  */
15
15
  declaredExtensionNames: string[];
16
+ /**
17
+ * The environment ID of the client
18
+ */
19
+ environmentId: string;
16
20
  /**
17
21
  * SDK initialization module handles the initialization error
18
22
  */
@@ -29,6 +29,10 @@ const createCore = (props) => {
29
29
  * checks this list and throws an error if it doesn't find "viem" there.
30
30
  */
31
31
  declaredExtensionNames: reactive([]),
32
+ /**
33
+ * The environment ID of the client
34
+ */
35
+ environmentId: props.environmentId,
32
36
  /**
33
37
  * SDK initialization module handles the initialization error
34
38
  */
package/src/index.d.ts CHANGED
@@ -7,3 +7,4 @@ export { createClient, type BaseClient, type ClientProps, baseClientExtensionNam
7
7
  export type { AuthModule } from './modules/authModule';
8
8
  export type { SdkModule } from './modules/sdkModule';
9
9
  export type { WalletsModule } from './modules/walletsModule';
10
+ export type { MfaModule } from './modules/mfaModule';
@@ -8,10 +8,14 @@ var logger = require('@dynamic-labs/logger');
8
8
  var _package = require('../../../package.cjs');
9
9
 
10
10
  const setupInstrumentationModule = (clientProps) => {
11
+ var _a;
11
12
  logger.Logger.setEnvironmentId(clientProps.environmentId);
12
13
  logger.Logger.globalMetaData.set('platform-origin', 'host');
13
14
  logger.Logger.globalMetaData.set('client-version', _package.version);
14
15
  logger.Logger.globalMetaData.set('app-name', clientProps.appName);
16
+ if (((_a = clientProps.debug) === null || _a === void 0 ? void 0 : _a.loggerLevel) !== undefined) {
17
+ logger.Logger.setLogLevel(clientProps.debug.loggerLevel);
18
+ }
15
19
  return {
16
20
  trackClient: (client) => {
17
21
  client.sdk.on('loadedChanged', (loaded) => {
@@ -4,10 +4,14 @@ import { Logger } from '@dynamic-labs/logger';
4
4
  import { version } from '../../../package.js';
5
5
 
6
6
  const setupInstrumentationModule = (clientProps) => {
7
+ var _a;
7
8
  Logger.setEnvironmentId(clientProps.environmentId);
8
9
  Logger.globalMetaData.set('platform-origin', 'host');
9
10
  Logger.globalMetaData.set('client-version', version);
10
11
  Logger.globalMetaData.set('app-name', clientProps.appName);
12
+ if (((_a = clientProps.debug) === null || _a === void 0 ? void 0 : _a.loggerLevel) !== undefined) {
13
+ Logger.setLogLevel(clientProps.debug.loggerLevel);
14
+ }
11
15
  return {
12
16
  trackClient: (client) => {
13
17
  client.sdk.on('loadedChanged', (loaded) => {
@@ -0,0 +1 @@
1
+ export { createMfaModule, type MfaModule } from './mfaModule';
@@ -0,0 +1,24 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ var messageTransport = require('@dynamic-labs/message-transport');
7
+
8
+ const createMfaModule = (core) => {
9
+ const requestChannel = messageTransport.createRequestChannel(core.messageTransport);
10
+ return {
11
+ addDevice: (...args) => requestChannel.request('addDevice', ...args),
12
+ authDevice: (...args) => requestChannel.request('authDevice', ...args),
13
+ authRecoveryCode: (...args) => requestChannel.request('authRecoveryCode', ...args),
14
+ authenticateDevice: (...args) => requestChannel.request('authenticateDevice', ...args),
15
+ completeAcknowledgement: (...args) => requestChannel.request('completeAcknowledgement', ...args),
16
+ deleteUserDevice: (...args) => requestChannel.request('deleteUserDevice', ...args),
17
+ getRecoveryCodes: (...args) => requestChannel.request('getRecoveryCodes', ...args),
18
+ getUserDevices: (...args) => requestChannel.request('getUserDevices', ...args),
19
+ updateUserDevice: (...args) => requestChannel.request('updateUserDevice', ...args),
20
+ verifyDevice: (...args) => requestChannel.request('verifyDevice', ...args),
21
+ };
22
+ };
23
+
24
+ exports.createMfaModule = createMfaModule;
@@ -0,0 +1,23 @@
1
+ import { MFADevice, MFADeviceType } from '@dynamic-labs/sdk-api-core';
2
+ import { Core } from '../../client/core';
3
+ export type MfaModule = {
4
+ authRecoveryCode: (code: string) => Promise<boolean>;
5
+ completeAcknowledgement: () => Promise<void>;
6
+ deleteUserDevice: (deviceId: string, mfaAuthToken: string) => Promise<void>;
7
+ getRecoveryCodes: (generateNewCodes?: boolean) => Promise<string[]>;
8
+ getUserDevices: () => Promise<MFADevice[]>;
9
+ updateUserDevice: (deviceId: string) => Promise<void>;
10
+ verifyDevice: (code: string, type?: MFADeviceType) => Promise<MFADevice>;
11
+ addDevice: (type?: MFADeviceType) => Promise<{
12
+ id: string;
13
+ secret: string;
14
+ uri: string;
15
+ }>;
16
+ authDevice: (code: string, type?: MFADeviceType, deviceId?: string) => Promise<boolean>;
17
+ authenticateDevice: ({ code, type, deviceId, }: {
18
+ code: string;
19
+ type?: MFADeviceType;
20
+ deviceId?: string;
21
+ }) => Promise<string | null>;
22
+ };
23
+ export declare const createMfaModule: (core: Core) => MfaModule;
@@ -0,0 +1,20 @@
1
+ 'use client'
2
+ import { createRequestChannel } from '@dynamic-labs/message-transport';
3
+
4
+ const createMfaModule = (core) => {
5
+ const requestChannel = createRequestChannel(core.messageTransport);
6
+ return {
7
+ addDevice: (...args) => requestChannel.request('addDevice', ...args),
8
+ authDevice: (...args) => requestChannel.request('authDevice', ...args),
9
+ authRecoveryCode: (...args) => requestChannel.request('authRecoveryCode', ...args),
10
+ authenticateDevice: (...args) => requestChannel.request('authenticateDevice', ...args),
11
+ completeAcknowledgement: (...args) => requestChannel.request('completeAcknowledgement', ...args),
12
+ deleteUserDevice: (...args) => requestChannel.request('deleteUserDevice', ...args),
13
+ getRecoveryCodes: (...args) => requestChannel.request('getRecoveryCodes', ...args),
14
+ getUserDevices: (...args) => requestChannel.request('getUserDevices', ...args),
15
+ updateUserDevice: (...args) => requestChannel.request('updateUserDevice', ...args),
16
+ verifyDevice: (...args) => requestChannel.request('verifyDevice', ...args),
17
+ };
18
+ };
19
+
20
+ export { createMfaModule };