@micha.bigler/ui-core-micha 1.4.39 → 1.4.40
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.
|
@@ -956,12 +956,12 @@ export const authTranslations = {
|
|
|
956
956
|
"fr": "Expirée",
|
|
957
957
|
"en": "Expired"
|
|
958
958
|
},
|
|
959
|
-
"Common.
|
|
959
|
+
"Common.YES": {
|
|
960
960
|
"de": "Ja",
|
|
961
961
|
"fr": "Oui",
|
|
962
962
|
"en": "Yes"
|
|
963
963
|
},
|
|
964
|
-
"Common.
|
|
964
|
+
"Common.NO": {
|
|
965
965
|
"de": "Nein",
|
|
966
966
|
"fr": "Non",
|
|
967
967
|
"en": "No"
|
|
@@ -1016,5 +1016,10 @@ export const authTranslations = {
|
|
|
1016
1016
|
"de": "Benutzer nicht angemeldet.",
|
|
1017
1017
|
"fr": "Utilisateur non connecté.",
|
|
1018
1018
|
"en": "User not logged in."
|
|
1019
|
-
}
|
|
1019
|
+
},
|
|
1020
|
+
"Auth.INVITE_BUTTON": {
|
|
1021
|
+
"de": "Einladung senden",
|
|
1022
|
+
"fr": "Envoyer l'invitation",
|
|
1023
|
+
"en": "Send invitation"
|
|
1024
|
+
},
|
|
1020
1025
|
};
|
|
@@ -12,24 +12,25 @@ function resolveWebAuthnOptions(options) {
|
|
|
12
12
|
}
|
|
13
13
|
export async function registerPasskey(name = 'Passkey') {
|
|
14
14
|
ensureWebAuthnSupport();
|
|
15
|
-
// 1.
|
|
16
|
-
const
|
|
17
|
-
//
|
|
15
|
+
// 1. Options vom Server
|
|
16
|
+
const optionsEnvelope = await getPasskeyRegistrationOptions();
|
|
17
|
+
// optionsEnvelope ist bei dir: { publicKey: { ... } } oder { creation_options: { publicKey: {...} } }
|
|
18
|
+
// Extrahiere die eigentlichen publicKey-Options
|
|
19
|
+
const publicKeyJson = (optionsEnvelope.creation_options && optionsEnvelope.creation_options.publicKey) ||
|
|
20
|
+
optionsEnvelope.publicKey ||
|
|
21
|
+
optionsEnvelope;
|
|
18
22
|
let credential;
|
|
19
23
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const publicKeyOptions = window.PublicKeyCredential.parseCreationOptionsFromJSON(creationOptions);
|
|
24
|
-
credential = await navigator.credentials.create({ publicKey: publicKeyOptions });
|
|
24
|
+
const publicKey = window.PublicKeyCredential.parseCreationOptionsFromJSON(publicKeyJson);
|
|
25
|
+
// Wichtig: create({ publicKey: ... })
|
|
26
|
+
credential = await navigator.credentials.create({ publicKey });
|
|
25
27
|
}
|
|
26
28
|
catch (err) {
|
|
27
29
|
if (err.name === 'NotAllowedError') {
|
|
28
30
|
throw normaliseApiError(new Error('Auth.PASSKEY_CANCELLED'), 'Auth.PASSKEY_CANCELLED');
|
|
29
31
|
}
|
|
30
|
-
throw err;
|
|
32
|
+
throw normaliseApiError(err, 'Auth.PASSKEY_CREATE_FAILED');
|
|
31
33
|
}
|
|
32
|
-
// 3. Send back to Server
|
|
33
34
|
const credentialJson = serializeCredential(credential);
|
|
34
35
|
return completePasskeyRegistration(credentialJson, name);
|
|
35
36
|
}
|
package/package.json
CHANGED
|
@@ -1003,12 +1003,12 @@ export const authTranslations = {
|
|
|
1003
1003
|
"fr": "Expirée",
|
|
1004
1004
|
"en": "Expired"
|
|
1005
1005
|
},
|
|
1006
|
-
"Common.
|
|
1006
|
+
"Common.YES": {
|
|
1007
1007
|
"de": "Ja",
|
|
1008
1008
|
"fr": "Oui",
|
|
1009
1009
|
"en": "Yes"
|
|
1010
1010
|
},
|
|
1011
|
-
"Common.
|
|
1011
|
+
"Common.NO": {
|
|
1012
1012
|
"de": "Nein",
|
|
1013
1013
|
"fr": "Non",
|
|
1014
1014
|
"en": "No"
|
|
@@ -1064,5 +1064,11 @@ export const authTranslations = {
|
|
|
1064
1064
|
"de": "Benutzer nicht angemeldet.",
|
|
1065
1065
|
"fr": "Utilisateur non connecté.",
|
|
1066
1066
|
"en": "User not logged in."
|
|
1067
|
-
}
|
|
1068
|
-
|
|
1067
|
+
},
|
|
1068
|
+
"Auth.INVITE_BUTTON": {
|
|
1069
|
+
"de": "Einladung senden",
|
|
1070
|
+
"fr": "Envoyer l'invitation",
|
|
1071
|
+
"en": "Send invitation"
|
|
1072
|
+
},
|
|
1073
|
+
|
|
1074
|
+
}
|
package/src/utils/authService.js
CHANGED
|
@@ -25,28 +25,34 @@ function resolveWebAuthnOptions(options) {
|
|
|
25
25
|
|
|
26
26
|
export async function registerPasskey(name = 'Passkey') {
|
|
27
27
|
ensureWebAuthnSupport();
|
|
28
|
-
|
|
29
|
-
// 1.
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
|
|
29
|
+
// 1. Options vom Server
|
|
30
|
+
const optionsEnvelope = await getPasskeyRegistrationOptions();
|
|
31
|
+
// optionsEnvelope ist bei dir: { publicKey: { ... } } oder { creation_options: { publicKey: {...} } }
|
|
32
|
+
|
|
33
|
+
// Extrahiere die eigentlichen publicKey-Options
|
|
34
|
+
const publicKeyJson =
|
|
35
|
+
(optionsEnvelope.creation_options && optionsEnvelope.creation_options.publicKey) ||
|
|
36
|
+
optionsEnvelope.publicKey ||
|
|
37
|
+
optionsEnvelope;
|
|
38
|
+
|
|
33
39
|
let credential;
|
|
34
40
|
try {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
window.PublicKeyCredential.parseCreationOptionsFromJSON(creationOptions);
|
|
41
|
-
credential = await navigator.credentials.create({ publicKey: publicKeyOptions });
|
|
41
|
+
const publicKey = window.PublicKeyCredential.parseCreationOptionsFromJSON(
|
|
42
|
+
publicKeyJson,
|
|
43
|
+
);
|
|
44
|
+
// Wichtig: create({ publicKey: ... })
|
|
45
|
+
credential = await navigator.credentials.create({ publicKey });
|
|
42
46
|
} catch (err) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
if (err.name === 'NotAllowedError') {
|
|
48
|
+
throw normaliseApiError(
|
|
49
|
+
new Error('Auth.PASSKEY_CANCELLED'),
|
|
50
|
+
'Auth.PASSKEY_CANCELLED',
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
throw normaliseApiError(err, 'Auth.PASSKEY_CREATE_FAILED');
|
|
47
54
|
}
|
|
48
55
|
|
|
49
|
-
// 3. Send back to Server
|
|
50
56
|
const credentialJson = serializeCredential(credential);
|
|
51
57
|
return completePasskeyRegistration(credentialJson, name);
|
|
52
58
|
}
|