Skip to content

Commit

Permalink
Fix a bug .get() won't reflect the setting
Browse files Browse the repository at this point in the history
- Fix a bug .get() won't reflect the setting
- Better error handling
- Version bump
  • Loading branch information
agektmr committed Jul 6, 2023
1 parent fa726f3 commit d607318
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webauthndemo",
"version": "2.1.0",
"version": "2.2.0",
"description": "An example JavaScript Relying Party implementation of the WebAuthn specification.",
"main": "dist/server.mjs",
"scripts": {
Expand Down
12 changes: 6 additions & 6 deletions src/libs/webauthn.mts
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ router.post('/registerRequest', authzAPI, async (
req.session.type = enrollmentType;

return res.json(options);
} catch (error) {
} catch (error: any) {
console.error(error);
return res.status(400).send({ status: false, error: error });
return res.status(400).send({ status: false, error: error.message });
}
});

Expand Down Expand Up @@ -365,10 +365,10 @@ router.post('/authRequest', authzAPI, async (
req.session.timeout = getNow() + WEBAUTHN_TIMEOUT;

return res.json(options);
} catch (error) {
} catch (error: any) {
console.error(error);

return res.status(400).json({ status: false, error });
return res.status(400).json({ status: false, error: error.message });
}
});

Expand Down Expand Up @@ -448,12 +448,12 @@ router.post('/authResponse', authzAPI, async (
delete req.session.challenge;
delete req.session.timeout;
return res.json(storedCred);
} catch (error) {
} catch (error: any) {
console.error(error);

delete req.session.challenge;
delete req.session.timeout;
return res.status(400).json({ status: false, error });
return res.status(400).json({ status: false, error: error.message });
}
});

Expand Down
1 change: 1 addition & 0 deletions src/public/scripts/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ const collectOptions = (
// This is authentication
} else {
return {
userVerification,
extensions: { devicePubKey },
customTimeout,
// abortTimeout,
Expand Down

0 comments on commit d607318

Please sign in to comment.