@nibssplc/cams-sdk-react 0.0.1-beta.93 → 0.0.1-beta.95
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/components/MFAGate.d.ts +2 -1
- package/dist/index.cjs.js +26 -7
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +26 -7
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,7 +11,8 @@ interface MFAGateProps {
|
|
|
11
11
|
children: React.ReactNode;
|
|
12
12
|
fallback?: React.ReactNode;
|
|
13
13
|
usePassKey?: boolean;
|
|
14
|
+
PassKeysRegisterProps?: Record<string, unknown>;
|
|
14
15
|
MFAEndpoints?: MFAEndpoints;
|
|
15
16
|
}
|
|
16
|
-
declare const MFAGate: ({ children, fallback, usePassKey, MFAEndpoints, }: MFAGateProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
17
|
+
declare const MFAGate: ({ children, fallback, usePassKey, PassKeysRegisterProps, MFAEndpoints, }: MFAGateProps) => string | number | bigint | boolean | Iterable<import("react").ReactNode> | Promise<string | number | bigint | boolean | import("react").ReactPortal | import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>> | Iterable<import("react").ReactNode> | null | undefined> | import("react/jsx-runtime").JSX.Element | null;
|
|
17
18
|
export default MFAGate;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1871,7 +1871,12 @@ var MFAOptions = function (_a) {
|
|
|
1871
1871
|
_a.trys.push([0, 4, , 5]);
|
|
1872
1872
|
// 1. Fetch authentication challenge from your server
|
|
1873
1873
|
console.log("Requesting authentication challenge from server...");
|
|
1874
|
-
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge
|
|
1874
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RetrieveAuthChallenge, {}, {
|
|
1875
|
+
headers: {
|
|
1876
|
+
"X-DEVICE-ID": GenerateDeviceId(),
|
|
1877
|
+
"X-API-VERSION": "1.0",
|
|
1878
|
+
},
|
|
1879
|
+
})];
|
|
1875
1880
|
case 1:
|
|
1876
1881
|
options = (_a.sent()).data;
|
|
1877
1882
|
console.log("Received challenge:", options);
|
|
@@ -1883,7 +1888,13 @@ var MFAOptions = function (_a) {
|
|
|
1883
1888
|
console.log("Authentication assertion received from client:", assertionResponse);
|
|
1884
1889
|
// 3. Send the assertion back to the server for verification
|
|
1885
1890
|
console.log("Sending assertion to server for verification...");
|
|
1886
|
-
return [4 /*yield*/, axios.post(MFAEndpoints.AuthChallengeVerify, assertionResponse
|
|
1891
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.AuthChallengeVerify, assertionResponse, {
|
|
1892
|
+
headers: {
|
|
1893
|
+
"X-DEVICE-ID": GenerateDeviceId(),
|
|
1894
|
+
"X-API-VERSION": "1.0",
|
|
1895
|
+
},
|
|
1896
|
+
withCredentials: true, // credentials: 'include'
|
|
1897
|
+
})];
|
|
1887
1898
|
case 3:
|
|
1888
1899
|
_a.sent();
|
|
1889
1900
|
sonner.toast.success("🔑 Sign-in successful!");
|
|
@@ -2107,7 +2118,12 @@ var DefaultLoginPage = function (_a) {
|
|
|
2107
2118
|
_a.trys.push([0, 4, , 5]);
|
|
2108
2119
|
// 1. Fetch challenge from your server
|
|
2109
2120
|
console.log("Requesting registration challenge from server...");
|
|
2110
|
-
return [4 /*yield*/, axios.post(MFAEndpoints.RegisterNewChallenge, __assign({}, data)
|
|
2121
|
+
return [4 /*yield*/, axios.post(MFAEndpoints.RegisterNewChallenge, __assign({}, data), {
|
|
2122
|
+
headers: {
|
|
2123
|
+
"X-DEVICE-ID": GenerateDeviceId(),
|
|
2124
|
+
"X-API-VERSION": "1.0",
|
|
2125
|
+
},
|
|
2126
|
+
})];
|
|
2111
2127
|
case 1:
|
|
2112
2128
|
options = (_a.sent()).data;
|
|
2113
2129
|
console.log("Received challenge:", options);
|
|
@@ -2120,7 +2136,10 @@ var DefaultLoginPage = function (_a) {
|
|
|
2120
2136
|
// 3. Send the response back to the server for verification
|
|
2121
2137
|
console.log("Sending attestation to server for verification...");
|
|
2122
2138
|
return [4 /*yield*/, axios.post(MFAEndpoints.RegisterVerify, attestationResponse, {
|
|
2123
|
-
headers: {
|
|
2139
|
+
headers: {
|
|
2140
|
+
"X-DEVICE-ID": GenerateDeviceId(),
|
|
2141
|
+
"X-API-VERSION": "1.0",
|
|
2142
|
+
},
|
|
2124
2143
|
withCredentials: true, // credentials: 'include'
|
|
2125
2144
|
})];
|
|
2126
2145
|
case 3:
|
|
@@ -2167,7 +2186,7 @@ var MFAGate = function (_a) {
|
|
|
2167
2186
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2168
2187
|
_c = _a.usePassKey,
|
|
2169
2188
|
// loginComponent: LoginComponent = DefaultLoginPage,
|
|
2170
|
-
usePassKey = _c === void 0 ? false : _c, MFAEndpoints = _a.MFAEndpoints;
|
|
2189
|
+
usePassKey = _c === void 0 ? false : _c, PassKeysRegisterProps = _a.PassKeysRegisterProps, MFAEndpoints = _a.MFAEndpoints;
|
|
2171
2190
|
var context = useCAMSContext();
|
|
2172
2191
|
var validatedMFAEndpoints = React.useMemo(function () {
|
|
2173
2192
|
var parsed = MFAEndpointsSchema.safeParse(MFAEndpoints);
|
|
@@ -2202,7 +2221,7 @@ var MFAGate = function (_a) {
|
|
|
2202
2221
|
return (jsxRuntimeExports.jsx(MFAOptions, { MFAEndpoints: validatedMFAEndpoints, usePassKey: usePassKey, onComplete: handleComplete, onAuthFailed: handleAuthFailed }));
|
|
2203
2222
|
}
|
|
2204
2223
|
if (!context.isAuthenticated) {
|
|
2205
|
-
return jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, MFAEndpoints: MFAEndpoints });
|
|
2224
|
+
return (jsxRuntimeExports.jsx(DefaultLoginPage, { usePassKey: usePassKey, MFAEndpoints: MFAEndpoints, PassKeysRegisterProps: PassKeysRegisterProps }));
|
|
2206
2225
|
}
|
|
2207
2226
|
return jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children });
|
|
2208
2227
|
};
|
|
@@ -2210,7 +2229,7 @@ var MFAGate = function (_a) {
|
|
|
2210
2229
|
exports.CAMSMSALProvider = CAMSMSALProvider;
|
|
2211
2230
|
exports.CAMSProvider = CAMSProvider;
|
|
2212
2231
|
exports.ClientOnly = ClientOnly;
|
|
2213
|
-
exports.
|
|
2232
|
+
exports.DefaultLoginPage = DefaultLoginPage;
|
|
2214
2233
|
exports.MFAGate = MFAGate;
|
|
2215
2234
|
exports.MFAOptions = MFAOptions;
|
|
2216
2235
|
exports.ProtectedRoute = ProtectedRoute;
|