@dynamic-labs/waas 4.46.0 → 4.46.2

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,13 @@
1
1
 
2
+ ### [4.46.2](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.1...v4.46.2) (2025-11-20)
3
+
4
+
5
+ ### Bug Fixes
6
+
7
+ * patch vulnerability with package @hpke/core ([#9923](https://github.com/dynamic-labs/dynamic-auth/issues/9923)) ([24133c6](https://github.com/dynamic-labs/dynamic-auth/commit/24133c6155fa36cd65cd2befabbdd9cbaa239b61))
8
+
9
+ ### [4.46.1](https://github.com/dynamic-labs/dynamic-auth/compare/v4.46.0...v4.46.1) (2025-11-20)
10
+
2
11
  ## [4.46.0](https://github.com/dynamic-labs/dynamic-auth/compare/v4.45.3...v4.46.0) (2025-11-19)
3
12
 
4
13
 
package/package.cjs CHANGED
@@ -3,6 +3,6 @@
3
3
 
4
4
  Object.defineProperty(exports, '__esModule', { value: true });
5
5
 
6
- var version = "4.46.0";
6
+ var version = "4.46.2";
7
7
 
8
8
  exports.version = version;
package/package.js CHANGED
@@ -1,4 +1,4 @@
1
1
  'use client'
2
- var version = "4.46.0";
2
+ var version = "4.46.2";
3
3
 
4
4
  export { version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dynamic-labs/waas",
3
- "version": "4.46.0",
3
+ "version": "4.46.2",
4
4
  "type": "module",
5
5
  "author": "Dynamic Labs, Inc.",
6
6
  "license": "MIT",
@@ -16,14 +16,15 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "dependencies": {
19
- "@dynamic-labs/assert-package-version": "4.46.0",
19
+ "@dynamic-labs/assert-package-version": "4.46.2",
20
20
  "@dynamic-labs/sdk-api-core": "0.0.821",
21
21
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.190",
22
- "@dynamic-labs/ethereum-core": "4.46.0",
23
- "@dynamic-labs/solana-core": "4.46.0",
24
- "@dynamic-labs/sui-core": "4.46.0",
25
- "@dynamic-labs/utils": "4.46.0",
26
- "@dynamic-labs/wallet-book": "4.46.0"
22
+ "@dynamic-labs/ethereum-core": "4.46.2",
23
+ "@dynamic-labs/logger": "4.46.2",
24
+ "@dynamic-labs/solana-core": "4.46.2",
25
+ "@dynamic-labs/sui-core": "4.46.2",
26
+ "@dynamic-labs/utils": "4.46.2",
27
+ "@dynamic-labs/wallet-book": "4.46.2"
27
28
  },
28
29
  "peerDependencies": {}
29
30
  }
@@ -9,6 +9,7 @@ var sdkApiCore = require('@dynamic-labs/sdk-api-core');
9
9
  var utils = require('@dynamic-labs/utils');
10
10
  var _package = require('../package.cjs');
11
11
  var constants = require('../utils/constants.cjs');
12
+ var instrumentation = require('../utils/instrumentation.cjs');
12
13
 
13
14
  // This class is common across all waas connectors
14
15
  class WaasExportHandler {
@@ -355,6 +356,49 @@ const withDynamicWaas = (BaseClass) => {
355
356
  this.dynamicWaasClient = undefined;
356
357
  });
357
358
  }
359
+ generateTraceId() {
360
+ // Generate a 128-bit trace ID
361
+ // 128-bit = 16 bytes = 32 hexadecimal characters
362
+ const bytes = new Uint8Array(16);
363
+ crypto.getRandomValues(bytes);
364
+ // Convert bytes to hexadecimal string
365
+ return Array.from(bytes)
366
+ .map((byte) => byte.toString(16).padStart(2, '0'))
367
+ .join('');
368
+ }
369
+ /**
370
+ * Helper method to instrument with automatic properties inclusion
371
+ */
372
+ instrument(message, context) {
373
+ const defaultContext = {
374
+ accountAddress: context.accountAddress || this.activeAccountAddress,
375
+ environmentId: context.environmentId || this.environmentId,
376
+ traceId: context.traceId || this.generateTraceId(),
377
+ };
378
+ this.logger.debug(message, Object.assign(Object.assign({}, defaultContext), context));
379
+ this.logger.instrument(message, Object.assign(Object.assign({}, defaultContext), context));
380
+ }
381
+ instrumentAsync(_a) {
382
+ return _tslib.__awaiter(this, arguments, void 0, function* ({ operation, resource, fn, context, }) {
383
+ const timing = new instrumentation.InstrumentationTimer(context === null || context === void 0 ? void 0 : context.startTime);
384
+ if (context === null || context === void 0 ? void 0 : context.stepStartTime) {
385
+ timing.setStepStartTime(context.stepStartTime);
386
+ }
387
+ else {
388
+ timing.startStep();
389
+ }
390
+ this.instrument(`[${operation}] ${resource} - start`, Object.assign({ key: `${resource}-start`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context));
391
+ try {
392
+ const result = yield fn(timing);
393
+ this.instrument(`[${operation}] ${resource} - completed`, Object.assign({ key: `${resource}-completed`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context));
394
+ return result;
395
+ }
396
+ catch (error) {
397
+ this.instrument(`[${operation}] ${resource} - failed`, Object.assign(Object.assign({ key: `${resource}-failed`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context), { error }));
398
+ throw error;
399
+ }
400
+ });
401
+ }
358
402
  }
359
403
  return DynamicWaasMixin;
360
404
  };
@@ -1,5 +1,7 @@
1
1
  import { DynamicWalletClient } from '@dynamic-labs-wallet/browser-wallet-client';
2
2
  import { MFAAction } from '@dynamic-labs/sdk-api-core';
3
+ import { Logger, InstrumentOptions } from '@dynamic-labs/logger';
4
+ import { InstrumentationTimer, InstrumentContext } from '../utils/instrumentation';
3
5
  export declare class WaasExportHandler {
4
6
  private iframeStamper;
5
7
  setIframeStamper(iframe: HTMLIFrameElement): void;
@@ -21,6 +23,7 @@ export declare const withDynamicWaas: <T extends abstract new (...args: any[]) =
21
23
  dynamicWaasClient: DynamicWalletClient | undefined;
22
24
  chainName: string;
23
25
  authMode: 'cookie' | 'header';
26
+ logger: Logger;
24
27
  __exportHandler: WaasExportHandler;
25
28
  validateActiveWallet(expectedAddress: string): Promise<void>;
26
29
  setGetAuthTokenFunction(getAuthToken: () => string): void;
@@ -93,4 +96,15 @@ export declare const withDynamicWaas: <T extends abstract new (...args: any[]) =
93
96
  }): Promise<string>;
94
97
  endSession(): Promise<void>;
95
98
  getActiveAccountAddress(): Promise<string | undefined>;
99
+ generateTraceId(): string;
100
+ /**
101
+ * Helper method to instrument with automatic properties inclusion
102
+ */
103
+ instrument(message: string, context: InstrumentOptions & InstrumentContext & Record<string, any>): void;
104
+ instrumentAsync<T_1>({ operation, resource, fn, context, }: {
105
+ operation: string;
106
+ resource: string;
107
+ fn: (timing: InstrumentationTimer) => Promise<T_1>;
108
+ context?: Record<string, any> | undefined;
109
+ }): Promise<T_1>;
96
110
  }) & T;
@@ -5,6 +5,7 @@ import { MFAAction } from '@dynamic-labs/sdk-api-core';
5
5
  import { DynamicError } from '@dynamic-labs/utils';
6
6
  import { version } from '../package.js';
7
7
  import { DEFAULT_BASE_API_URL, DEFAULT_BASE_MPC_RELAY_API_URL } from '../utils/constants.js';
8
+ import { InstrumentationTimer } from '../utils/instrumentation.js';
8
9
 
9
10
  // This class is common across all waas connectors
10
11
  class WaasExportHandler {
@@ -351,6 +352,49 @@ const withDynamicWaas = (BaseClass) => {
351
352
  this.dynamicWaasClient = undefined;
352
353
  });
353
354
  }
355
+ generateTraceId() {
356
+ // Generate a 128-bit trace ID
357
+ // 128-bit = 16 bytes = 32 hexadecimal characters
358
+ const bytes = new Uint8Array(16);
359
+ crypto.getRandomValues(bytes);
360
+ // Convert bytes to hexadecimal string
361
+ return Array.from(bytes)
362
+ .map((byte) => byte.toString(16).padStart(2, '0'))
363
+ .join('');
364
+ }
365
+ /**
366
+ * Helper method to instrument with automatic properties inclusion
367
+ */
368
+ instrument(message, context) {
369
+ const defaultContext = {
370
+ accountAddress: context.accountAddress || this.activeAccountAddress,
371
+ environmentId: context.environmentId || this.environmentId,
372
+ traceId: context.traceId || this.generateTraceId(),
373
+ };
374
+ this.logger.debug(message, Object.assign(Object.assign({}, defaultContext), context));
375
+ this.logger.instrument(message, Object.assign(Object.assign({}, defaultContext), context));
376
+ }
377
+ instrumentAsync(_a) {
378
+ return __awaiter(this, arguments, void 0, function* ({ operation, resource, fn, context, }) {
379
+ const timing = new InstrumentationTimer(context === null || context === void 0 ? void 0 : context.startTime);
380
+ if (context === null || context === void 0 ? void 0 : context.stepStartTime) {
381
+ timing.setStepStartTime(context.stepStartTime);
382
+ }
383
+ else {
384
+ timing.startStep();
385
+ }
386
+ this.instrument(`[${operation}] ${resource} - start`, Object.assign({ key: `${resource}-start`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context));
387
+ try {
388
+ const result = yield fn(timing);
389
+ this.instrument(`[${operation}] ${resource} - completed`, Object.assign({ key: `${resource}-completed`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context));
390
+ return result;
391
+ }
392
+ catch (error) {
393
+ this.instrument(`[${operation}] ${resource} - failed`, Object.assign(Object.assign({ key: `${resource}-failed`, operation, stepTime: timing.getStepElapsed(), time: timing.getElapsed() }, context), { error }));
394
+ throw error;
395
+ }
396
+ });
397
+ }
354
398
  }
355
399
  return DynamicWaasMixin;
356
400
  };
@@ -0,0 +1,31 @@
1
+ 'use client'
2
+ 'use strict';
3
+
4
+ Object.defineProperty(exports, '__esModule', { value: true });
5
+
6
+ class InstrumentationTimer {
7
+ constructor(startTime) {
8
+ this.startTime = startTime || Date.now();
9
+ this.stepStartTime = this.startTime;
10
+ }
11
+ getElapsed() {
12
+ return Date.now() - this.startTime;
13
+ }
14
+ startStep() {
15
+ this.stepStartTime = Date.now();
16
+ }
17
+ getStepElapsed() {
18
+ return Date.now() - this.stepStartTime;
19
+ }
20
+ resetStep() {
21
+ this.startStep();
22
+ }
23
+ setStartTime(startTime) {
24
+ this.startTime = startTime;
25
+ }
26
+ setStepStartTime(stepStartTime) {
27
+ this.stepStartTime = stepStartTime;
28
+ }
29
+ }
30
+
31
+ exports.InstrumentationTimer = InstrumentationTimer;
@@ -0,0 +1,16 @@
1
+ export declare class InstrumentationTimer {
2
+ private startTime;
3
+ private stepStartTime;
4
+ constructor(startTime?: number);
5
+ getElapsed(): number;
6
+ startStep(): void;
7
+ getStepElapsed(): number;
8
+ resetStep(): void;
9
+ setStartTime(startTime: number): void;
10
+ setStepStartTime(stepStartTime: number): void;
11
+ }
12
+ export type InstrumentContext = {
13
+ traceId?: string;
14
+ accountAddress?: string;
15
+ environmentId?: string;
16
+ };
@@ -0,0 +1,27 @@
1
+ 'use client'
2
+ class InstrumentationTimer {
3
+ constructor(startTime) {
4
+ this.startTime = startTime || Date.now();
5
+ this.stepStartTime = this.startTime;
6
+ }
7
+ getElapsed() {
8
+ return Date.now() - this.startTime;
9
+ }
10
+ startStep() {
11
+ this.stepStartTime = Date.now();
12
+ }
13
+ getStepElapsed() {
14
+ return Date.now() - this.stepStartTime;
15
+ }
16
+ resetStep() {
17
+ this.startStep();
18
+ }
19
+ setStartTime(startTime) {
20
+ this.startTime = startTime;
21
+ }
22
+ setStepStartTime(stepStartTime) {
23
+ this.stepStartTime = stepStartTime;
24
+ }
25
+ }
26
+
27
+ export { InstrumentationTimer };