@nibssplc/cams-sdk-react 0.0.1-beta.95 → 0.0.1-beta.96

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.esm.js CHANGED
@@ -1843,11 +1843,12 @@ var MFAOptions = function (_a) {
1843
1843
  var idToken = context.authMode === "MSAL" ? context.idToken : "";
1844
1844
  var authenticate = useWebAuthn().authenticate;
1845
1845
  var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
1846
- var options, assertionResponse, error_1;
1847
- return __generator(this, function (_a) {
1848
- switch (_a.label) {
1846
+ var options, fixedOptions, assertionResponse, error_1;
1847
+ var _a, _b, _c, _d, _e, _f;
1848
+ return __generator(this, function (_g) {
1849
+ switch (_g.label) {
1849
1850
  case 0:
1850
- _a.trys.push([0, 4, , 5]);
1851
+ _g.trys.push([0, 4, , 5]);
1851
1852
  // 1. Fetch authentication challenge from your server
1852
1853
  console.log("Requesting authentication challenge from server...");
1853
1854
  return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
@@ -1857,13 +1858,17 @@ var MFAOptions = function (_a) {
1857
1858
  },
1858
1859
  })];
1859
1860
  case 1:
1860
- options = (_a.sent()).data;
1861
+ options = (_g.sent()).data;
1861
1862
  console.log("Received challenge:", options);
1863
+ fixedOptions = __assign(__assign({}, options), { pubKeyCredParams: (_a = options.pubKeyCredParams) === null || _a === void 0 ? void 0 : _a.map(function (param) { return ({
1864
+ type: "public-key",
1865
+ alg: param.alg
1866
+ }); }), 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()) || "discouraged", userVerification: ((_f = (_e = options.authenticatorSelection) === null || _e === void 0 ? void 0 : _e.userVerification) === null || _f === void 0 ? void 0 : _f.toLowerCase()) || "preferred" }) });
1862
1867
  // 2. Call the SDK to trigger the browser's passkey authentication UI
1863
1868
  console.log("Calling SDK authenticate function...");
1864
- return [4 /*yield*/, authenticate(options)];
1869
+ return [4 /*yield*/, authenticate(fixedOptions)];
1865
1870
  case 2:
1866
- assertionResponse = _a.sent();
1871
+ assertionResponse = _g.sent();
1867
1872
  console.log("Authentication assertion received from client:", assertionResponse);
1868
1873
  // 3. Send the assertion back to the server for verification
1869
1874
  console.log("Sending assertion to server for verification...");
@@ -1875,11 +1880,11 @@ var MFAOptions = function (_a) {
1875
1880
  withCredentials: true, // credentials: 'include'
1876
1881
  })];
1877
1882
  case 3:
1878
- _a.sent();
1883
+ _g.sent();
1879
1884
  toast.success("🔑 Sign-in successful!");
1880
1885
  return [3 /*break*/, 5];
1881
1886
  case 4:
1882
- error_1 = _a.sent();
1887
+ error_1 = _g.sent();
1883
1888
  console.error("Authentication failed:", error_1);
1884
1889
  toast.error("❌ Could not sign in.");
1885
1890
  return [3 /*break*/, 5];