summaryrefslogtreecommitdiffhomepage
path: root/example
diff options
context:
space:
mode:
Diffstat (limited to 'example')
-rw-r--r--example/fido-conformance.ts7
-rw-r--r--example/index.ts9
-rw-r--r--example/package-lock.json32
-rw-r--r--example/package.json2
4 files changed, 21 insertions, 29 deletions
diff --git a/example/fido-conformance.ts b/example/fido-conformance.ts
index 7229626..5f67c67 100644
--- a/example/fido-conformance.ts
+++ b/example/fido-conformance.ts
@@ -11,7 +11,6 @@ import {
verifyAuthenticationResponse,
verifyRegistrationResponse,
} from '@simplewebauthn/server';
-import { isoBase64URL, isoUint8Array } from '@simplewebauthn/server/helpers';
import { AuthenticationResponseJSON, RegistrationResponseJSON } from '@simplewebauthn/types';
import { expectedOrigin, rpID } from './index';
@@ -234,6 +233,7 @@ fidoConformanceRouter.post('/assertion/options', async (req, res) => {
const { devices } = user;
const opts = await generateAuthenticationOptions({
+ rpID,
extensions,
userVerification,
allowCredentials: devices.map((dev) => ({
@@ -269,10 +269,7 @@ fidoConformanceRouter.post('/assertion/result', async (req, res) => {
return res.status(400).send({ errorMessage: msg });
}
- const credIDBuffer = isoBase64URL.toBuffer(id);
- const existingDevice = user.devices.find((device) =>
- isoUint8Array.areEqual(device.credentialID, credIDBuffer)
- );
+ const existingDevice = user.devices.find((device) => device.credentialID === id);
if (!existingDevice) {
const msg = `Could not find device matching ${id}`;
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;
}
diff --git a/example/package-lock.json b/example/package-lock.json
index f7f4e6d..d339cf2 100644
--- a/example/package-lock.json
+++ b/example/package-lock.json
@@ -9,7 +9,7 @@
"version": "1.0.0",
"license": "ISC",
"dependencies": {
- "@simplewebauthn/server": "9.0.3",
+ "@simplewebauthn/server": "10.0.0",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"express-session": "^1.17.3",
@@ -112,9 +112,9 @@
}
},
"node_modules/@simplewebauthn/server": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-9.0.3.tgz",
- "integrity": "sha512-FMZieoBosrVLFxCnxPFD9Enhd1U7D8nidVDT4MsHc6l4fdVcjoeHjDueeXCloO1k5O/fZg1fsSXXPKbY2XTzDA==",
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-10.0.0.tgz",
+ "integrity": "sha512-w5eIoiF7ltg1sgggjY5Tx654j+DBuyEx2B3869jjmPp0xl2Z4BUP4kJ3yJ6DnZIv+ZYYntT3E6nZXNjPOQbrtw==",
"dependencies": {
"@hexagon/base64": "^1.1.27",
"@levischuck/tiny-cbor": "^0.2.2",
@@ -123,17 +123,17 @@
"@peculiar/asn1-rsa": "^2.3.8",
"@peculiar/asn1-schema": "^2.3.8",
"@peculiar/asn1-x509": "^2.3.8",
- "@simplewebauthn/types": "^9.0.1",
+ "@simplewebauthn/types": "^10.0.0",
"cross-fetch": "^4.0.0"
},
"engines": {
- "node": ">=16.0.0"
+ "node": ">=20.0.0"
}
},
"node_modules/@simplewebauthn/types": {
- "version": "9.0.1",
- "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-9.0.1.tgz",
- "integrity": "sha512-tGSRP1QvsAvsJmnOlRQyw/mvK9gnPtjEc5fg2+m8n+QUa+D7rvrKkOYyfpy42GTs90X3RDOnqJgfHt+qO67/+w=="
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-10.0.0.tgz",
+ "integrity": "sha512-SFXke7xkgPRowY2E+8djKbdEznTVnD5R6GO7GPTthpHrokLvNKw8C3lFZypTxLI7KkCfGPfhtqB3d7OVGGa9jQ=="
},
"node_modules/@tsconfig/node10": {
"version": "1.0.8",
@@ -1610,9 +1610,9 @@
}
},
"@simplewebauthn/server": {
- "version": "9.0.3",
- "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-9.0.3.tgz",
- "integrity": "sha512-FMZieoBosrVLFxCnxPFD9Enhd1U7D8nidVDT4MsHc6l4fdVcjoeHjDueeXCloO1k5O/fZg1fsSXXPKbY2XTzDA==",
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@simplewebauthn/server/-/server-10.0.0.tgz",
+ "integrity": "sha512-w5eIoiF7ltg1sgggjY5Tx654j+DBuyEx2B3869jjmPp0xl2Z4BUP4kJ3yJ6DnZIv+ZYYntT3E6nZXNjPOQbrtw==",
"requires": {
"@hexagon/base64": "^1.1.27",
"@levischuck/tiny-cbor": "^0.2.2",
@@ -1621,14 +1621,14 @@
"@peculiar/asn1-rsa": "^2.3.8",
"@peculiar/asn1-schema": "^2.3.8",
"@peculiar/asn1-x509": "^2.3.8",
- "@simplewebauthn/types": "^9.0.1",
+ "@simplewebauthn/types": "^10.0.0",
"cross-fetch": "^4.0.0"
}
},
"@simplewebauthn/types": {
- "version": "9.0.1",
- "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-9.0.1.tgz",
- "integrity": "sha512-tGSRP1QvsAvsJmnOlRQyw/mvK9gnPtjEc5fg2+m8n+QUa+D7rvrKkOYyfpy42GTs90X3RDOnqJgfHt+qO67/+w=="
+ "version": "10.0.0",
+ "resolved": "https://registry.npmjs.org/@simplewebauthn/types/-/types-10.0.0.tgz",
+ "integrity": "sha512-SFXke7xkgPRowY2E+8djKbdEznTVnD5R6GO7GPTthpHrokLvNKw8C3lFZypTxLI7KkCfGPfhtqB3d7OVGGa9jQ=="
},
"@tsconfig/node10": {
"version": "1.0.8",
diff --git a/example/package.json b/example/package.json
index 744f938..b03a528 100644
--- a/example/package.json
+++ b/example/package.json
@@ -11,7 +11,7 @@
"author": "",
"license": "ISC",
"dependencies": {
- "@simplewebauthn/server": "9.0.3",
+ "@simplewebauthn/server": "10.0.0",
"dotenv": "^10.0.0",
"express": "^4.17.1",
"express-session": "^1.17.3",