summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/server/src')
-rw-r--r--packages/server/src/authentication/generateAuthenticationOptions.test.ts (renamed from packages/server/src/assertion/generateAssertionOptions.test.ts)2
-rw-r--r--packages/server/src/authentication/generateAuthenticationOptions.ts (renamed from packages/server/src/assertion/generateAssertionOptions.ts)0
-rw-r--r--packages/server/src/authentication/verifyAuthenticationResponse.test.ts (renamed from packages/server/src/assertion/verifyAssertionResponse.test.ts)2
-rw-r--r--packages/server/src/authentication/verifyAuthenticationResponse.ts (renamed from packages/server/src/assertion/verifyAssertionResponse.ts)0
-rw-r--r--packages/server/src/index.test.ts8
-rw-r--r--packages/server/src/index.ts26
-rw-r--r--packages/server/src/registration/generateRegistrationOptions.test.ts (renamed from packages/server/src/attestation/generateAttestationOptions.test.ts)18
-rw-r--r--packages/server/src/registration/generateRegistrationOptions.ts (renamed from packages/server/src/attestation/generateAttestationOptions.ts)6
-rw-r--r--packages/server/src/registration/verifications/tpm/constants.ts (renamed from packages/server/src/attestation/verifications/tpm/constants.ts)0
-rw-r--r--packages/server/src/registration/verifications/tpm/parseCertInfo.ts (renamed from packages/server/src/attestation/verifications/tpm/parseCertInfo.ts)0
-rw-r--r--packages/server/src/registration/verifications/tpm/parsePubArea.ts (renamed from packages/server/src/attestation/verifications/tpm/parsePubArea.ts)0
-rw-r--r--packages/server/src/registration/verifications/tpm/verifyTPM.test.ts (renamed from packages/server/src/attestation/verifications/tpm/verifyTPM.test.ts)0
-rw-r--r--packages/server/src/registration/verifications/tpm/verifyTPM.ts (renamed from packages/server/src/attestation/verifications/tpm/verifyTPM.ts)2
-rw-r--r--packages/server/src/registration/verifications/verifyAndroidKey.test.ts (renamed from packages/server/src/attestation/verifications/verifyAndroidKey.test.ts)0
-rw-r--r--packages/server/src/registration/verifications/verifyAndroidKey.ts (renamed from packages/server/src/attestation/verifications/verifyAndroidKey.ts)2
-rw-r--r--packages/server/src/registration/verifications/verifyAndroidSafetyNet.test.ts (renamed from packages/server/src/attestation/verifications/verifyAndroidSafetyNet.test.ts)0
-rw-r--r--packages/server/src/registration/verifications/verifyAndroidSafetyNet.ts (renamed from packages/server/src/attestation/verifications/verifyAndroidSafetyNet.ts)2
-rw-r--r--packages/server/src/registration/verifications/verifyApple.test.ts (renamed from packages/server/src/attestation/verifications/verifyApple.test.ts)0
-rw-r--r--packages/server/src/registration/verifications/verifyApple.ts (renamed from packages/server/src/attestation/verifications/verifyApple.ts)2
-rw-r--r--packages/server/src/registration/verifications/verifyFIDOU2F.ts (renamed from packages/server/src/attestation/verifications/verifyFIDOU2F.ts)2
-rw-r--r--packages/server/src/registration/verifications/verifyPacked.test.ts (renamed from packages/server/src/attestation/verifications/verifyPacked.test.ts)0
-rw-r--r--packages/server/src/registration/verifications/verifyPacked.ts (renamed from packages/server/src/attestation/verifications/verifyPacked.ts)2
-rw-r--r--packages/server/src/registration/verifyRegistrationResponse.test.ts (renamed from packages/server/src/attestation/verifyAttestationResponse.test.ts)50
-rw-r--r--packages/server/src/registration/verifyRegistrationResponse.ts (renamed from packages/server/src/attestation/verifyAttestationResponse.ts)30
24 files changed, 77 insertions, 77 deletions
diff --git a/packages/server/src/assertion/generateAssertionOptions.test.ts b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
index 0208d9d..93cc398 100644
--- a/packages/server/src/assertion/generateAssertionOptions.test.ts
+++ b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
@@ -1,6 +1,6 @@
jest.mock('../helpers/generateChallenge');
-import generateAssertionOptions from './generateAssertionOptions';
+import generateAssertionOptions from './generateAuthenticationOptions';
test('should generate credential request options suitable for sending via JSON', () => {
const challenge = 'totallyrandomvalue';
diff --git a/packages/server/src/assertion/generateAssertionOptions.ts b/packages/server/src/authentication/generateAuthenticationOptions.ts
index 35bf13e..35bf13e 100644
--- a/packages/server/src/assertion/generateAssertionOptions.ts
+++ b/packages/server/src/authentication/generateAuthenticationOptions.ts
diff --git a/packages/server/src/assertion/verifyAssertionResponse.test.ts b/packages/server/src/authentication/verifyAuthenticationResponse.test.ts
index b1eeebb..681b2f3 100644
--- a/packages/server/src/assertion/verifyAssertionResponse.test.ts
+++ b/packages/server/src/authentication/verifyAuthenticationResponse.test.ts
@@ -1,5 +1,5 @@
import base64url from 'base64url';
-import verifyAssertionResponse from './verifyAssertionResponse';
+import verifyAssertionResponse from './verifyAuthenticationResponse';
import * as decodeClientDataJSON from '../helpers/decodeClientDataJSON';
import * as parseAuthenticatorData from '../helpers/parseAuthenticatorData';
diff --git a/packages/server/src/assertion/verifyAssertionResponse.ts b/packages/server/src/authentication/verifyAuthenticationResponse.ts
index 12d5a9d..12d5a9d 100644
--- a/packages/server/src/assertion/verifyAssertionResponse.ts
+++ b/packages/server/src/authentication/verifyAuthenticationResponse.ts
diff --git a/packages/server/src/index.test.ts b/packages/server/src/index.test.ts
index ea02a04..6feefb3 100644
--- a/packages/server/src/index.test.ts
+++ b/packages/server/src/index.test.ts
@@ -1,11 +1,11 @@
import * as index from './index';
-test('should export method `generateAttestationOptions`', () => {
- expect(index.generateAttestationOptions).toBeDefined();
+test('should export method `generateRegistrationOptions`', () => {
+ expect(index.generateRegistrationOptions).toBeDefined();
});
-test('should export method `verifyAttestationResponse`', () => {
- expect(index.verifyAttestationResponse).toBeDefined();
+test('should export method `verifyRegistrationResponse`', () => {
+ expect(index.verifyRegistrationResponse).toBeDefined();
});
test('should export method `generateAssertionOptions`', () => {
diff --git a/packages/server/src/index.ts b/packages/server/src/index.ts
index 0e191b4..30560f3 100644
--- a/packages/server/src/index.ts
+++ b/packages/server/src/index.ts
@@ -2,39 +2,39 @@
* @packageDocumentation
* @module @simplewebauthn/server
*/
-import generateAttestationOptions from './attestation/generateAttestationOptions';
-import verifyAttestationResponse from './attestation/verifyAttestationResponse';
-import generateAssertionOptions from './assertion/generateAssertionOptions';
-import verifyAssertionResponse from './assertion/verifyAssertionResponse';
+import generateRegistrationOptions from './registration/generateRegistrationOptions';
+import verifyRegistrationResponse from './registration/verifyRegistrationResponse';
+import generateAssertionOptions from './authentication/generateAuthenticationOptions';
+import verifyAssertionResponse from './authentication/verifyAuthenticationResponse';
import MetadataService from './services/metadataService';
import SettingsService from './services/settingsService';
export {
- generateAttestationOptions,
- verifyAttestationResponse,
+ generateRegistrationOptions,
+ verifyRegistrationResponse,
generateAssertionOptions,
verifyAssertionResponse,
MetadataService,
SettingsService,
};
-import type { GenerateAttestationOptionsOpts } from './attestation/generateAttestationOptions';
-import type { GenerateAssertionOptionsOpts } from './assertion/generateAssertionOptions';
+import type { GenerateRegistrationOptionsOpts } from './registration/generateRegistrationOptions';
+import type { GenerateAssertionOptionsOpts } from './authentication/generateAuthenticationOptions';
import type { MetadataStatement } from './services/metadataService';
import type {
VerifiedAttestation,
- VerifyAttestationResponseOpts,
-} from './attestation/verifyAttestationResponse';
+ VerifyRegistrationResponseOpts,
+} from './registration/verifyRegistrationResponse';
import type {
VerifiedAssertion,
VerifyAssertionResponseOpts,
-} from './assertion/verifyAssertionResponse';
+} from './authentication/verifyAuthenticationResponse';
export type {
- GenerateAttestationOptionsOpts,
+ GenerateRegistrationOptionsOpts,
GenerateAssertionOptionsOpts,
MetadataStatement,
- VerifyAttestationResponseOpts,
+ VerifyRegistrationResponseOpts,
VerifyAssertionResponseOpts,
VerifiedAttestation,
VerifiedAssertion,
diff --git a/packages/server/src/attestation/generateAttestationOptions.test.ts b/packages/server/src/registration/generateRegistrationOptions.test.ts
index eb7dcd7..19fa0a6 100644
--- a/packages/server/src/attestation/generateAttestationOptions.test.ts
+++ b/packages/server/src/registration/generateRegistrationOptions.test.ts
@@ -1,6 +1,6 @@
jest.mock('../helpers/generateChallenge');
-import generateAttestationOptions from './generateAttestationOptions';
+import generateRegistrationOptions from './generateRegistrationOptions';
test('should generate credential request options suitable for sending via JSON', () => {
const rpName = 'SimpleWebAuthn';
@@ -11,7 +11,7 @@ test('should generate credential request options suitable for sending via JSON',
const timeout = 1;
const attestationType = 'indirect';
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName,
rpID,
challenge,
@@ -55,7 +55,7 @@ test('should generate credential request options suitable for sending via JSON',
});
test('should map excluded credential IDs if specified', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName: 'SimpleWebAuthn',
rpID: 'not.real',
challenge: 'totallyrandomvalue',
@@ -80,7 +80,7 @@ test('should map excluded credential IDs if specified', () => {
});
test('defaults to 60 seconds if no timeout is specified', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName: 'SimpleWebAuthn',
rpID: 'not.real',
challenge: 'totallyrandomvalue',
@@ -92,7 +92,7 @@ test('defaults to 60 seconds if no timeout is specified', () => {
});
test('defaults to none attestation if no attestation type is specified', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName: 'SimpleWebAuthn',
rpID: 'not.real',
challenge: 'totallyrandomvalue',
@@ -104,7 +104,7 @@ test('defaults to none attestation if no attestation type is specified', () => {
});
test('should set authenticatorSelection if specified', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName: 'SimpleWebAuthn',
rpID: 'not.real',
challenge: 'totallyrandomvalue',
@@ -125,7 +125,7 @@ test('should set authenticatorSelection if specified', () => {
});
test('should set extensions if specified', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpName: 'SimpleWebAuthn',
rpID: 'not.real',
challenge: 'totallyrandomvalue',
@@ -140,7 +140,7 @@ test('should set extensions if specified', () => {
});
test('should generate a challenge if one is not provided', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpID: 'not.real',
rpName: 'SimpleWebAuthn',
userID: '1234',
@@ -152,7 +152,7 @@ test('should generate a challenge if one is not provided', () => {
});
test('should use custom supported algorithm IDs as-is when provided', () => {
- const options = generateAttestationOptions({
+ const options = generateRegistrationOptions({
rpID: 'not.real',
rpName: 'SimpleWebAuthn',
userID: '1234',
diff --git a/packages/server/src/attestation/generateAttestationOptions.ts b/packages/server/src/registration/generateRegistrationOptions.ts
index 6faf30c..c55b308 100644
--- a/packages/server/src/attestation/generateAttestationOptions.ts
+++ b/packages/server/src/registration/generateRegistrationOptions.ts
@@ -11,7 +11,7 @@ import base64url from 'base64url';
import generateChallenge from '../helpers/generateChallenge';
-export type GenerateAttestationOptionsOpts = {
+export type GenerateRegistrationOptionsOpts = {
rpName: string;
rpID: string;
userID: string;
@@ -93,8 +93,8 @@ const defaultSupportedAlgorithmIDs = supportedCOSEAlgorithmIdentifiers.filter(id
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
*/
-export default function generateAttestationOptions(
- options: GenerateAttestationOptionsOpts,
+export default function generateRegistrationOptions(
+ options: GenerateRegistrationOptionsOpts,
): PublicKeyCredentialCreationOptionsJSON {
const {
rpName,
diff --git a/packages/server/src/attestation/verifications/tpm/constants.ts b/packages/server/src/registration/verifications/tpm/constants.ts
index 9b9cfa6..9b9cfa6 100644
--- a/packages/server/src/attestation/verifications/tpm/constants.ts
+++ b/packages/server/src/registration/verifications/tpm/constants.ts
diff --git a/packages/server/src/attestation/verifications/tpm/parseCertInfo.ts b/packages/server/src/registration/verifications/tpm/parseCertInfo.ts
index 1ac391e..1ac391e 100644
--- a/packages/server/src/attestation/verifications/tpm/parseCertInfo.ts
+++ b/packages/server/src/registration/verifications/tpm/parseCertInfo.ts
diff --git a/packages/server/src/attestation/verifications/tpm/parsePubArea.ts b/packages/server/src/registration/verifications/tpm/parsePubArea.ts
index 5f0d63b..5f0d63b 100644
--- a/packages/server/src/attestation/verifications/tpm/parsePubArea.ts
+++ b/packages/server/src/registration/verifications/tpm/parsePubArea.ts
diff --git a/packages/server/src/attestation/verifications/tpm/verifyTPM.test.ts b/packages/server/src/registration/verifications/tpm/verifyTPM.test.ts
index 81f1fbe..81f1fbe 100644
--- a/packages/server/src/attestation/verifications/tpm/verifyTPM.test.ts
+++ b/packages/server/src/registration/verifications/tpm/verifyTPM.test.ts
diff --git a/packages/server/src/attestation/verifications/tpm/verifyTPM.ts b/packages/server/src/registration/verifications/tpm/verifyTPM.ts
index e2fb772..7579f1f 100644
--- a/packages/server/src/attestation/verifications/tpm/verifyTPM.ts
+++ b/packages/server/src/registration/verifications/tpm/verifyTPM.ts
@@ -8,7 +8,7 @@ import {
Name,
} from '@peculiar/asn1-x509';
-import type { AttestationFormatVerifierOpts } from '../../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../../verifyRegistrationResponse';
import decodeCredentialPublicKey from '../../../helpers/decodeCredentialPublicKey';
import { COSEKEYS, COSEALGHASH } from '../../../helpers/convertCOSEtoPKCS';
diff --git a/packages/server/src/attestation/verifications/verifyAndroidKey.test.ts b/packages/server/src/registration/verifications/verifyAndroidKey.test.ts
index f249066..f249066 100644
--- a/packages/server/src/attestation/verifications/verifyAndroidKey.test.ts
+++ b/packages/server/src/registration/verifications/verifyAndroidKey.test.ts
diff --git a/packages/server/src/attestation/verifications/verifyAndroidKey.ts b/packages/server/src/registration/verifications/verifyAndroidKey.ts
index 29d184e..391f8eb 100644
--- a/packages/server/src/attestation/verifications/verifyAndroidKey.ts
+++ b/packages/server/src/registration/verifications/verifyAndroidKey.ts
@@ -2,7 +2,7 @@ import { AsnParser } from '@peculiar/asn1-schema';
import { Certificate } from '@peculiar/asn1-x509';
import { KeyDescription, id_ce_keyDescription } from '@peculiar/asn1-android';
-import type { AttestationFormatVerifierOpts } from '../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../verifyRegistrationResponse';
import convertCertBufferToPEM from '../../helpers/convertCertBufferToPEM';
import validateCertificatePath from '../../helpers/validateCertificatePath';
diff --git a/packages/server/src/attestation/verifications/verifyAndroidSafetyNet.test.ts b/packages/server/src/registration/verifications/verifyAndroidSafetyNet.test.ts
index 6a754d3..6a754d3 100644
--- a/packages/server/src/attestation/verifications/verifyAndroidSafetyNet.test.ts
+++ b/packages/server/src/registration/verifications/verifyAndroidSafetyNet.test.ts
diff --git a/packages/server/src/attestation/verifications/verifyAndroidSafetyNet.ts b/packages/server/src/registration/verifications/verifyAndroidSafetyNet.ts
index 85eaba9..4375efa 100644
--- a/packages/server/src/attestation/verifications/verifyAndroidSafetyNet.ts
+++ b/packages/server/src/registration/verifications/verifyAndroidSafetyNet.ts
@@ -1,6 +1,6 @@
import base64url from 'base64url';
-import type { AttestationFormatVerifierOpts } from '../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../verifyRegistrationResponse';
import toHash from '../../helpers/toHash';
import verifySignature from '../../helpers/verifySignature';
diff --git a/packages/server/src/attestation/verifications/verifyApple.test.ts b/packages/server/src/registration/verifications/verifyApple.test.ts
index 6ba0a5e..6ba0a5e 100644
--- a/packages/server/src/attestation/verifications/verifyApple.test.ts
+++ b/packages/server/src/registration/verifications/verifyApple.test.ts
diff --git a/packages/server/src/attestation/verifications/verifyApple.ts b/packages/server/src/registration/verifications/verifyApple.ts
index d0c3059..00b21ff 100644
--- a/packages/server/src/attestation/verifications/verifyApple.ts
+++ b/packages/server/src/registration/verifications/verifyApple.ts
@@ -1,7 +1,7 @@
import { AsnParser } from '@peculiar/asn1-schema';
import { Certificate } from '@peculiar/asn1-x509';
-import type { AttestationFormatVerifierOpts } from '../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../verifyRegistrationResponse';
import validateCertificatePath from '../../helpers/validateCertificatePath';
import convertCertBufferToPEM from '../../helpers/convertCertBufferToPEM';
diff --git a/packages/server/src/attestation/verifications/verifyFIDOU2F.ts b/packages/server/src/registration/verifications/verifyFIDOU2F.ts
index a2bfd53..f11a1c9 100644
--- a/packages/server/src/attestation/verifications/verifyFIDOU2F.ts
+++ b/packages/server/src/registration/verifications/verifyFIDOU2F.ts
@@ -1,4 +1,4 @@
-import type { AttestationFormatVerifierOpts } from '../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../verifyRegistrationResponse';
import convertCOSEtoPKCS from '../../helpers/convertCOSEtoPKCS';
import convertCertBufferToPEM from '../../helpers/convertCertBufferToPEM';
diff --git a/packages/server/src/attestation/verifications/verifyPacked.test.ts b/packages/server/src/registration/verifications/verifyPacked.test.ts
index 5884e53..5884e53 100644
--- a/packages/server/src/attestation/verifications/verifyPacked.test.ts
+++ b/packages/server/src/registration/verifications/verifyPacked.test.ts
diff --git a/packages/server/src/attestation/verifications/verifyPacked.ts b/packages/server/src/registration/verifications/verifyPacked.ts
index dd876c2..1cb74ec 100644
--- a/packages/server/src/attestation/verifications/verifyPacked.ts
+++ b/packages/server/src/registration/verifications/verifyPacked.ts
@@ -1,7 +1,7 @@
import elliptic from 'elliptic';
import NodeRSA from 'node-rsa';
-import type { AttestationFormatVerifierOpts } from '../verifyAttestationResponse';
+import type { AttestationFormatVerifierOpts } from '../verifyRegistrationResponse';
import convertCOSEtoPKCS, {
COSEKEYS,
diff --git a/packages/server/src/attestation/verifyAttestationResponse.test.ts b/packages/server/src/registration/verifyRegistrationResponse.test.ts
index da5f125..9877e14 100644
--- a/packages/server/src/attestation/verifyAttestationResponse.test.ts
+++ b/packages/server/src/registration/verifyRegistrationResponse.test.ts
@@ -1,6 +1,6 @@
import base64url from 'base64url';
-import verifyAttestationResponse from './verifyAttestationResponse';
+import verifyRegistrationResponse from './verifyRegistrationResponse';
import * as decodeAttestationObject from '../helpers/decodeAttestationObject';
import * as decodeClientDataJSON from '../helpers/decodeClientDataJSON';
@@ -42,7 +42,7 @@ afterEach(() => {
});
test('should verify FIDO U2F attestation', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationFIDOU2F,
expectedChallenge: attestationFIDOU2FChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -71,7 +71,7 @@ test('should verify FIDO U2F attestation', async () => {
});
test('should verify Packed (EC2) attestation', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationPacked,
expectedChallenge: attestationPackedChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -95,7 +95,7 @@ test('should verify Packed (EC2) attestation', async () => {
});
test('should verify Packed (X5C) attestation', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationPackedX5C,
expectedChallenge: attestationPackedX5CChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -118,7 +118,7 @@ test('should verify Packed (X5C) attestation', async () => {
});
test('should verify None attestation', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -142,7 +142,7 @@ test('should verify None attestation', async () => {
test('should verify None attestation w/RSA public key', async () => {
const expectedChallenge = 'pYZ3VX2yb8dS9yplNxJChiXhPGBk8gZzTAyJ2iU5x1k';
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: {
id: 'kGXv4RJWLeXRw8Yf3T22K3Gq_GGeDv9OKYmAHLm0Ylo',
rawId: 'kGXv4RJWLeXRw8Yf3T22K3Gq_GGeDv9OKYmAHLm0Ylo',
@@ -175,7 +175,7 @@ test('should verify None attestation w/RSA public key', async () => {
test('should throw when response challenge is not expected value', async () => {
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: 'shouldhavebeenthisvalue',
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -186,7 +186,7 @@ test('should throw when response challenge is not expected value', async () => {
test('should throw when response origin is not expected value', async () => {
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://different.address',
@@ -207,7 +207,7 @@ test('should throw when attestation type is not webauthn.create', async () => {
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: challenge,
expectedOrigin: origin,
@@ -230,7 +230,7 @@ test('should throw if an unexpected attestation format is specified', async () =
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -251,7 +251,7 @@ test('should throw error if assertion RP ID is unexpected value', async () => {
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -269,7 +269,7 @@ test('should throw error if user was not present', async () => {
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -288,7 +288,7 @@ test('should throw if the authenticator does not give back credential ID', async
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -308,7 +308,7 @@ test('should throw if the authenticator does not give back credential public key
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -325,7 +325,7 @@ test('should throw error if no alg is specified in public key', async () => {
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -342,7 +342,7 @@ test('should throw error if unsupported alg is used', async () => {
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -354,7 +354,7 @@ test('should throw error if unsupported alg is used', async () => {
test('should not include authenticator info if not verified', async () => {
mockVerifyFIDOU2F.mockReturnValue(false);
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationFIDOU2F,
expectedChallenge: attestationFIDOU2FChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -375,7 +375,7 @@ test('should throw an error if user verification is required but user was not ve
});
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationFIDOU2F,
expectedChallenge: attestationFIDOU2FChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -387,7 +387,7 @@ test('should throw an error if user verification is required but user was not ve
test('should validate TPM RSA response (SHA256)', async () => {
const expectedChallenge = '3a07cf85-e7b6-447f-8270-b25433f6018e';
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: {
id: 'lGkWHPe88VpnNYgVBxzon_MRR9-gmgODveQ16uM_bPM',
rawId: 'lGkWHPe88VpnNYgVBxzon_MRR9-gmgODveQ16uM_bPM',
@@ -420,7 +420,7 @@ test('should validate TPM RSA response (SHA256)', async () => {
test('should validate TPM RSA response (SHA1)', async () => {
const expectedChallenge = 'f4e8d87b-d363-47cc-ab4d-1a84647bf245';
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: {
id: 'oELnad0f6-g2BtzEn_78iLNoubarlq0xFtOtAMXnflU',
rawId: 'oELnad0f6-g2BtzEn_78iLNoubarlq0xFtOtAMXnflU',
@@ -453,7 +453,7 @@ test('should validate TPM RSA response (SHA1)', async () => {
test('should validate Android-Key response', async () => {
const expectedChallenge = '14e0d1b6-9c36-4849-aeec-ea64676449ef';
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: {
id: 'PPa1spYTB680cQq5q6qBtFuPLLdG1FQ73EastkT8n0o',
rawId: 'PPa1spYTB680cQq5q6qBtFuPLLdG1FQ73EastkT8n0o',
@@ -485,7 +485,7 @@ test('should validate Android-Key response', async () => {
});
test('should support multiple possible origins', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: ['https://dev.dontneeda.pw', 'https://different.address'],
@@ -497,7 +497,7 @@ test('should support multiple possible origins', async () => {
test('should throw an error if origin not in list of expected origins', async () => {
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: ['https://different.address'],
@@ -507,7 +507,7 @@ test('should throw an error if origin not in list of expected origins', async ()
});
test('should support multiple possible RP IDs', async () => {
- const verification = await verifyAttestationResponse({
+ const verification = await verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
@@ -519,7 +519,7 @@ test('should support multiple possible RP IDs', async () => {
test('should throw an error if RP ID not in list of possible RP IDs', async () => {
await expect(
- verifyAttestationResponse({
+ verifyRegistrationResponse({
credential: attestationNone,
expectedChallenge: attestationNoneChallenge,
expectedOrigin: 'https://dev.dontneeda.pw',
diff --git a/packages/server/src/attestation/verifyAttestationResponse.ts b/packages/server/src/registration/verifyRegistrationResponse.ts
index 23da221..f25ae24 100644
--- a/packages/server/src/attestation/verifyAttestationResponse.ts
+++ b/packages/server/src/registration/verifyRegistrationResponse.ts
@@ -16,7 +16,7 @@ import { COSEKEYS } from '../helpers/convertCOSEtoPKCS';
import convertAAGUIDToString from '../helpers/convertAAGUIDToString';
import settingsService from '../services/settingsService';
-import { supportedCOSEAlgorithmIdentifiers } from './generateAttestationOptions';
+import { supportedCOSEAlgorithmIdentifiers } from './generateRegistrationOptions';
import verifyFIDOU2F from './verifications/verifyFIDOU2F';
import verifyPacked from './verifications/verifyPacked';
import verifyAndroidSafetynet from './verifications/verifyAndroidSafetyNet';
@@ -24,7 +24,7 @@ import verifyTPM from './verifications/tpm/verifyTPM';
import verifyAndroidKey from './verifications/verifyAndroidKey';
import verifyApple from './verifications/verifyApple';
-export type VerifyAttestationResponseOpts = {
+export type VerifyRegistrationResponseOpts = {
credential: RegistrationCredentialJSON;
expectedChallenge: string;
expectedOrigin: string | string[];
@@ -38,18 +38,18 @@ export type VerifyAttestationResponseOpts = {
*
* **Options:**
*
- * @param credential Authenticator credential returned by browser's `startAttestation()`
+ * @param credential Authenticator credential returned by browser's `startAuthentication()`
* @param expectedChallenge The base64url-encoded `options.challenge` returned by
- * `generateAttestationOptions()`
- * @param expectedOrigin Website URL (or array of URLs) that the attestation should have occurred on
- * @param expectedRPID RP ID (or array of IDs) that was specified in the attestation options
+ * `generateRegistrationOptions()`
+ * @param expectedOrigin Website URL (or array of URLs) that the registration should have occurred on
+ * @param expectedRPID RP ID (or array of IDs) that was specified in the registration options
* @param requireUserVerification (Optional) Enforce user verification by the authenticator
* (via PIN, fingerprint, etc...)
* @param supportedAlgorithmIDs Array of numeric COSE algorithm identifiers supported for
* attestation by this RP. See https://www.iana.org/assignments/cose/cose.xhtml#algorithms
*/
-export default async function verifyAttestationResponse(
- options: VerifyAttestationResponseOpts,
+export default async function verifyRegistrationResponse(
+ options: VerifyRegistrationResponseOpts,
): Promise<VerifiedAttestation> {
const {
credential,
@@ -80,15 +80,15 @@ export default async function verifyAttestationResponse(
const { type, origin, challenge, tokenBinding } = clientDataJSON;
- // Make sure we're handling an attestation
+ // Make sure we're handling an registration
if (type !== 'webauthn.create') {
- throw new Error(`Unexpected attestation type: ${type}`);
+ throw new Error(`Unexpected registration type: ${type}`);
}
// Ensure the device provided the challenge we gave it
if (challenge !== expectedChallenge) {
throw new Error(
- `Unexpected attestation challenge "${challenge}", expected "${expectedChallenge}"`,
+ `Unexpected registration challenge "${challenge}", expected "${expectedChallenge}"`,
);
}
@@ -96,12 +96,12 @@ export default async function verifyAttestationResponse(
if (Array.isArray(expectedOrigin)) {
if (!expectedOrigin.includes(origin)) {
throw new Error(
- `Unexpected attestation origin "${origin}", expected one of: ${expectedOrigin.join(', ')}`,
+ `Unexpected registration origin "${origin}", expected one of: ${expectedOrigin.join(', ')}`,
);
}
} else {
if (origin !== expectedOrigin) {
- throw new Error(`Unexpected attestation origin "${origin}", expected "${expectedOrigin}"`);
+ throw new Error(`Unexpected registration origin "${origin}", expected "${expectedOrigin}"`);
}
}
@@ -171,7 +171,7 @@ export default async function verifyAttestationResponse(
throw new Error('Credential public key was missing numeric alg');
}
- // Make sure the key algorithm is one we specified within the attestation options
+ // Make sure the key algorithm is one we specified within the registration options
if (!supportedAlgorithmIDs.includes(alg as number)) {
const supported = supportedAlgorithmIDs.join(', ');
throw new Error(`Unexpected public key alg "${alg}", expected one of "${supported}"`);
@@ -239,7 +239,7 @@ export default async function verifyAttestationResponse(
}
/**
- * Result of attestation verification
+ * Result of registration verification
*
* @param verified If the assertion response could be verified
* @param attestationInfo.fmt Type of attestation