summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Miller <matthew@millerti.me>2021-03-10 19:41:38 -0800
committerMatthew Miller <matthew@millerti.me>2021-03-10 19:46:07 -0800
commita57624c339769786dbb29880f003ba60e39f7c43 (patch)
tree562c7f80d31689cfa6b2c257797bacc555ed3ac2
parentc001f4ffd9fee9ab2230e65d6e6c0b0b6e7ae037 (diff)
Update Conformance example RP ID and origin
-rw-r--r--example/fido-conformance.ts9
-rw-r--r--example/index.ts4
2 files changed, 6 insertions, 7 deletions
diff --git a/example/fido-conformance.ts b/example/fido-conformance.ts
index 80371f8..fd01934 100644
--- a/example/fido-conformance.ts
+++ b/example/fido-conformance.ts
@@ -17,6 +17,7 @@ import {
} from '@simplewebauthn/typescript-types';
import { MetadataStatement } from '@simplewebauthn/server/dist/metadata/metadataService';
+import { rpID, expectedOrigin } from './index';
import { LoggedInUser } from './example-server';
interface LoggedInFIDOUser extends LoggedInUser {
@@ -30,8 +31,6 @@ export const fidoConformanceRouter = express.Router();
export const fidoRouteSuffix = '/fido';
const rpName = 'FIDO Conformance Test';
-const rpID = 'localhost';
-const origin = 'https://localhost';
/**
* Load JSON metadata statements provided by the Conformance Tools
@@ -59,7 +58,7 @@ try {
*/
fetch('https://mds.certinfra.fidoalliance.org/getEndpoints', {
method: 'POST',
- body: JSON.stringify({ endpoint: `${origin}${fidoRouteSuffix}` }),
+ body: JSON.stringify({ endpoint: `${expectedOrigin}${fidoRouteSuffix}` }),
headers: { 'Content-Type': 'application/json' },
})
.then(resp => resp.json())
@@ -167,7 +166,7 @@ fidoConformanceRouter.post('/attestation/result', async (req, res) => {
verification = await verifyAttestationResponse({
credential: body,
expectedChallenge: `${expectedChallenge}`,
- expectedOrigin: origin,
+ expectedOrigin,
});
} catch (error) {
console.error(`RP - attestation: ${error.message}`);
@@ -254,7 +253,7 @@ fidoConformanceRouter.post('/assertion/result', (req, res) => {
verification = verifyAssertionResponse({
credential: body,
expectedChallenge: `${expectedChallenge}`,
- expectedOrigin: origin,
+ expectedOrigin,
expectedRPID: rpID,
authenticator: existingDevice,
fidoUserVerification: userVerification,
diff --git a/example/index.ts b/example/index.ts
index fe8d896..5c24880 100644
--- a/example/index.ts
+++ b/example/index.ts
@@ -63,11 +63,11 @@ if (ENABLE_CONFORMANCE === 'true') {
* RP ID represents the "scope" of websites on which a authenticator should be usable. The Origin
* represents the expected URL from which an attestation or assertion occurs.
*/
-const rpID = 'localhost';
+export const rpID = 'localhost';
// This value is set at the bottom of page as part of server initialization (the empty string is
// to appease TypeScript until we determine the expected origin based on whether or not HTTPS
// support is enabled)
-let expectedOrigin = '';
+export let expectedOrigin = '';
/**
* 2FA and Passwordless WebAuthn flows expect you to be able to uniquely identify the user that