@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.cjs.js +14 -9
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +14 -9
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1864,11 +1864,12 @@ var MFAOptions = function (_a) {
|
|
|
1864
1864
|
var idToken = context.authMode === "MSAL" ? context.idToken : "";
|
|
1865
1865
|
var authenticate = useWebAuthn().authenticate;
|
|
1866
1866
|
var handleFIDOLogin = function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
1867
|
-
var options, assertionResponse, error_1;
|
|
1868
|
-
|
|
1869
|
-
|
|
1867
|
+
var options, fixedOptions, assertionResponse, error_1;
|
|
1868
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1869
|
+
return __generator(this, function (_g) {
|
|
1870
|
+
switch (_g.label) {
|
|
1870
1871
|
case 0:
|
|
1871
|
-
|
|
1872
|
+
_g.trys.push([0, 4, , 5]);
|
|
1872
1873
|
// 1. Fetch authentication challenge from your server
|
|
1873
1874
|
console.log("Requesting authentication challenge from server...");
|
|
1874
1875
|
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
|
|
@@ -1878,13 +1879,17 @@ var MFAOptions = function (_a) {
|
|
|
1878
1879
|
},
|
|
1879
1880
|
})];
|
|
1880
1881
|
case 1:
|
|
1881
|
-
options = (
|
|
1882
|
+
options = (_g.sent()).data;
|
|
1882
1883
|
console.log("Received challenge:", options);
|
|
1884
|
+
fixedOptions = __assign(__assign({}, options), { pubKeyCredParams: (_a = options.pubKeyCredParams) === null || _a === void 0 ? void 0 : _a.map(function (param) { return ({
|
|
1885
|
+
type: "public-key",
|
|
1886
|
+
alg: param.alg
|
|
1887
|
+
}); }), 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" }) });
|
|
1883
1888
|
// 2. Call the SDK to trigger the browser's passkey authentication UI
|
|
1884
1889
|
console.log("Calling SDK authenticate function...");
|
|
1885
|
-
return [4 /*yield*/, authenticate(
|
|
1890
|
+
return [4 /*yield*/, authenticate(fixedOptions)];
|
|
1886
1891
|
case 2:
|
|
1887
|
-
assertionResponse =
|
|
1892
|
+
assertionResponse = _g.sent();
|
|
1888
1893
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1889
1894
|
// 3. Send the assertion back to the server for verification
|
|
1890
1895
|
console.log("Sending assertion to server for verification...");
|
|
@@ -1896,11 +1901,11 @@ var MFAOptions = function (_a) {
|
|
|
1896
1901
|
withCredentials: true, // credentials: 'include'
|
|
1897
1902
|
})];
|
|
1898
1903
|
case 3:
|
|
1899
|
-
|
|
1904
|
+
_g.sent();
|
|
1900
1905
|
sonner.toast.success("🔑 Sign-in successful!");
|
|
1901
1906
|
return [3 /*break*/, 5];
|
|
1902
1907
|
case 4:
|
|
1903
|
-
error_1 =
|
|
1908
|
+
error_1 = _g.sent();
|
|
1904
1909
|
console.error("Authentication failed:", error_1);
|
|
1905
1910
|
sonner.toast.error("❌ Could not sign in.");
|
|
1906
1911
|
return [3 /*break*/, 5];
|