summaryrefslogtreecommitdiffhomepage
path: root/example/index.ts
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2024-04-12 19:19:06 -0700
committerMatthew Miller <matthew@millerti.me>2024-04-12 19:19:06 -0700
commitb299b51a0b4cd2731aa4ee2e5644ee13bab9843f (patch)
tree113f233634a10f0f81fd38c66ec7199a22631b1c /example/index.ts
parent81d9e499de9d3068dbd726f2cf859b0283233940 (diff)
Update Example to v10.0.0
Diffstat (limited to 'example/index.ts')
-rw-r--r--example/index.ts9
1 files changed, 2 insertions, 7 deletions
diff --git a/example/index.ts b/example/index.ts
index be18cb0..221a58f 100644
--- a/example/index.ts
+++ b/example/index.ts
@@ -23,7 +23,6 @@ import {
verifyAuthenticationResponse,
verifyRegistrationResponse,
} from '@simplewebauthn/server';
-import { isoBase64URL, isoUint8Array } from '@simplewebauthn/server/helpers';
import type {
GenerateAuthenticationOptionsOpts,
GenerateRegistrationOptionsOpts,
@@ -126,7 +125,6 @@ app.get('/generate-registration-options', async (req, res) => {
const opts: GenerateRegistrationOptionsOpts = {
rpName: 'SimpleWebAuthn Example',
rpID,
- userID: loggedInUserId,
userName: username,
timeout: 60000,
attestationType: 'none',
@@ -195,9 +193,7 @@ app.post('/verify-registration', async (req, res) => {
if (verified && registrationInfo) {
const { credentialPublicKey, credentialID, counter } = registrationInfo;
- const existingDevice = user.devices.find((device) =>
- isoUint8Array.areEqual(device.credentialID, credentialID)
- );
+ const existingDevice = user.devices.find((device) => device.credentialID === credentialID);
if (!existingDevice) {
/**
@@ -260,10 +256,9 @@ app.post('/verify-authentication', async (req, res) => {
const expectedChallenge = req.session.currentChallenge;
let dbAuthenticator;
- const bodyCredIDBuffer = isoBase64URL.toBuffer(body.rawId);
// "Query the DB" here for an authenticator matching `credentialID`
for (const dev of user.devices) {
- if (isoUint8Array.areEqual(dev.credentialID, bodyCredIDBuffer)) {
+ if (dev.credentialID === body.id) {
dbAuthenticator = dev;
break;
}