summaryrefslogtreecommitdiffhomepage
path: root/example/index.js
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2020-06-07 15:20:25 -0700
committerMatthew Miller <matthew@millerti.me>2020-06-07 15:20:47 -0700
commit50f325a1b43bf00a1eb49cba9678c79fdaa98dfb (patch)
tree58b15ec0c63a8aad6b3a926b76cbc79cab295de2 /example/index.js
parent20231a7359ea991c836c67811194b856fdb13b33 (diff)
Update example to v0.6.0
Diffstat (limited to 'example/index.js')
-rw-r--r--example/index.js19
1 files changed, 14 insertions, 5 deletions
diff --git a/example/index.js b/example/index.js
index b3f0691..3d78a9b 100644
--- a/example/index.js
+++ b/example/index.js
@@ -153,7 +153,12 @@ app.post('/verify-attestation', (req, res) => {
let verification;
try {
- verification = verifyAttestationResponse(body, expectedChallenge, origin);
+ verification = verifyAttestationResponse({
+ credential: body,
+ expectedChallenge,
+ expectedOrigin: origin,
+ expectedRPID: rpID,
+ });
} catch (error) {
console.error(error);
return res.status(400).send({ error: error.message });
@@ -164,9 +169,7 @@ app.post('/verify-attestation', (req, res) => {
if (verified) {
const { base64PublicKey, base64CredentialID, counter } = authenticatorInfo;
- const existingDevice = user.devices.find(
- device => device.credentialID === base64CredentialID,
- );
+ const existingDevice = user.devices.find(device => device.credentialID === base64CredentialID);
if (!existingDevice) {
/**
@@ -234,7 +237,13 @@ app.post('/verify-assertion', (req, res) => {
let verification;
try {
- verification = verifyAssertionResponse(body, expectedChallenge, origin, dbAuthenticator);
+ verification = verifyAssertionResponse({
+ credential: body,
+ expectedChallenge,
+ expectedOrigin: origin,
+ expectedRPID: rpID,
+ authenticator: dbAuthenticator,
+ });
} catch (error) {
console.error(error);
return res.status(400).send({ error: error.message });