@nibssplc/cams-sdk-react 0.0.1-beta.101 → 0.0.1-beta.103

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/dist/index.cjs.js CHANGED
@@ -582,14 +582,13 @@ function register(options) {
582
582
  case 0:
583
583
  _k.trys.push([0, 2, , 3]);
584
584
  createOptions = __assign(__assign({}, options), { challenge: base64urlToArrayBuffer(options.challenge), user: __assign(__assign({}, options.user), { id: base64urlToArrayBuffer(options.user.id) }) });
585
- console.log("Creating credential with options:", createOptions, "...\n\n\n", options);
586
585
  return [4 /*yield*/, navigator.credentials.create({
587
586
  publicKey: __assign(__assign({}, createOptions), { pubKeyCredParams: (_a = options.pubKeyCredParams) === null || _a === void 0 ? void 0 : _a.map(function (param) { return ({
588
587
  type: "public-key",
589
588
  alg: param.alg,
590
589
  }); }), attestation: (((_b = options.attestation) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || "none"), authenticatorSelection: __assign(__assign({}, options.authenticatorSelection), { residentKey: (((_d = (_c = options.authenticatorSelection) === null || _c === void 0 ? void 0 : _c.residentKey) === null || _d === void 0 ? void 0 : _d.toLowerCase()) ||
591
590
  "discouraged"), userVerification: (((_f = (_e = options.authenticatorSelection) === null || _e === void 0 ? void 0 : _e.userVerification) === null || _f === void 0 ? void 0 : _f.toLowerCase()) ||
592
- "preferred") }) }),
591
+ "discouraged") }) }),
593
592
  })];
594
593
  case 1:
595
594
  credential = _k.sent();
@@ -610,12 +609,16 @@ function register(options) {
610
609
  }];
611
610
  case 2:
612
611
  err_1 = _k.sent();
612
+ console.error("Error during registration:", err_1);
613
613
  if (err_1.name === "NotAllowedError") {
614
- throw new Error("Registration cancelled by user.");
614
+ throw new Error("Face ID/Touch ID cancelled or failed. Please try again.");
615
615
  }
616
616
  if (err_1.name === "InvalidStateError") {
617
617
  throw new Error("Passkey already registered for this user.");
618
618
  }
619
+ if (err_1.name === "NotSupportedError") {
620
+ throw new Error("Passkeys not supported on this device.");
621
+ }
619
622
  throw err_1;
620
623
  case 3: return [2 /*return*/];
621
624
  }