@micha.bigler/ui-core-micha 1.2.4 → 1.2.5
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/auth/authApi.js +14 -11
- package/package.json +1 -1
- package/src/auth/authApi.jsx +17 -11
package/dist/auth/authApi.js
CHANGED
|
@@ -178,12 +178,13 @@ async function registerPasskeyStart({ passwordless = true } = {}) {
|
|
|
178
178
|
params: passwordless ? { passwordless: true } : {},
|
|
179
179
|
withCredentials: true,
|
|
180
180
|
});
|
|
181
|
-
const
|
|
182
|
-
//
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
181
|
+
const responseBody = res.data || {};
|
|
182
|
+
// Handle nested 'data' wrapper if present, otherwise use body directly
|
|
183
|
+
const payload = responseBody.data || responseBody;
|
|
184
|
+
// Extract the inner publicKey structure required by the browser API
|
|
185
|
+
const publicKeyJson = (payload.creation_options && payload.creation_options.publicKey) ||
|
|
186
|
+
payload.publicKey ||
|
|
187
|
+
payload;
|
|
187
188
|
return publicKeyJson;
|
|
188
189
|
}
|
|
189
190
|
async function registerPasskeyComplete(credentialJson, name = 'Passkey') {
|
|
@@ -226,11 +227,13 @@ export async function registerPasskey(name = 'Passkey') {
|
|
|
226
227
|
async function loginWithPasskeyStart() {
|
|
227
228
|
ensureWebAuthnSupport();
|
|
228
229
|
const res = await axios.get(`${HEADLESS_BASE}/auth/webauthn/login`, { withCredentials: true });
|
|
229
|
-
const
|
|
230
|
-
//
|
|
231
|
-
const
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
const responseBody = res.data || {};
|
|
231
|
+
// Handle nested 'data' wrapper if present
|
|
232
|
+
const payload = responseBody.data || responseBody;
|
|
233
|
+
// Extract request options for authentication
|
|
234
|
+
const requestOptionsJson = (payload.request_options && payload.request_options.publicKey) ||
|
|
235
|
+
payload.request_options ||
|
|
236
|
+
payload;
|
|
234
237
|
return requestOptionsJson;
|
|
235
238
|
}
|
|
236
239
|
async function loginWithPasskeyComplete(credentialJson) {
|
package/package.json
CHANGED
package/src/auth/authApi.jsx
CHANGED
|
@@ -235,18 +235,21 @@ async function registerPasskeyStart({ passwordless = true } = {}) {
|
|
|
235
235
|
},
|
|
236
236
|
);
|
|
237
237
|
|
|
238
|
-
const
|
|
238
|
+
const responseBody = res.data || {};
|
|
239
239
|
|
|
240
|
-
//
|
|
241
|
-
|
|
240
|
+
// Handle nested 'data' wrapper if present, otherwise use body directly
|
|
241
|
+
const payload = responseBody.data || responseBody;
|
|
242
|
+
|
|
243
|
+
// Extract the inner publicKey structure required by the browser API
|
|
242
244
|
const publicKeyJson =
|
|
243
|
-
(
|
|
244
|
-
|
|
245
|
-
|
|
245
|
+
(payload.creation_options && payload.creation_options.publicKey) ||
|
|
246
|
+
payload.publicKey ||
|
|
247
|
+
payload;
|
|
246
248
|
|
|
247
249
|
return publicKeyJson;
|
|
248
250
|
}
|
|
249
251
|
|
|
252
|
+
|
|
250
253
|
async function registerPasskeyComplete(credentialJson, name = 'Passkey') {
|
|
251
254
|
const res = await axios.post(
|
|
252
255
|
`${HEADLESS_BASE}/account/authenticators/webauthn`,
|
|
@@ -304,13 +307,16 @@ async function loginWithPasskeyStart() {
|
|
|
304
307
|
{ withCredentials: true },
|
|
305
308
|
);
|
|
306
309
|
|
|
307
|
-
const
|
|
310
|
+
const responseBody = res.data || {};
|
|
311
|
+
|
|
312
|
+
// Handle nested 'data' wrapper if present
|
|
313
|
+
const payload = responseBody.data || responseBody;
|
|
308
314
|
|
|
309
|
-
//
|
|
315
|
+
// Extract request options for authentication
|
|
310
316
|
const requestOptionsJson =
|
|
311
|
-
(
|
|
312
|
-
|
|
313
|
-
|
|
317
|
+
(payload.request_options && payload.request_options.publicKey) ||
|
|
318
|
+
payload.request_options ||
|
|
319
|
+
payload;
|
|
314
320
|
|
|
315
321
|
return requestOptionsJson;
|
|
316
322
|
}
|