@vizualkei/neuma-client-sdk 0.120.0 → 0.121.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.
@@ -36,7 +36,7 @@ export type PendingOperationErrorContext = {
36
36
  export type HandlePendingOperationOptions = {
37
37
  /**
38
38
  * Limit handling to one or more SDK operation names, e.g.
39
- * `authenticate`, `enroll`, `restore`, or `unenroll-user`.
39
+ * `verify-user`, `enroll`, `restore-enrollment`, or `unenroll-user`.
40
40
  */
41
41
  operation?: PendingOperationMatcher;
42
42
  /**
@@ -15,11 +15,11 @@ void (0, common_utils_1.initLogging)({ serviceName: 'neuma-client-sdk', level: '
15
15
  // Operation code mappings for short URLs
16
16
  const OP_CODES = {
17
17
  enroll: 'e',
18
- authenticate: 'a',
19
- 'clear-user': 'c',
18
+ 'verify-user': 'v',
19
+ 'clear-enrollment': 'ce',
20
20
  'unenroll-user': 'u',
21
- 'retrieve-key': 'r',
22
- restore: 'rs',
21
+ 'verify-user-for-key': 'k',
22
+ 'restore-enrollment': 're',
23
23
  };
24
24
  class NeumaMobile {
25
25
  constructor() {
@@ -437,7 +437,7 @@ class NeumaMobile {
437
437
  if (!pending)
438
438
  return null;
439
439
  // Offline operations don't have a server-side result to poll for.
440
- if (pending.operation === 'retrieve-key' || pending.operation === 'clear-user') {
440
+ if (pending.operation === 'verify-user-for-key' || pending.operation === 'clear-enrollment') {
441
441
  this.clearPendingResult();
442
442
  return null;
443
443
  }
@@ -458,6 +458,7 @@ class NeumaMobile {
458
458
  clearPendingResult() {
459
459
  this.clearPendingOperation();
460
460
  this.clearCompletedResult();
461
+ this.clearReturnUrlMarkers();
461
462
  }
462
463
  generateRandomId() {
463
464
  return (Math.random().toString(36).substring(2, 15) +
@@ -505,7 +506,7 @@ class NeumaMobile {
505
506
  * URL. The unique `neuma_cb=<callbackId>` query param disambiguates the
506
507
  * originating tab so Safari does not open a new tab on return. For polling
507
508
  * operations, the same markers also let the SDK resume polling after an
508
- * iOS Safari remount. Offline operations (`retrieve-key`, `clear-user`)
509
+ * iOS Safari remount. Offline operations (`verify-user-for-key`, `clear-enrollment`)
509
510
  * use the markers only for exact tab matching and do not persist pending
510
511
  * polling state.
511
512
  *
@@ -803,8 +804,8 @@ class NeumaMobile {
803
804
  cleanupFn = this.options.onQrCode(qrData);
804
805
  common_utils_1.logger.info('QR code callback invoked', { callbackId });
805
806
  }
806
- // For retrieve-key and clear-user operations, work in offline mode (no polling)
807
- if (operation === 'retrieve-key' || operation === 'clear-user') {
807
+ // For verify-user-for-key and clear-enrollment operations, work in offline mode (no polling)
808
+ if (operation === 'verify-user-for-key' || operation === 'clear-enrollment') {
808
809
  common_utils_1.logger.info('Offline operation - no polling', { callbackId, operation });
809
810
  return null;
810
811
  }
@@ -851,12 +852,12 @@ class NeumaMobile {
851
852
  hasNeumaSessionToken: !!this.options.neumaSessionToken,
852
853
  hasUser: !!user,
853
854
  });
854
- const isOfflineOperation = operation === 'retrieve-key' || operation === 'clear-user';
855
+ const isOfflineOperation = operation === 'verify-user-for-key' || operation === 'clear-enrollment';
855
856
  // Always give iOS Safari a returnUrl so Neuma's Close button can
856
857
  // foreground the originating browser tab. All iOS Safari returnUrls
857
858
  // get a unique marker for exact tab matching; only polling operations
858
- // persist pending state because offline operations (`retrieve-key`,
859
- // `clear-user`) do not write a server result for the SDK to resume.
859
+ // persist pending state because offline operations (`verify-user-for-key`,
860
+ // `clear-enrollment`) do not write a server result for the SDK to resume.
860
861
  const returnUrl = this.captureReturnUrl(callbackId, operation);
861
862
  // Persist pending-op metadata BEFORE firing the deep link when a
862
863
  // browser return path can lose the in-memory polling promise. iOS
@@ -931,7 +932,7 @@ class NeumaMobile {
931
932
  this.options.onAppLaunchFailed?.(context);
932
933
  }, 2000);
933
934
  }
934
- // For retrieve-key and clear-user operations, work in offline mode (no polling, no server connection).
935
+ // For verify-user-for-key and clear-enrollment operations, work in offline mode (no polling, no server connection).
935
936
  // Do not resolve immediately after assigning `window.location.href` to the custom scheme:
936
937
  // on iOS Safari that can let the webapp mutate UI/state while the browser is still
937
938
  // completing the handoff to Neuma, which makes the later `returnUrl` launch more prone
@@ -1028,8 +1029,8 @@ class NeumaMobile {
1028
1029
  }
1029
1030
  async restoreEnrollment() {
1030
1031
  try {
1031
- const payload = await this.invokeMobileApp('restore', undefined);
1032
- const nrt = this.extractNeumaResultToken(payload, 'restore', 'AUTH_FAILED');
1032
+ const payload = await this.invokeMobileApp('restore-enrollment', undefined);
1033
+ const nrt = this.extractNeumaResultToken(payload, 'restore-enrollment', 'AUTH_FAILED');
1033
1034
  const decoded = this.decodeJwtPayload(nrt);
1034
1035
  if (decoded && decoded.userId && decoded.enrollmentId) {
1035
1036
  const enrollment = {
@@ -1060,8 +1061,8 @@ class NeumaMobile {
1060
1061
  }
1061
1062
  async verifyUser() {
1062
1063
  try {
1063
- const payload = await this.invokeMobileApp('authenticate', undefined);
1064
- const nrt = this.extractNeumaResultToken(payload, 'authenticate', 'AUTH_FAILED');
1064
+ const payload = await this.invokeMobileApp('verify-user', undefined);
1065
+ const nrt = this.extractNeumaResultToken(payload, 'verify-user', 'AUTH_FAILED');
1065
1066
  common_utils_1.logger.info('User verification successful');
1066
1067
  return nrt;
1067
1068
  }
@@ -1083,7 +1084,7 @@ class NeumaMobile {
1083
1084
  common_utils_1.logger.error('verifyUserForKey called from desktop browser');
1084
1085
  throw new NeumaMobileInterface_1.NeumaError('This operation is supported only on mobile browsers', 'AUTH_FAILED');
1085
1086
  }
1086
- await this.invokeMobileApp('retrieve-key', undefined);
1087
+ await this.invokeMobileApp('verify-user-for-key', undefined);
1087
1088
  return null;
1088
1089
  }
1089
1090
  parseVerifyUserForKeyResult(jsonString) {
@@ -1121,7 +1122,7 @@ class NeumaMobile {
1121
1122
  common_utils_1.logger.error('clearEnrollment called from desktop browser');
1122
1123
  throw new NeumaMobileInterface_1.NeumaError('This operation is supported only on mobile browsers', 'AUTH_FAILED');
1123
1124
  }
1124
- await this.invokeMobileApp('clear-user', undefined);
1125
+ await this.invokeMobileApp('clear-enrollment', undefined);
1125
1126
  this.persistEnrollment(null);
1126
1127
  common_utils_1.logger.info('Enrollment cleared successfully');
1127
1128
  return;
@@ -112,7 +112,7 @@ export type NeumaMobileOptions = {
112
112
  export interface PendingOperationInfo {
113
113
  /** Random callback ID matching the deep-link `id` and the polling URL path segment. */
114
114
  readonly callbackId: string;
115
- /** Internal operation name (`enroll`, `authenticate`, `restore`, `unenroll-user`, `retrieve-key`, `clear-user`). */
115
+ /** Internal operation name (`enroll`, `verify-user`, `restore-enrollment`, `unenroll-user`, `verify-user-for-key`, `clear-enrollment`). */
116
116
  readonly operation: string;
117
117
  /** Epoch ms timestamp of when the deep-link was issued. */
118
118
  readonly ts: number;
@@ -199,7 +199,7 @@ export interface NeumaMobileInterface {
199
199
  * success. If polling already completed in a previous page lifetime,
200
200
  * this returns the cached payload instead of polling again. Returns
201
201
  * `null` when there is no recoverable operation, or when the operation is
202
- * offline-only (`retrieve-key`, `clear-user`) and does not write a
202
+ * offline-only (`verify-user-for-key`, `clear-enrollment`) and does not write a
203
203
  * server-side result.
204
204
  *
205
205
  * Marks cached results as being consumed, but keeps them briefly so a
@@ -216,17 +216,12 @@ export interface NeumaMobileInterface {
216
216
  resumePendingResult(): Promise<unknown | null>;
217
217
  /**
218
218
  * Clears SDK recovery storage for the current deep-link operation,
219
- * including pending metadata and cached completed results.
219
+ * including pending metadata, cached completed results, and iOS Safari
220
+ * return-URL markers.
220
221
  *
221
- * This intentionally leaves `neuma_cb` / `neuma_op` / `neuma_ts`
222
- * return-URL markers in the browser URL until they expire or a later
223
- * operation replaces them. iOS Safari uses an exact URL match to refocus
224
- * the originating tab when the native app launches `returnUrl`; removing
225
- * those markers before the user taps Close in the native app can make
226
- * Safari open a new tab instead.
227
- *
228
- * Call this after app-level result handling has been made durable. It is
229
- * always safe to call, including when no operation is pending.
222
+ * Call this only after app-level result handling has been made durable
223
+ * (for example after persisting or showing the result popup). It is always
224
+ * safe to call, including when no operation is pending.
230
225
  */
231
226
  clearPendingResult(): void;
232
227
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const NEUMA_CLIENT_SDK_VERSION = "0.120.0";
1
+ export declare const NEUMA_CLIENT_SDK_VERSION = "0.121.1";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NEUMA_CLIENT_SDK_VERSION = void 0;
4
4
  // This file is generated by scripts/generate-package-version.mjs. Do not edit by hand.
5
- exports.NEUMA_CLIENT_SDK_VERSION = '0.120.0';
5
+ exports.NEUMA_CLIENT_SDK_VERSION = '0.121.1';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizualkei/neuma-client-sdk",
3
- "version": "0.120.0",
3
+ "version": "0.121.1",
4
4
  "description": "Neuma Web Client SDK - Biometric verification SDK for webapp integration",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",