@micha.bigler/ui-core-micha 1.2.3 → 1.2.4
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 +8 -5
- package/package.json +1 -1
- package/src/auth/authApi.jsx +8 -5
package/dist/auth/authApi.js
CHANGED
|
@@ -180,10 +180,11 @@ async function registerPasskeyStart({ passwordless = true } = {}) {
|
|
|
180
180
|
});
|
|
181
181
|
const data = res.data || {};
|
|
182
182
|
// allauth.headless: { creation_options: { publicKey: { ... } } }
|
|
183
|
-
|
|
184
|
-
|
|
183
|
+
// Wir wollen am Ende den INNEREN publicKey-Block haben:
|
|
184
|
+
const publicKeyJson = (data.creation_options && data.creation_options.publicKey) ||
|
|
185
|
+
data.publicKey ||
|
|
185
186
|
data;
|
|
186
|
-
return
|
|
187
|
+
return publicKeyJson;
|
|
187
188
|
}
|
|
188
189
|
async function registerPasskeyComplete(credentialJson, name = 'Passkey') {
|
|
189
190
|
const res = await axios.post(`${HEADLESS_BASE}/account/authenticators/webauthn`, {
|
|
@@ -197,10 +198,12 @@ export async function registerPasskey(name = 'Passkey') {
|
|
|
197
198
|
if (!hasJsonWebAuthn) {
|
|
198
199
|
throw new Error('Passkey JSON helpers are not available in this browser.');
|
|
199
200
|
}
|
|
200
|
-
|
|
201
|
+
// Hier bekommst du bereits den inneren publicKey-Block mit challenge etc.
|
|
202
|
+
const publicKeyJson = await registerPasskeyStart({ passwordless: true });
|
|
201
203
|
let credential;
|
|
202
204
|
try {
|
|
203
|
-
|
|
205
|
+
// publicKeyJson hat challenge auf Top-Level
|
|
206
|
+
const publicKeyOptions = window.PublicKeyCredential.parseCreationOptionsFromJSON(publicKeyJson);
|
|
204
207
|
credential = await navigator.credentials.create({
|
|
205
208
|
publicKey: publicKeyOptions,
|
|
206
209
|
});
|
package/package.json
CHANGED
package/src/auth/authApi.jsx
CHANGED
|
@@ -238,12 +238,13 @@ async function registerPasskeyStart({ passwordless = true } = {}) {
|
|
|
238
238
|
const data = res.data || {};
|
|
239
239
|
|
|
240
240
|
// allauth.headless: { creation_options: { publicKey: { ... } } }
|
|
241
|
-
|
|
241
|
+
// Wir wollen am Ende den INNEREN publicKey-Block haben:
|
|
242
|
+
const publicKeyJson =
|
|
242
243
|
(data.creation_options && data.creation_options.publicKey) ||
|
|
243
|
-
data.
|
|
244
|
+
data.publicKey ||
|
|
244
245
|
data;
|
|
245
246
|
|
|
246
|
-
return
|
|
247
|
+
return publicKeyJson;
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
async function registerPasskeyComplete(credentialJson, name = 'Passkey') {
|
|
@@ -265,12 +266,14 @@ export async function registerPasskey(name = 'Passkey') {
|
|
|
265
266
|
throw new Error('Passkey JSON helpers are not available in this browser.');
|
|
266
267
|
}
|
|
267
268
|
|
|
268
|
-
|
|
269
|
+
// Hier bekommst du bereits den inneren publicKey-Block mit challenge etc.
|
|
270
|
+
const publicKeyJson = await registerPasskeyStart({ passwordless: true });
|
|
269
271
|
|
|
270
272
|
let credential;
|
|
271
273
|
try {
|
|
274
|
+
// publicKeyJson hat challenge auf Top-Level
|
|
272
275
|
const publicKeyOptions =
|
|
273
|
-
window.PublicKeyCredential.parseCreationOptionsFromJSON(
|
|
276
|
+
window.PublicKeyCredential.parseCreationOptionsFromJSON(publicKeyJson);
|
|
274
277
|
|
|
275
278
|
credential = await navigator.credentials.create({
|
|
276
279
|
publicKey: publicKeyOptions,
|