@adminforth/two-factors-auth 2.1.2 → 2.1.3

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/build.log CHANGED
@@ -13,5 +13,5 @@ custom/package.json
13
13
  custom/tsconfig.json
14
14
  custom/utils.js
15
15
 
16
- sent 74,931 bytes received 172 bytes 150,206.00 bytes/sec
17
- total size is 74,291 speedup is 0.99
16
+ sent 76,042 bytes received 172 bytes 152,428.00 bytes/sec
17
+ total size is 75,402 speedup is 0.99
@@ -204,13 +204,25 @@
204
204
  });
205
205
 
206
206
  async function isCMAAvailable() {
207
+ let isCMA_supported = false;
208
+ let isParsingSupported = false;
207
209
  if (window.PublicKeyCredential &&
208
210
  PublicKeyCredential.isConditionalMediationAvailable) {
209
211
  const isCMA = await PublicKeyCredential.isConditionalMediationAvailable();
210
- if (isCMA) {
211
- isPasskeysSupported.value = true;
212
- }
212
+ if (isCMA) {
213
+ isCMA_supported = true;
214
+ }
215
+ }
216
+ try {
217
+ const temp = PublicKeyCredential.parseRequestOptionsFromJSON({challenge: 'test123', timeout: 60000, userVerification: 'required'});
218
+ if (temp && typeof temp === 'object') {
219
+ isParsingSupported = true;
220
+ }
221
+ } catch (e) {
222
+ adminforth.alert({message: 'Please ensure your browser supports passkeys.', variant: 'warning'});
223
+ isParsingSupported = false;
213
224
  }
225
+ isPasskeysSupported.value = (isCMA_supported && isParsingSupported);
214
226
  }
215
227
 
216
228
  onBeforeUnmount(() => {
@@ -327,6 +327,8 @@
327
327
  }
328
328
 
329
329
  function checkForCompatibility() {
330
+ let isCMA_supported = false;
331
+ let isParsingSupported = false;
330
332
  if (window.PublicKeyCredential &&
331
333
  PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable &&
332
334
  PublicKeyCredential.isConditionalMediationAvailable) {
@@ -335,13 +337,23 @@
335
337
  PublicKeyCredential.isConditionalMediationAvailable(),
336
338
  ]).then(results => {
337
339
  if (results.every(r => r === true)) {
338
- isPasskeySupported.value = true;
340
+ isCMA_supported = true;
339
341
  } else {
340
- isPasskeySupported.value = false;
342
+ isCMA_supported = false;
341
343
  addPasskeyMode.value = 'cross-platform';
342
344
  }
343
345
  });
344
- }
346
+ }
347
+ try {
348
+ const temp = PublicKeyCredential.parseRequestOptionsFromJSON({challenge: 'test123', timeout: 60000, userVerification: 'required'});
349
+ if (temp && typeof temp === 'object') {
350
+ isParsingSupported = true;
351
+ }
352
+ } catch (e) {
353
+ adminforth.alert({message: 'Please ensure your browser supports passkeys.', variant: 'warning'});
354
+ isParsingSupported = false;
355
+ }
356
+ isPasskeySupported.value = (isCMA_supported && isParsingSupported);
345
357
  }
346
358
 
347
359
  async function fetchInformationFromTheBackend(confirmationResult) {
@@ -204,13 +204,25 @@
204
204
  });
205
205
 
206
206
  async function isCMAAvailable() {
207
+ let isCMA_supported = false;
208
+ let isParsingSupported = false;
207
209
  if (window.PublicKeyCredential &&
208
210
  PublicKeyCredential.isConditionalMediationAvailable) {
209
211
  const isCMA = await PublicKeyCredential.isConditionalMediationAvailable();
210
- if (isCMA) {
211
- isPasskeysSupported.value = true;
212
- }
212
+ if (isCMA) {
213
+ isCMA_supported = true;
214
+ }
215
+ }
216
+ try {
217
+ const temp = PublicKeyCredential.parseRequestOptionsFromJSON({challenge: 'test123', timeout: 60000, userVerification: 'required'});
218
+ if (temp && typeof temp === 'object') {
219
+ isParsingSupported = true;
220
+ }
221
+ } catch (e) {
222
+ adminforth.alert({message: 'Please ensure your browser supports passkeys.', variant: 'warning'});
223
+ isParsingSupported = false;
213
224
  }
225
+ isPasskeysSupported.value = (isCMA_supported && isParsingSupported);
214
226
  }
215
227
 
216
228
  onBeforeUnmount(() => {
@@ -327,6 +327,8 @@
327
327
  }
328
328
 
329
329
  function checkForCompatibility() {
330
+ let isCMA_supported = false;
331
+ let isParsingSupported = false;
330
332
  if (window.PublicKeyCredential &&
331
333
  PublicKeyCredential.isUserVerifyingPlatformAuthenticatorAvailable &&
332
334
  PublicKeyCredential.isConditionalMediationAvailable) {
@@ -335,13 +337,23 @@
335
337
  PublicKeyCredential.isConditionalMediationAvailable(),
336
338
  ]).then(results => {
337
339
  if (results.every(r => r === true)) {
338
- isPasskeySupported.value = true;
340
+ isCMA_supported = true;
339
341
  } else {
340
- isPasskeySupported.value = false;
342
+ isCMA_supported = false;
341
343
  addPasskeyMode.value = 'cross-platform';
342
344
  }
343
345
  });
344
- }
346
+ }
347
+ try {
348
+ const temp = PublicKeyCredential.parseRequestOptionsFromJSON({challenge: 'test123', timeout: 60000, userVerification: 'required'});
349
+ if (temp && typeof temp === 'object') {
350
+ isParsingSupported = true;
351
+ }
352
+ } catch (e) {
353
+ adminforth.alert({message: 'Please ensure your browser supports passkeys.', variant: 'warning'});
354
+ isParsingSupported = false;
355
+ }
356
+ isPasskeySupported.value = (isCMA_supported && isParsingSupported);
345
357
  }
346
358
 
347
359
  async function fetchInformationFromTheBackend(confirmationResult) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "2.1.2",
3
+ "version": "2.1.3",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",