@dynamic-labs-sdk/client 0.21.0 → 0.22.1

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.
Files changed (80) hide show
  1. package/dist/{InvalidParamError-CIGCphfb.cjs.js → InvalidParamError-Z-OXIzF5.cjs.js} +506 -35
  2. package/dist/InvalidParamError-Z-OXIzF5.cjs.js.map +1 -0
  3. package/dist/{InvalidParamError-D7XZbzuT.esm.js → InvalidParamError-uk3RG_2n.esm.js} +458 -11
  4. package/dist/InvalidParamError-uk3RG_2n.esm.js.map +1 -0
  5. package/dist/{NotWaasWalletAccountError-BvzlkqKx.esm.js → NotWaasWalletAccountError-BNu0YC8I.esm.js} +18 -6
  6. package/dist/{NotWaasWalletAccountError-BvzlkqKx.esm.js.map → NotWaasWalletAccountError-BNu0YC8I.esm.js.map} +1 -1
  7. package/dist/{NotWaasWalletAccountError-DOi9OAsI.cjs.js → NotWaasWalletAccountError-TP-jawk1.cjs.js} +19 -7
  8. package/dist/NotWaasWalletAccountError-TP-jawk1.cjs.js.map +1 -0
  9. package/dist/client/defaultClient/defaultClient.d.ts.map +1 -1
  10. package/dist/core.cjs.js +121 -49
  11. package/dist/core.cjs.js.map +1 -1
  12. package/dist/core.esm.js +82 -10
  13. package/dist/core.esm.js.map +1 -1
  14. package/dist/errors/base/BaseError.d.ts.map +1 -1
  15. package/dist/exports/index.d.ts +1 -1
  16. package/dist/exports/index.d.ts.map +1 -1
  17. package/dist/{getNetworkProviderFromNetworkId-yH4_BUi0.esm.js → getNetworkProviderFromNetworkId-B0f3IebZ.esm.js} +264 -12
  18. package/dist/getNetworkProviderFromNetworkId-B0f3IebZ.esm.js.map +1 -0
  19. package/dist/{getNetworkProviderFromNetworkId-DcEjbjOm.cjs.js → getNetworkProviderFromNetworkId-TKiHxL8x.cjs.js} +321 -69
  20. package/dist/getNetworkProviderFromNetworkId-TKiHxL8x.cjs.js.map +1 -0
  21. package/dist/{getSignedSessionId-DPZjqpdm.cjs.js → getSignedSessionId-CMF56kGw.cjs.js} +33 -9
  22. package/dist/{getSignedSessionId-DPZjqpdm.cjs.js.map → getSignedSessionId-CMF56kGw.cjs.js.map} +1 -1
  23. package/dist/{getSignedSessionId-CADCZ36G.esm.js → getSignedSessionId-YLI28a3p.esm.js} +30 -6
  24. package/dist/{getSignedSessionId-CADCZ36G.esm.js.map → getSignedSessionId-YLI28a3p.esm.js.map} +1 -1
  25. package/dist/{getVerifiedCredentialForWalletAccount--OXuJ-DH.esm.js → getVerifiedCredentialForWalletAccount-BqymKhjg.esm.js} +118 -10
  26. package/dist/getVerifiedCredentialForWalletAccount-BqymKhjg.esm.js.map +1 -0
  27. package/dist/{getVerifiedCredentialForWalletAccount-nfQS96Xr.cjs.js → getVerifiedCredentialForWalletAccount-Dxasodsq.cjs.js} +164 -56
  28. package/dist/getVerifiedCredentialForWalletAccount-Dxasodsq.cjs.js.map +1 -0
  29. package/dist/index.cjs.js +1328 -320
  30. package/dist/index.cjs.js.map +1 -1
  31. package/dist/index.esm.js +1229 -221
  32. package/dist/index.esm.js.map +1 -1
  33. package/dist/{isMfaRequiredForAction-Bq5ETrIg.cjs.js → isMfaRequiredForAction-BH38Zggg.cjs.js} +32 -8
  34. package/dist/isMfaRequiredForAction-BH38Zggg.cjs.js.map +1 -0
  35. package/dist/{isMfaRequiredForAction-C4DOmn6q.esm.js → isMfaRequiredForAction-HXQXYFWo.esm.js} +29 -5
  36. package/dist/isMfaRequiredForAction-HXQXYFWo.esm.js.map +1 -0
  37. package/dist/modules/apiClient/utils/convertToApiErrorMiddleware/convertToApiErrorMiddleware.d.ts.map +1 -1
  38. package/dist/modules/checkout/checkout.types.d.ts +1 -1
  39. package/dist/modules/checkout/checkout.types.d.ts.map +1 -1
  40. package/dist/modules/checkout/submitCheckoutTransaction/submitCheckoutTransaction.d.ts.map +1 -1
  41. package/dist/modules/clientEvents/clientEvents.d.ts.map +1 -1
  42. package/dist/modules/legacyWalletBook/getWalletConnectCatalog/getChainFromWalletSchema/getChainFromWalletSchema.d.ts.map +1 -1
  43. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts +1 -2
  44. package/dist/modules/projectSettings/fetchProjectSettings/fetchProjectSettings.d.ts.map +1 -1
  45. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts +1 -1
  46. package/dist/modules/wallets/proveWalletAccountOwnership/proveWalletAccountOwnership.d.ts.map +1 -1
  47. package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts +2 -1
  48. package/dist/modules/wallets/utils/getSignInMessage/getSignInMessage.d.ts.map +1 -1
  49. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts +8 -1
  50. package/dist/modules/wallets/walletProvider/walletProvider.types.d.ts.map +1 -1
  51. package/dist/services/instrumentation/connectLoggerToInstrumentation/connectLoggerToInstrumentation.d.ts.map +1 -1
  52. package/dist/services/instrumentation/createInstrumentation/createInstrumentation.d.ts.map +1 -1
  53. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts +1 -0
  54. package/dist/services/instrumentation/instrumentFunction/instrumentFunction.d.ts.map +1 -1
  55. package/dist/services/instrumentation/instrumentation.types.d.ts +13 -1
  56. package/dist/services/instrumentation/instrumentation.types.d.ts.map +1 -1
  57. package/dist/services/instrumentation/scrubParameters/scrubParameters.d.ts.map +1 -1
  58. package/dist/services/instrumentation/transports/createDynamicTransport/createDynamicTransport.d.ts.map +1 -1
  59. package/dist/services/realtime/createRealtimeService/createRealtimeService.d.ts.map +1 -1
  60. package/dist/services/storage/createStorage/formatForStorage/storageFormat.d.ts.map +1 -1
  61. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  62. package/dist/utils/isMobile/isMobile.d.ts.map +1 -1
  63. package/dist/waas.cjs.js +12 -11
  64. package/dist/waas.cjs.js.map +1 -1
  65. package/dist/waas.esm.js +11 -10
  66. package/dist/waas.esm.js.map +1 -1
  67. package/dist/waasCore.cjs.js +26 -26
  68. package/dist/waasCore.cjs.js.map +1 -1
  69. package/dist/waasCore.esm.js +25 -25
  70. package/dist/waasCore.esm.js.map +1 -1
  71. package/package.json +3 -3
  72. package/dist/InvalidParamError-CIGCphfb.cjs.js.map +0 -1
  73. package/dist/InvalidParamError-D7XZbzuT.esm.js.map +0 -1
  74. package/dist/NotWaasWalletAccountError-DOi9OAsI.cjs.js.map +0 -1
  75. package/dist/getNetworkProviderFromNetworkId-DcEjbjOm.cjs.js.map +0 -1
  76. package/dist/getNetworkProviderFromNetworkId-yH4_BUi0.esm.js.map +0 -1
  77. package/dist/getVerifiedCredentialForWalletAccount--OXuJ-DH.esm.js.map +0 -1
  78. package/dist/getVerifiedCredentialForWalletAccount-nfQS96Xr.cjs.js.map +0 -1
  79. package/dist/isMfaRequiredForAction-Bq5ETrIg.cjs.js.map +0 -1
  80. package/dist/isMfaRequiredForAction-C4DOmn6q.esm.js.map +0 -1
@@ -2,11 +2,11 @@ import { AuthStorageEnum, Configuration, SDKApi, isDeviceNonceSignatureRequiredF
2
2
 
3
3
  //#region package.json
4
4
  var name = "@dynamic-labs-sdk/client";
5
- var version = "0.21.0";
5
+ var version = "0.22.1";
6
6
  var dependencies = {
7
7
  "@dynamic-labs-sdk/assert-package-version": "workspace:*",
8
8
  "@dynamic-labs-wallet/browser-wallet-client": "0.0.286",
9
- "@dynamic-labs/sdk-api-core": "0.0.918",
9
+ "@dynamic-labs/sdk-api-core": "0.0.921",
10
10
  "@simplewebauthn/browser": "13.1.0",
11
11
  "ably": "2.17.1",
12
12
  "buffer": "6.0.3",
@@ -194,6 +194,357 @@ const isCookieEnabled = (client) => {
194
194
  return dynamicCookiesEnabled || byoJwtCookieEnabled;
195
195
  };
196
196
 
197
+ //#endregion
198
+ //#region src/modules/auth/extractSessionId/extractSessionId.ts
199
+ /**
200
+ * Extracts the session ID (`sid` claim) from a JWT token string.
201
+ *
202
+ * Decodes the base64url-encoded payload segment of the token and reads the
203
+ * `sid` field. This is used to correlate instrumentation events with the
204
+ * authenticated session, without ever forwarding the full token.
205
+ *
206
+ * Returns `null` when no token is present, when the token is malformed, or
207
+ * when the payload does not contain a `sid` claim.
208
+ * @not-instrumented
209
+ */
210
+ const extractSessionId = (token) => {
211
+ try {
212
+ const payload = token.split(".")[1];
213
+ return JSON.parse(atob(payload)).sid ?? null;
214
+ } catch {
215
+ return null;
216
+ }
217
+ };
218
+
219
+ //#endregion
220
+ //#region src/utils/getUserAgent/getUserAgent.ts
221
+ /**
222
+ * Returns the browser's `navigator.userAgent` string for inclusion in
223
+ * instrumentation events.
224
+ *
225
+ * Falls back to an empty string in environments where `navigator` is not
226
+ * available (e.g., Node.js SSR, service workers) so that callers never need
227
+ * to guard against undefined.
228
+ * @not-instrumented
229
+ */
230
+ const getUserAgent = () => {
231
+ try {
232
+ return navigator.userAgent;
233
+ } catch {
234
+ return "";
235
+ }
236
+ };
237
+
238
+ //#endregion
239
+ //#region src/services/instrumentation/constants.ts
240
+ const DEFAULT_PII_FIELDS = [
241
+ "password",
242
+ "token",
243
+ "secret",
244
+ "privateKey",
245
+ "mnemonic",
246
+ "seed",
247
+ "email",
248
+ "phone",
249
+ "ssn",
250
+ "address",
251
+ "authorization"
252
+ ];
253
+ const REDACTED_VALUE = "[REDACTED]";
254
+ const MAX_STRING_LENGTH = 500;
255
+ const TRUNCATED_SUFFIX = "...[truncated]";
256
+ /**
257
+ * Label prefix for binary data placeholders. The full placeholder includes the
258
+ * byte length, e.g. `[Binary:16 bytes]`, so consumers can gauge data size
259
+ * without the actual bytes appearing in logs.
260
+ */
261
+ const BINARY_LABEL = "Binary";
262
+ /**
263
+ * Placeholder emitted when a circular reference is detected in the value tree.
264
+ * Using a named constant makes it easy to search for or filter in downstream
265
+ * log tooling.
266
+ */
267
+ const CIRCULAR_VALUE = "[Circular]";
268
+
269
+ //#endregion
270
+ //#region src/services/instrumentation/scrubParameters/scrubParameters.ts
271
+ const scrubString = ({ key, piiFieldsLower, redactAll, value }) => {
272
+ if (piiFieldsLower.includes(key.toLowerCase())) return REDACTED_VALUE;
273
+ if (redactAll) return REDACTED_VALUE;
274
+ if (value.length > MAX_STRING_LENGTH) return value.slice(0, MAX_STRING_LENGTH) + TRUNCATED_SUFFIX;
275
+ return value;
276
+ };
277
+ const scrubArray = ({ context, value }) => {
278
+ if (context.visited.has(value)) return [CIRCULAR_VALUE];
279
+ context.visited.add(value);
280
+ const result = value.map((item, index) => scrubValue({
281
+ context,
282
+ key: String(index),
283
+ value: item
284
+ }));
285
+ context.visited.delete(value);
286
+ return result;
287
+ };
288
+ const scrubObject = ({ context, value }) => {
289
+ if (context.visited.has(value)) return { [CIRCULAR_VALUE]: true };
290
+ context.visited.add(value);
291
+ const result = Object.create(null);
292
+ for (const key of Object.keys(value)) result[key] = scrubValue({
293
+ context,
294
+ key,
295
+ value: value[key]
296
+ });
297
+ context.visited.delete(value);
298
+ return result;
299
+ };
300
+ const scrubValue = ({ context, key, value }) => {
301
+ if (value === null || value === void 0) return value;
302
+ if (value instanceof Uint8Array) return `[${BINARY_LABEL}:${value.byteLength} bytes]`;
303
+ if (context.piiFieldsLower.includes(key.toLowerCase())) return REDACTED_VALUE;
304
+ if (typeof value === "string") return scrubString({
305
+ key,
306
+ piiFieldsLower: context.piiFieldsLower,
307
+ redactAll: context.redactAll,
308
+ value
309
+ });
310
+ if (Array.isArray(value)) return scrubArray({
311
+ context,
312
+ value
313
+ });
314
+ if (value instanceof Set) {
315
+ if (context.visited.has(value)) return [CIRCULAR_VALUE];
316
+ context.visited.add(value);
317
+ const setResult = scrubArray({
318
+ context,
319
+ value: [...value]
320
+ });
321
+ context.visited.delete(value);
322
+ return setResult;
323
+ }
324
+ if (value instanceof Map) {
325
+ if (context.visited.has(value)) return { [CIRCULAR_VALUE]: true };
326
+ context.visited.add(value);
327
+ const asObject = Object.create(null);
328
+ for (const [k, v] of value.entries()) asObject[String(k)] = v;
329
+ const mapResult = scrubObject({
330
+ context,
331
+ value: asObject
332
+ });
333
+ context.visited.delete(value);
334
+ return mapResult;
335
+ }
336
+ if (value instanceof WeakMap) return "[WeakMap]";
337
+ if (value instanceof WeakSet) return "[WeakSet]";
338
+ if (value instanceof Date) return value.toISOString();
339
+ if (value instanceof Error) return `[Error: ${value.message}]`;
340
+ if (typeof value === "object") return scrubObject({
341
+ context,
342
+ value
343
+ });
344
+ return value;
345
+ };
346
+ /** @not-instrumented */
347
+ const scrubParameters = ({ piiFields, redactAll, value }) => {
348
+ return scrubObject({
349
+ context: {
350
+ piiFieldsLower: piiFields.map((field) => field.toLowerCase()),
351
+ redactAll,
352
+ visited: /* @__PURE__ */ new WeakSet()
353
+ },
354
+ value
355
+ });
356
+ };
357
+
358
+ //#endregion
359
+ //#region src/services/instrumentation/instrumentFunction/extractParams/extractParams.ts
360
+ /**
361
+ * Normalises the raw positional arguments of an instrumented function call
362
+ * into a flat `Record<string, unknown>` suitable for structured logging.
363
+ *
364
+ * ## Why this is needed
365
+ *
366
+ * Instrumented functions are wrapped with `(...args: unknown[])`, so their
367
+ * parameters arrive as an array. Logging a raw array loses the semantic names
368
+ * of each argument. This function recovers a named representation:
369
+ *
370
+ * - **No arguments** → `{}`
371
+ * - **Single plain-object argument** → that object is returned as-is, because
372
+ * SDK functions follow the single-object-parameter convention, so the object
373
+ * already carries named keys (`{ amount, to }`, etc.).
374
+ * - **Everything else** (multiple args, a single primitive, a single array) →
375
+ * each value is indexed as `arg0`, `arg1`, …
376
+ *
377
+ * ## Why arrays are NOT treated as plain objects
378
+ *
379
+ * `typeof [] === 'object'` and `[] !== null`, so without the `Array.isArray`
380
+ * guard a single-array argument would be returned as-is. That would produce
381
+ * an object with numeric string keys (`{ '0': ..., '1': ... }`), which is
382
+ * misleading and inconsistent with how multi-arg calls are handled. Instead,
383
+ * arrays fall through to the indexed `arg0` path.
384
+ * @not-instrumented
385
+ */
386
+ const extractParams = (args) => {
387
+ if (args.length === 0) return {};
388
+ if (args.length === 1 && typeof args[0] === "object" && args[0] !== null && !Array.isArray(args[0])) return args[0];
389
+ const result = {};
390
+ for (let i = 0; i < args.length; i++) result[`arg${i}`] = args[i];
391
+ return result;
392
+ };
393
+
394
+ //#endregion
395
+ //#region src/services/instrumentation/instrumentFunction/scrubResolvedValue/scrubResolvedValue.ts
396
+ /**
397
+ * Scrubs a resolved return value of any type before logging it.
398
+ * Routes through `scrubParameters` by wrapping the value so that strings,
399
+ * arrays, Dates, Errors, and all other types are handled identically to
400
+ * nested object fields.
401
+ * @not-instrumented
402
+ */
403
+ const scrubResolvedValue = ({ piiFields, redactAll, value }) => scrubParameters({
404
+ piiFields,
405
+ redactAll,
406
+ value: { result: value }
407
+ }).result;
408
+
409
+ //#endregion
410
+ //#region src/services/instrumentation/instrumentFunction/instrumentFunction.ts
411
+ const serializeError = (error) => {
412
+ if (error instanceof Error) return {
413
+ message: error.message,
414
+ name: error.name,
415
+ stack: error.stack
416
+ };
417
+ return {
418
+ message: String(error),
419
+ name: "UnknownError"
420
+ };
421
+ };
422
+ /**
423
+ * Wraps a function so that each invocation emits a structured
424
+ * `FunctionInstrumentationEvent` at three lifecycle points:
425
+ *
426
+ * - **started** — immediately before the function body executes, with the
427
+ * PII-scrubbed call parameters.
428
+ * - **resolved** — after the function (or its returned Promise) settles
429
+ * successfully, with the PII-scrubbed return value.
430
+ * - **rejected** — if the function throws synchronously or its returned
431
+ * Promise rejects.
432
+ *
433
+ * The original return value (or thrown error) is always forwarded to the
434
+ * caller unchanged — instrumentation is purely observational.
435
+ *
436
+ * ## Usage
437
+ *
438
+ * ```ts
439
+ * const transfer = instrumentFunction({
440
+ * fn: rawTransfer,
441
+ * functionName: 'transfer',
442
+ * getCore: () => core,
443
+ * });
444
+ *
445
+ * // When called, three events are emitted automatically:
446
+ * await transfer({ amount: 1, to: '0xabc' });
447
+ * ```
448
+ *
449
+ * ## How functions are wrapped
450
+ *
451
+ * `instrumentFunction` is not called manually in application code. Instead,
452
+ * the esbuild instrumentation plugin (`tools/instrumentation-plugin`) injects
453
+ * it at build time: any exported function annotated with `@instrumented` in its
454
+ * JSDoc is automatically wrapped by the plugin during the build step.
455
+ * The plugin strips the original `export`, renames the function, and re-exports
456
+ * it under the original name via `instrumentFunction(...)` — so the public API
457
+ * is unchanged and no call sites need to be updated.
458
+ *
459
+ * ## Opting out
460
+ *
461
+ * Instrumentation is skipped entirely when:
462
+ * - `getCore()` returns `undefined` (SDK not initialised), or
463
+ * - `core.instrumentation.config.enabled` is `false`.
464
+ *
465
+ * In both cases the original function is called directly with no overhead.
466
+ *
467
+ * ## PII scrubbing
468
+ *
469
+ * All string values whose key appears in `piiFields` are replaced with
470
+ * `"[redacted]"` before events are emitted. Pass `redactAll: true` to redact
471
+ * every field, regardless of key name.
472
+ * @not-instrumented
473
+ */
474
+ const instrumentFunction = ({ fn, functionName, getCore: getCore$1, redactAll }) => {
475
+ const wrapped = (...args) => {
476
+ const core = getCore$1();
477
+ if (!core) return fn(...args);
478
+ if (!core.instrumentation.config.enabled) return fn(...args);
479
+ const instrumentation = core.instrumentation;
480
+ const state = core.state.get();
481
+ const baseEvent = {
482
+ environmentId: core.environmentId,
483
+ functionName,
484
+ parameters: scrubParameters({
485
+ piiFields: instrumentation.config.piiFields,
486
+ redactAll,
487
+ value: extractParams(args)
488
+ }),
489
+ sdkSessionId: core.sdkSessionId,
490
+ sdkVersion: core.version,
491
+ status: "info",
492
+ tokenSessionId: state.token ? extractSessionId(state.token) : null,
493
+ userAgent: getUserAgent(),
494
+ userId: state.user?.id ?? null
495
+ };
496
+ instrumentation.logFunction({
497
+ ...baseEvent,
498
+ phase: "started",
499
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
500
+ });
501
+ try {
502
+ const result = fn(...args);
503
+ if (result instanceof Promise) return result.then((value) => {
504
+ instrumentation.logFunction({
505
+ ...baseEvent,
506
+ phase: "resolved",
507
+ resolvedValue: scrubResolvedValue({
508
+ piiFields: instrumentation.config.piiFields,
509
+ redactAll,
510
+ value
511
+ }),
512
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
513
+ });
514
+ return value;
515
+ }).catch((error) => {
516
+ instrumentation.logFunction({
517
+ ...baseEvent,
518
+ phase: "rejected",
519
+ rejectedError: serializeError(error),
520
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
521
+ });
522
+ throw error;
523
+ });
524
+ instrumentation.logFunction({
525
+ ...baseEvent,
526
+ phase: "resolved",
527
+ resolvedValue: scrubResolvedValue({
528
+ piiFields: instrumentation.config.piiFields,
529
+ redactAll,
530
+ value: result
531
+ }),
532
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
533
+ });
534
+ return result;
535
+ } catch (error) {
536
+ instrumentation.logFunction({
537
+ ...baseEvent,
538
+ phase: "rejected",
539
+ rejectedError: serializeError(error),
540
+ timestamp: (/* @__PURE__ */ new Date()).toISOString()
541
+ });
542
+ throw error;
543
+ }
544
+ };
545
+ return wrapped;
546
+ };
547
+
197
548
  //#endregion
198
549
  //#region src/modules/sessionKeys/getSessionKeys/getSessionKeys.ts
199
550
  /** @instrumented */
@@ -202,6 +553,18 @@ const getSessionKeys = (client) => {
202
553
  if (!publicKey) return;
203
554
  return { publicKey };
204
555
  };
556
+ const __getSessionKeys_impl = getSessionKeys;
557
+ const __getSessionKeys_wrapped = instrumentFunction({
558
+ fn: __getSessionKeys_impl,
559
+ functionName: "getSessionKeys",
560
+ getCore: () => {
561
+ try {
562
+ return getCore(getDefaultClient());
563
+ } catch {
564
+ return;
565
+ }
566
+ }
567
+ });
205
568
 
206
569
  //#endregion
207
570
  //#region src/modules/auth/getElevatedAccessToken/getElevatedAccessToken.ts
@@ -245,6 +608,18 @@ const getElevatedAccessToken = ({ consume = true, scope }, client = getDefaultCl
245
608
  }
246
609
  return token.token;
247
610
  };
611
+ const __getElevatedAccessToken_impl = getElevatedAccessToken;
612
+ const __getElevatedAccessToken_wrapped = instrumentFunction({
613
+ fn: __getElevatedAccessToken_impl,
614
+ functionName: "getElevatedAccessToken",
615
+ getCore: () => {
616
+ try {
617
+ return getCore(getDefaultClient());
618
+ } catch {
619
+ return;
620
+ }
621
+ }
622
+ });
248
623
 
249
624
  //#endregion
250
625
  //#region src/errors/APIError/APIError.ts
@@ -427,6 +802,18 @@ const getNonce = async (client) => {
427
802
  await fetchAndStoreNonces(client);
428
803
  return getNonce(client);
429
804
  };
805
+ const __getNonce_impl = getNonce;
806
+ const __getNonce_wrapped = instrumentFunction({
807
+ fn: __getNonce_impl,
808
+ functionName: "getNonce",
809
+ getCore: () => {
810
+ try {
811
+ return getCore(getDefaultClient());
812
+ } catch {
813
+ return;
814
+ }
815
+ }
816
+ });
430
817
 
431
818
  //#endregion
432
819
  //#region src/modules/deviceRegistration/getDeviceSigner/getDeviceSigner.ts
@@ -445,6 +832,18 @@ const getDeviceSigner = async (client) => {
445
832
  sign: (payload) => keychain.sign(keyName, payload)
446
833
  };
447
834
  };
835
+ const __getDeviceSigner_impl = getDeviceSigner;
836
+ const __getDeviceSigner_wrapped = instrumentFunction({
837
+ fn: __getDeviceSigner_impl,
838
+ functionName: "getDeviceSigner",
839
+ getCore: () => {
840
+ try {
841
+ return getCore(getDefaultClient());
842
+ } catch {
843
+ return;
844
+ }
845
+ }
846
+ });
448
847
 
449
848
  //#endregion
450
849
  //#region src/modules/deviceRegistration/getHeadersForNonceSignedByDeviceSigners/getHeadersForNonceSignedByDeviceSigners.ts
@@ -458,8 +857,8 @@ const getHeadersForNonceSignedByDeviceSigners = async (client) => {
458
857
  * Then we dont need to provide the headers
459
858
  */
460
859
  if (isCookieEnabled(client)) return {};
461
- const deviceSigner = await getDeviceSigner(client);
462
- const nonce = await getNonce(client);
860
+ const deviceSigner = await __getDeviceSigner_wrapped(client);
861
+ const nonce = await __getNonce_wrapped(client);
463
862
  const signedNonce = await deviceSigner.sign(nonce);
464
863
  const publicKey = await deviceSigner.getPublicKey();
465
864
  return {
@@ -468,6 +867,18 @@ const getHeadersForNonceSignedByDeviceSigners = async (client) => {
468
867
  "x-dynamic-device-signed-nonce": signedNonce
469
868
  };
470
869
  };
870
+ const __getHeadersForNonceSignedByDeviceSigners_impl = getHeadersForNonceSignedByDeviceSigners;
871
+ const __getHeadersForNonceSignedByDeviceSigners_wrapped = instrumentFunction({
872
+ fn: __getHeadersForNonceSignedByDeviceSigners_impl,
873
+ functionName: "getHeadersForNonceSignedByDeviceSigners",
874
+ getCore: () => {
875
+ try {
876
+ return getCore(getDefaultClient());
877
+ } catch {
878
+ return;
879
+ }
880
+ }
881
+ });
471
882
 
472
883
  //#endregion
473
884
  //#region src/modules/apiClient/utils/deviceSignatureHeadersMiddleware/createDeviceSignatureHeadersMiddleware.ts
@@ -478,7 +889,7 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
478
889
  * The signed nonce is not required for cookie based environments.
479
890
  */
480
891
  if (isDeviceNonceSignatureRequiredForUrl(context.url) && !isCookieEnabled(client)) {
481
- const deviceSignerHeaders = await getHeadersForNonceSignedByDeviceSigners(client);
892
+ const deviceSignerHeaders = await __getHeadersForNonceSignedByDeviceSigners_wrapped(client);
482
893
  return {
483
894
  init: {
484
895
  ...context.init,
@@ -492,6 +903,18 @@ const createDeviceSignatureHeadersMiddleware = (client) => {
492
903
  }
493
904
  } };
494
905
  };
906
+ const __createDeviceSignatureHeadersMiddleware_impl = createDeviceSignatureHeadersMiddleware;
907
+ const __createDeviceSignatureHeadersMiddleware_wrapped = instrumentFunction({
908
+ fn: __createDeviceSignatureHeadersMiddleware_impl,
909
+ functionName: "createDeviceSignatureHeadersMiddleware",
910
+ getCore: () => {
911
+ try {
912
+ return getCore(getDefaultClient());
913
+ } catch {
914
+ return;
915
+ }
916
+ }
917
+ });
495
918
 
496
919
  //#endregion
497
920
  //#region src/errors/UnauthorizedError.ts
@@ -549,22 +972,34 @@ const createApiClient = (options = {}, client) => {
549
972
  if (client.projectSettings && isCookieEnabled(client)) settings.credentials = "include";
550
973
  if (options.includeMfaToken && coreState.mfaToken) settings.headers[MFA_TOKEN_HEADER] = coreState.mfaToken;
551
974
  if (options.elevatedAccessTokenScope) {
552
- const elevatedToken = getElevatedAccessToken({ scope: options.elevatedAccessTokenScope }, client);
975
+ const elevatedToken = __getElevatedAccessToken_wrapped({ scope: options.elevatedAccessTokenScope }, client);
553
976
  if (elevatedToken) settings.headers[ELEVATED_ACCESS_TOKEN_HEADER] = elevatedToken;
554
977
  }
555
- const sessionPublicKey = getSessionKeys(client)?.publicKey;
978
+ const sessionPublicKey = __getSessionKeys_wrapped(client)?.publicKey;
556
979
  const isSessionPublicKeyHeaderPresent = settings.headers[SESSION_PUBLIC_KEY_HEADER] !== void 0;
557
980
  if (sessionPublicKey && !isSessionPublicKeyHeaderPresent) settings.headers[SESSION_PUBLIC_KEY_HEADER] = sessionPublicKey;
558
981
  return new SDKApi(new Configuration({
559
982
  ...settings,
560
983
  fetchApi: core.fetch,
561
984
  middleware: [
562
- createDeviceSignatureHeadersMiddleware(client),
985
+ __createDeviceSignatureHeadersMiddleware_wrapped(client),
563
986
  createConvertToApiErrorMiddleware({ errorMappers: [...options.errorMappers || [], clientErrorMapper] }),
564
987
  createUnauthorizedMiddleware()
565
988
  ]
566
989
  }));
567
990
  };
991
+ const __createApiClient_impl = createApiClient;
992
+ const __createApiClient_wrapped = instrumentFunction({
993
+ fn: __createApiClient_impl,
994
+ functionName: "createApiClient",
995
+ getCore: () => {
996
+ try {
997
+ return getCore(getDefaultClient());
998
+ } catch {
999
+ return;
1000
+ }
1001
+ }
1002
+ });
568
1003
 
569
1004
  //#endregion
570
1005
  //#region src/utils/getNonce/fetchAndStoreNonces/fetchAndStoreNonces.ts
@@ -582,7 +1017,7 @@ const createApiClient = (options = {}, client) => {
582
1017
  const fetchAndStoreNonces = async (client) => {
583
1018
  const core = getCore(client);
584
1019
  const { environmentId } = core;
585
- const { nonces } = await createApiClient({}, client).getNonces({
1020
+ const { nonces } = await __createApiClient_wrapped({}, client).getNonces({
586
1021
  count: NONCE_POOL_SIZE,
587
1022
  environmentId
588
1023
  });
@@ -691,6 +1126,18 @@ const getChainFromVerifiedCredentialChain = (verifiedCredentialChain) => {
691
1126
  assertDefined(chain, `Unknown chain: ${verifiedCredentialChain}`);
692
1127
  return chain;
693
1128
  };
1129
+ const __getChainFromVerifiedCredentialChain_impl = getChainFromVerifiedCredentialChain;
1130
+ const __getChainFromVerifiedCredentialChain_wrapped = instrumentFunction({
1131
+ fn: __getChainFromVerifiedCredentialChain_impl,
1132
+ functionName: "getChainFromVerifiedCredentialChain",
1133
+ getCore: () => {
1134
+ try {
1135
+ return getCore(getDefaultClient());
1136
+ } catch {
1137
+ return;
1138
+ }
1139
+ }
1140
+ });
694
1141
 
695
1142
  //#endregion
696
1143
  //#region src/constants.ts
@@ -722,5 +1169,5 @@ var InvalidParamError = class extends BaseError {
722
1169
  };
723
1170
 
724
1171
  //#endregion
725
- export { NONCE_POOL_SIZE as A, getSessionKeys as C, randomString as D, ValueMustBeDefinedError as E, getCore as F, name as I, version as L, setDefaultClient as M, ClientNotFoundError as N, CLIENT_SDK_NAME as O, BaseError as P, getElevatedAccessToken as S, assertDefined as T, MfaRateLimitedError as _, DYNAMIC_ICONIC_SPRITE_URL as a, InvalidExternalAuthError as b, CHAINS_INFO_MAP as c, UnauthorizedError as d, createDeviceSignatureHeadersMiddleware as f, SandboxMaximumThresholdReachedError as g, getNonce as h, DYNAMIC_WAAS_METADATA as i, getDefaultClient as j, DYNAMIC_SDK_API_VERSION as k, fetchAndStoreNonces as l, getDeviceSigner as m, DEFAULT_WAAS_BASE_API_URL as n, SDK_API_CORE_VERSION as o, getHeadersForNonceSignedByDeviceSigners as p, DEFAULT_WAAS_BASE_MPC_RELAY_API_URL as r, getChainFromVerifiedCredentialChain as s, InvalidParamError as t, createApiClient as u, MfaInvalidOtpError as v, isCookieEnabled as w, APIError as x, LinkCredentialError as y };
726
- //# sourceMappingURL=InvalidParamError-D7XZbzuT.esm.js.map
1172
+ export { ValueMustBeDefinedError as A, name as B, __getSessionKeys_wrapped as C, extractSessionId as D, getUserAgent as E, getDefaultClient as F, setDefaultClient as I, ClientNotFoundError as L, CLIENT_SDK_NAME as M, DYNAMIC_SDK_API_VERSION as N, isCookieEnabled as O, NONCE_POOL_SIZE as P, BaseError as R, __getElevatedAccessToken_wrapped as S, DEFAULT_PII_FIELDS as T, version as V, MfaRateLimitedError as _, DYNAMIC_ICONIC_SPRITE_URL as a, InvalidExternalAuthError as b, CHAINS_INFO_MAP as c, UnauthorizedError as d, __createDeviceSignatureHeadersMiddleware_wrapped as f, SandboxMaximumThresholdReachedError as g, __getNonce_wrapped as h, DYNAMIC_WAAS_METADATA as i, randomString as j, assertDefined as k, fetchAndStoreNonces as l, __getDeviceSigner_wrapped as m, DEFAULT_WAAS_BASE_API_URL as n, SDK_API_CORE_VERSION as o, __getHeadersForNonceSignedByDeviceSigners_wrapped as p, DEFAULT_WAAS_BASE_MPC_RELAY_API_URL as r, __getChainFromVerifiedCredentialChain_wrapped as s, InvalidParamError as t, __createApiClient_wrapped as u, MfaInvalidOtpError as v, instrumentFunction as w, APIError as x, LinkCredentialError as y, getCore as z };
1173
+ //# sourceMappingURL=InvalidParamError-uk3RG_2n.esm.js.map